What is the role of Ophelia? Gertrude? How do they compare and cantrast?
Hamlet characterizes women in a way that reflects the Catholic Church's paradigm of women. Women are either good and pure (like the Virgin Mary) or prostitutes (like Mary Magdalene), it is a failing of his that he can't see women as anything deeper than that.
His mother, Gertrude, is a prostitute in his estimation because she chose to marry his uncle, his father's brother, something he views as incestuous, but she also (in his eyes) chose his uncle over him.
Ophelia, his love interest starts out as good, pure, and virginal to Hamlet's mind but when she follows Gertrude's suit and chooses to follow her father's will (allowing her father to listen in on a conversation between Ophelia and Hamlet) over Hamlet's will, she too becomes a whore in his eyes.
Both characters are portrayed as child like, sheltered and trusting throughout the play as well as somewhat one dimensional (which is different than some of the other heroines in Shakespeare's work who are more fleshed out).
But digging deeper into their characters, there are differences between the two. Gertrude, despite being a grown woman who has been Queen of Denmark and at least somewhat involved in matters of state, has stubbornly chosen to keep a childlike demeanor. She's shallow and only interested in external pleasures and what the next novel pleasure will be. But despite her shallow nature, she is deeply devoted to both Hamlet and Claudius.
Ophelia on the other hand, is a much younger woman, sheltered by both her brother and her father from matters of state. When Hamlet turns on her for acting like his mother (in his eyes), she's shattered by this. No one had ever been so cruel to her before and to call her a whore and to tell her that he never loved her though he once claimed to is devastating to her to the point that it snaps her mind. Ophelia is not afforded the same leniency in her frailty as Gertrude was. Ophelia wanders, singing bawdy songs as a bitter reminder to others that her innocence is now gone. When she can no longer handle one tragedy after another (including Hamlet's murder of her father), she chooses to take her own life, unlike Gertrude who died the way she lived, choosing to drink from a shiny new cup to enjoy the novelty, preferring to drink from the poisoned cup than listen to Hamlet's vague warning not to.