The Infinite Monkeys Theorem.

Not all mathematical theorems are brainy and incomprehensible, there are many simple phenomena that also have their explanation. The Infinite Monkeys Theorem is a well-known statement, which ensures that

A monkey banging on a typewriter for an infinite amount of time could write any given text, such as the complete works of Shakespeare.

This theorem is used to illustrate how difficult it is to try to grasp the concept of infinite. The theorem is true, in a long enough time the monkey would end up writing the complete works of Shakespeare, and those of Cervantes too if necessary, but the probability that this happens in a time interval as large as the age of the Universe is practically nil. ‘Infinite time’ is not ‘a long time’, it is simply… infinite.

The Infinite Monkeys Theorem

Another variant of the theorem states that infinitely many monkeys could write any given text in any (not necessarily infinite) interval of time. The analogy is the same. ‘Infinite monkeys’ does not mean a million monkeys, nor billions, it simply means… infinite.

The ‘monkeys’ are actually a metaphor from any device capable of randomly generating text. The theorem can be generalized, in the sense that any random experiment it will be able to produce a certain result as long as the experience is carried out as many times as necessary.

The Infinite Monkeys Theorem

For example, it is possible (although the probability is practically nil), that when flipping a coin we get heads a thousand times in a row. You just have to flip the coin a sufficient number of times. In fact, if we tossed the coin infinite times, we would get sequences of a million heads in a row, a billion, or as many as we want.


Suppose each key pressed is a random event, statistically independent from the previous one (in the case of a monkey pounding on a keyboard, it would not be strictly true, obviously it is more likely that with each hit several keys will be pressed in a certain neighborhood, but this is unnecessarily looping the loop for the purpose of the theorem).

The Infinite Monkeys Theorem

If two events are independent, the probability that both occur at the same time is the product of both probabilities (for example, if two coin tosses are independent, the probability that both will come up heads is 0.5 * 0.5 = 0.25). If we suppose that we use a keyboard with the Spanish alphabet, without accents, numbers and ignoring punctuation marks, we have 27 letters, with which we can assume that the probability that each one of them is pressed is 1/27.

The probability of writing a certain word of n letters, under the assumption of independence, will be (1/27)*(1/27)*…*(1/27) = one/27. For example, applying this formula, the probability of randomly typing the word ‘cat’ when pressing the keyboard four times would be one in half a million.

The Infinite Monkeys Theorem

Following the reasoning, the probability of missing a given n-letter word in a sequence of n keystrokes is eleven/27. For the next block of n letters, exactly the same, and so on. If we assume that each block is independent, the probability of not writing a given n-letter word in k consecutive blocks is (eleven/27)k.

If the block size n is bounded (as big as we want, but finite), being k the number of times we repeat the experiment, we can see that the limit as k approaches infinity is zero. That is, the probability that we will not write any sequence of letters (for example, the complete works of Shakespeare) tends to zero if we carry out infinite experiments. Or seen another way, the probability that we do write any given text tends to 100%.

However, the concept of ‘infinite experiments’, as we have already stressed, does not mean ‘lots of experiments’. Let’s try to put numbers. Suppose we have as many monkeys as there are particles in the Universe (about 1080) and that each of them is capable of pressing 1000 keys per second, for a time 100 times greater than the age of the Universe. Well, even so, the probability that they could reproduce any existing book is practically nil.

The Infinite Monkeys Theorem

When ‘infinite monkeys’ means many, many more monkeys than all the existing particles in the Universe, and ‘infinite time’ means much longer than a hundred times the age of the Universe, the concept of ‘infinity’ ceases to have practical meaning, to be a mere theoretical tool. Although we intuitively associate ‘infinity’ with ‘very large’, we see in this case that this does not always work.

The experiments carried out with computer simulators have fully demonstrated this fact, and even ‘typing’ at thousands of times faster than a real monkey would, only very rarely do you get more than two meaningful words in a row. In another experiment, a keyboard was left in a cage with monkeys, and after they mostly hit it with rocks and urinated on it it became clear that these are not good examples of random generators.

In Genscience | Apes have mathematical abilities

The Infinite Monkeys Theorem