Oedipus was the son of Laius and Jocasta, king and queen of Thebes. After having been married some time without children, his parents consulted the Oracle of Apollo(God of Sun) at Delphi about their childlessness. The Oracle prophesized that if Jocasta should have a son, the son would kill her husband Laius and marry her. In an attempt to prevent this prophecy's fulfillment, when Jocasta indeed bore a son, Laius had his ankles pinned together so that he could not crawl, and gave the boy to a servant to abandon ("expose") on the nearby mountain. However, rather than leave the child to die of exposure, as Laius intended, the sympathetic servant passed the baby onto a shepherd from Corinth and then to another shepherd.
Oedipus the infant eventually came to the house of Polybus, king of Corinth and his queen, Merope, who adopted him as they were without children of their own. Little Oedipus/Oidipous was named after the swelling from the injuries to his feet and ankles. The word oedema (British English) or edema (American English) is from this same Greek word for swelling: οἴδημα, or oedēma.
Many years later, Oedipus was told by a drunk that Polybus was not his real father but when he asked his parents, they denied it. Oedipus sought counsel from the same Delphic Oracle. The Oracle didn't tell him the identity of his true parents but instead told him that he was destined to kill his father and marry his mother. In his attempt to avoid the fate predicted by the Oracle, he decided to not return home to Corinth. Since it was near to Delphi, Oedipus decided to go to Thebes.
As Oedipus traveled, he came to Davlia, where three roads crossed each other. Here he encountered a chariot driven by his (unrecognized) birth-father, King Laius. They fought over who had the right to go first and Oedipus killed Laius in self defense, unwittingly fulfilling part of the prophecy. The only witness of the King's death was a slave who fled from a caravan of slaves also traveling on the road at the time.
Continuing his journey to Thebes, Oedipus encountered a Sphinx which would stop all those who traveled to Thebes and ask them a riddle. If the travelers were unable to answer correctly, they would be killed and eaten by the Sphinx; if they were successful, they would be able to continue their journey. The riddle was: "What walks on four feet in the morning, two in the afternoon and three at night?". Oedipus answered: "Man: as an infant, he crawls on all fours; as an adult, he walks on two legs and; in old age, he relies on a walking stick". Oedipus was the first to answer the riddle correctly and, having heard Oedipus' answer, the Sphinx was astounded and inexplicably killed itself by throwing itself into the sea, freeing Thebes.
Grateful, the people of Thebes appointed Oedipus as their king and gave him the recently widowed Queen Jocasta's hand in marriage. (The people of Thebes believed her husband had been killed while on a search for the answer to the Sphinx's riddle. They had no idea of the killer's real identity.) The marriage of Oedipus and Jocasta fulfilled the rest of the prophecy. Oedipus and Jocasta had four children: two sons, Eteocles and Polynices (see Seven Against Thebes), and two daughters, Antigone and Ismene.
Many years after the marriage of Oedipus and Jocasta, a plague of infertility struck the city of Thebes; crops no longer grew to harvest and women did not bear children. Oedipus, in his hubris, asserted that he would end the pestilence. He sent Creon, Jocasta's brother, to the Oracle at Delphi, seeking guidance. When Creon returned, Oedipus heard that the murderer of the former King Laius must be found and either be killed or exiled. In a search for the identity of the killer, Oedipus followed Creon's suggestion and sent for the blind prophet, Tiresias, who warned him not to try to find the killer. In a heated exchange, Tiresias was provoked into exposing Oedipus himself as the killer, and the fact that Oedipus was living in shame because he did not know who his true parents were. Oedipus blamed Creon for Tiresias' telling Oedipus that he was the killer. Oedipus and Creon began a heated argument. Jocasta entered and tried to calm Oedipus, attempting to comfort him by telling him about her first son and his supposed death. Oedipus became unnerved as he began to think that he might have killed Laius and so brought about the plague. Suddenly, a messenger arrived from Corinth with the news that King Polybus had died. Oedipus was relieved concerning the prophecy for it could no longer be fulfilled if Polybus, whom he thought of as his father, was now dead.
Nonetheless, he was wary while his mother lived and did not wish to go. To ease the stress of the matter, the messenger then revealed that Oedipus was, in fact, adopted. Jocasta, finally realizing Oedipus' true identity, begged him to abandon his search for Laius's murderer. Oedipus misunderstood the motivation of her pleas, thinking that she was ashamed of him because he might have been the son of a slave. Jocasta then went into the palace where she hanged herself. Oedipus sought verification of the messenger's story from the very same herdsman who was supposed to have left Oedipus to die as a baby. From the herdsman, Oedipus learned that the infant raised as the adopted son of Polybus and Merope was the son of Laius and Jocasta. Thus, Oedipus finally realized in great agony that so many years ago, at the place where the three roads met, he had killed his own father, King Laius and subsequently married his mother, Jocasta.
Oedipus went in search of Jocasta and found she has killed herself. Using the pin from a brooch he took off Jocasta's gown, Oedipus gouged his eyes out. Oedipus asked Creon to look after his daughters, for his sons were old and mature enough to look after themselves, and to be allowed to touch them one last time before he was exiled. His daughter Antigone acted as his guide as he wandered blindly through the country, ultimately dying at Colonus after being placed under the protection of Athens by King Theseus.
His two sons, Eteocles and Polynices, arranged to share the kingdom, each taking an alternating one-year reign. However, Eteocles refused to cede his throne after his year as king. Polynices brought in an army to oust Eteocles from his position and a battle ensued. At the end of the battle the brothers killed each other. Jocasta's brother, Creon, takes the throne. He decided that Polynices was a "traitor," and should not be given burial rites. Defying this edict, Antigone attempted to bury her brother and, for this trespass, Creon had her buried in a rock cavern where she hanged herself.
There are many different endings to the legend of Oedipus due to its oral tradition. Significant variations on the legend of Oedipus are mentioned in fragments by several ancient Greek poets including Homer, Hesiod and Pindar. Most of what is known of Oedipus comes from the set of Theban plays by Sophocles: Oedipus the King, Oedipus at Colonus, and Antigone.