Forgetting Prayer Rakat and Not Doing Sujud Sahwi, Is It True That It Is Invalid?
Forgetting is a human trait, including during prayer. Prophet Muhammad SAW once forgot the number of rakat and performed sujud sahwi after being reminded by his companions. According to the Shafi'i school, sujud sahwi is sunnah, not obligatory. Prayer remains valid if the pillars are fulfilled, even if sujud sahwi is omitted. However, if the number of rakat is lacking, the prayer is invalid and must be repeated. When in doubt about the number of rakat, take what is most certain, complete the deficiency, then perform sujud sahwi before salam. If you only remember after salam and a short pause, it is recommended to perform sujud sahwi again; if the pause is long or ablution is broken, the prayer remains valid because sujud sahwi is sunnah. Sujud sahwi is performed twice with iftirasy sitting in between, reciting: 'Subhaana man laa yanaamu wa laa yas-huu'.
https://mozaik.inilah.com/ibad