Infinite Monkey Theorem

A thought experiment showing that if a monkey randomly mashes a typewriter for an eternity, it will eventually type out a complete masterpiece.

Definition The infinite monkey theorem is a famous probability thought experiment stating that an infinite number of monkeys randomly pressing typewriter keys for an infinite amount of time will almost surely type a given text, such as the complete works of William Shakespeare. It illustrates that any event with a non-zero probability will inevitably happen if given infinite opportunities.

A Typing Monkey and the Power of Infinity

Imagine closing your eyes, hitting a keyboard at random, and trying to accidentally type the word 'apple.' If a keyboard has roughly 50 keys, hitting 'a-p-p-l-e' in exact order by sheer luck has odds of just one in several hundred million. If spelling one single word is this improbable, blindly typing an entire book containing tens of thousands of words seems utterly impossible.

Yet in mathematics, when you introduce infinite time and infinite attempts, the rules change completely. As long as the probability is not absolute zero, multiplying the chance of failure infinitely causes that failure rate to shrink all the way to zero.

Just as flipping a coin countless times will eventually produce a streak of 100 heads in a row, infinite trials turn even the most absurd fluke into an absolute certainty.

Infinite Monkey Diagram Infinite Time/Tries Sure Masterpiece Random Typing A A Sa Prob = 100%

In the Real World: Why It's Physically Impossible

The infinite monkey theorem is purely a logical thought experiment meant to illustrate mathematical infinity; it could never happen in our physical universe. In reality, neither 'infinite time' nor 'infinite typewriters' exist.

Take a standard keyboard with 50 keys, including letters, spaces, and punctuation. The odds of randomly typing just a single 60-character sentence from Hamlet are 1 in 50โถโฐ. The denominator of that number is vastly larger than the total count of atoms in the entire observable universe (roughly 10โธโฐ).

Even if every grain of sand in the universe had turned into a monkey typing thousands of times per second since the Big Bang 13.8 billion years ago, the chance of finishing a meaningful book remains practically zero. The theorem isn't about real-world feasibilityโ€”it showcases the staggering power of infinity as a mathematical tool.

A Common Misconception: Evolution and the Origin of Life

Some people misuse this theorem to dispute evolution, arguing that 'just as a monkey cannot accidentally type a novel, random chance could never assemble complex living organisms.' However, biological evolution through natural selection works in a completely different way from pure random typing.

The infinite monkey theorem relies on independent trials, where any typo forces you to start over from scratch. Biological evolution, on the other hand, operates through 'cumulative selection,' where beneficial mutations are preserved and passed down across generations.

To use the typewriter analogy, it is like locking in each correct letter the moment it appears and only randomly typing the remaining letters. With cumulative selection, random variation can assemble intricate genetic blueprints with astonishing speed and efficiency.

Monkey Theorem vs Natural Selection Pure Random: Full Reset on Error M E T H Q Discard All & Reset Cumulative: Keep Right Letters M E T H O Lock Match, Search Next

๐Ÿค” Common misconceptions

โœ• Myth

Given enough time, a real monkey in a zoo could eventually type out Hamlet.

โœ“ Fact

Our physical universe has finite time (around 13.8 billion years so far) and limited resources, making this impossible in reality. The theorem is an abstract mathematical thought experiment that requires literal infinity.

๐Ÿงบ Where you meet it

1 If you flip a coin endlessly, you will eventually hit a rare streak of 20 heads in a row.
2 If you keep randomly guessing a 4-digit PIN with unlimited attempts, you are guaranteed to unlock it eventually.
๐Ÿ’ก In one sentence

No matter how tiny the probability, infinite attempts guarantee eventual successโ€”demonstrating the power of mathematical infinity rather than a real-world possibility.