In the previous scene, the King, Queen, Polonius, and Rosencrantz and Guildenstern have been discussing Hamlet’s “insanity.” His friends from abroad have been summoned– apparently–to find out the origins of Hamlet’s insanity/melancholy.

It is more than likely that Hamlet is feigning insanity, and thus knows from the beginning of the scene that Polonius and Claudius are watching him. Although Polonius and the King hide in the shadows to observe Hamlet in the lines prior to Hamlet’s soliloquy and encounter with Ophelia, Hamlet probably knows that he is being watched, hence take planned actions.

To understand the nunnery scene, it seems apparent that Hamlet’s soliloquy must be observed first. The monologue focuses on Hamlet’s argument with himself over the decision of his own life or death. It is curious that Hamlet would enter a room and immediately start pondering about the trials of life—how it seems all unworthy, yet it is the only thing we are sure of, therefore the lesser of two great fears. When he questions whether it is better “to be, or not to be,” the obvious implication is, “Should I kill myself?” The entire soliloquy strongly suggests that he is toying with suicide and perhaps trying to work up his courage to do it. Hamlet merely plays with suicide, as he never directly suggests that he will close his eyes to “the sleep of death.” But at no point does he say that he is in pain or discusses why he wants to kill himself. In fact, he never says “I” or “me” in the entire speech. He’s not trying to “express” himself at all; instead, he poses the question as a matter of philosophical debate. When he claims that everybody would commit suicide if they weren’t uncertain about the afterlife, it sounds as if he’s making an argument to convince an imaginary listener (the audience) about an abstract point rather than directly addressing how the question applies to him. Now, it’s perfectly ordinary for characters in plays to say something other than what they mean to other characters (this suggests that they are consciously hiding their true motives), but Hamlet does it when he’s talking to himself. This creates the general impression that there are things going on in Hamlet’s mind that he can’t openly talk, considering the fact that he knows Polonius and Claudius are at the place.

This analysis of Hamlet being aware that Polonius and Claudius are there naturally connects into Hamlet’s encounter with Ophelia. In Act III, Scene I, Hamlet says, 'I did love you once.' However, four lines later, he contradicts himself by saying 'I loved you not.' Hamlet claims to have loved Ophelia, but at the moment, he feels betrayed by several people, including her (because she also lies that Polonius is at his house when Hamlet already knows that he is watching). The feelings of betrayal influence him to conflict with his emotions, and manipulate him to say things he does not believe. He also laments the dishonesty of beauty, and bitterly comments on the wretchedness of humankind as he urges Ophelia to “Get thee to a nunnery” and “marry a fool; for wise men know well enough what monsters you make of them,” rather than become a “breeder of sinners.” He criticizes women for making men behave like monsters and for contributing to the world’s dishonesty by painting their faces to appear more beautiful than they are. Working himself into a rage, Hamlet denounces Ophelia, women, and humankind in general, saying that he wishes to end all marriages. Such hatred against marriages echoes Queen Gertrude and Claudius. In this sense, he intentionally mentioned this to warn Claudius as he was aware that Claudius was watching.