Sayyiduna Samurah (may Allah be pleased with him) says: The Messenger of Allah (peace and blessings be upon him) ordered us that if the time of prayer came upon us while we were three or more, one man from among us should stand and be our imam, and if we were two, we should form a row together.
Hadith Referenceالمعجم الكبير للطبراني / باب السين / 6985