Answered by Shaykh Ilyas Patel
What if I sit after 3 rakats in a 4 rakat prayer, and then understand I made a mistake? What about leaving qunut in witr and remembering in ruku?
In the name of Allah, inspirer of all truth.
If one remains sitting after the prostrations at the end of the third rakat of a four-rakat prayer, and then realizes that one should stand up, one should stand up, and then perform sajda sahw (prostrations for forgetfulness) at the end of the fourth and final rak’at.
If one completes the salat with three rakats, then his salat will be invalid, as the only valid three rak’at prayers are Maghrib and Witr.
If one forgets to read the Dua’ul-Qunut, then one remembers in ruku or thereafter one will have to do the sajda sahw(forgetfulness prostration).
– Ilyas Patel.