Ophelia and Hamlet's lives run parallel in some key ways. Both have lost a parent prematurely, and both have suffered great disappointment at the hands of someone that he or she trusts, of the opposite sex. For Hamlet, that person is his mother; for Ophelia, that person is Hamlet. They are also both weak.
I think Hamlet would have trusted Ophelia if she would have been trustworthy, but she was not. It is difficult to conceive of the depths of her naiivite--if it is in fact that. That she could be oblivious to the events happening in the castle seems inconceivable, and yet she seems to have no inkling about how desperately Hamlet needs a friend. Instead, she allows herself to participate in a scam to trap him into revealing his feelings for her. This would suggest that Ophelia is somewhat superficial intellectually, and immature emotionally.
In this respect, she is the perfect foil for Hamlet. Hamlet does not blindly trust (as she does) but tests before accepting or rejecting offers of friendship. He uses his mind; she is controlled by others and by her emotions. He thinks--she reacts. Eventually, Hamlet turns his anger outwards but Ophelia turns hers in upon herself.
Both are moved to the point of madness in grief, and both lose themselves to sin--hers, despair; his, anger.
First, a foil, in literary terms, is "a character in a work whose behavior and values contrast with those of another character in order to highlight the distinctive temperament of that character (usually the protagonist)." Ophelia is one of Hamlet's foils in her complete innocence of his plan to feign madness. Hamlet appears all the more mad when Ophelia is being used as a sounding board for his plan to be believed. Hamlet goes to great lengths to "highlight his distinctive temperment", as in this famous exchange in Act 3, Scene 1:
If thou dost marry, I'll give thee this plague for
thy dowry: be thou as chaste as ice, as pure as
snow, thou shalt not escape calumny. Get thee to a
nunnery, go: farewell. Or, if thou wilt needs
marry, marry a fool; for wise men know well enough
what monsters you make of them. To a nunnery, go,
and quickly too. Farewell.
O heavenly powers, restore him!
As a parallel, both come from pretty messed up families. Ophelia has her brother, Laeretes, but he leaves her to go to college. Hamlet had his father, the king, but he is murdered. Those left behind, Gertrude, Claudius, and Polonius, do not have their children's best interest at heart. Additionally, Hamlet and Ophelia do seem to have shared a comraderie earlier, but Hamlet chooses to abandon their connection in favor of revenge.
In Hamlet we find Ophelia frustrated from very begining because she does not enjoy her life as a free agent.When ever she meets Hamlet and is excited by him,she conveys to her father and is instructed.Simultaneously ,Hamlet is plunged in same frustration because of hasty marriage.
Ophelia is mad due to the death of her father.She wanders hither
and thither in great dejection,as see that Hamlet is told the truth by ghost.Afterwards he loses his consciousness and like mad he starts searching out the truth.As your question is ,u use parallel,Ophelia is a weak character,she is more frustrated.She finds nothing in the world useful,that`swhy she commits suicide.If her father had told about the spirit of love,she would not have been suffered and would have collected power from love to survive.
Hamlet`s suffering is intensified by her becoming mad and death.
Due to her death,her brother fights him and causes of his tragedy.So it is clear that she is foil and even she worries over being the mad of Hamlet.She is not so foil as Hamlet because Hamlet`s goal is to take avenge of his father from murderer.Whereas Ophelia is weak and how she can avenge from her beloved whom she likes that is not disclosed by her openly.May be ,being mad ,she punishes him.