How does the relationship between Hamlet and Ophelia change throughout the play?and how it links to the central idea of the play.
This is an interesting sub-plot to the play and I like that you are being asked to connect it to the larger themes of the play as a whole! If you review the play from Act 1, we learn about Hamlet and Ophelia's relationship through Ophelia's conversations with her brother and her father. In those conversations we learn that Hamlet and Ophelia love each other and that Ophelia trusts the sincerity of Hamlet's words and actions. Laertes seems to trust his sister's judgement here, but warns her that even if Hamlet does love her, he is a prince who may not be able to choose his wife for himself because the "health of Denmark" will rest on his choice. Ophelia is not noble and doesn't have any political advantage to bring to the throne of Denmark. We actually learn more about their relationship in what Ophelia tells her father. In the course of the conversation she tries to interject that Hamlet has "made many tenders of his affection to me," and that he has "importuned me with love in honorable fashion," and lastly that Hamlet has regarded her with esteem and "hath given countenance to his speech with almost all the holy vows of heaven." Polonius doesn't have much faith in Hamlet's sincerity, but Ophelia clearly does as evidenced by the fact that she is willing to defend him to her father is who already speaking very negatively and condescendingly.
Unfortunately for Ophelia, she ends up being a victim of the larger circumstances of the Hamlet's life. He treats her weirdly when he visits her room and he treats her VERY rudely when they speak in Act 3. These two scenes though are Hamlet's attempts to "put an antic disposition on" and act crazy in an attempt to throw off Claudius and assure himself of Claudius's guilt. Hamlet's focus on his revenge is primary, and he must do what he must to convince everyone that he has lost his mind. That is why he tells Ophelia that he never loved her and that she should get herself to a nunnery. Those words are harsh, but necessary. Hamlet is suspicious of being spied on and probably recognizes that Ophelia is being used as "bait," so he says harsh things to her.
Hamlet reveals what is probably his true feelings when he stands at her funeral. He is devastated that Ophelia has died and likely recognizes that his treatment of her and his killing her father are probably to blame for her death. He boldly declares that he loved Ophelia and that "forty thousand brothers could not (with all their quantity of love) make up my sum." He says that he wishes he could be dead along with her. Even though Hamlet has an audience here, he is speaking in verse and probably speaking from the heart in that moment. It is a sad ending to what could have been a promising relationship. It all links to one of the central themes of the play which is appearance versus reality. There are so many instances in the play where characters believe one thing but behave in an outwardly very different way because it suits their purposes. Hamlet's feelings for Ophelia serve as an excellent example of this.