Cal Weaver (Steve Carell) is a middle-aged man who learns that his wife Emily (Julianne Moore) has cheated on him with a co-worker, David Lindhagen (Kevin Bacon), and that she wants a divorce. After moving into his own apartment, Cal goes to a bar night after night, talking loudly about his divorce, until he attracts the attention of a young man named Jacob Palmer (Ryan Gosling), a womanizer who beds women each night, although a young woman named Hannah (Emma Stone) recently had rejected his advances. Jacob takes pity on Cal, and offers to teach him how to pick up women. Using Jacob's teachings, Cal seduces Kate (Marisa Tomei) at the bar. After this encounter, Cal manages to successfully seduce other women in the bar. He sees Emily again at their son Robbie's (Jonah Bobo) parent-teacher conference. The interaction goes well until they discover that Robbie's teacher is Kate, who reveals to Emily that she and Cal have slept together. Cal then confesses to sleeping with many women. Emily leaves in disgust and begins actively dating David. Meanwhile, Hannah, a recent law school graduate, is expecting her boyfriend, Richard (Josh Groban) to propose marriage while they celebrate her passing the bar exam, but he does not, instead, offering her a position at his law firm. Offended and hurt, Hannah returns to the bar where she originally rejected Jacob's advances and kisses Jacob passionately. The two return to Jacob's home to have sex, but end up talking to each other all night and making a connection. Jacob starts a relationship with Hannah, and he becomes distant from Cal.
At the same time, Robbie makes numerous grand gestures to try to win the heart of his 17-year-old babysitter, Jessica Riley (Analeigh Tipton), who actually has a crush on Cal. On the advice of her classmate Madison (Julianna Guill), she takes naked photos of herself to send to Cal and tucks them away in an envelope inside her dresser drawer. Later, when Emily calls Cal under the guise of needing help with the house's pilot light, Cal decides to try and win her back. Meanwhile, Jacob returns Cal's calls and asks for advice about starting a real relationship and meeting his girlfriend's parents. Jessica's mother, Claire (Beth Littleford), who dislikes Cal, discovers Jessica's naked photos in the dresser drawer and shows them to Jessica's father, Bernie (John Carroll Lynch). Bernie was Cal's best friend before Claire made him end their friendship in the aftermath of the breakup. Bernie rushes to the Weaver residence to confront him about the photos, with Jessica in pursuit. Cal and his kids create a makeshift mini golf set in their backyard to remind Emily of their first date. During the gathering, Jacob and Hannah show up at the house, and Hannah is revealed to be Cal and Emily's first daughter. Cal is appalled that Jacob is dating his daughter, and forbids her to see him. At that moment, Bernie shows up and attacks Cal. Jessica arrives and tells her father that Cal knew nothing of the pictures. Then David arrives on the scene to return Emily's sweater from a previous date. Jacob asks David if his name is Lindhagen and when David replies "yes," Jacob punches him in the face for the pain he caused Cal. Cal, Jacob, David, and Bernie then get into a scuffle which is soon broken up by the police. Cal starts spending time at the bar again and receives a visit from Jacob, who confesses that he is in love with Hannah. Cal replies that he is happy that Jacob is a changed man but cannot approve of Jacob and Hannah's relationship, having seen Jacob's former lifestyle. Jacob harbors no ill feelings; rather, he respects Cal and praises him for being a great father.
At Robbie's eighth grade graduation, Robbie is the Salutatorian and gives a pessimistic speech about how he no longer believes in true love and soul-mates. Cal stops him and instead begins to recount his courtship with Emily to the audience, saying that, while he doesn't know if things will work out, he will never give up on Emily. With renewed faith, Robbie reaffirms his love for Jessica, to the audience's applause. After the ceremony, Cal gives Jacob and Hannah his blessing. Jessica gives Robbie an envelope containing the nude photos of herself that were originally meant for Cal to "get him through high school." Cal and Emily have a laugh talking about the events that have transpired the past year, hinting that they might get back together.

Question: Who did Emily cheat with?
Answer: She cheated with a co-worker.