# The theory that cracked the enigma code

### Despite its humble beginnings, Bayes' Theory has many important applications, and provides a useful tool for updating our thinking.

It was the year 1761, and Thomas Bayes the English Presbyterian minister and mathematician had just passed on. At the request of relatives, his friend Richard Price was sorting through his papers when he made a unique discovery.

He came across something titled ‘An Essay towards solving a problem in the Doctrine of Chances’, which Bayes had written many years before. In it, Price noticed a remarkable formula.

Price spent the next two years developing the ideas in the essay before sending it to the Royal Society of London, where it was published in 1763. With the essay published, mathematicians were astonished at what they saw, and Bayes was immortalised.

Bayes’ theorem (see image above) is a mathematical formula for calculating conditional probabilities, based on the idea that when we update our initial belief with new objective information, we get a new and improved belief. This new belief becomes the starting point for the next round of belief updating. To see some real life examples of how the Bayes’ formula works, click here.

### The Enigma code

In 1774, the brilliant French mathematician Pierre-Simon Laplace expanded upon Bayes’ theorem, before the theorem all but disappeared from sight until the 20th Century, when British codebreaker Alan Turing used it during the Second World War to help crack the ‘unbreakable’ Enigma code, a development that helped the Allies win the war.

Turing developed a system based on Bayesian theory that enabled him to guess a stretch of letters in an Enigma message, calculate the probabilities, and add more clues as they arrived. With this method he could reduce the number of wheel settings to be tested, which subsequently led him to cracking the code.

With the advent of the computer age, the use of Bayesian theory has exploded, into such areas as artificial intelligence, robotics, law, imaging technologies and medical diagnostics. In 1996, Bill Gates said that Microsoft’s competitive advantage was its use of Bayesian networks. Bayes techniques are also used in spam filters, voice recognition systems, recommendation systems and in Google search.

Despite Bayes’ theorem being a clever mathematical formula, the good news is that you don’t need to be a mathematician to be able to apply Bayesian thinking to investing or your everyday life.

The main challenge is that updating our beliefs with new objective information can be quite difficult. The economist John Kenneth Galbraith said: ‘Faced with the choice between changing one’s mind and proving there is no need to do so, most people get busy on the proof’.

### Commitment and Consistency

Psychologist Robert Cialdini believes that one of the reasons it isn’t easy to change our thinking is the ‘Commitment and Consistency Tendency’, which he describes in his book Influence. Cialdini explains that when people make a commitment, there is a natural tendency to want to appear consistent to that commitment, especially in front of other people.

Consistency is highly valued and, in most cases, it’s in our best interests to be consistent. As a result, we fall into the habit of being consistent all the time, even when it would be better to modify our approach.

However, being able to change tack when we receive new objective information is a valuable skill for investors. It may help us scramble out of an investment mistake, or it may help us get into a quality stock that we had previously misread. The important thing is to have our facts straight and to process them appropriately.

The economist John Maynard Keynes summed up Bayesian thinking perfectly when he said, 'When the facts change, I change my opinion. What do you do, sir?'

## Want access to our latest research and new buy ideas?

Start a free 15 day trial and gain access to our research, recommendations and market-beating model portfolios.