Do “Monkey-Typewriter” Arguments Work?

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 p as a shorthand for this probability, so

p = Probability of a coherent word.

For instance, if p = 0.1 (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 L. That is,

L = 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 e, t and T to mean the following:

t = total time it takes for our monkey to type something of the correct length.

T = 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 M for this:

M = 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 T / t. If we have M different monkey all doing this, the total of number of documents that will be produced by all the monkeys cumulatively is MT / t. 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 p^L that one of works produced is actually made up of words, and a probability of 1 - p^L 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 be able to publish the first ever book written by a monkey is

(1-p^L)^{MT/t}.

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 M? 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 4.22 * 10^{-105} 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 3.58 * 10^{80} cubic meters. Working out the numbers, our impossibly generous value of M will be

M = \dfrac{\text{Volume of Universe}}{\text{Planck Volume}} = \dfrac{3.58 * 10^{80}}{4.22 * 10^{-105}} \approx 8.5 * 10^{184} monkeys.

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 T:

T = 4.4 * 10^{17} seconds.

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 t to be the Planck time, so

t = 5.39 * 10^{-44} seconds.

We can now compute the total constant MT/t from the equation earlier. From all of these numbers, we arrive at

\dfrac{MT}{t} = \dfrac{(8.5 * 10^{184})(4.4 * 10^{17})}{5.39 * 10^{-44}} \approx 6.94 * 10^{245}.

Therefore, our probability of working out a “book” of L words in our insane scenario (let’s call this B for book) is

B = (1 - p^L)^{6.94 * 10^{245}}.

The only things we have ye to choose are p and L. The value of p = 0.1 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 124/676 \approx 0.18, or 18%.
  • The probability of three random letters making a word is around 1292/17576 \approx 0.07, or 7%.
  • The probability of four random letters making a word is around 5454/456976 \approx 0.01, or 1%.
  • The probability of five random letters making a word is around 158390/11881376 \approx 0.01, or 1%.
  • The probability of six random letters making a word is around 22157/308915776 \approx 0.007, 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 p 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 p at 1% is reasonable enough.

Now, the only value we have left to choose is L. We can use various values of L to see what happens. Let’s first use the classic example of Hamlet – which is 29551 words long. Then the value of B is

B = (1 - (0.01)^{29551})^{(6.94 * 10^{245}) = .

How small is this? Well, when I initially typed it into Wolfram Alpha, a very advanced online calculator, it told me the answer is 1. It didn’t tell me approximately 1, it didn’t let me calculate the real number. It just said 1. To get an idea of the actual size, we have to use some methods of approximation. Using something called a first-order Taylor expansion, we know that if p^L is small positive value and N is any positive number, then the approximation (1 - p^L)^N \approx 1 - N*p^L is very good, and in fact that if $N$ isn’t absurdly large the amount of error is virtually undectable. Therefore, our probability is about 1 - (6.94 * 10^{245})*(0.01)^{29551}, which means the probability of a success is about

(6.94 * 10^{245})*(0.01)^{29551} \approx 6.94 * 10^{-58857}.

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 M, T, t won’t really do very much. It’s really the values of p, L 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

(6.94 * 10^{245})*0.01^{200} \approx 6.94 * 10^{-155}.

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.

10 thoughts on “Do “Monkey-Typewriter” Arguments Work?

      1. Sure! I was a math major in college. I took a History of Science course at the University of Maryland-College Park, that course solidified my faith more than any other books. That textbook is a valuable resource for me.

        Like

      2. Can you give me a title or something for that textbook? I’d love to read it. I have in the works a research-heavy history of mathematics post – it won’t be an article per se but should still have some interesting content once I have time to finish it to my satisfaction.

        Like

      3. Physics, The Human Adventure by Holton and Brush. I feel you trying to get a post to your satisfaction, I want to explore Godell/Einstein in an upcoming post but I do not want to get too technical with the language

        Like

      4. That would be a brilliant thing to write about! Both Einstein and Godel had very subtle views on theism that are quite fascinating… I want to eventually make a post about Godel’s ontological argument (which he does via modern mathematical notation). Essentially, I took a “Top 100 Mathematicians” list and am trying to do research to convince myself to a reasonable extent of the religious beliefs of every individual on the list… which turns out to be a very difficult task as one proceeds down the list.

        Like

  1. Do you accept the scientific consensus on the starting time for life? What about evolution as the primary source of its diversity? If not then what are your thoughts? I just noticed theres a box to click to be notified of new comments so I clicked that

    Like

    1. Thanks for the update about comment notifications – I don’t spend a lot of time on my blog “as a reader” so I hadn’t found that feature yet. As for that, I’m not aware of any consensus on the start of life except for an approximate timeframe – I don’t recall exactly when off the top of my head but I’m not aware of any reason to reject that.

      As for the diversity, I am fully convinced of microevolutionary phenomena but I am far from convinced of any totally naturalistic macroevolutionary account of biodiversity. I also have not gone as far in depth on that as I have on many other things though (only so much time in the day, sadly) but I’ll probably do something much more extended someday on evolution.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: