The first indication that we have that all is not well with Hamlet is in Act II Scene ii with his speech
O, that this too too solid flesh would melt
Thaw and resolve itself into a dew!
Or that the Everlasting had not fix’d
His canon ‘gainst self-slaughter!
I.ii 129 -133
which indicates that he is bordering on the suicidal as result of his mother’s marriage to his uncle.
Once he has seen the ghost of his father on the battlements, he realises that the burden that the ghost is laid upon him has meant that his wits are beginning to teeter. He greets his companions with ” wild and whirling words”.
He then extracts an agreement from them that despite
How strange or odd soe’er I bear myself,
As I perchance hereafter shall think meet
To put an antic disposition on,
I.v 170 -172
They will not
giving out, to note
That you know aught of me
I.v 179 -180
There has been a lot of discussion about whether Hamlet is actually mad or feigning madness as well as discussions about the possible nature of his mental illness. From a dramatic perspective, this is more or less irrelevant. Mad or otherwise, Hamlet’s behaviour, and its impact on other people, is exactly the same as if you were mad
This is borne out the “affrighted” Ophelia’s description of him to her father
Lord Hamlet, with his doublet all unbraced;
No hat upon his head; his stockings foul’d,
Ungarter’d, and down-gyved to his ancle;
Pale as his shirt; his knees knocking each other;
And with a look so piteous in purport
As if he had been loosed out of hell
To speak of horrors,–he comes before me.
II.i 76 – 182
From her description is pretty clear to Polonius that Hamlet has lost plot and he is very quick to put his slant on the situation and to work it to his own advantage.
Come, go with me: I will go seek the king.
This is the very ecstasy of love
II.i 99 – 100
And this is not the first time it has happened. Claudius says to Rosencrantz and Guildenstern, as he sets them to spy on Hamlet
Something have you heard
Of Hamlet’s transformation; so call it,
Sith nor the exterior nor the inward man
Resembles that it was.
II.ii 4 – 7
Gertrude advances another explanation of the cause of Hamlet’s madness
but the main;
His father’s death, and our o’erhasty marriage.
II.ii 55 – 56
But clearly Claudius suspects it might be something more and is clearly keen to find out how much Hamlet knows. But he is circumspect in his dealings with Rosencrantz and Guildenstern
What it should be,
More than his father’s death, that thus hath put him
So much from the understanding of himself,
I cannot dream of:
II.ii 7 – 10
And sets them the task
So much as from occasion you may glean,
Whether aught, to us unknown, afflicts him thus,
That, open’d, lies within our remedy.
II.ii 15 – 18
So, add to Hamlet’s woes, he now has to contend with Rosencrantz and Guildenstern. Not that they are likely to be a problem, within half a scene he has completely unmasked the reasons for their visit to Denmark.
My lord, we were sent for.
I will tell you why; so shall my anticipation
prevent your discovery, and your secrecy to the king
and queen moult no feather. I have of late–but
wherefore I know not–lost all my mirth, forgone all
custom of exercises;
that this goodly frame, the earth,
seems to me a sterile promontory,
appears no other thing to me
than a foul and pestilent congregation of vapours.
II.ii 281 – 292
However, the arrival of the players appears to banish Hamlet’s madness completely and we see no trace of it for the rest of the play.