Infinite Monkeys, Keyboards and Time - What are the Odds?



When I was young, I read a book called Can you feel anything when I do this? by Robert Scheckley which contained a number of thought-provoking short stories. One of the stories in the book introduced me to the concept of what has come to be known as the infinite Monkey Theorem. For those uninitiated (which is probably no one), the Infinite Monkey Theorem (IMT) is a thought experiment that posits that if you had an infinite number of monkeys randomly punching numbers on an infinite number of keyboards for an infinite period of time, they would ultimately randomly reproduce all of the works in the Library of Congress (or the works of Shakespeare or the works of Steinbeck, etc). The short story in the Scheckley book played on the IMT by having a rich man set up the experiment with only a few monkeys (my recollection was that it was about 100), to see if they would type anything intelligible. In the story, all of the monkeys surprisingly began to type the great novels without a single error.

Of course, we all know that this would never happen. In fact, it has been tried, and the monkeys unsurprisingly typed only gibberish. But if the IMT is true, at some point the monkeys would need to do exactly what the monkeys in the Scheckley short story were doing -- type a book from beginning to end without error. But everyone would intuitively recognize that if the monkeys did immediately start typing books without error that the game would be somehow rigged. Why? Because the odds are so long that random chance could produce anything remotely intelligible that it would be practically impossible for the monkeys to produce a full novel of intelligible text. Exactly how long are the odds that monkeys would, by random punching of keys on the keyboard, produce letter for letter a novel that was brought into existence by an intelligence? It actually will take much longer than most people suspect.

First, let's assume that a monkey is seated at a typewriter and will be striking keys at random. What are the odds that the monkey will randomly type a novel? In order to know, we need to know how many characters-keys are on a typical keyboard. The keyboard I use is a standard Acer keyboard. Using that as an example, I count 46 character-keys (including all of the letters, numbers, and a few random keys like [ ] \ , . ; ' and /). In addition, I have a space-bar (a null character key) that stretches across 6 keys on the next lowest register. So, counting the space-bar as 6 keys, the chance of the monkey striking any single key will be 1 in 52. Not bad. But in order to type a novel letter for letter, the reader needs to recognize that there are more than 46 characters on the keyboard. Every character-key except the space-bar has an additional character that can be accessed by pressing the shift key. So, unless the monkey is reproducing a t.s. eliot book, the monkey can strike any one of 92 characters on the keyboard. Thus, the chance of striking a character (discounting the space-bar for a moment) is actually 1 in 92. That's pretty doable.

Now the space-bar is actually a null character, but it counts as 12 characters because it can be struck and count as a space regardless of whether the shift-key is hit. So, all in all, there are 104 characters that the monkey can hit. The chance of hitting any particular character is 1 in 104. The chance of hitting a null-character (a space) is 12 in 104 or about 1 in 9. Thus, it is more likely that a space will appear than a character.

So, let's consider what it would take for this monkey to type a book letter-for-letter by randomly pushing keys on the keyboard. First, let's take a book that a monkey might type. I have chosen A Tale of Two Cities by Charles Dickens as the text to examine because of it's familiar opening and because I really like the book. The opening paragraph is familiar:

It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way--in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.
Let’s take a look at the odds of the monkey typing the first paragraph. In fact, let’s break it down to much easier parts to see how difficult it would be for the individual parts to appear by sheer chance. Let’s start by having the monkey randomly type the word “It.” What are the odds? Well the odds are 1/104 (the odds of typing a Capital I) multiplied by 1/104 (the odds of typing a lower-case t). 1/104 times 1/104 (or 1/1042) is 1/10,816. So, if we leave a monkey to punch random keys on the keyboard, the odds that it would randomly type the word “It” is only 1 chance in 10,816. Not bad compared to where we are going.

Next, let’s have the monkey type the first three words of the first clause, i.e., “It was the”. Here, we have 8 characters and two spaces. The odds of typing any particular character remains 1/104 but we have to type 8 characters so the odds of hitting those exact 8 characters is (1/104)8. The odds of typing a space is 1/9, and we have two spaces, so the odds of typing the two spaces is (1/9)2 . Most people don’t realize that the odds of the monkey picking out these characters at random would be more than one in one-sextillion (1018)! In other words, the monkey would type out “It was the” randomly only one time in 1,108,540,930,828,270,000 attempts.

The first two clauses of the paragraph, “It was the best of times, it was the worst of times,” calculates out to an ungraspable 1 in 1.57 x 1093 (=(1/104)41*(1/9)11). I have no idea what you would call that number (thirty-fiveillion?), but the number is huge – uncomprehendingly large. I have not done the math for the entire first paragraph, but the odds increase to a point as to be silly to think that it could ever even stand a remote chance of happening.

So, let's assume that a monkey is able to make a single effort to type the first paragraph once a minute, every hour of every day for 300 million years. What are the odds that the monkey would be able to type any portion of the first paragraph of A Tale of Two Cities? Well, it would make 1440 attempts each and every day, so it should be able to type the word "It" at least once within 8 days of continuous typing. But how long would it be before the monkey can type "It was the"? At 1440 attempts per day (525,600 attempts in a typical 365 day year), on average the monkey will be able to type the first three words one time within 2,109,096,139,323 years. That is a lot longer than the 300 million years we have given to the monkey to complete the paragraph. Needless to say, the chances of typing the first two clauses, "It was the best of times, it was the worst of times," with appropriate capitalization remains astronomically small.

Does it help to increase the number of monkeys? What if we have ten billion monkeys making 1440 attempts every single day. Sure, that will reduce the time, but it doesn't help in the big picture. Ten billion monkeys typing continuously on a keyboard hitting random keys will likely produce "It was the" once within 211 years. But what about the longer phrase, "It was the best of times, it was the worst of times,"? Even ten billion monkeys foregoing food, sleep and bathroom to hammer randomly and continuously on a keyboard will type out those two short phrases only once in 2.98*1077 years. Yikes! That is billions upon billions of times longer than the universe has existed and certainly longer than our 300 million years.

Thus, do I believe that the IMT will result in monkeys typing all of the books in the Library of Congress or at least the works of Shakespeare? Well, yes, provided that they have an infinite amount of time in which to do it. But it will take an infinite amount of time and an infinite number of monkeys because in the real world where monkeys, typewriters and time are all finite, it is not realistically possible that a finite number of monkeys typing on a finite number of keyboards for a finite amount of time (even if it is very long) will ever produce even the first two clauses of a book, let alone an entire book. And unless Dilbert's poem is incredibly short, it is going to take a lot more monkeys and a lot more time to come close to reproducing it -- after all, random chances don't care if the poem is good or not.

So, what does this have to do with Christianity? I plan to tackle that next time.

Comments

Popular posts from this blog

Martin Luther King, Jr., Jesus, Jonah and U2’s Pride in the Name of Love

How Many Children in Bethlehem Did Herod Kill?

Where did Jesus say "It is better to give than receive?"

How Should I Be A Sceptic -- belief and reason

Kierkegaard's Knights of Faith and the Account of Abraham

Bayes Theorem And Probability of God: No Dice!

If Christianity were true, would you become a Christian?

The Origin of Life and the Fallacy of Composition