Baker Street Wiki

Solve for 'X'

1,304pages on
this wiki
Add New Page
Talk0 Share
"Solve for 'X'"

Season 2, Episode 2

Tumblr mt1gyk7ifN1ri1p5ro1 r1 500
Air Date 3 October, 2013
Writer Jeffrey Paul King
Director Jerry Levine
Viewers 9.38 million (U.S.)[1]
Previous "Step Nine"
Next "We Are Everyone"
"Solve for 'X'" is the second episode of season two of Elementary. It first aired on CBS on 3 October, 2013.


Sherlock and Joan investigate the murder of a mathematician whose walls are painted with a complex formula. A colleague of Sherlock's reveals the formula is a nearly unsolvable problem, and directs them to a professor, Tayna, who had written about the formula. Tanya points them to a suspect, but he has been murdered. Sherlock realises the second victim was under surveillance and tracks down the man responsible. He tells Sherlock the value of the completed formula – a skeleton key to bypass any encryption – and directs them back at Tanya, but she provides a video recording of her alibi. Sherlock confronts Tanya with evidence that she manipulated the footage because she already solved the problem, and that she killed the two victims because they were getting close. Meanwhile, Joan meets with the son of the patient she lost during surgery and he asks her for money. Joan considers the request, and goes to Sherlock to discuss an advance on her salary, but he deduces how she intends to spend the money, and declares that he is against the proposition. Sherlock considers it a form of emotional blackmail, and suggests that, if they start, the payments may never end.


Part One

On a deserted street, mugger Benny Charles demands his victim's wallet. The man nervously says he doesn't want any trouble, and hands it over, but Charles says he didn't move fast enough, and slashes the man's face with his knife, then runs. Charles removes the cash from the wallet and hops a fence to cut through a house's backyard. To his surprise, he hears a man yelling inside the house, then two gunshots. Charles is frozen in place when the shooter runs out of the house a few seconds later and notices him. Trembling, Charles repeats his victim's earlier words, "I don't want no trouble...", but the shooter raises a pistol and fires again.

The next day, Joan is making her regular visit to the grave of Gerald Castoro (the man she accidentally killed on the operating table) to leave flowers, when she runs into Gerald's son, Joey. He greets her warmly, and asks her to coffee so they can catch up.

Sherlock approaches Detective Bell outside the shooting victim's house, in response to Bell's text. Bell looks at Holmes' phone, and says the text was received three months ago, from someone named "Bella," but sarcastically remarks that it's an easy mistake, as "I know you're not into details." Only briefly embarrassed, Holmes says that as long as he's there, he might as well be allowed to take a look at the crime scene.

Inside the house, the victim, a mathematics tutor named Felix Soto, is lying on his living room floor, shot twice. Bell says the neighbors mentioned hearing Soto arguing with another man a few weeks ago, so Bell will try to track him down. Bell adds that Benny Charles survived his gunshot wounds, but is in a coma at a nearby hospital.

Looking through the rooms, both men notice something odd: the next room off the living room is empty of furniture and the walls are completely bare - something unusual for a single man living in a small efficiency space. Bell says he had already guessed that pictures had been taken down, but looked at the walls and found no nail holes.

Holmes leans closer to the wall and sniffs something. He tells Bell there must be a blacklight somewhere in the house - the walls are redolent of CAM phosphor, a chemical that is a key ingredient in invisible ink. Sure enough, Holmes lifts the shade off a standing lamp in the living room and finds a black light bulb. Placing the lamp in the center of the room, and asking Bell to draw the curtains, Holmes switches on the light, and reveals the walls, from floor to ceiling, inscribed with mathematical formulas. So, they now know what Mr. Soto was doing in the empty room, and that he was carefully keeping it a secret - the only mystery is, could it have something to do with his murder?

Part Two

Over coffee at a local diner, Joey congratulates Joan on her new career as a private investigator, then wonders whether she'd be interested in investing in a bar he's opening. He promises that he will pay her back, as she knows he's good for it. Joan is hesitant, but promises to think about it.

Returning home to The Brownstone, Watson is taken aback to find a shirtless man examining a blow-up of the mathematical formulas from Felix Soto's house. The man seems unruffled to see her behind him, and casually tells her Sherlock is down in the kitchen.

While preparing eggs, Sherlock says the man's name is Harlan Emple, a mathematics professor at Columbia and another of his many consultants. A few years ago, Emple proposed a mathematical formula for predicting the ebb and flow of crime patterns in New York. Ultimately, his equation didn't work, but Sherlock was quite intrigued by the concept and they've been corresponding regularly ever since then. Sherlock brought him in to make sense of the equations. As for why he is shirtless, Holmes explains that, "every great thinker has a process", and Harlan likes to feel that there is nothing "between" him and the numbers - Joan should count herself lucky that he hasn't yet felt the need to strip completely naked.

Joan mentions her meeting with Joey, and wonders if she could have an advance on her salary to make the loan. Sherlock appears wary, but before they can discuss it further, Harlan calls them to the living room.

Re-buttoning his shirt, Harlan excitedly says the formulas are calculations for P vs. NP! Sherlock and Joan look at him blankly, and he is disbelieving, saying it is one of the most famous math problems in history. He explains, P vs. NP asks whether a mathematical problem whose solution can be quickly verified by a computer can also be quickly solved by a computer. It sounds simple, but in practice it is fiendishly difficult, so much that some leading experts have theorized that it is unsolvable.

Sherlock asks whether the solution to P vs. NP could be a motive for murder, and Harlan wryly says, only if people still consider $1 million a sum worth killing over. That is the amount offered by the Clay Mathematics Institute's Millennium Prizes, to anyone who can solve even one of the world's seven hardest problems, including P vs. NP. Harlan adds that the maths on the wall are not a complete solution to P vs. NP, but it is farther than he has ever seen anyone else go, and Soto may have been only months, or even weeks, away from a solution.

Although they can't make sense of the maths, both Sherlock and Joan can tell from the handwriting that they were written by at least two different people, and the other person must have been a man as well. It looks like their most obvious suspect in Felix Soto's murder was the mathematician he was partnering with, who believed he could complete the problem on his own and not have to share the million dollars. Harlan says that P vs. NP is the sort of problem that demands a lifetime of work, and Soto would not be working with just any mathematician. Sherlock asks for names, and Harlan says he doesn't know, but his closest contact who would is Tanya Barrett, a professor at TriBoro College.

Sherlock and Joan interview Professor Barrett at the college, who says that she heard about Soto's death on the radio. Sherlock asks about Soto's partner, but Barrett says she finds it hard to think of someone: Soto was highly secretive, and kept all his work to himself. While Holmes is browsing through an old journal containing Barrett's articles on P vs. NP, Watson asks how she became interested in the subject. Ruefully, Barrett relates that when she was "very young and full of myself", she took a summer off to try and solve it, and when she looked up from her calculations, three years had gone by and she was no closer. She is now starting to believe those experts who theorize that P vs. NP is unsolvable.

In one of the articles, Holmes sees a photograph of a chalkboard, which has equations in a handwriting identical to the mystery man from Soto's house. Barrett identifies the work as Cyril Nauer's, a reclusive but brilliant savant. Outside her office, Holmes calls Bell to say they have a strong suspect in Felix Soto's murder. Bell says that is good, since they have just found another victim - shot a short distance away from Soto's house, on the same night, and with what looks like the same gun. Bell says the victim's name is Cyril Nauer, and asks for the name of Holmes's suspect. Holmes, baffled, can say nothing.

Part Three

Holmes and Watson examine Nauer's body in the morgue. Apart from the gunshot wounds, Holmes noted one useful piece of forensic evidence: some dog hairs caught in his shoe. Since neither Nauer, Soto, or any of his immediate neighbors owned a dog, the hairs must have come from the shooter. Holmes says, given a little time, he can identify the breed.

While she is washing up, Joan reminds him that they never finished their discussion about the advance on her salary. Instead of responding directly, Sherlock asks about her history with Joey. After an uncomfortable pause, Joan shares the details of what happened that caused her suspension from medicine. Gerald Castoro was her patient, and she got to know him and his family very well in the weeks leading up to his surgery. It was a simple operation, of a kind she had done many times before, yet she somehow nicked the vena cava of his heart, causing a fatal hemorrhage into his abdomen. Gerald's widow was understandably distraught, and sued Joan and the hospital for malpractice. Although she was not convicted, the trial was very hard for Joan, listening to Mrs. Castoro's blistering opinions about her incompetence as a doctor. But after the trial, Joey wrote her a letter to say that he forgave her, and did not believe it was her fault. "At the time, it meant a lot to me," she admits.

Holmes listens without judgment, then asks one simple question: is this the first time Joey has asked her for money? Shifting slightly, Joan admits that she bought Joey a car when he went off to college, to make it easier for him to live at home with his mother and commute to school. She says it was not a hardship for her, but even she can see what Sherlock is getting at - to an outsider, it sounds as if Joey is taking advantage of her.

