The phrase deus ex machina literally means “a god from a machine.” It refers to the practice, in some ancient plays, of using a crane to lower an actor, playing a god, onto the stage. The actor playing the god would then use his divine powers to resolve some knotty complication in the plot of the work. To employ this (literal) device was often considered inartistic. It would be as if one had painted oneself into a corner and then discovered a hidden door allowing a quick and easy exit.
One example of a deus ex machina might be the sudden appearance of Hymen at the end of William Shakespeare's play As You Like It. However, perhaps an even better example occurs a bit later. In the final scene of the drama, all the romantic complications of the play have been worked out to everyone’s satisfaction. One problem, however, remains: the rightful but unnamed Duke, who has been living in exile in a forest after having been banished by Frederick, his usurping younger brother, is still living in exile and also in potential danger. Frederick, it turns out, has decided to come into the forest with an army. He plans to hunt down the rightful duke and slay him. Fortunately, however, a character quite unexpectedly appears and makes the following speech:
Duke Frederick, hearing how that every day
Men of great worth resorted to this forest,
Address'd a mighty power; which were on foot,
In his own conduct, purposely to take
His brother here, and put him to the sword;
And to the skirts of this wild wood he came,
Where, meeting with an old religious man,
After some question with him, was converted
Both from his enterprise and from the world;
His crown bequeathing to his banish'd brother,
And all their lands restor'd to them again
That were with him exil'd.
This could not be neater or less expected. In twelve lines, all the political problems facing the unnamed Duke and his followers suddenly disappear. The evil Duke Frederick has quite literally found not simply “a” god but “the” God, and so his worldly ambitions are conveniently at an end. If he had not by chance encountered the old man who converted him to true Christianity, the play might have had a very bloody ending.
Why did Shakespeare choose to conclude his play this way when he could easily have ended it otherwise? Here are some possibilities:
- If the play had ended with unexpected news of the sudden death of Frederick, justice might have seemed served, but the happy, romantic, optimistic tone of the play’s conclusion might have been spoiled.
- By ending the play on a note that seems almost miraculous, Shakespeare celebrates the possibility of sudden and unexpected good. He affirms the joyous, almost fairy-tale tone of the play’s conclusion. Good things, after all, sometimes do suddenly and unexpectedly happen in real life, even if they seem to happen rarely. Perhaps Shakespeare wants to remind us of such occurrences.
- On the other hand, perhaps Shakespeare made the ending somewhat improbable precisely to remind us that his play is, after all, only a play. In other words, by ending the play in a way that may seem contrived and naïvely optimistic, perhaps Shakespeare helps remind us that we should not expect such outcomes in real life but should be thankful for them whenever they occasionally occur. The whole play is wondrous in many ways and on many levels, and it ends, like Mozart's The Magic Flute, on a note of almost miraculous joy.