There is a famous analogy that is used in discussion of highly improbable events – that of monkeys sitting at a typewriter, banging away at the keys. It is said in this parable that, given enough time, the monkey will type out Hamlet, or a Shakespeaean sonnet, or the complete works of Shakespeare, or some other work of literature, because with unlimited time, any random sequence will eventually show patterns like that. The purpose of the monkey-typewriter parable is meant to be that a highly unlikely event cannot be dismissed just because it is unlikely, because unlikely things happen given enough time. This kind of thinking is relevant with something like evolutionary theory, say, where the development of life is attributed to random genetic mutations (while those who survive are not per se chosen at random, the set of genes from which the survivors are chosen is essentially random).
Technically, this is true. But there is a problem. We don’t have infinite time available to us. The Big Bang happened a finite amount of time ago. It is almost an unimaginable amount of time for us limited people with lifetimes no more than about 100 years, but it is finite nonetheless. So, have we had enough time? Well surely about 14 billion years (the approximate age of the universe according to the mathematical calculations of the general relativity theory of Einstein) is enough, right? That is such a massive number, surely that must be enough time to account for all kinds of highly unlikely events.
This turns out to be quite mistaken. The probability calculations involved here involve what is called exponential decay, and exponential decay and the related concept of exponential growth are notorious for defying almost everyone’s mathematical intuitions – including mathematicians and scientists. Therefore, we ought to be very careful when we try to reason about any domain in which exponential growth or decay come into play. This article is meant to do exactly that. I will do some mathematical calculations to show how you’d actually compute something like the probability of a monkey typing out Hamlet.
And I suspect that the results will be surprising to most people… so I will be careful to justify the mathematics and I will try to be as generous as possible with giving the randomness every opportunity to succeed.
What Is the Probability?
This part isn’t necessary to understand the end of the post – if you don’t want to follow the mathematics, just skip this part. The formula I derive will be used with actual numbers later.
Instead of using numbers straight away, we will begin with a broader question. And we will make some simplifying assumptions to help us out – and we will simplify in the direction of making things easier for our aspiring primate poets.
It is rather difficult to analyze whether a particular letter pressed by the monkey is a ‘good’ or ‘bad’ letter, because for that we need the previous letters. And we don’t know how often the monkey will press the spacebar. To simplify things, I will then be speaking mostly about the probability that, between any two spacebars, the monkey has typed a coherent word. We will use as a shorthand for this probability, so
= Probability of a coherent word.
For instance, if (which is the fraction 1/10), this means that one out of every ten strings of letters typed by the monkey will be an actual English word.
To be generous to our hard-working monkeys, we won’t force them to adhere to grammatical rules. That would make things more complicated. You could introduce, if you like, a probability that between any two periods is a coherent sentence. This probability would be quite low. But to be generous, we will ignore this.
The next thing we need to know is how long the literature we are trying to write is. How many words long is the book/poem that is our aim? As a stand-in for the word length, let’s use the letter . That is,
= Number of Words We Need.
Again, let’s be very generous to our monkeys and not require that they actually type the correct words – let’s just allow them to type the same number of words. So we don’t ask them for Hamlet, just the same number of words that appear in Hamlet. We would also like to know how quickly the monkeys type, and how much time we have before we have to send our monkey’s work to the publishers. Let’s use , and to mean the following:
= total time it takes for our monkey to type something of the correct length.
= total amount of time they monkeys are given to finish their job.
Finally, let’s not leave our monkey all alone – monkeys needs friends. Let’s let lots of monkeys all have their own typewriters, typing away together, each racing to be the first one to have their own book. We can use for this:
= Number of Monkeys Trying
This will be all the information we need for a formula. What we want is the probability that some monkey eventually produces something coherent within the allotted amount of time. First things first – how many potential books will each monkey produce? The answer to this is the total time divided by the time it takes to produce on such book – this is . If we have different monkey all doing this, the total of number of documents that will be produced by all the monkeys cumulatively is . Secondly, we need to know how likely it is that each possible book will actually “make sense” – how many books will have only words with no nonsense? This is a similar question to asking how likely it is to flip heads a bunch of times in a row – we multiply the probability to itself the correct number of times. This gives us a probability of that one of works produced is actually made up of words, and a probability of of failure. To calculate the probability that every attempt will fail, you take the probability of failure and raise it to the power of the number of attempts. The final formula we obtain for the overall probability that we will not be publishing the first ever book written by a monkey is
This is the probability of failure for each attempt to the power of the number of attempts.
So, now we ask – what can we do with this? What kinds of values do we get out of this formula?
What Values Should We Use?
In the spirit of optimism, let’s make an effort to be as generous to our monkeys as we can. Let’s try to make all of our numbers as large as we can to help our monkey out.
First, how big can we make ? Well, we could estimate the number of monkeys that exist on earth today, or that have every existed. But that is too boring – instead, let’s go insane. Quantum physics has as part of it something called the Planck volume, which you can think of more or less as the smallest amount of space that is meaningful to talk about in a laboratory. Anything smaller is literally impossible to measure. This number is around cubic meters. We can hardly be any more generous than to allow our monkeys and their typewriters to only take up one Planck volume worth of space. In cosmology, scientists can also approximate the total volume of the universe, so we can actually calculate how many of these micro-monkeys we can stuff into our universe. The estimated volume of the universe is cubic meters. Working out the numbers, our impossibly generous value of will be
Let’s also be as generous as possible with our time constraints. We can allow our monkeys to begin typing at the moment of the Big Bang itself – which was about 14 billion years ago. Converting to seconds, we arrive at our insane value of :
Like the Planck volume, in quantum physics there is also a Planck time – the smallest amount of time that can be meaningful in a laboratory. To be as generous as we can, let’s allow to be the Planck time, so
We can now compute the total constant from the equation earlier. From all of these numbers, we arrive at
Therefore, our probability of working out a “book” of words in our insane scenario (let’s call this for book) is
The only things we have ye to choose are and . The value of used as an example is absurdly high, as I think is be clear upon intuitive reflection. To put some numbers to this, though, let me list out a few (approximate) probabilities for shorter words
- The probability of two random letters making a word is around , or 18%.
- The probability of three random letters making a word is around , or 7%.
- The probability of four random letters making a word is around , or 1%.
- The probability of five random letters making a word is around , or 1%.
- The probability of six random letters making a word is around , or 0.7%.
To give you an idea of the meaning of all of this, I counted in the first sentence of this article 120 letters and 26 words, which averages out to 4.6 letters per word. This puts us in the 1% area. I think it would be appropriate then to allow our value of to be around 1%. In reality it would be lower – after all the probability of pressing a space bar if everything is truly random would be 1/27, which would mean our monkey would on average type 27 letters in a row between spaces. There are, well, basically no words 27 letters long, so we would probably have to sift through hundreds upon hundreds of pages to find even one coherent word. So, I think a value of at 1% is reasonable enough.
Now, the only value we have left to choose is . We can use various values of to see what happens. Let’s first use the classic example of Hamlet – which is 29551 words long. Then the value of is
How big is this? Well, when I initially typed it into Wolfram Alpha, a very advanced online calculator, it told me the answer is 1. In other words, the probability of failure is so close to 100% that Wolfram Alpha just assumed it really was 100%. To get an idea of the actual size, then, we have to use some methods of approximation. Using something called a first-order Taylor expansion, we know that if is small positive value and is any positive number, then the approximation is pretty good, and in fact that if $N$ isn’t absurdly large the amount of error is virtually undectable. Therefore, our probability is about , which means the probability of a success is about
This is a number that is something like 0.000000….000006, where the total number of zeros is about 60 thousand. It is beyond comprehension. For a slightly more concrete idea, I can convert this probability to a coin-flip scenario. These odds are about the same as flipping heads around 195518 times in a row. And keep in mind, we have been as generous as what we know about physics even allow us to be. Actually, changing the values of won’t really do very much. It’s really the values of that are the heavyweights here. But even changing these won’t quite work. If we instead use a 200 word poem, then we obtain instead the approximate probability
This is still really bad – this is like flipping 514 heads in a row. This stuff just doesn’t happen.
Moral of the Story
So what is the moral of the story here? You can’t just appeal to “billions of years” to account for extremely unlikely things happening. For example, as valuable as the theory of evolution is, it requires something more than totally random genetic mutations to work. Things are just too complicated here. The genetic code of even the simplest living organism – like a single-cell bacteria, is vastly less probable to find from random chance alone than is often suggested. It is a situation like typing Hamlet by banging on a keyboard – there just isn’t enough time for an appeal to chance to work. It isn’t even close to being close to enough time.
Even if the probabilities with evolution were made reasonable, that doesn’t address how the first ever living cell appeared on earth. Evolution as we know it to day by its very definition cannot explain that, since evolution only claims to explain how one type of life gives rise to another type of life. The very first cell (or very first form of life) did not come from another living thing, so evolution doesn’t apply. Randomness alone doesn’t work – the probabilities are all too low to take that seriously. Some sort of orientation is needed, but there can’t be anything like natural selection going on, because we are not in the realm of biology anymore but in mere chemistry.
So, as thinking people I think we can dismiss arguments that appeal to probabilities playing out over billions of years. Any argument of that sort is like a plane without wings – it needs a new piece to get off the ground. So if you encounter an argument of this sort, ask for more evidence.