Last night the BBC’s *Sherlock Holmes* returned for a New Year’s special. It was great. If you missed it (and have access) you should catch it on BBC iPlayer before it goes away forever (click here). The episode inspired me to think of how game theory can be used to solve some of Sherlock’s many problems. That’s what I’m going to investigate in this post.

Just a quick disclaimer before we begin. There are many people out there much smarter than me that could use game theoretic tools to capture how Mr. Holmes uses his logic and deductive reasoning to solve all of his little puzzles. I’m a bit slow, so I’m going to assess a pretty simple puzzle faced by Mr. Holmes a long time ago in 1891.

Indeed, the return of Sherlock reminded me of an old, but pretty famous, Sherlock Holmes story written by Sir Arthur Conan Doyle called “*The Final Problem”*. (You can access a PDF of The Final Problem here.) In this story strategic interdependence between Holmes and his arch nemesis Moriarty is particularly prevalent. Therefore, the tools of game theory can be used and, moreover, we can ask a big question: *“Did Sherlock Holmes act rationally?”*

### The Final Problem

This story, set in 1891, introduces Holmes’s greatest opponent, the criminal mastermind Professor James Moriarty. Here’s a recap of The Final Problem to set the scene for our game.

One evening Holmes arrives at Dr. John Watson’s residence in an agitated state and with grazed and bleeding knuckles. Much to Watson’s surprise, he had apparently escaped three separate murder attempts that day after a visit from Professor Moriarty, who warned Holmes to withdraw from his pursuit of justice against him to avoid any regrettable outcome.

Holmes has been tracking Moriarty and his agents for months and is on the brink of snaring them all and delivering them to Scotland Yard. Moriarty is the criminal genius behind a highly organised and secret criminal force and Holmes will consider it the crowning achievement of his career if only he can defeat Moriarty. Moriarty is out to thwart Holmes’s plans and is well capable of doing so, for he is, as Holmes admits, the great detective’s only intellectual equal.

In response to Moriarty’s threats, Holmes asks Watson to come to the continent with him, giving him unusual instructions designed to hide his tracks to Victoria station. On meeting at Victoria Station Holmes plans that the two head to Dover in order to flee to the continent. The next day Watson follows Holmes’s instructions to the letter and finds himself waiting in the reserved first class coach for his friend, but only an elderly Italian priest is there. The cleric soon makes it apparent that he is in fact, Holmes in disguise.

As the train pulls out of Victoria, Holmes spots Moriarty on the platform, apparently trying to get someone to stop the train. Holmes is forced to take action as Moriarty has obviously tracked Watson, despite extraordinary precautions. He and Watson strategically alight at Canterbury (before reaching Dover), making a change to their planned route. As they are waiting for another train to Newhaven a special one-coach train roars through Canterbury, as Holmes suspected it would. It contains Moriarty, who has hired the train in an effort to overtake Holmes and catch him before he and Watson were to reach Dover. Holmes and Watson are forced to hide behind luggage, but they manage to make their escape to the continent!

Having made their way to Strasbourg via Brussels, Holmes gets word that Moriarty is searching for them. After a chase through Europe, finally settling in Switzerland, Moriarty catches up with Holmes and fights with him atop a waterfall at Reichenbach Falls. They both appear to fall to their deaths. Indeed, this was depicted in last nights episode!

### Applying some game theory

The story of Holmes and Watson fleeing England describes a situation of strategic interdependence to which we can apply some game theory. The three elements that we need in any game are players, strategies, and payoffs, so let’s figure these out…

**Players.**For simplicity we consider only two players in this game:*Sherlock Holmes*and*Professor Moriarty*.**Strategies.**Holmes is faced with the decision of either going straight to*Dover*or disembarking at*Canterbury*, which is the only intermediate station. Moriarty, whose intelligence allows him to recognise these possibilities, has the same set of options. Therefore the strategy sets for both players contain only*Dover*and*Canterbury*.**Payoffs.**Holmes believes that if they should find themselves on the same platform, it is likely that he’ll be killed by Moriarty. If Holmes reaches Dover unharmed, he can then make good his escape. Even if Moriarty guesses correctly, Holmes prefers Dover, as then, if Moriarty does fail, Holmes can better escape to the continent.

In this game there is *imperfect information: *Sherlock does not know what Moriarty is going to do for sure before he moves, and vice versa. Both players must therefore select their strategies *simultaneously*.

