Skip to main content

Can an infinite number of monkeys with typewriters produce Shakespeare?

Sometimes people come up with awful analogies in an effort to describe a concept which is too difficult for a regular person to understand. One such bizarre analogy deals with monkeys, typewriters and Shakespeare. This analogy states:

An infinite number of monkeys hitting at an infinite number of typewriters for an infinite amount of time will eventually produce all works of Shakespeare.

monkey_130_roll This ridiculous Infinite Monkeys Theorem (yeah, it's given the status of a theorem since it has been repeated so many times by so many people for so many years) is actually releated to the theories of probability. What it's trying to say that if an evenly distributed random number generator generates random numbers for an infinite amount of time, the probability of generating a particular finite sequence of number becomes unusually high.

Wikipedia offers a nice explanation of this theory.

Suppose the typewriter has 50 keys, and the word to be typed is "banana". Typing at random, the chance that the first letter typed is b is 1/50, and the chance that the second letter typed is a is also 1/50, and so on, because events are independent. So the chance of the first six letters matching banana is

(1/50) × (1/50) × (1/50) × (1/50) × (1/50) × (1/50) = (1/50)6.

For the same reason, the chance that the next 6 letters match banana is also (1/50)6, and so on.

From the above, the chance of not typing banana in a given block of 6 letters is 1 − (1/50)6. Because each block is typed independently, the chance of not typing banana in any of the first n blocks of 6 letters is

monkey

As n grows, Xn gets smaller. For an n of a million, Xn is roughly 0.9999 (i.e. the chance of not typing banana is roughly 99.99%), but for an n of 10 billion Xn is roughly 0.53 (i.e. the chance of not typing banana is roughly 53%) and for an n of 100 billion it is roughly 0.0017 (i.e. the chance of not typing banana is roughly 0.17%). As n approaches infinity, the probability Xn approaches zero.

So if we bring an infinite number of typewriters for this purpose, the probability of the typewriters producing the word banana becomes close to 100%.

By the same argument, an infinite number of monkeys typing at an infinite number of typewriters will most surely produce even complex works like Hamlet or Othello.

Those who have been following my blog, and particularly those who had the patience to follow this article till now, must be wondering why I suddenly began to talk about monkeys and Shakespeare. Well, it started when I stumbled across this program called Infinite Monkeys.

The Infinite Monkeys program tries to create the 'infinite monkeys with typewriters' scenario by simulating a large number of monkeys typing random characters on the keyboard and outputting the data to files. The program creates one monkey per thread and has the capacity of creating any number of threads, and hence monkeys, depending on the capacity of the computer. I ran 5 monkeys, which is the default and which I guess my machine can handle, and in about 5 seconds they produced 50 Mb of text files. Now all I need is some volunteers to help me find Hamlet in these files! :)

infinite-monkeys

Doing some more research into this monkey business, I discovered a website called One Million Monkeys Typing. OMMT tries to "harness the literary power of one million "monkeys" typing" to churn out adventures and stories. You begin by reading a snippet of a story and then add your own segment thus advancing the story. The site hopes that when a large number of people (or monkeys) contribute it will eventually produce a literray work worthy of the Booker Prize! It says:

With a total of 1248 registered monkeys, we are 0.1248% complete to our goal.

But perhaps the funniest episode involving the Infinite Monkeys theory is, some lecturers and students from the University of Plymouth in England actually put this to test. A single computer was placed inside an enclosure with six primates. At the end of six months all they succeeded in producing was five pages of text which consisted mainly of the letter "s" and a partially destroyed computer. More on the story.

Comments

  1. Should you not factor in the possibility a monkey is more likely to bang or smash multiple keys at once (as with fists or open palms) than to press single keys individually? Key presses created with fists or open palms will certainly register multiple characters and this can be considered, but the proximity of these characters on the keyboard must also be factored. An open palm press of the keyboard is extremely unlikely to register a "P" and a "Z" simultaneously, for example.

    This brings up the issue of case sensitivity... how can we account for the need for capital letters to be created at the appropriate times?

    Let us not forget the most important question of all, which is... given an infinite number of monkeys, who is going to clean up all that monkey shit?

    ReplyDelete
  2. That's exactly what the guys at the University of Plymouth found out.

    ReplyDelete
  3. i went bananas reading this

    ReplyDelete
  4. Picking a string of words of sufficiently long length you might calculate how random a random number generator is right? If the longer you type the more likely you are to type the fixed length string in this case one of Shakespeare's plays.
    It seems possible to estimate the number of random keystrokes it would take by working backward from the string length.
    The formula would be...
    Calculate variance and approximate randomness.

    ReplyDelete
  5. I've often thought that Charles Darwin's "Origin of the Species" disproves The infinite monkey theorem. In other words if you had an infinite number of monkeys with an infinite amount of typewriters it is very likely that the monkeys would evolve into another species prior to publishing any readable written work. ;-)

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Record CPU and Memory Usage Over Time in Windows?

Whenever the computer is lagging or some application is taking too long to respond, we usually fire up task manager and look under the Performance tab or under Processes to check on processor utilization or the amount of free memory available. The task manager is ideal for real-time analysis of CPU and memory utilization. It even displays a short history of CPU utilization in the form of a graph. You get a small time-window, about 30 seconds or so, depending on how large the viewing area is.

How to Schedule Changes to Your Facebook Page Cover Photo

Facebook’s current layout, the so called Timeline, features a prominent, large cover photo that some people are using in a lot of different creative ways. Timeline is also available for Facebook Pages that people can use to promote their website or business or event. Although you can change the cover photo as often as you like, it’s meant to be static – something which you design and leave it for at least a few weeks or months like a redesigned website. However, there are times when you may want to change the cover photo frequently and periodically to match event dates or some special promotion that you are running or plan to run. So, here is how you can do that.

Diagram 101: Different Types of Diagrams and When To Use Them

Diagrams are a great way to visualize information and convey meaning. The problem is that there’s too many different types of diagrams, so it can be hard to know which ones you should use in any given situation. To help you out, we’ve created this diagram that lays out the 7 most common types of diagrams and when they’re best used: