كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(19)
Chapter: As-Sahw (forgetfulness) in prayer and prostrating to compensate for it
(19)
باب السَّهْوِ فِي الصَّلاَةِ وَالسُّجُودِ لَهُ ‏
Sahih Muslim 572 a

'Alqama narrated It on the authority of 'Abdullah (b. Mas'ud) who said:

The Messenger of Allah (ﷺ) said the prayer; (the narrator added): He made some act of omission or commission when he pronounced salutation; it was said to him: Messenger of Allah, is there something new about the prayer? He (the Holy Prophet) said: What is it? They said: You said prayer in such and such away. He (the narrator) said: He (the Holy Prophet) turned his feet and faced the Qibla and performed two prostrations and then pronounced salutations, and then turned his face towards us and said: If there is anything new about prayer (new command from the Lord) I informed you of that. But I am a human being and I forget as you for. get, so when I forget, remind me, and when any one of you is in doubt about his prayer. he should aim at what Is correct. and complete his prayer in that respect and then make two prostrations.
وَحَدَّثَنَا عُثْمَانُ، وَأَبُو بَكْرٍ ابْنَا أَبِي شَيْبَةَ وَإِسْحَاقُ بْنُ إِبْرَاهِيمَ جَمِيعًا عَنْ جَرِيرٍ، - قَالَ عُثْمَانُ حَدَّثَنَا جَرِيرٌ، - عَنْ مَنْصُورٍ، عَنْ إِبْرَاهِيمَ، عَنْ عَلْقَمَةَ، قَالَ قَالَ عَبْدُ اللَّهِ صَلَّى رَسُولُ اللَّهِ صلى الله عليه وسلم - قَالَ إِبْرَاهِيمُ زَادَ أَوْ نَقَصَ - فَلَمَّا سَلَّمَ قِيلَ لَهُ يَا رَسُولَ اللَّهِ أَحَدَثَ فِي الصَّلاَةِ شَىْءٌ قَالَ ‏"‏ وَمَا ذَاكَ ‏"‏ ‏.‏ قَالُوا صَلَّيْتَ كَذَا وَكَذَا - قَالَ - فَثَنَى رِجْلَيْهِ وَاسْتَقْبَلَ الْقِبْلَةَ فَسَجَدَ سَجْدَتَيْنِ ثُمَّ سَلَّمَ ثُمَّ أَقْبَلَ عَلَيْنَا بِوَجْهِهِ فَقَالَ ‏"‏ إِنَّهُ لَوْ حَدَثَ فِي الصَّلاَةِ شَىْءٌ أَنْبَأْتُكُمْ بِهِ وَلَكِنْ إِنَّمَا أَنَا بَشَرٌ أَنْسَى كَمَا تَنْسَوْنَ فَإِذَا نَسِيتُ فَذَكِّرُونِي وَإِذَا شَكَّ أَحَدُكُمْ فِي صَلاَتِهِ فَلْيَتَحَرَّ الصَّوَابَ فَلْيُتِمَّ عَلَيْهِ ثُمَّ لْيَسْجُدْ سَجْدَتَيْنِ ‏"‏ ‏.‏
Reference : Sahih Muslim 572a
In-book reference : Book 5, Hadith 112
USC-MSA web (English) reference : Book 4, Hadith 1168
  (deprecated numbering scheme)