In Shakespeare's, Hamlet, Hamlet seemingly devises and then reveals his plan to prove or disprove the Ghost's story that Claudius killed King Hamlet, during his soliloquy in Act 2.2.565-572. He starts the speech with angry condemnations of himself, but ends it with the revelation of his plan.
Hamlet is intelligent enough to know that the Ghost could be a devil in disguise trying to get him to kill an innocent man, Claudius. Though Hamlet certainly doesn't like Claudius, and though Claudius usurped his thrown, albeit legally, and hastily and incestuously married his mother, Hamlet isn't willing to kill him without proof. The plan is to have the players present a play that presents a murder scene in which the murder is killed in a similar way to how, according to the Ghost, Claudius killed King Hamlet. If Claudius overreacts with a strong show of emotion, Hamlet will know with certainty that Claudius is guilty.
Claudius does overreact, of course: he rises then yells
Give me some light. Away! (Act 3.2.250)
This is so drastic that the entire stage clears, except for Hamlet and Horatio. And Horatio informs Hamlet that he agrees with his interpretation of Claudius's behavior with "Very well, my Lord [he perceived it very well]" (Act 3.2.268), and "I did very well note him," two lines later.
The confirmation Hamlet receives from "the play within the play" changes Hamlet's position so drastically that it should end the play in a matter of minutes. Hamlet now knows Claudius is guilty, and he sets off to kill him and get his revenge.
But, unfortunately for Hamlet and the others that die at the close of the play, it does not.
In Act 3.3.73-96 Hamlet has a perfect opportunity--and is now equipped with the necessary certainty of Claudius's guilt--to get his revenge and kill Claudius. But he doesn't.
Why? Because he mistakenly thinks Claudius is confessing his sins, and killing him during confession would send him straight to heaven with his sins forgiven. And Hamlet won't do that.
And this is the climax of the play. When Hamlet refuses to kill Claudius he dooms himself and Denmark. Again, why? That's what happens when human beings play God. Salvation is God's business, not Hamlet's. Hamlet messes where he doesn't belong. He should go ahead with his revenge and let God take care of salvation.
Ironically, of course, Claudius never confesses. He, too, is intelligent, and he's smart enough to know he cannot be forgiven as long as he clings to the rewards he got by committing the sin.
I am guessing you mean Act III, scene 2? Well then...
The Mousetrap has revealed, at least in Hamlet's mind and perhaps others that there is something wrong and perhaps that Claudius, his uncle is to blame. He purposely put on the play in such a fashion that it would bring to the surface the emotions of guilt and pain that Claudius might be feeling, having murdered his brother, and in that anguish Hamlet felt he could at least discern his guilt, thus giving impetus to Hamlet's feeling that he ought to avenge his father's death and be doing so righteously. He has placed Horatio in a position to observe the King's reaction and thereby confirm his guilt.