Fyodor Dostoevsky's Crime and Punishment is full of troubled characters, all of whom suffer from those troubles; however, not all of them react in the same way. A foil is any character who serves as a contrast to another in order to highlight certain characteristics. In this novel, Sonya Marmeladova serves as a foil to the protagonist, Rodion Romanovich Raskolnikov.
The main character is Raskolnikov, a young man (twenty-three years old) who has recently quit his university studies. He is broke and suffering mental anguish, presumably stemming from his poverty. In his rather demented state, he comes to believe he is a superhuman who does not have to follow the laws of humanity. He kills two innocent women and suffers surprisingly few pangs of conscience for his crimes. He blames his impoverished state for his actions and his behavior grows more erratic and deranged as the novel progresses.
Sonya also lives a life of poverty. Her father is a drunken civil servant, and Sonya is forced to become a prostitute in order to support her stepmother's children. Unlike Raskolnikov, however, she does not become jaded and cynical. Despite her immoral profession, Sonya is a pure and innocent young girl. Raskolnikov is drawn to her and ultimately confesses his crimes to her. Though she is horrified, she forgives him and becomes the motivation and inspiration for his journey to redemption.
These two characters, in somewhat similar situations, respond in completely different ways to their circumstances. Sonya's innocence serves as a clear foil to Raskolnikov's guilt.