Sahih Muslim Book 4, Hadith Number 1471.

Chapter : Compensation of the missed prayer and excellence of observing it promptly.

Yahya b. Yazid al-Huna’i reported: I asked Anas b. Malik about shortening of prayer. He said: When the Messenger of’ Allah (may peace be upon him) had covered a distance of three miles or three farsakh (Shu’ba, one of the narrators, had some doubt about it) he observed two rak’ahs.