ArticleslgStudy

mathematics

Infinite monkey theorem

Infinite monkey theorem is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Infinite monkey theorem rather than just read about it. In short: The infinite monkey theorem states that a monkey hitting keys independently and at random on a typewriter keyboard for an infinite amount of time will almost surely type any given text, including the complete works of William Shakespeare. More precisely, under the assumption of independence and randomness of each keystroke, the monkey would almost surely type every possible finite text an infinite number of times.

Infinite monkey theorem — main illustration
Infinite monkey theorem — illustration

Key takeaways

  • Infinite monkey theorem belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Infinite monkey theorem to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Infinite monkey theorem from memory before moving on to harder problems.

Reference excerpt

The infinite monkey theorem states that a monkey hitting keys independently and at random on a typewriter keyboard for an infinite amount of time will almost surely type any given text, including the complete works of William Shakespeare. More precisely, under the assumption of independence and randomness of each keystroke, the monkey would almost surely type every possible finite text an infinite number of times. The theorem can be generalized to state that any infinite sequence of independent events whose probabilities are uniformly bounded below by a positive number will almost surely have infinitely many occurrences. In this context, "almost surely" is a mathematical term meaning the event happens with probability 1, and the "monkey" is not an actual monkey, but a metaphor for an abstract device that produces an endless random sequence of letters and symbols. Variants of the theorem include multiple and even infinitely many independent typists, and the target text varies between an entire library and a single sentence. One of the earliest instances of the use of the "monkey metaphor" is that of French mathematician Émile Borel in 1913, but the first instance may have been even earlier. Jorge Luis Borges traced the history of this idea from Aristotle's On Generation and Corruption and Cicero's De Natura Deorum (On the Nature of the Gods), through Blaise Pascal and Jonathan Swift, up to modern statements with their iconic simians and typewriters. In the early 20th century, Borel and Arthur Eddington used the theorem to illustrate the timescales implicit in the foundations of statistical mechanics.

Solution

Direct proof There is straightforward proof of this theorem. As an introduction, recall that if two events are statistically independent, then the probability of both happening equals the product of the first and second events' probabilies. For example, if the chance of rain in Moscow on a particular day in the future is 0.4, and the chance of an earthquake in San Francisco on any particular day is 0.00003, then the chance of both happening on the same day is 0.000012 simply by multiplying the probabilities together, assuming that they are indeed independent.

Let us consider the probability of typing the word banana on a typewriter with 50 keys. Suppose that the keys are pressed independently and uniformly at random, meaning that each key has an equal chance of being pressed regardless of what keys had been pressed previously. 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. Therefore, the probability of the first six letters spelling banana is:

The result is less than one in 15 billion, but not zero. 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 Xn of not typing banana in any of the first n blocks of 6 letters is:

As n grows, Xn gets smaller. For n = 1 million, Xn is roughly 0.9999, but for n = 10 billion Xn is roughly 0.53 and for n = 100 billion it is roughly 0.0017. As n approaches infinity, the probability Xn approaches zero; that is, by making n large enough, Xn can be made as small as is desired, and the chance of typing banana approaches 100%. Thus, the probability of the word banana appearing at some point in an infinite sequence of keystrokes is equal to one.

The same argument applies if we replace one monkey typing n consecutive blocks of text with n monkeys each typing one block (simultaneously and independently). In this case, Xn = (1 − (1/50)6)n is the probability that none of the first n monkeys types banana correctly on their first try. Therefore, at least one of infinitely many monkeys will (with probability equal to one) produce a text using the same number of keystrokes as a perfectly accurate human typist copying it from the original.

Infinite strings This can be stated more generally and compactly in terms of strings, which are sequences of characters chosen from some finite alphabet: Given an infinite string where each character is chosen independently and uniformly at random, any given finite string almost surely occurs as a substring at some position. Given an infinite sequence of infinite strings, where each character of each string is chosen independently and uniformly at random, any given finite string almost surely occurs as a prefix of one of these strings.

Both follow easily from the second Borel–Cantelli lemma. For the second theorem, let Ek be the event that the kth string begins with the given text. Because this has some fixed nonzero probability p of occurring, the Ek are independent, and the below sum diverges,

the probability that infinitely many of the Ek occur is 1. The first theorem is shown similarly; one can divide the random string into nonoverlapping blocks matching the size of the desired text and make Ek the event where the kth block equals the desired string.

… excerpt ends here. Continue reading the full article.

Illustrations

Infinite monkey theorem: A chimpanzee probably not writing Hamlet
A chimpanzee probably not writing Hamlet
Infinite monkey theorem: Thomas Huxley is sometimes misattributed with proposing a variant of the theory in his debates with Samuel Wilberforce.
Thomas Huxley is sometimes misattributed with proposing a variant of the theory in his debates with Samuel Wilberforce.

Worked examples

Example 1 — a first encounter with Infinite monkey theorem

Start with the simplest possible case. Write down what Infinite monkey theorem claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Infinite monkey theorem before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Infinite monkey theorem ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Infinite monkey theorem

In research
Infinite monkey theorem appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Infinite monkey theorem in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Infinite monkey theorem is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cultural depictions of William Shakespeare, Infinity, Literary theory, so understanding it makes those chapters shorter.
In everyday life
Look for Infinite monkey theorem outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Infinite monkey theorem” →

How to study Infinite monkey theorem in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Infinite monkey theorem means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Infinite monkey theorem out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Infinite monkey theorem in simple terms?

The infinite monkey theorem states that a monkey hitting keys independently and at random on a typewriter keyboard for an infinite amount of time will almost surely type any given text, including the complete works of William Shakespeare. More precisely, under the assumption of independence and ran…

Why does Infinite monkey theorem matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Infinite monkey theorem?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Infinite monkey theorem.

Tags

  • Cultural depictions of William Shakespeare
  • Infinity
  • Literary theory
  • Metaphors referring to books and paper
  • Metaphors referring to monkeys
  • Random text generation
  • Statistical randomness
  • Theorems in probability theory
  • Thought experiments

Keep exploring