A:
Talaq pronounced by an insane person is not valid, as they are not considered Mukallafs (people meeting the conditions to be held legally accountable for their actions), for their minds are affected. It was authentically reported from `Aly (may Allah be pleased with him) that the Prophet (peace be upon him) said,
There are three (persons) whose actions are not recorded: a sleeper until they awaken, a boy until he reaches puberty and an insane until they recover their mind.
(Narrated by
Abu Dawud and others)
May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.