According to Greek mythology, the sphinx was placed by Hera at Thebes to ask passersby a riddle: "Which creature goes about on four legs in the morning, two legs in the afternoon, and three legs in the evening?" Anyone who failed to solve the riddle was killed and devoured; Oedipus correctly answered that the creature of the riddle was man in his three stages of life: as a baby, an adult, and as an old man with a cane. Upon hearing the answer the sphinx killed herself.
The Greek play of Oedipus Rex by Sophocles features the sphinx as a creature who tests the titular character with a riddle. The riddle of the sphinx has since become a common trope in various forms.