Examining Cyril Nauer's apartment, Sherlock notices that what looks like a traffic camera is aimed directly at Nauer's window, not at the street. Taking it down, he hands it to Bell and says the NYPD's tech division should be able to trace its signal back to its user.

Holmes and Watson accompany Bell to his interview with Linus Roe, the president of Roe Encryption, which provides cryptography services to many top-flight New York banks and other financial institutions. Confronted with the camera, Roe admits that he was surveilling Cyril Nauer, but only to keep an eye on his progress.

Bell asks if Roe Encryption is hurting for money, and needed a $1 million boost. To their surprise, Roe says the Millennium Prizes don't matter to him - a solution to P vs. NP would be worth much, much more than $1 million. He explains that all modern cryptography systems are based on presenting a computer with mathematical problems so complex that they cannot be solved without a key - but a solution to P vs. NP allows a user to bypass the problems altogether, and "tell" the computer they have been solved. A person who solves P vs. NP could "walk" in or out of any computer system in the world, tamper with nuclear launch codes, steal billions of dollars - and in the process, make Roe Encryption's entire work product "about as useful as a pet rock." Impressed, Holmes summarizes, "it's the skeleton key." Roe corrects him, "it's the key to building the skeleton key", since the mathematician who solved the problem would still need a programmer to write the computer code to input it.

Roe hired Nauer (the most brilliant mathematician he had ever encountered) to solve P vs. NP, on the condition that if he did, he would turn over his work in secret. Nauer said he didn't care about the money, he wanted the recognition from solving it. Roe became paranoid when he learned Nauer was working with another mathematician, Soto, so they broke into their homes and took photos of their calculations. Ruefully, Roe says they might as well not have bothered - they showed the photos to an expert, who said they weren't anywhere near a solution. Holmes says his expert says differently, and asks for the name of Roe's, who replies, Tanya Barrett.

Interviewed at the precinct, Barrett confesses to Bell and Captain Gregson that she agreed to consult for Roe - the university cut two of her classes, and she was hurting for money. Holmes asks why she lied to Roe about the level of progress Soto and Nauer had made, and she replies that, technically, she didn't. She concurs with Harlan that Soto and Nauer took P vs. NP farther than anyone else ever had - yet they were, in her estimation, only a third of the way done. Unlike Harlan, she believed it would be years, if ever, before they arrived at a solution.

Holmes has a different theory: Barrett is working on her own solution to P vs. NP, and killed Soto and Nauer after seeing how close they were to beating her to it. He notes that she used to own a dog of the same breed as the hairs he found, and used to own a gun of the same model that shot the two men. Angry, Barrett says the dog died weeks ago, the gun was stolen from her, and she has an alibi for the night of the murders: she was having dinner with a friend, Wayne Kaneshiro, at a pub. A security video from the pub confirms that she was there at the time of the murders. She is innocent, and Holmes and Watson are no closer to finding the murderer.

Part Four

Watson comes downstairs to see Holmes doing sit-ups in the living room, facing a wall of photos - other mathematicians devoted to solving P vs. NP, and thus potential suspects. When Joan asks why he won't go jogging by the river, and yet do calisthenics at 3:00 am. He explains that cardiovascular exercise stimulates blood flow to the brain, "and the river smells like rotten cod." Standing, he confides that, against his better judgment, he has agreed to Watson's request for an advance, and points to a shoebox on the counter. Looking through it, Watson is confused to see at least $20,000.00, when she only asked for five. Holmes says her best course of action is to give it all to Joey, and thus ensure that it will be years, or never, before he hits her up for money again. Protesting, Watson insists that Joey isn't taking advantage of her and she genuinely wants to help him, but that sounds feeble even to her. Holmes tells her that he is an expert on deadly poisons - yet he has learned that guilt is much more toxic than any substance known to man.

Holmes approaches Professor Barrett at TriBoro College again. At first she brushes him off, but he says he has a different theory. If she can't have been the killer, then the fact that all the available clues pointed to her indicates that she is being framed. Holmes asks if anyone she knows might have a grudge against her. Looking disbelieving, she says the only person she could think of would be her ex-boyfriend, Jason Harrison, who seemed to take their break-up unusually hard.

The police interview Jason Harrison, confronting him with a series of threatening emails, sent to Barrett from his address. Harrison swears he has never seen those messages before, and has no idea what they're talking about. Gregson and Bell seem to believe that Harrison will crack eventually, but Holmes is not so sure. Then they get a call from the hospital: Benny Charles has regained consciousness.

