عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ عَنِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ قَالَ: ((إِنَّمَا الْإِمَامُ لِيُؤْتَمَّ بِهِ فَلَا تَخْتَلِفُوا عَلَيْهِ، فَإِذَا كَبَّرَ فَكَبِّرُوا، وَلَا تُكَبِّرُوا حَتَّى يُكَبِّرَ، فَإِذَا رَكَعَ فَارْكَعُوا، وَلَا تَرْكَعُوا حَتَّى يَرْكَعَ، وَإِذَا قَالَ سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ فَقُولُوا رَبَّنَا وَلَكَ الْحَمْدُ (وَفِي رِوَايَةٍ: اللَّهُمَّ رَبَّنَا لَكَ الْحَمْدُ، وَفِي أُخْرَى: رَبَّنَا لَكَ الْحَمْدُ) وَإِذَا سَجَدَ فَاسْجُدُوا، وَلَا تَسْجُدُوا حَتَّى يَسْجُدَ، وَإِنْ صَلَّى جَالِسًا فَصَلُّوا جُلُوسًا أَجْمَعُونَ))
It is narrated from Sayyiduna Abu Hurairah, may Allah be pleased with him, that the Messenger of Allah, peace and blessings be upon him, said: The imam is appointed only to be followed, so do not differ with him. When he says the takbir, then you say the takbir, and do not say the takbir until he has said the takbir. Likewise, when he bows (for ruku‘), then you bow, and do not bow until he has bowed. When he says سَمِعَ اللّٰہُ لِمَنْ حَمِدَہُ, then you say رَبَّنَا وَلَکَ الْحَمْدُ. In one narration, it is اَللّٰہُمَّ رَبَّنَا لَکَ الْحَمْدُ, and in another, رَبَّنَا لَکَ الْحَمْدُ. When the imam prostrates, then you prostrate, and do not prostrate before he has prostrated. And if he prays sitting, then you should also pray sitting.