The day of the twins' trial arrives. Pudd'nhead Wilson, who is their attorney, and Aunt Patsy, their landlady, are their only allies, although even Pudd'nhead is starting to doubt their innocence. Everyone is present at the trial, including Roxy, who carries her bill of sale with her, and "Tom", who has angered Roxy by suggesting that the twins did them a favor by killing Judge Driscoll (Roxy has no reason to think "Tom" has been involved). "Tom" has been giving Roxy a substantial stipend. Pembroke Howard is prosecuting the case. He establishes a motive for the crime--the lost election and the refused challenge to a duel--and reminds the court that the judge had said in public that the twins would be able to find their knife the next time they needed to assassinate someone. Things are looking bad for the twins. Pudd'nhead calls three witnesses: the women who saw "Tom" disguised as a woman leaving the judge's house. He tells the court that their story suggests that another party is involved, who must be found in order for the twins to get a fair trial.
The court adjourns for the day, and "Tom" leaves congratulating himself on his clever disguise and his care in destroying all the evidence. Pudd'nhead returns home and once more looks over all the fingerprints in his collection from females. "Tom" stops by to mock him, and handles a few of the slides with the prints on them, including an old one from Roxy. He notes that he and "Chambers" were only seven months old when that set was taken, and then asks Pudd'nhead a question about a line on Roxy's prints. Pudd'nhead holds up the prints to the light, and is suddenly startled by something he sees. "Tom" asks him what has affected him, and Pudd'nhead assures him he is just tired. After "Tom" leaves, Pudd'nhead pulls "Tom"'s old prints from his collection. The print that "Tom" had left on the slide with Roxy's prints matches the prints on the knife perfectly, as do more recent sets of "Tom"'s prints. Pudd'nhead also looks at "Tom"'s prints from his infancy and is startled to see that they don't match the others. Confused, he goes to sleep. A dream suggests a reason for the discrepancy to him, and he rushes to check more of his collection. Pudd'nhead has apparently figured out Roxy's secret.
Pudd'nhead prepares a series of displays for the court. The next morning he arrives at the trial and informs the judge that he has new evidence. Proceeding dramatically and incorporating a few careful guesses, Pudd'nhead lays out his case for the twins' innocence, explaining the theory behind fingerprinting to the audience, who had laughed upon seeing him produce his slides. He gives a brief demonstration of the process, identifying a series of prints that members of the audience have provided. The twins are released from suspicion, but Pudd'nhead delays naming the murderer. Instead, he produces evidence of Roxy's baby switch. Finally he names "Tom" as not only the murderer but as in reality a black slave named Chambers. "Tom", or Chambers, faints, and is arrested. Roxy begs God for mercy.
The town immediately revises its opinion of Pudd'nhead and the twins. The twins, tired of their notoriety, depart for Europe. "Chambers", now known as Tom, becomes a free man and the heir to the judge's estate. Having been raised as a slave, and speaking in a black dialect, he can't bring himself to inhabit "the white man's parlor." The slave quarters are no longer an option for him either, and he spends his time alone and unhappy. Tom continues Roxy's stipend. She is now a meek creature who spends most of her time in church seeking to redeem herself. Chambers, formerly known as "Tom," confesses to the crime and is sentenced to life imprisonment. The creditors who had been only partially compensated at Percy Driscoll's (Tom's father) death reappear, however, claiming that Chambers, in reality a slave, should have been sold years ago to pay them. By a convoluted logic, they claim that, had he been sold, the judge would not have been murdered, and therefore it is not Chambers, but the mistake surrounding his identity, which is responsible for the murder. The governor of Missouri agrees and pardons Chambers/"Tom," who is then immediately sold "down the river."
Pudd'nhead's science triumphs and objective truth seems to save the day. The resolution of the trial, though, leaves both Tom/"Chambers" and Chambers/"Tom" in ambiguous positions. By revealing "Tom"'s true identity along with his guilt, Pudd'nhead actually saves his life: as a slave, he is a valuable piece of property. However, it is left open whether being sold "down the river" is a better fate than life in prison or even execution. As for the real Tom, his is perhaps the most horrible situation of all. Taught to think of himself as less than a man, he cannot speak the way a white man should and he finds himself in a terrible limbo. The town has thought of him as a black man for so long that it is impossible for him to move into white society, yet their view of what is proper for a white man keeps him from his friends in the slave quarters. Twain refuses to tell of Tom's fate, saying only that it would be "curious" and "a long story." Reconstruction (the attempt to reintegrate the South after the Civil War and the effort to give blacks a more secure place in society) had begun to fail noticeably by the time Twain was writing this novel; perhaps the real Tom's fate can best be read as an allegorical representation of the situation of blacks in America in the 1890s. It is fascinating that Tom/"Chambers" is most trapped by his speech, his most direct form of self-representation. Chambers/"Tom" has passed as a white man for so many years on the basis of his "proper" speech (although he fails at Yale), and the twins have made a living on their ability to spin a yarn about themselves.
Twain himself built an entire alternate persona based on different types of public speech--speaking tours, witty sayings, newspaper articles. This abstract, subjective form of declaring one's identity is a challenge to Pudd'nhead's seemingly objective scientific approach, but in its way it provides a pessimistic confirmation of Pudd'nhead's role model Benjamin Franklin's theory that men create their own places in the world.
The accidental nature of Pudd'nhead's discovery of the true murderer further clouds the picture. It is through "Tom"'s own actions and his obvious hubris that he is caught. Had he not gone out of his way to mock Pudd'nhead's methods, he would have gotten away, literally, with murder. Despite the carefully orchestrated show he puts on before the court, Pudd'nhead has been failed by his scientific side: not only is "Tom"'s negligence required to open Pudd'nhead's eyes, but Pudd'nhead also has to overcome his own certainty, based on what he thinks is solid empirical evidence, about a female being involved. Finally, the final piece of the puzzle--that "Tom" is actually Chambers--has to come to him in a dream. Pudd'nhead succeeds through his failures, and this suggests that the issues of race and identity at hand are too complex to be solved by the simple application of a system. It takes random acts of chance and unexplained phenomena (i.e. the dream) to bring about a resolution that, while not perfect, is probably the best possible.
The twins meet a curious fate as well. While everything in the novel, especially the overwhelming initial response of the townspeople to them, has hinted that they would be eventually unmasked as frauds, they reach the end of the novel with their reputations intact. Have the townspeople been right all along? Or are some things about identity just unknowable? Tired of the drama, they leave for Europe right away, and these questions will never be answered. Roxy too retreats, and no one is left on the stage. Even Shakespeare's darkest tragedies leave someone alive to continue on; Twain, though, leaves a mass of ambiguities and no viable characters, save Pudd'nhead Wilson. Why, then, is the novel called The Tragedy of Pudd'nhead Wilson? Perhaps it is because at the end, he has become a success in a world too debased to be worth succeeding in.