The idea of a character feigning madness is not foreign to great literary works; in fact, many authors use it to show the sanity of the character. Odysseus shows his sanity by pretending to be mad in Homer's The Iliad to avoid going to war. If his plan had been successful, he would have stayed safe at home, away from the dangers of war. The idea of feigning madness is also apparent throughout Shakespeare's Hamlet. The tragic character puts on an act after he is told of his father's murder, perhaps to have something on which he can place the blame after he avenges his father's death, or perhaps it is to capture the attention of certain characters so that he may find out exactly what has gone "rotten in Denmark." Though it sounds like a crazy idea, Hamlet is feigning madness in Shakespear's tragic play. .
It is certainly understandable for someone who has just lost their father, and gained a stepfather to suddenly go mad. However, some time passes before Hamlet is "mad." In fact, before he even begins showing signs of madness, he says to his friend Horatio "As I perchance hereafter shall think meet to put an antic disposition on" (Act I, scene V, lines 166-167). It is not until after this statement that Hamlet becomes mad, and in saying this statement, it is implied that he is in fact feigning madness. Later, as Hamlet is speaking to Guildenstern, he makes the analogy that he is "but mad north-north-west: when the wind is southerly I know a hawk from a handsaw" (Act II, scene II, lines 408-410), again indicating that he is only shamming insanity. Also, in a heated conversation in which his mother is questioning his sanity, Hamlet says "I essentially am not in madness, But mad in craft" (Act III, scene IV, lines 168-169). Hamlet is putting on an act, a deceiving performance in order to confirm who was involved with his father's death. .
Hamlet only performs his act for certain characters, though.