Monkeys to Infinity: A Fun Way to Teach Probability


If you put a monkey in front of a typewriter and let him type for a very long time, would he eventually produce the works of Shakespeare?

This question, or a version similar to it, has been floating around the world of mathematical probability for a very long time and is thought to have originated with Émile Borel, an early 20th century mathematician. Because of its striking visuality and inherent humor, the image has become a part of popular culture—one both creationists and evolutionists like to use to prove their point.

“Of course not!” says one camp.

“Why not?” says the other.

The answer, statisticians tell us, is that a monkey in front of a typewriter—IF he is a completely random typist and IF he has an infinite number of years to type—will almost surely type every literary work known to man. The key is in the infinite, which provides a framework where, theoretically, every possibility will happen.

Of course, neither creationists nor evolutionists believe the universe is infinite. No scientist estimates it to be older than 14 billion years. So—assuming 14 billion years as our limit—what are the chances of a monkey randomly generating a single line of Shakespeare?

Answering this question provides a fun way to teach your students probability.

First, let’s make the question a little more interesting. We’ll create a theoretical universe of 14 billion galaxies. Within each galaxy are 14 billion planets and on each planet are 14 billion monkeys. Each monkey has a typewriter and each is typing at the rate of one letter per second for the duration of 14 billion years. To make the job of the typing monkeys a bit easier, let’s give them simplified keyboards with only 32 keys. That includes the 26 letters of the alphabet, a few basic punctuation marks, and a space bar.

What are the chances, under these conditions, that one of the monkeys will randomly type this famous line from Hamlet’s soliloquy?

to be or not to be – that is the question

Counting the spaces and the dash, we see a total of 41 characters that must be typed in exactly the right order to create this line. We can calculate the number of possible ways these characters could be arranged by taking the total number of possibilities—the 32 keys of the typewriter—and multiplying that number to the power of the number of characters in Hamlet’s line: 41.

3241 = 5.142202e+61. (That’s 5142202 + 55 zeros)

Next, we calculate the probability of Shakespeare’s line randomly occurring in 14 billion years by dividing the number of possible arrangements by the number of characters typed.

  1. Total number of possible arrangements for a 41-character line:
  • 3241 = 5.142202e+61 possible arrangements.
  1. Total number of monkeys (14 billion galaxies, times 14 billion planets, times 14 billion monkeys):
  • 14e9 x 14e9 x 14e9 = 2.744e+30 monkeys.
  1. Total number of seconds (14 billion years, times 365 days, times 24 hours, times 60 minutes, times 60 seconds):
  • 14e9 x 365 x 24 x 60 x 60 = 4.41504e+17 seconds
  1. Total number of characters typed (number of monkeys times number of seconds):
  • 744e+30 x 4.41504e+17 = 1.211487e+48 characters typed
  1. Probability of one of the monkeys randomly typing “to be or not to be – that is the question” (number of possible arrangements dived by the total number of characters typed):
  • 142202e+61 / 1.211487e+48 = 4.244537e+13

In other words, the chances are one in 42 trillion that in 14 billion years a monkey will randomly type the correct line.

You might also want to tell your students this:

Proteins perform nearly every necessary function of our bodies—from transmitting signals to generating movement to transporting nutrients—and every protein is made from a long, precise sequence of amino acids. Twenty different amino acids form the thousands of proteins our bodies need. Some of these proteins are thousands of amino acids in length, and if even one amino acid is out of sequence, the protein cannot function properly.

202000 =?

Twenty amino acids, thousands of “characters”—what are the odds of getting it right?

The complexity and artistry of our Creator’s design is truly mind-boggling. Over a biology textbook, I worship.


P.S. Credit for the monkeys to infinity math problem, along with the amazing things I learned about proteins, goes to my biology professor, Dr. Finny Kuruvilla.

Pass it on:

Related Items

Lucas Hilty

5 years ago

Thanks, James, for catching that. I’ve updated the post.

James A Goering II

5 years ago

There appears to be a mistake in this post. When the number 5.142202e+61 is converted to standard notation it should be 5142202 + 55 zeros because the decimal point is moved to the end of the number when converting it to standard notation.

Leave a Reply


Leave Feedback