In a complex question of this sort – discussing two kinds of madness – one feigned – in two very complex plays, it would be fruitful to return to Shakespeare’s time and audience – What did “madness” mean to 16th c. London? Far from any modern notion of mental instability as defined by Freud or Jung, madness meant “irrational behavior that contradicted social norms; behavior that threatened self-preservation, especially behavior that challenged the Great Chain of Being” (q.v.), especially manifested in class hierarchies. Hamlet is seen as “mad” when he appears in public not properly dressed; a simple and clear example of Elizabethan madness is shown when Ophelia (truly mad) appears with “her hair down” – never done in royal society, as Gertrude points out. With Lear, his very madness is caused by his unacceptable act – relinquishing his throne before his death, which clearly upset the chain of heirarchy in his kingdom. The nonsense (on one level) speech of the Fool is meant to show that “normal” rules of discourse (reference to reality) were not being followed, a sure sign of madness to an Elizabethan audience. These lines of inquiry should lead you to write the essay you want. Go to each manifestation of madness in the two plays and ask what Elizabethan “rules” of socially accepted behavior are being violated.
The term “developed” implies a discussion of the plays’ dramatic structures, so you will want to find how the manifestation of madness accelerates in the course of each play. And, yes, you should use all the characters who manifest “mad” behavior. (Note: "lunatic" behavior is different -- it is caused by natural disorder, the heavens being out of line, etc. (luna = moon).