Madness and Melancholia in Hamlet
The themes of madness and melancholia are present throughout all of Shakespeare's play “Hamlet”.
Melancholy is mainly expressed through the young Prince Hamlet. Before the opening of the play he has lost his father, seen his country degenerate and his mother marrying his uncle. Furthermore Hamlet has an unpleasant feeling that his father did not suffer a natural death.
These worries are the main courses of Hamlet's melancholic mood. Thereby the melancholic atmosphere is set early in the play. For example Hamlet says:
“how weary, stale, flat and unprofitable Seem to me all the uses of this world” [[#sdfootnote1sym|1]]

Also in the famous “to be, or not to be” soliloquy – act 3, scene 1 – Hamlet is reflecting upon the subject of suicide, saying that life is a burden he would be glad not to bear.
Hamlet's melancholy effects the whole play and provides a preparation of the tragic happenings by inducing a sad or melancholic feeling from the opening of the play.
Where melancholia in “Hamlet” is always present, the madness is a much more complex feature.
For the most part Prince Hamlet is conveying this madness. But is he in fact mad, or is he only “mad in craft”[[#sdfootnote2sym|2]]?
At first hand, Hamlet's behaviour in all the play indicates that he, as he says, only play-acting mad. Actually Hamlet decides to put up a mad act when he is on stage – the whole audience is let in on his plan. Also Hamlet tells both Horatio and his old school friends Rosenkranz and Guildenstone that he is simply to tricking the King and Queen.
The clearest sign of Hamlet's sanity is his conducts when he is alone. Here he does not come across as mad, but as deeply depressed and worried.
Prince Hamlet's madness is a convenient act. Hamlet provides some freedom for himself to be highly inappropriate, without receiving an immediate reaction from the court. But also Hamlet's uncle King Claudius tries to profit from Hamlet's madness. The King sees a possibility to get rid of his nephew using the madness as an excuse, for sending him away or even killing him.
Even though Hamlet's behaviour towards his mother and uncle is not an expression of insanity, the young Prince graduately starts acting out of character during the play. His inner renaissance man is under pressure.
At first Hamlet is seriously considering suicide, then his aggressiveness escalates and peaks in “the Queen's closet scene”. In this scene Hamlet stabs the King's advisor Polonouis to death, without knowing who he's killing. And he speaks so harshly of his mother's guilt, scaring the Queen until the old King's ghost comes to stop him.
Really Hamlet is not mad, he is just becoming obsessed with his mission to find the truth and revenge his father. Of course it is a question of interpretation, but the most valid explanation for Hamlet's actions is that he simply gets absorbed by his mission.
An other aspect of the madness the kind that hits Polonious' daughter Ophelia.
After Hamlet has gone to England and Polonious has been killed she goes completely mad, singing silly songs, acting entirely inappropriate. But Ophelia's madness is not that far fetched. Her songs and herbs are symbols hinting at the terrible deception King Claudius is pulling of. Thereby her madness becomes a way to remind the audience of the terrible thing that are being hidden.

[[#sdfootnote1anc|1]]Act 1, scene 2, lines 133-134.
[[#sdfootnote2anc|2]]Act 1, scene 2, lines 133-134.