Q. A stroke patient. His family was instructed that he may not fast on Yom Kippur. Fearing he would not listen if he knew it was Yom Kippur, they did not tell him when it was Yom Kippur. However, sometime during Sukkos he decided that it was Yom Kippur and refused to eat. He fasted without any telltale effects from late afternoon till late at night the next day. Nobody could budge him from his conviction that it was Yom Kippur. Being shown the Sukka and the Arba Minim he had shook the day before did not convince him. He was sure it was Yom Kippur and that was that.

Question: Does he get schar as if he fasted on Yom Kippur? Is this called someone who tried to do a mitzva with all his effort but didn’t manage to do so, that it is counted in Heaven as if he had done so?

A. It is well known the principle of the Derech Hashem expounded in Kovetz Maamorim (Maamar al Hateshuva p. 23, Kovetz Haoros 70) that in general mitzvos maintain two different aspects in their essence. One reflects the compliance to the will of Hashem by keeping and following His will and instructions. The other attest to the improvement, betterment and benefit acquired and created when performing them. This is due to the fact that the Torah is the Universal Plan of Creation, therefore the mitzvos bring about the necessary fulfillment of that plan.
Rav Elchonon Vasserman zt’l thus explains why our forefathers kept the mitzvos of the Torah even before they were ordained, as they understood the benefit created. In some unique cases, they understood the betterment to be reflected in different ways, as in Yaakov marrying two sisters.
The above also elucidates, why when someone truly wants to abide by a mitzva, but then accidentally can not, it is counted as having complied (Brochos 6a). Since although the benefit accrued from actually performing the mitzva did not materialize, the effort to follow the will of Hashem and his command was indeed achieved.
Horav Shlomo Miller’s Shlit’a opinion is that the patient was also compliant with the mitzvos of emuna, ahavas and yiraas Hashem.
The Rov added that in this case and similar ones, is to greatly care for the welfare of the patient including his mental and emotional disposition. Therefore, with common sense and good judgment, allowance and understanding should be granted to the quirks and oddities of the aged and ill.

Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a