# The Infinite Monkey Theorem

The Infinite Monkey Theorem is a popular illustration of probability. In fact, this theory is mainly known to the general public via popular culture rather than its transmission via the classroom.

The theorem is purely a proposition than an unlimited number of monkeys can “almost surely” produce a specific text such as Macbeth or even the entire works of Shakespeare, provided that they are given sufficient typewriters and time. The theorem might look pretty absurd from the hindsight, but undoubtedly there’s some logic behind it. We’ll come to that in this article but before that we would like to point something out first. The probability of a complete universe full of monkeys typing an entire complete work of Shakespeare such as Macbeth/Hamlet is so tiny that the chance of it happening is extremely low (time taken to perform the feat should be longer than the age of the universe). But do remember that we said “extremely low” which technically, isn’t a zero.

Another thing to remember in this context is that “almost surely” is a term having a specific meaning from the point of view of mathematics. If you want to look into the meaning of the term, you can refer to the hyperlinked Wikipedia article provided above. The monkey is also not an actual monkey. The term “monkey” is used as a metaphor. It is actually an abstract device that makes a random sequence of letters as well as symbols.

## Reasoning

The reasoning is short, simple but there’s no doubt that it’s sound. It says that if the monkeys are given infinite time, they would be able to produce the required output with random input.

On a bigger note, the theorem implies to the fact that any problem can be solved if there’s the input of sufficient time and resources. The same idea is universally applied in many fields such as software development, testing, project management, computing, etc. Like we said above, the theorem is also used to explain the basics of probability.

## Proof

There is a direct and straightforward proof of this theorem. Remember that if two events are independent, the probability of occurrence of both the events is equal to the product of the probabilities of each event happening independently. A simple example:

Chance of rain in place A on a specific day= 0.5.

Chance of rain in place B on a specific day= 0.4

Chances of rain happening on the same day in BOTH places= 0.5 x 0.4= 0.20.

Hope you get the point. Now let’s get back to the theorem.

Imagine that a typewriter has 50 keys. The word that you have to type is “SLEEPY.” According to this theorem, we’ll have to press the typewriter keys randomly and at the same time, generate the required word. We have ample time and resources on our hand. So the only limitation is patience, but that’s not the point. Our point is to prove that it CAN be done. If the typewriter keys are pressed independently and randomly, each key has an equal chance of being pressed.

So, the chance of the first letter “S” getting typed= 1/50.

Chance of the 2nd letter “L” getting typed= 1/50.

The same is true for other letters in a word SLEEPY. Therefore, the chance of getting the word right is-

(1/50) × (1/50) × (1/50) × (1/50) × (1/50) × (1/50) = (1/50)6 = 1/15 625 000 000.

Very very very small but it is NOT zero. Therefore it is very possible.

The same principle is applied in the Infinite Monkey Theorem. Although the number of words is much much much much more than this (you are trying to get the complete works of Shakespeare through this method…aren’t you?), the point is it CAN be done. It might take forever, but it can be done.

The Infinite Monkey Theorem is interesting indeed, especially when you become aware of the fact that the theorem is valid and this, it stands. The concept is also pretty fun. With that, we’ll bring this article to a close. Hope you had a good read.

### Sudipto Das

Sudipto writes technical and educational content periodically for wizert.com and backs it up with extensive research and relevant examples. He's an avid reader and a tech enthusiast at the same time with a little bit of “Arsenal Football Club” thrown in as well. He's got a B.Tech in Electronics and Instrumentation.