The two sorts of madness in Shakespeare’s Hamlet are between the Prince Hamlet and delicate Ophelia. The couple fulfills functioning archetypes: the strong-minded man, the weak-minded woman. One faces the risks of avenging a father; the other is lost without one; both conquer self-control to find their satisfaction.
The elaborate purpose of Hamlet’s madness is to cloak his investigation. For Hamlet, madness is a performance. He does it to mystify the other characters, but the weaving of it provides the same message: Hamlet cannot be controlled.
The on-going squabbles Hamlet argues are often to do with women