The Infinite Monkey Theorem is a proposition that an unlimited number of monkeys, given enough typewriters and an infinite amount time, will eventually produce a particular text, such as Hamlet or even the complete works of Shakespeare.

In fact, the monkey would almost surely type every possible finite text an infinite number of times. However, the probability of a universe full of monkeys typing a complete work, such as Shakespeare’s *Hamlet,* is so tiny that the chance of it occurring during a period of time hundreds of thousands of orders of magnitude longer than the age of the universe is *extremely* low (but technically not zero).

In this context, “almost surely” is a mathematical term with a precise meaning, 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. 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 be even earlier.

The reasoning behind that supposition is that, given infinite time, random input should produce all possible outputs. The Infinite Monkey Theorem translates to the idea that any problem can be solved, with the input of sufficient resources and time. That idea has been applied in various contexts, including software development and testing, commodity computing, project management and the SETI (the Search for Extraterrestrial Intelligence) project to support a greater allocation of resources – often, more specifically, a greater allocation of low-end resources – to solve a given problem. The theorem is also used to illustrate basic concepts in probability.

Variants of the theorem include multiple or even an infinite number of typists, and the target text varies between an entire library and a single sentence. The history of these statements can be traced back to Aristotle’s *On Generation and Corruption* and Cicero’s *De natura deorum* (On the Nature of the Gods), through Blaise Pascal and Jonathan Swift, and finally 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.