Sherlock Holmes: A Game of Shadows is Guy Ritchie’s second film adaptation of Arthur Conan Doyle’s famous detective stories. Set in the midst of the industrial revolution, Holmes works to foil the schemes of his nemesis Professor Moriarty. In between quickfire action sequences and snappy dialogue, there is a wealth of maths and physics hidden in the background.
In the books, Professor Moriarty is described as a criminal genius, who is ‘the organiser of half that is evil and of nearly all that is undetected in this great city’ (i.e. London). He was also a mathematical prodigy who published A Treatise on the Binomial Theorem at the tender age of 21. This landed him a university chair in mathematics, where he increased his renown by authoring The Dynamics of an Asteroid, ‘a book which ascends to such rarefied heights of pure mathematics that it is said that there was no man in the scientific press capable of criticising it’.
Sherlock confronts Moriarty in his office. Image credit: Warner Bros.In order to convey Moriarty’s mathematical brilliance in A Game of Shadows, Warner Bros. sought the help of mathematicians from the Oxford Centre for Collaborative Applied Mathematics (OCCAM). As described in SIAM News, mathematicians Alain Goriely and Derek Moulton were tasked with designing equations for Moriarty’s office blackboard, as well as devising the code that he used to secretly keep track of his business empire.
The blackboard in Moriarty’s office. Image credit: Warner Bros.As you can see, Goriely and Moulton managed to cram a lot of equations into this one blackboard. They did a great job of including material relevant to Moriarty’s interests, and consistent with the period in which the film was set.
Let’s try to decipher what’s going on here. There’s a lot of stuff to cover, so we’ll try to break it up and tackle each topic individually. Here is the same blackboard with all of the different topics labelled.
Moriarty’s blackboard broken up into topics. Image credit: Goriely and Morton, 2012.Cracking the code: the Fibonacci numbers
Moriarty uses a code in his personal notebook, and in secret messages to his associates. At the end of the film, we find out that Holmes has figured out this code by putting together the clues left on Moriarty’s blackboard.
The secret is hidden at the bottom of the blackboard, where you can see a triangle made of numbers. This is known as Pascal’s Triangle, a mathematical tool with several interesting properties. It is constructed by following the rules:
- Start with 1’s along the top two sides of the triangle
- Fill in the rest of the triangle with each number equal to the sum of the two numbers above it.
See, for instance, this animation:
Pascal’s triangle. Image credit: Wikimedia Commons.One cool feature of Pascal’s triangle is that if you add up the numbers on each of the diagonals, the answers will give you the Fibonacci numbers. These numbers form a sequence, where the next term is always the sum of the previous two terms (1, 1, 2, 3, 5, 8, 13, … ).
Here it is shown on Moriarty’s blackboard, with the arrows pointing out the diagonals.
Pascal’s triangle as seen on Moriarty’s blackboard. Image credit: Warner Bros.According to Goriely and Moulton, Moriarty uses the Fibonacci numbers to encode his secret messages (actually, they say that Moriarty’s code is based on a generalised version of the Fibonacci numbers, called the Fibonacci p-numbers, but this detail is not included in the final cut of the film).
So how was Pascal’s triangle used to encode messages?
Well, one way this could be done is to make each letter in the code correspond to a different Fibonacci number. But Moriarty, being the cunning genius he is, added an extra layer of complexity.
Instead, he made each letter correspond to three numbers: a character number, line number, and page number in a particular book. The book in this case is The Art of Domestic Horticulture. Incredibly, Holmes is able to figure this out after noticing that Moriarty’s plants were being neglected despite owning this book.
The Art of Domestic Horticulture. Image credit: Warner Bros.Once the message has been encoded using the book, the sequence is converted to combinations of Fibonacci numbers. This new code is given by the positions of the lowest Fibonacci numbers that add together to make numbers in the book sequence.
For example, if a particular letter in the message corresponds to page 5, line 10, and character 15 in the book, then the corresponding Fibonacci numbers would be:
05 – 0306 – 0307
05 means fifth in the Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, 21, … ), which gives the page number 5; 0306 means third and sixth in the sequence, which are 2 and 8, adding up to give the line number 10; and 0307 means third and seventh in the sequence, which are 2 and 13, adding up to give the character number 15.
In the film, we see this code in action when Colonel Moran hands Moriarty an encrypted note.
The message Colonel Moran gave to Moriarty. Image credit: Warner Bros.Written out more clearly, the code reads:
060401 – 0903 – 080604 – 04
1011 – 05 – 060501
0805 – 0805
Using the Fibonacci numbers, we can convert this into the book sequence:
Page 12, line 36, characters 32 & 3
Page 144, line 5, characters 14, 26 & 26
So it seems like it is a one word message, made up of 5 letters. All that needs to be done is find the corresponding letters in The Art of Domestic Horticulture.
Disappointingly, it seems like this is just a fictional book. The only time we see its contents in the film is when Mary Watson is deciphering the code herself.
One of the pages of The Art of Domestic Horticulture. Image credit: Warner Bros.Weirdly, the book seems to be discussing something about the history of the calendar. Not sure how that relates to domestic horticulture …
In any case, this is where the trail seems to end, unless I have missed something. The message to Moriarty seems like it could be genuine. I wonder what it could be?
I’ll talk about the rest of Moriarty’s blackboard in my next blog post (don’t worry, there will be more physics in that one – stay tuned).
Share this:- Film