Chance and Probability


By David R. Tribble

Revision 1.4, 2007-02-10.


An Infinite Number of Monkeys

The Infinite Number of Monkeys conjecture states that given an infinite number of monkeys and an infinite amount of time, where each monkey has a typewriter and is continually banging away at it at random, they will eventually type out the entire collected works of Shakespeare. Actually, this is a misquoting of the original conjecture, which requires only a finite number of monkeys. So given, say, six monkeys and six typewriters, all you need to do is wait long enough and eventually they will produce the entire Shakespearean corpus.

This little mental exercise was contrived simply to demonstrate the nature of chance and probability. Given a continuing random process, such as the monkeys typing away, there is a certain probability that a particular pattern, such as the words of Shakespeare's works, will appear at some point in the process. This is based on the fact that any particular pattern is as likely to occur as any other, and the fact that eventually all possible sequences will be produced, all strung together one after another (but in no particular order). We could choose to wait instead for only the words of Shakespeare's Sonnets, or perhaps the words to the Declaration of Independence, or even for the words in this paragraph to appear. The point is that any particular pattern would occur eventually, given enough time. And that's the key to the whole conjecture - enough time.

Let's say we're waiting for a particular pattern of 1,000,000 words, and that the average word size is five letters. This gives a pattern of 6,000,000 letters and spaces. Let's also say that we've got six monkeys doing the typing, banging away at a rate of one keystroke per second. We'll simplify our little experiment by ignoring punctuation and assume that the typewriters can only produce 26 lowercase letters ("a" through "z") and a space.

In the first second, all six monkeys hit one key apiece, producing a random sequence of six characters. Since there are 27 possible keystrokes (26 letters and one space) and each keystroke is equally likely, there are a total of 27×27×27×27×27×27 (which is 276 or 387,420,489) possible combinations of 6-keystroke sequences. A given sequence may turn out to be a real word, such as "behold", but it's far more probable that it is simply a jumble of letters and spaces that do not spell any recognizable English word.

Continuing this way, with six letters produced every second, after a year we will get a sequence of 6×60×60×24×365 keystrokes, or 189,216,000 characters. While that's 31.5 times the length of the sequence we're looking for, the chances are very small that our particular 6,000,000-letter sequence is in there. This is because there are so many possible 6,000,000-letter sequences.

The amount of time we'll have to wait is an incredibly huge amount of time, so vast that it can't be reckoned with normal standards of timekeeping. So let's devise a more comprehensible system of time reckoning, that is, let's build a clock that can show time by the eons rather than the minutes or years. We'll start with a block of granite as part of the clock. (I borrowed this idea from the science fiction story "Been a Long, Long Time" by R. A. Lafferty.) Every 1,000 years a bird will come by and sharpen its beak by taking a few swipes on the stone and then fly away for another 1,000 years. The bird's beak makes a small scratch in the stone each time. It's not much, but eventually the block will be worn away over time. We can tell how much time has elapsed by seeing how much of the block has been worn away. Since we're dealing with such a large amount of elapsed time, we'll make the block pretty big to start with, say a sphere that's 80 billion light years in diameter (which is roughly the size of the visible Universe). That's a total volume of 268.1×1030 cubic light years or 227.0×1075 cubic centimeters (cc). Assuming that it takes the bird a thousand swipes to wear away one cc of stone, that gives us a clock "tick" of one cc per million years. The block will be completely worn away after 227.0×1081 years.

But 1081 years, as long as it seems, doesn't even come close to the length of time we're going to measure. So let us improve the clock. We'll use several granite blocks arranged in a row, so that each block is a digit in our cosmic digital clock. We start the clock ticking by letting the bird come to sharpen its beak on the first block. The bird takes a swipe on the first digit block, which we call the "ones" digit, and then flies away for a millennium. Eventually, the "ones" digit block will get worn away. Once this happens, we replace it with a fresh new block and then "carry" into the next digit block. We do this by letting the bird take a swipe on the next digit block, which we can call the "tens" digit. This continues until the "tens" block is worn away, at which point we "carry" into the next block, called the "hundreds" block. Each time one of the blocks is worn away, it counts as a digit flipping over, just like the digits in the odometer in a car. We can consider the wearing away of the "ones" digit as a "mega-tick" in our cosmic clock, where each "mega-tick" is 227.0×1081 years long. We let the clock tick away like this, over and over, on and on, for a very long time, all the while watching the monkeys bang away at their typewriters.

I said earlier that there are many possible 6,000,000-letter sequences that can be produced. There are, in fact, 276,000,000 possible combinations of 6,000,000 letters, or about 3.8×108,588,182 combinations. We would have to generate half this number of keystrokes before we could be reasonably certain of seeing our particular sequence occur even once. That would take about 5×108,588,161 trillion years. (For comparison, the Universe is only about 12 billion years old, or 12×109 years.) Using our cosmic clock, that means that we would need about 103,025 digits (blocks) to measure this many years.

Just image our clock ticking away, the bird swiping its beak every 1,000 years (a single tick), slowly wearing away the block of granite. As the block wears away (a mega-tick of 227.0×1081 years), we replace it with a fresh new block of granite and let the bird take a swipe on the next block in the odometer. Eventually, the next block wears away too (a mega-mega-tick of 51.5×10165 years), and we move on to the next block. This goes on and on, monotonously, for a seemingly interminable length of time, until at least 5×108,588,173 years have past. At this point, the 103,025th block has been almost completely worn away. We've exhausted half of the possible number of 6,000,000-keystroke sequences, so we've got an even chance of seeing Shakespeare's complete works somewhere within that hugely vast stream of typewritten output.


References

  1. Been a Long, Long Time
    a short story by R. A. Lafferty, from the book Galactic Empires, vol. 1,
    St. Martins Press, Oct 1977, ISBN 0312315279.

  2. Infinite monkey theorem
    Wikipedia entry.

  3. Observable universe
    Wikipedia entry.


Copyright ©1998,2007 by David R. Tribble, all rights reserved.

[Home]