What function does the friendship of Hamlet and Horatio serve in the play?
Shakespeare created the character of Horatio mainly in order to provide Hamlet with a sympathetic listener. Shakespeare has to rely heavily on soliloquies in order to reveal what Hamlet is thinking and feeling. Hamlet's psychological problems are a very important part of the play. Without Horatio there would probably have to be even more of Hamlet's soliloquies, and Shakespeare undoubtedly felt, as an artist, that he was in danger of overdoing this device. The problem in writing plays is that they rely so heavily on dialogue. Characters have to talk to other characters in order to reveal information to the audience. They even have to keep calliing each other by name, so that the audience will be able to identify them. Hamlet, of course, has a lot of secrets. He can't trust most of the people around him, not even Ophelia, who is submissive to her father. Horatio is a friend, someone he can trust with his secrets, and in confiding his secret thoughts and plans to his friend, Hamlet is also confiding them to the audience. Horatio is wise, trustworthy, sympathetic, loyal, understandiing--he is given just the character traits he needs to serve as a confidant to Hamlet.
The friendship between Horatio and Hamlet is very important to the play itself because Horatio serves as the word of wisdom and trust in the play. He is the most trustworthy person in the play. We see the value of their friendship at the end of the play when Hamlet tells Horatio to tell his story.
1) The guards' knowledge of the friendship prompts the decision that gives the ghost legitimacy. The guards have Horatio clarify the ghost as a real essence--not just a figment of Hamlet's imagination.
2) Drives Horatio's desire to redeem himself as a worthy friend to Hamlet. On the roof, Horatio so scares himself with his story of omens at caesar's death that he acts irrationally to the ghost, losing the apparition and his chance to clarify the ghost's appearance ahead of time for Hamlet. Horatio's guilt for abandoning this duty to Hamlet moves him to stay by Hamlet for the rest of the play.
2) The friendship serves to validate Claudius' guilt--Hamlet turns to Horatio to second Hamlet's interpretation of the King's response to the play.
3) The friendship provides for Gertrude's sole account of Ophelia's death--again, in Horatio's desire not to abandon Hamlet, Horatio chooses to meet with Hamlet after reading Hamlet's letter. In doing so, he leaves his watch over Ophelia, so the only evidence of Ophelia's death resides in Gertrude's story.
4) The friendship provides for evaluations of Hamlet's moral character--the extent of Hamlet's moral degeneration emerges in Horatio's shock over Hamlet's cold-blooded response to Ros. and Guild,'s likely inability to repent before they die and also in Horatio's lamentation of the extent of Hamlet's moral fall after Hamlet dies: "Now cracks a noble heart."