The infinite monkey theorem is a probabilistic concept that illustrates the relationship between randomness and the emergence of ordered patterns. It states that a monkey (or any random process) hitting keys on a typewriter keyboard for an infinite amount of time will, with probability 1, eventually produce any given finite text, such as the complete works of William Shakespeare.
Formal description
- Let $A$ be a finite sequence of characters of length $n$ drawn from an alphabet of size $k$.
- Consider an infinite sequence of independent, uniformly random characters from the same alphabet.
- The probability that $A$ appears as a contiguous subsequence somewhere in the infinite random sequence is 1.
This follows from the Borel–Cantelli lemmas and the fact that the sum of the probabilities of the event “$A$ occurs starting at position $i$” over all positions $i$ diverges.
Historical background
- The idea was popularized by French mathematician Émile Borel in 1913 as a thought experiment about infinite sequences and probability.
- The modern phrasing involving “monkeys” and “typewriters” appears in a 1955 article by the mathematician Stanislaw Ulam, who used the image to explain the notion to a general audience.
- The theorem is often cited in discussions of the limits of random processes, the foundations of probability theory, and the concept of almost sure events.
Mathematical implications
- The theorem does not claim that the required text will be produced in any finite amount of time; expected waiting times are astronomically large.
- It demonstrates that events of probability 1 may still be practically unreachable, highlighting the distinction between theoretical certainty and empirical feasibility.
- The result holds for any stationary, memoryless random source; extensions exist for non‑uniform distributions and for more complex target structures (e.g., languages defined by grammar rules).
Related concepts
- Borel’s law of large numbers – describes convergence of relative frequencies in independent trials.
- Kolmogorov complexity – measures the length of the shortest program that can generate a given string; random strings have high Kolmogorov complexity, whereas Shakespeare’s text is highly compressible.
- Monte Carlo methods – use random sampling to approximate deterministic results, contrasting with the theorem’s illustration of random generation of deterministic output.
Cultural references
- The theorem has been referenced in literature, film, and popular science to convey the idea that randomness can, given enough time, reproduce complex structures.
- It appears in discussions of evolutionary biology as an analogy for the generation of functional sequences, though the theorem itself does not address selective mechanisms.
Limitations and critiques
- The theorem assumes truly infinite time and a perfectly random source; real-world processes are finite and often exhibit correlations.
- Critics note that the theorem’s rhetorical power can lead to misunderstandings about the role of randomness in natural phenomena, especially when applied to biological evolution without acknowledging selection.
Mathematical example
If a keyboard has 50 keys and the target text is the 5‑character string “Hello”, the probability that a random 5‑character block matches the target is $(1/50)^5 = 1/312{,}500{,}000$. Over an infinite sequence of independent blocks, the expected number of occurrences diverges to infinity, guaranteeing occurrence with probability 1.
Conclusion
The infinite monkey theorem remains a foundational illustration in probability theory, emphasizing that events with probability 1 are inevitable in an infinite temporal framework, while also serving as a cautionary example of the gap between theoretical certainty and practical attainability.