<P> Deus ex machina (Latin: (ˈdeʊs ɛks ˈmaː. khɪ. naː): / ˈdeɪ. əs ɛks ˈmɑːkiːnə / or / ˈdiːəs ɛks ˈmækɪnə /; plural: dei ex machina) is a Latin calque from Greek ἀπὸ μηχανῆς θεός (apò mēkhanês theós), meaning "god from the machine". The term has evolved to mean a plot device whereby a seemingly unsolvable problem is suddenly and abruptly resolved by the inspired and unexpected intervention of some new event, character, ability, or object . Its function can be to resolve an otherwise irresolvable plot situation, to surprise the audience, to bring the tale to a happy ending, or act as a comedic device . </P> <P> The term was coined from the conventions of Greek tragedy, where a machine is used to bring actors playing gods onto the stage . The machine could be either a crane (mechane) used to lower actors from above or a riser that brought actors up through a trapdoor . Preparation to pick up the actors was done behind the skene . The idea was introduced by Aeschylus and was used often to resolve the conflict and conclude the drama . Although the device is associated mostly with Greek tragedy, it also appeared in comedies . </P> <P> Aeschylus used the device in his Eumenides, but it was with Euripides that it became an established stage machine . More than half of Euripides' extant tragedies employ a deus ex machina in their resolution, and some critics claim that Euripides, not Aeschylus, invented it . A frequently cited example is Euripides' Medea, in which the deus ex machina, a dragon - drawn chariot sent by the sun god, is used to convey his granddaughter Medea, who has just committed murder and infanticide, away from her husband Jason to the safety and civilization of Athens . In Alcestis, the eponymous heroine agrees to give up her own life in order to spare the life of her husband, Admetus . At the end, Heracles shows up and seizes Alcestis from Death, restoring her to life and to Admetus . </P>

Where does the term deus ex machina come from