The *strategic-form* of the game is given by the *payoff matrix* below:

So what type of game is this? How do we solve it?

**Pure conflict and maximin strategies**

The game between Holmes and Moriarty is a **constant-sum game** where the sum of the payoffs in each cell of the matrix give a fixed number (in this case 100). A two-player constant-sum game is a game in which the two players’ payoffs always sum to a constant. Since this property implies that a change in behaviour which raises one player’s payoff must lower the other player’s payoff, constant-sum games are situations of **pure conflict**. In other words, **what is good for one player is bad for the other**.

If you have read many Sherlock Holmes stories, you know that he is both brilliant and arrogant. While it would be uncharacteristic of him to take a conservative tack in handling a strategic situation, he is smart enough to know that Moriarty may well be his match. So, rather than think about Holmes formulating a conjecture about what Moriarty would do and then choosing a best reply, let us presume that he takes a more cautious route in selecting a strategy.

Suppose, then, that Holmes believes that whatever strategy he selects, Moriarty will have foreseen it and will act so as to minimise Holmes’ expected payoff. Holmes then wants to choose the mixed strategy that maximises his own expected payoff given his belief about Moriarty. In other words, he exercises caution by optimising against his pessimistic beliefs.

What we’ve just described Holmes as choosing is what is known as his **maximin strategy**. Generally speaking, **a maximin strategy maximises a player’s payoff, given that the other players are expected to respond by choosing strategies to minimise that player’s payoff.**

**Solving games of pure conflict**

To solve this game we first let *p* be the probability that Holmes chooses to go to *Dover*, and then we let *q* be the probability that Moriarty chooses to go to *Dover*.

**Holmes’s maximin strategy.** To derive Holmes’s maximin strategy we need to derive his expected payoff function when Moriarty chooses to go to Dover. This expected payoff function is given by: **p * 20 + (1-p) * 70 = 70 – 50p** .

If Moriarty chooses Canterbury, Holmes’s expected payoff function is: **p * 90 + (1-p) * 10 = 10 + 80p** .

We can map these expected payoff functions in the diagram below:

Thus, *p = 6/13* is the mixed strategy that maximises Holmes’s expected payoff, given that whatever mixed strategy Holmes chooses, Moriarty responds so as to minimise Holmes’s expected payoff.

**Moriarty’s maximin strategy.** To derive Moriarty’s maximin strategy we need to derive his expected payoff function when Holmes chooses to go to *Dover*. This expected payoff function is given by: **q * 80 + (1-q) * 10 = 10 + 70q** .

If Holmes chooses *Canterbury*, Moriarty’s expected payoff function is: **q * 80 + (1-q) * 90 = 90 – 60q** .

We can map these expected payoff functions in the diagram below:

Thus, *q = 8/13* is the mixed strategy that maximises Moriarty’s expected payoff, given that whatever mixed strategy Moriarty chooses, Holmes responds so as to minimise Moriarty’s expected payoff. This strategy pair is the maximin solution to the game.

**The Final Solution**

The Mixed Strategy Nash equilibrium of this game, therefore, is where Holmes will go to *Dover* with probability *6/13 *(and therefore goes to Canterbury with probability *7/13*),* * while Moriarty will go to Dover with probability *8/13 *(and therefore goes to Canterbury with probability *5/13*). Thus, there is a higher probability for Sherlock to alight at Canterbury in an effort get rid of Moriarty.

Yo, this is exactly what happened in the story! Gosh darn, game theory has done it again! Moreover, Sherlock seems to have acted rationally! With a good grip on game theory you can be as clever as Sherlock Holmes too!

### Conclusions & John von Neumann

I think that the real hero here isn’t Sherlock Holmes… Nor is it Dr. John Watson… The real hero can only be attributed to the genius that is John von Neumann.

John von Neumann is one of the greatest mathematicians that has ever lived, and should be considered as one of the founding fathers of game theory. Specifically, he has to be credited with providing the solution concept for games of pure conflict.

He was first to really discuss the maximin property which states that for any two-player game of pure conflict, the maximin solution is a Nash equilibrium.

Furthermore, if a two-player game of pure conflict has a Nash equilibrium in which both players randomise (i.e., they don’t use pure strategies), then each player’s Nash equilibrium strategy is also his maximin strategy.