Many parts or elements of the myth of Oedipus occur before the opening scene of the play, although some are alluded to in the text. Oedipus is the son of Laius and Jocasta, the king and queen of Thebes. The misfortunes of his house are the result of a curse laid upon his father for violating the sacred laws of hospitality. In his youth, Laius was the guest of Pelops, the king of Elis, and he became the tutor of Chrysippus, the king's youngest son, in chariot racing. Laius seduced or abducted and raped Chrysippus, who according to some versions, killed himself in shame. This murder cast a doom over Laius and all of his descendants (although many scholars regard Laius' transgressions against Chrysippus to be a late addition to the myth).
When his son is born, the king consults an oracle as to his fortune. To his horror, the oracle reveals that Laius "is doomed to perish by the hand of his own son". Laius binds the infant's feet together with a pin, and orders Jocasta to kill him. Unable to kill her own son, Jocasta orders a servant to slay the infant for her. The servant then exposes the infant on a mountaintop, where he is found and rescued by a shepherd (in some versions, the servant gives the infant to the shepherd). The shepherd names the child Oedipus, "swollen feet", as his feet had been tightly bound by Laius. The shepherd brings the infant to Corinth, and presents him to the childless king Polybus, who raises Oedipus as his own son.
As he grows to manhood, Oedipus hears a rumour that he is not truly the son of Polybus and his wife, Merope. He asks the Delphic Oracle who his parents really are. The Oracle seems to ignore this question, telling him instead that he is destined to "mate with [his] own mother, and shed/With [his] own hands the blood of [his] own sire". Desperate to avoid this terrible fate, Oedipus, who still believes that Polybus and Merope are his true parents, leaves Corinth for the city of Thebes.
On the road to Thebes, Oedipus encounters Laius and his retainers, and the two quarrel over whose chariot has the right of way. The Theban king moves to strike the insolent youth with his sceptre, but Oedipus, unaware that Laius is his true father, throws the old man down from his chariot, killing him. Thus, Laius is slain by his own son, and the prophecy that the king had sought to avoid by exposing Oedipus at birth is fulfilled.
Before arriving at Thebes, Oedipus encounters the Sphinx, a legendary beast with the head and breast of a woman, the body of a lioness, and the wings of an eagle. The Sphinx was sent to the road approaching Thebes as a punishment from the gods, and would strangle any traveler who failed to answer a certain riddle. The precise riddle asked by the Sphinx varied in early traditions, and is not stated in Oedipus Rex, as the event precedes the play; but the most widely-known version is, "what is the creature that walks on four legs in the morning, two legs at noon, and three in the evening?" Oedipus correctly guesses, "man", who crawls on all fours as an infant, walks upright in maturity, and leans on a stick in old age. Bested by the prince, the Sphinx throws herself from a cliff, thereby ending the curse. Oedipus' reward for freeing Thebes from the Sphinx is its kingship, and the hand of the dowager queen, Jocasta; none then realize that Jocasta is Oedipus' true mother. Thus, unknown to all of the characters, the prophecy has been fulfilled.