The Comedy of Errors is one of Shakespeare's earliest plays. It was first printed in the First Folio in 1623, and the earliest known performance is recorded to have been at Gray's Inn, one of London's law schools, on December 28th, 1594. However, thematic resemblances to other plays have led many scholars to believe that it was written years earlier than this performance.
The play bears a striking resemblance to the Menaechmi, a play by the Roman playwright Plautus. Shakespeare must have read the original play in Latin, since the English version did not appear until 1595. The premise of the Menaechmi follows: a Syracusan merchant with twin sons takes one of them on a trip abroad. During the trip, his seven year old son becomes separated and is taken to be raised by a childless trader. The father is heartbroken and dies a few days later, while his son is taken to Epidamnum with the trader. When the news reaches Syracuse, the other brother's name is changed to that of his now missing brother.
The action in the play is set years later when Menaechmus of Syracuse arrives at Epidamnum. He is greeted warmly by everyone and receives numerous free gifts, including intercourse with his brother's mistress. The two men finally meet and decide to return to Syracuse, at which point the one brother sells off all of his assets- including his, ³wife, should there be any purchaser."
Shakespeare adopted a great deal of his plot from this story, but added several key changes. He moved the action to Ephesus, which is more associated with magic arts and early Christianity. He also added the twin servants for humor content, borrowing them from another of Plautus' plays, the Amphitruo.
The dramatic element is heightened by Shakespeare because he includes an intense rivalry between the cities of Syracuse and Ephesus. Thus Egeon is captured and sentenced under an inflexible law. At the end of the play he is being led to his execution, raising the stakes of a resolution to the plot. Further, he is the character who gains the most once he is reunited with his loved ones.
The only authoritative text source for the play is the First Folio of 1623. It is believed that the text was based on Shakespeare's own autograph manuscript, since several references and stage directions indicate knowledge of the play which only Shakespeare would have possessed. For example, stage directions indicate characters such as ³a schoole-master, call'd Pinch" or ³wife of Antipholis Sereptus." Since there is no mention in the dialogue that Pinch is a schoolmaster, or of the surname Sereptus, it has been inferred that these are Shakespeare's original directions.