The Prophet ﷺ said, "When one of you leads the people in prayer, let him keep it brief, for among them are the young, the old, the weak, and the sick. But when he prays alone, let him pray however he wishes."
حدثنا قتيبة حدثنا المغيرة بن عبد الرحمن عن أبي الزناد عن الأعرج
أن النبي ﷺ قال إذا أم أحدكم الناس فليخفف فإن فيهم الصغير والكبير والضعيف والمريض فإذا صلى وحده فليصل كيف شاء
Agreed upon [by Bukhari and Muslim]. Muslim reported it in the Book of Prayer, chapter "The command to imams to shorten the prayer in full," hadith no. 467, from Qutayba, and Bukhari in the Book of Adhan, chapter "If he prays for himself, let him lengthen it as he wishes," hadith no. 703, both through Abu Zinad.On this subject there are also narrations from Adi bin Hatim [Ahmad, 4/257, 258], Anas [Bukhari, hadith nos. 706, 708, and Muslim, hadith no. 469], Jabir bin Samura [Ahmad, 5/91], Malik bin Abdullah [Ahmad, 5/225, 226], Abu Waqid [Ahmad, 5/218, 219], Uthman bin Abu As [Muslim, hadith no. 468], Abu Masud [Bukhari, hadith no. 7159, and Muslim, hadith no. 466], Jabir bin Abdullah [Bukhari, hadith no. 701, and Muslim, hadith no. 465], and Ibn Abbas [see Majma al-Zawaid, 2/73].