Numerous passages in the play indicate that Hamlet is not, in fact, mad. Immediately after speaking with the ghost of his father in Act I, Scene 5, he actually tells Horatio and his friends that he will
perchance hereafter shall think meet
To put an antic disposition on...
In other words, he will pretend to be mad. Later in the play, he says essentially the same thing to Rosencrantz and Guildenstern, informing them that
But my uncle-father and aunt-
mother are deceived...I am but mad north-north-west. When the wind is southerly I know a hawk from a handsaw.
Finally, when Hamlet confronts his mother in her closet, he beseeches her not to reveal to her husband that he is "essentially not in madness/But mad in craft." Other characters, even Polonius, who is convinced that Hamlet is insane, notes that there is "method" in Hamlet's madness. Hamlet does contradict himself late in the play, telling Laertes that he was mad when he killed Polonius. And he is certainly a tormented figure, as his famous soliloquies demonstrate. But he says early in the play that he will feign madness in order to carry out his plot to avenge his father's murder, and he sticks to it throughout the story. He is impulsive, often melancholic, but his madness seems to be a convincing ruse.