Could a lot of monkeys write Shakespeare?

In this extract from his book Fibonacci's Rabbits, presenter and writer Adam Hart-Davis explains the 'Infinite Monkey Theorem': whether infinite monkeys on infinite typewriters could eventually type out the works of Shakespeare.

‘Probability,’ said the Irish mathematician George Boole in 1854, ‘is expectation founded upon partial knowledge. A perfect acquaintance with all the circumstances affecting the occurrence of an event would change expectation into certainty.’


So, if we don’t know for sure that probable events will occur, can we be sure that improbable events won’t? And when does improbable become impossible? This is the question that intrigued French mathematician Emile Borel about a century ago.

The impossible and improbable are embedded in our language. ‘Lightning never strikes twice in the same place.’ ‘Oh that could never happen!’ But maybe it could...


A brief history of chance

Back in the times of ancient Greece and Rome, many thinkers pondered whether the world could have been formed from atoms coming together entirely by chance. The Greek philosopher Aristotle thought it could – unlikely but possible.

Roman scholar Cicero thought it so unlikely that you could be certain it didn’t. We now know they were both right. Yes, countless atoms did come together but it was not entirely by chance – they were pulled by gravity.

Read more about maths:

But mathematicians like certainty, even when it comes to uncertainty, so over the centuries many have tried to pin down the impossible. There was, for instance, the eighteenth- century French philosopher Jean d’Alembert, who was told by his mother that he would never be a philosopher.

D’Alembert explored whether you could measure long sequences in which occurrence and non-occurrence are equally likely. Was it possible that a tossed coin could land heads two million times in a row, for instance?

© Jason Anscomb/Rawshock design

A hundred years later another Frenchman, Antoine- Augustin Cournot (1801–1877) asked if you could ever balance a cone on its tip. Of course, we’ve seen circus acrobats and conceptual artists perform seemingly impossible balancing acts.

Cournot wanted to distinguish between a physical certainty – an event that can certainly happen physically, like the balancing cone – and a practical certainty, one that is so unlikely that is impossible in practice. He put it like this in what we now call Cournot's principle: ‘It is a practical certainty that an event with a very small probability will not happen.’

The law of single chance

Emile Borel wrote a series of papers about this in the 1920s. Borel was a politician and in 1925 became Minister of the Marine in the government of fellow mathematician Paul Painlevé. Who knows how much his political career influenced his interest in the impossible?

As he explored the notion of the impossible, he came up with what he called the Law of Single Chance, now known as Borel’s idea, which is essentially the same as Cournot’s principle. Borel argued that some events, while not mathematically impossible, are so unlikely that to all intents and purposes are impossible. Of course, there is a chance that the sun might rise in the west one day, but it is so unlikely as to be impossible.

Read more about the history of maths:

To help pin this down, Borel created a scale on which the probability of things occurring is so small they can be considered impossible in practice. That does not mean they are mathematically impossible, but so unlikely that a mathematician can treat them as impossible. On a human scale, a probability of less than one in a million could be said to be impossible.

Monkey bards

To show how his ideas worked, Borel presented a picture of monkeys hitting typewriter keys randomly. Could they by sheer chance eventually type the entire works of Shakespeare? Of course, it is highly improbable that they will, but mathematically, over an infinite time (or with an infinite number of monkeys), it must certainly happen.

So it is not mathematically impossible but so unlikely that to all intents and purposes it is impossible. As a result, Borel’s law is popularly known as the Infinite Monkey Theorem.

© Jason Anscomb/Rawshock design

Monkeys typing the works of Shakespeare is so captivating that it has popped up in popular culture ever since, sometimes humorously, sometimes with serious intent. Then in 2003, scientists got a grant to actually try it with monkeys. Six Celebes crested macaques in Devon’s Paignton Zoo were let loose on a computer keyboard.

The monkeys rightly took a dim view of the writer’s life and mostly bashed the keyboard with a stone or peed on it. All the same, they ended up typing five pages, mostly of the letter ‘s’: obviously a sign of disapproval.

In 2011, computer programmer Jesse Andersen decided to play it safe – he created a million virtual monkeys on a computer program. This army of computer monkeys then ran through 180 billion character groups a day at random. Amazingly, in just 45 days, they did indeed come up with the goods. It was, however, a bit of a cheat, because the program was made to spot and capture groups of nine correct characters in the right sequence to build up the complete works.

Mathematicians can say that such an event as the Monkey Shakespeare is impossible in practice. But impossible in practice doesn’t mean never...


Fibonacci's Rabbits and 49 Other Discoveries that Revolutionised Mathematics by Adam Hart-Davis is out now (£12.99, Modern Books).

Go to full site