Resilience is an ability to recover from and adapt in a positive way to adverse circumstances and situations. In Sophocles's Oedipus Rex, Oedipus doesn't show resilience as much as he shows a single-minded, relentless determination to solve a murder, but he demonstrates emotional resilience in Oedipus at Colonus. Hamlet doesn't respond well to adverse emotional situations in Shakespeare's Hamlet, but as the play progresses, Hamlet demonstrates an ability to adapt intellectually to those same adverse situations, even though his intellectual adaptations result in inaction.
At the beginning of Oedipus Rex, Oedipus learns that the city of Thebes is suffering from a plague and famine inflicted on them by the gods because the murderer of Laius, the former King of Thebes, still resides, unpunished, among the people of Thebes. Oedipus swears to discover the identity of the murderer, no matter where his investigation might lead.
OEDIPUS. ...[T]herefore I
His blood-avenger will maintain his cause
As though he were my sire, and leave no stone
Unturned to track the assassin or avenge
The son of Labdacus [Laius]... (Oedipus Rex)
Oedipus relentlessly pursues his investigation until it leads to himself as Laius's murderer. In the process of his investigation, Oedipus learns the true story of his life, and that Laius was his father, and Laius's wife, Jocasta—now Oedipus's wife—is his own mother.
When all of this is ultimately revealed, Oedipus collapses emotionally. He gouges out his own eyes at the sight of Jocasta's suicide, demands to be banished from Thebes, and bemoans his fate.
OEDIPUS. [to his small daughters, Antigone and Ismene] Pray ye may find some home and live content,
And may your lot prove happier than your sire's (Oedipus Rex).AAZX
In Oedipus at Colonus, Oedipus is old, blind, and dependent on his daughters for his day-to-day existence, and he's come to Colonus to die. Nevertheless, over the past several years of his wandering throughout Greece, Oedipus has overcome his self-inflicted adverse situation, reconciled himself to his fate, and accepted responsibility for the choices that he made that brought him to this point in his life.
At the beginning of Hamlet, Hamlet is wallowing in grief and self-pity in response to the death of his father, and he's passive-aggressively "acting out" about what Hamlet considers his mother's "incestuous" marriage to Hamlet's uncle, Claudius.
When Hamlet learns from the ghost that Claudius murdered his father, Hamlet swears repeatedly over the course of the play to avenge his father's death, but he does nothing.
Hamlet has no emotional coping skills, and even though he appears emotionally demonstrative at time, he sublimates his emotions throughout the play.
Hamlet is highly resilient intellectually, but he uses his intellectual abilities to rationalize his inaction with regard to avenging his father's murder.
Hamlet wants to believe the ghost about his father's murder, but he intellectualizes that he needs more proof.
HAMLET. The spirit that I have seen
May be a devil; and the devil hath power
T'assume a pleasing shape; yea, and perhaps
Out of my weakness and my melancholy,
As he is very potent with such spirits,
Abuses me to damn me. I'll have grounds
More relative than this (Hamlet, 2.2.593–599).
Hamlet's "To be or not to be" soliloquy in act 3, scene 1 is an intellectual exercise, almost entirely devoid of emotional context or content. Hamlet isn't going to kill himself no matter how much he talks to himself about it.
Hamlet has an opportunity to avenge his father's murder in act 3, scene 3 when Claudius is alone and vulnerable, but Hamlet talks himself out of killing Claudius.
Claudius sends Hamlet to England to be executed, but Hamlet cleverly rewrites the commission from Claudius to the King of England to request that the king kill Rosencrantz and Guildenstern instead. It's all an intellectual exercise. Hamlet gives no consideration to the fact that Claudius wants to kill him, and he has no regrets whatsoever for sending Rosencrantz and Guildenstern to their deaths in his place.
HAMLET. [to Horatio] Why, man, they did make love to this employment!
They are not near my conscience; their defeat
Does by their own insinuation grow (Hamlet, 5.2.61–63).
Hamlet's first reaction to Ophelia's death is "What, the fair Ophelia?" (Hamlet, 5.1. 238), and he later jumps into her grave and attacks Laertes, her brother, claiming that he loved Ophelia more than Laertes ever could.
HAMLET. I loved Ophelia. Forty thousand brothers
Could not, with all their quantity of love,
Make up my sum (Hamlet, 5.1.270–272).
Yet Hamlet never told Ophelia that he loved her, and instead demeaned her and drove her out of his life—"Get thee to a nunnery!" (Hamlet, 3.1.120)—and ostensibly caused her suicide.
Hamlet's emotions finally overwhelm him in the final scene of the play. Hamlet is dying. Ophelia is dead, Laertes is dying, Hamlet's mother died in his arms, and Hamlet finally recognizes and releases his emotions—although not in a positive, constructive way—and kills Claudius.
Whereas Oedipus initially lacked emotional resilience in Oedipus Rex, which leads to his tragic downfall, he demonstrates emotional resilience in Oedipus at Colonus. Hamlet demonstrates intellectual resilience throughout Hamlet, which unfortunately leads to his intellectualized inaction, but he exhibits very little emotional resilience and succumbs to his repressed emotions, which ultimately leads to his tragic death.