saying in the hadith of Abū Sa‘īd:
“Let him set doubt aside and proceed on the basis of what he is certain of, then perform two prostrations before saying the salām. If he has prayed five rak‘ahs, these two prostrations will make his prayer even; and if he has prayed the full four, they will humiliate Satan.”
Likewise, in the hadith of ‘Abd al-Rahmān:
“Then let him perform two prostrations while seated, before saying the salām, and then say the salām.”
He also commanded this in Ibn Mas‘ūd’s hadith concerning the exercise of one’s best judgment, saying:
“Let him determine what is most likely correct, complete his prayer accordingly, and then perform two prostrations.”
Another wording states:
“These two prostrations are for someone who does not know whether he has added to his prayer or omitted something from it. Let him determine what is most likely correct, complete his prayer accordingly, and then perform two prostrations.”
In the other hadith of Ibn Mas‘ūd, reported by both al-Bukhārī and Muslim:
“We said, ‘O Messenger of Allah, has something new been introduced into the prayer?’ He replied, ‘No.’ We then told him what he had done, and he said, ‘If a person adds to the prayer or omits something from it, let him perform two prostrations.’” The narrator said: “Then he performed two prostrations.”
Thus, he commanded the two prostrations whenever a person adds something or omits something. What he meant was adding something he had prohibited or omitting something he had commanded. This establishes the obligation to prostrate for any commanded act that a person inadvertently omits, provided that the inadvertent omission does not require him to perform the omitted act itself, and whenever he inadvertently adds something prohibited.
Accordingly, whenever a person inadvertently omits any commanded act in the prayer, he must either perform it when he remembers it or perform the prostrations of forgetfulness. One of the two is indispensable.