A mugger is running through an alleyway after stealing a man’s wallet, when suddenly he hears gunshots. A figure approaches him and the muggers pleads, “I don’t want any trouble.” The figure then shoots the mugger.
The next morning, Joan is visiting a former patient’s grave, when she runs into the former patient’s son, Joey (Jeremy Jordan). Joey is touched that Joan came to visit and offers to buy her a cup of coffee.
Sherlock, meanwhile, goes to the crime scene where a mathematician (during the initial gunshots last night) was shot and killed. Detective Bell gives Sherlock the details of the case. The mugger happened upon the first murder by accident and was shot in the driveway. Although he managed to survive, the mugger is in surgery and things aren’t looking too good for him.
Sherlock rules out a robbery, since no valuables were left behind. Bell tells Sherlock that a neighbor heard the mathematician arguing with another man a few nights ago, but never got a good look at the man.
Sherlock identifies a smell coming from the walls in the empty room and, apparently, only ultraviolet light can be used to see whatever is on the walls. He finds a lamp that has an ultraviolet lightbulb, and after Bell closes the curtains, Sherlock turns on the lamp.
The wall is covered with various mathematical symbols and equations. The question, Sherlock says, is whether or not it has anything to do with the mathematician’s death.
After Joan fills Joey in on her new job as a consulting detective, Joey reveals that he left school in the middle of his junior year of college. Joan is saddened to hear about this, especially because – prior to Joey’s dad’s death – Joey was really excited about becoming an engineer. Unfortunately, Joey can’t return to school since he lost his scholarship.
So Joey tells Joan about the bar he and his friend are buying and shows her pictures of the place on his phone. He asks Joan for a loan, although he presents it as an investment “opportunity”. Joan asks how much money he needs.
When Joan returns to the apartment, there’s a shirtless man (Rich Sommer, best known for playing Harry Crane on Mad Men) looking at a screen projection of the math wall from the deceased mathematician’s house.
In the kitchen, Sherlock explains that the shirtless man’s name is Harlan Emple and he’s a professor of applied mathematics at Columbia University. Sherlock lists Harlan’s various accomplishment, but Joan just wants to know why he’s shirtless. Sherlock tells her that it’s part of Harlan’s process.
Sherlock met Harlan after he learned that Harlan was devising a mathematical model to predict crime patterns in and around New York City (hello, Person of Interest!). Even though it didn’t work, Sherlock found the concept fascinating so the two had been corresponding ever since.
Joan then asks Sherlock for a $5000 advance on her salary. She briefly mentions the situation with Joey, when suddenly Harlan calls for Sherlock from the other room saying that he’s figured it out.
Before Harlan can explain further, Sherlock mentions that it was two mathematicians at work on the wall – the dead mathematician and another man. Joan explains the handwriting is what gives it away.
Harlan says that these two mathematicians were geniuses. They were working on the P versus NP problem, the most unsolvable equation in math. The equation is worth $1 million, which gives the murderer motive. Harlan says that these two math guys were just weeks, maybe months, away from figuring it out. Once they did, a non-profit organization based in Rhode Island called the Clay Mathematics Institute would award them $1 million as part of their Millennium Prize.
Sherlock figures that the other mathematician figured he could solve the equation by himself and take the prize money without having to share it. That’s why he murdered the now-deceased mathematician, Mr. Soto.
Harlan tells Sherlock that there’s an entire P versus NP community. He then gives him the name of a woman – Tanya Barrett (Lynn Collins) – who can help give him access to that community.
A Third Victim Emerges
Tanya reveals that she knew Mr. Soto. She gives them a few books and they find an illustration in one of them that contains the same handwriting as the one from Mr. Soto’s math wall. The handwriting in the illustration belongs to a man named Cyril Nower.
When Sherlock calls Bell to tell him about Cyril and how he’s a strong suspect, Bell reveals that there’s been a third murder – the same gun used to kill Mr. Soto has been used in this murder. And the third victim is none other than Cyril Nower!
In the morgue, Joan and Sherlock discuss who the murder could be. Joan muses that it could have been a competitor who killed Mr. Soto and Cyril before they could finish solving the equation.
Since dog hair was found on Cyril’s clothes, Sherlock and Joan figure the murderer might own a dog.
Joan brings up their conversation from yesterday – about her advance. Sherlock wants to know exactly who asked her for $5000 and what his connection is with the man who died under Joan’s care. Sherlock knows Joan went to visit the former patient’s grave because of the smell of carnation flowers on her sleeves.
Sherlock reassures Joan that he’s not trying to be nosy – he just wants to make sure this person asking Joan for a loan is not taking advantage of her.
Sherlock’s admission gets Joan to finally reveal what happened with the former patient. During surgery to remove a tumor from his heart, Joan accidentally nicked his venae cavae. The patient died.
The wife subsequently sued Joan. Joan went to court and listened to the wife say horrible things about her. Meanwhile, Joey – who was 17 at the time – wrote Joan a letter saying it wasn’t her fault and that he forgave her. The letter meant a lot to Joan at the time.
Sherlock asks if this is the first time Joey has asked Joan for money. Joan reveals that she previously bought him a car.
Bell calls Sherlock from Cyril’s apartment. When Sherlock and Joan get there, Bell shows them a bug he found from inside the apartment. Someone was spying on Cyril!
Sherlock notices the cameras across the street. One of them is pointed directly at Cyril’s apartment. The ever-eccentric Sherlock climbs on top of a taxi – promising to pay the cab driver $20 for staying still – to examine the cameras. Sherlock finds a signal jumper. Someone was hijaking the video feed.
Thankfully, they can use the device to trace back to a receiver and figure out who was spying on Cyril.
The trio – Sherlock, Joan, and Det. Bell – go to Roe Encryption Technologies and speak with Linus Roe (Glenn Fitzgerald). Bell tells him that his company has been spying on Cyril, but Linus claims he’s not familiar with the name.
When Sherlock reveals that Cyril is dead, Linus takes the trio back to his office. Linus admits that they were spying on Cyril because of his work on the P versus NP problem, but he says that no one at his company would kill him.
For a P versus NP solve, Linus says that his company would pay $10 to $100 million more than what they would get from the Millennium Prize. A solution to the equation would render all modern encryption technology obsolete, Linus explains. With the right software, you could hack into almost anything.
Therefore, a solution to P versus NP would result in dire consequences for Linus’ company.
But Linus claims he wanted Cyril to solve the equation, as long as Cyril helped Linus design cryptography to defeat it. That would make Linus’ company the only company in the world capable of defending against P versus NP.
Cyril refused Linus’ offer, however. When Linus found out Cyril had a partner, Mr. Soto, they infiltrated his home as well and took pictures of the equation. They took the pictures to an expert, but the expert told Linus that Cyril and Mr. Soto were nowhere close to figuring out the P versus NP problem.
Sherlock interrupts, saying that’s not what he was told. Joan asks about the expert. It turns out to be Tanya Barrett!
At the police station, Tanya apologizes for not revealing her work with Linus, but she says that she didn’t think it had anything to do with Mr. Soto’s death. She admits she lied to Linus about Cyril and Mr. Soto being nowhere close to figuring out the P versus NP problem.
Sherlock correctly states that Tanya is a dog owner – Boston Terrier, to be exact. Captain Gregson (Aidan Quinn) tells her that they found dog hair on Cyril’s body and DNA results showed that they belonged to a Boston Terrier.
She also registered a 9mm handgun in 2009, the same weapon that was used to kill Mr. Soto and Cyril. Tanya claims the gun was stolen from her apartment a month ago and that she filed a police report. Joan interrupts, saying that the gun was never stolen – Tanya just needed an excuse in case she got caught.
As for her alibi, Tanya claims she was having dinner with a friend at a restaurant.
The team gets security camera footage from the restaurant and they see Tanya entering the restaurant about 20 minutes before Mr. Soto was shot. Tanya was telling the truth about her alibi! She’s not the killer!
Back to Square One
Joan finds Sherlock doing sit-ups and push-ups in the middle of the night, facing a wall, in order to stimulate blood flow to the frontal lobe so he can solve this case.
Even though they were wrong about Tanya, Sherlock thinks they were right about the motive. He’s studying the profiles of the other contenders for the Millennium prize.
Sherlock informs Joan that against his better judgment, he has decided to give her the advancement she asked for. Joan wants to know why it’s against his “better judgment”. Sherlock thinks it’s suspicious that both Joey and Joan went to visit the grave the day after the anniversary of Joey’s dad’s death. Joan says it’s complicated. Sherlock also points out that Joey knows that Joan blames herself for the death – but it was an accident.
“As loathe as I am to admit it, accidents happen,” Sherlock says.
According to Sherlock, the fact that Joey has been using Joan’s guilt against her in exchange for money speaks to his poor character. But Joan doesn’t want to hear it.
Sherlock then leaves her with a box containing her advancement. Joan finds $20,000 in it, instead of the $5000 she asked for. When she confronts Sherlock about this, he says it’s all the money he has at his disposable and it will allow Joan to buy Joey out of her life for good. Joan will get the peace of mind she needs, knowing Joey will never approach her about money again.
Joan insists that she doesn’t mind. But Sherlock does mind! He doesn’t like seeing Joan consumed with guilt and being taken advantage of. They’ve both paid for their mistakes and it’s now time for the past to remain in the past.
Joan is speechless, and obviously emotional. She changes the subject back to the case and wonders if Tanya was working with a partner who committed the crimes for her. Sherlock says that it would be too risky for Tanya to do that. However, it is possible that someone is trying to frame Tanya.
Sherlock approaches Tanya who is on her way to teach a class. He tells that he thinks she’s being framed and asks if she has any enemies. After some hesitation, Tanya tells Sherlock about her ex, who did not take their break-up very well.
Bell, Joan, and Sherlock question Tanya’s ex, Jason, at the police station. Tanya showed them some very threatening emails sent to her by Jason. Jason claims he’s innocent and that, contrary to what Tanya said, he’s never met Cyril or Mr. Soto before in his life. However, the police found that Jason ordered ammunition for a 9mm gun earlier that day, further incriminating him.
Bell, Joan, and Sherlock leave the interrogation room and tell Gregson that Jason has asked for a lawyer. Gregson says that the mugger who got shot is awake and they better go question him immediately, in case he takes a turn for the worse again.
At the hospital, the mugger identifies his shooter as a tall, brown-haired woman wearing glasses – it’s Tanya!
Back at the police station, Sherlock says – despite Tanya’s alibi – the mugger identified her as his shooter and the dog hairs found on Cyril’s body didn’t come from any Boston Terrier, but her Boston Terrier. Not to mention the fact that the 9mm handgun used in the killings belonged to her.
Suddenly, Joan has an epiphany. She figures out that the timestamp on the security footage is incorrect – it’s been digitized on.
The Killer Is Arrested
Sherlock and Joan confront Tanya Barrett one last time, as the police get ready to take her away. Joan tells Tanya that she was at the restaurant between 5:30PM and 7:30PM, not 8:30PM to 10:30PM like she claimed.
Although Tanya tries to deny it, Sherlock and Joan tell her that she hacked into the restaurant’s security footage to rig the timestamps. And the reason Tanya killed Mr. Soto and Cyril isn’t because she wanted to solve the P versus NP problem herself. In fact, she had already solved it! She was planning on using the equation to steal hundreds of millions of dollars from various financial institutions.
She had teamed up with a computer programmer, but the problem was that this programmer needed time to write the appropriate code for each financial institution they were planning to rob. They didn’t have much time, however, especially when Tanya found out that Mr. Soto and Cyril were close to solving the P versus NP problem. So she killed them.
And this computer programmer happened to be the friend she was having dinner with at the restaurant. Bell reveals that the programmer has already confessed everything to the police.
They got her!
Joan meets with Joey at a diner. She tells him that she’s willing to invest… in his education. She’ll give him $20,000 so he can go back to school and finish his engineering degree. Joey looks disappointed. School just isn’t for him right now, he says. Joan makes it clear, however, that school is the only thing she’s comfortable with giving him money for.
Joey gets upset and brings up the fact that his dad is gone because of Joan. Joan, while visibly emotional, stands her ground. She’ll only give him money to further his education.
When Joan returns to the loft, Sherlock tells Joan that the NSA has ordered the NYPD to surrender anything and everything to do with the P versus NP problem, including Tanya Barrett.
He asks about her meeting with Joey. Apparently, Joey said he would think about her offer, but Joan’s not holding her breath. She also tells Sherlock that, had she given the money to Joey, she would have paid him back. Of course, Sherlock doesn’t care about money.
Before they head their separate ways, Sherlock tells Joan that he would very much like to go to the cemetery with Joan next time. He wants to pay his respects to the man who changed the course of Joan’s life and left such a huge impression on her. Joan looks touched. “I’d like that,” she replies.
Elementary airs Thursdays at 10PM on CBS.