From his hospital bed, Charles says that his assailant was a woman in glasses, not a man. Joan shows him Barrett's photo on her smartphone, and Charles says he is positive it is her.

Part Five

At the precinct, Holmes and Watson are watching the security video from the pub over and over again. Barrett's alibi seems unshakeable, yet all the clues point to her, and Benny Charles swears that she is the person who shot him. Since they are arguing in circles, Joan diverts the conversation back to Joey and Holmes's continuing refusal to endorse her decision to loan him the money. Holmes says she might as well keep the money for herself, and do something useful for it, like buy 5,500 beers. After a moment, Joan asks him how he came up with that figure, and Holmes motions to the security video, showing a heavyset man laying a $10 bill on the bar in exchange for four glasses of beer. Joan remarks that beer in a Manhattan pub usually isn't that cheap, except during happy hour. Sherlock says that is impossible, the video's time stamp shows that it was taken much later in the evening, at the time of the murders... the digital time stamp. And just like that, the case is solved.

Holmes, Watson, Gregson, and Bell confront Barrett in her classroom. Holmes admits that he was wrong: Barrett wasn't trying to solve P vs. NP before Soto and Nauer - she solved it weeks ago, but needed to keep the fact that a solution existed a secret, until her programmer accomplice completed the computer code to implement it. If the solution was revealed too soon - for instance, by Soto and Nauer - then the world's banks might change their cryptography systems before Barrett had a chance to stroll in and steal billions of dollars.

The proof: Wayne Kaneshiro, the friend with whom she was dining, has already confessed to being her accomplice programmer, and that he tampered with the security video to make it seem as if it was taken much later in the evening. At the time in question, Barrett was not actually in the pub at all - she was killing Soto and Nauer. Kaneshiro also used the code to write and send the phony emails from Jason Harrison's address, to strengthen her alibi.

Joan meets with Joey, and tells him that she has decided to help him, but instead of giving him money, is helping him in a more roundabout way, because she is concerned that he is becoming too dependent on her.

When she returns home, she is surprised to see Holmes boxing up the case file, including the photos of Soto and Nauer's equations. He confides that Barrett has been taken into custody by the federal government, who have also confiscated all the maths related to P vs. NP. Deciding that the solution is a threat to national security, the government is keeping it a secret until countermeasures can be developed. Instead of being indicted for murder, Barrett will be held in protective custody while she assists the government with those countermeasures. Watson reflects that Linus Roe was wrong, and the world will go on much as it has before, now that P vs. NP has been solved.

Holmes congratulates her for her elegant solution to the Joey problem. Watson cannot dismiss some lingering doubt whether Holmes was reluctant to loan her the money because he was worried she would not pay him back. Holmes dismisses her doubts, saying that money is about as useful to him as a collection of Hummel figurines. He then surprises Watson by asking if he can accompany her to her next visit to the Castoro grave site. The man, either through his life or through his death, obviously had a profound impact on Watson, and was indirectly responsible for her becoming Holme's's partner. Holmes feels he owes the man his respects. Pleased, Watson says she would be glad for Holmes to come along next time.


Elementary - Episode 2X02 "Solve For X" Extended Promo00:31

Elementary - Episode 2X02 "Solve For X" Extended Promo



Guest stars

  • Jeremy Jordan – Joey Castoro
  • Lynn Collins Tanya Barrett
  • Khalil Kain – Benny Charles
  • Rich Sommer – Harlan Emple
  • Glenn Fitzgerald – Linus Roe
  • Rick Holmes – Jason Harrison
  • Simon Feil – Office Worker
  • Rock Kohli – Cabbie
  • Nick Maccarone – Wayne Kaneshiro

Season Two navigation

Season Two
#01 Step Nine#09 On the Line#17 Ears to You
#02 Solve for 'X'#10 Tremors#18 The Hound of the Cancer Cells
#03 We Are Everyone#11 Internal Audit#19 The Many Mouths of Aaron Colville
#04 Poison Pen#12 The Diabolical Kind#20 No Lack of Void
#05 Ancient History#13 All in the Family‎#21 The Man With the Twisted Lip
#06 An Unnatural Arrangement#14 Dead Clade Walking#22 Paint It Black
#07 The Marchioness‎‎#15 Corpse de Ballet#23 Art in the Blood
#08 Blood is Thicker#16 The One Percent Solution#24 The Grand Experiment


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.