Why does Hamlet doubt the honesty of the ghost?
Hamlet does not doubt that the ghost he meets in Act 1, Scene 5 is truly the ghost of his dead father. Later, however, he begins to have doubts. In his soliloquy at the end of Act 2, Scene 2, he explains why.
The spirit that I have seen
May be a devil; and the devil hath power
T' assume a pleasing shape; yea, and perhaps
Out of my weakness and my melancholy,
As he is very potent with such spirits,
Abuses me to damn me. I'll have grounds
More relative than this. The play's the thing
Wherein I'll catch the conscience of the King.
The arrival of the players has given him an idea. He will have them put on a play which resembles what the ghost has told him. A man murders a sleeping king and seduces the king's wife. The play is titled The Murder of Gonzago. Hamlet tells himself in his soliloquy that he will observe Claudius closely in order to see how he reacts. As Hamlet says:
I'll observe his looks;
I'll tent him to the quick. If he but blench,
I know my course.
Later, in Act 3, Scene 2, he asks Horatio to help him watch Claudius during the play. By this time Hamlet has taken Horatio into his confidence and told him what he heard from the ghost. Horatio agrees to Hamlet's request. The audience will also be watching Claudius very closely after all this preparation. Shakespeare creates a strange stage effect with this play within a play. The audience is watching a play in which an audience is watching another play. The fact that the audience in the play is watching a play makes the real play seem more like reality. Claudius does not seem like a character in a play at this point but just another member of the audience. Shakespeare's audience is led to believe they are watching someone in the audience and not an actor on the stage. Claudius makes a spectacle of himself when he sees the character Lucianus pour poison into his sleeping uncle's ears. Claudius calls for lights and flees ignominiously. Hamlet is delighted that his trick has worked. Horatio confirms what Hamlet now believes.
O good Horatio, I'll take the ghost's word for a thousand pound. Didst perceive?
Very well, my lord.
From now on Hamlet will be determined to assassinate Claudius, and Hamlet now has an ally in his friend Horatio, who is also convinced that Claudius murdered Hamlet's father the former king. Hamlet calls him "O good Horatio" because he is so happy to have someone on his side. Hamlet has been all alone up to this point, surrounded by spies and false friends. There had been no one he could trust, including Ophelia. Now he can trust himself, trust Horatio, and trust his father's ghost. This is one of the places in the play where Hamlet shows an evolving character change. He now has more self-confidence. He trusts his own intuition.