Infinite Monkey Theorem
Main Concept
The Infinite Monkey Theorem is a popular demonstration of mathematical probability, stating that
A monkey hitting keys at random on a typewriter keyboard, given enough time and typewriters, will reproduce the entire works of Shakespeare.
In mathematical terms, the text typed by a monkey for an infinite period of time can be interpreted as an infinite string with uniformly chosen random characters. The probability that a finite substring of length k does not occur in the first n blocks of k characters is
Pn=1−126kn
assuming a keyboard with 26 different keys. As n→∞, the probability that a monkey fails to reproduce any text of finite length k is
limn→∞1−126kn assuming k>0 = 0
The following demonstration generates random strings of characters and attempts to build sentences containing pre-defined types of words. Experiment with the sentence structure and see how many sensible sentences you can generate. Use the "Word complexity" slider to influence the chance of generating longer strings.
Sentence structure: NounVerbAdverbAdjectivePrepositionConjunctionPronounInterjectionArticleNoneNounVerbAdverbAdjectivePrepositionConjunctionPronounInterjectionArticleNoneNounVerbAdverbAdjectivePrepositionConjunctionPronounInterjectionArticleNoneNounVerbAdverbAdjectivePrepositionConjunctionPronounInterjectionArticleNoneNounVerbAdverbAdjectivePrepositionConjunctionPronounInterjectionArticleNoneNounVerbAdverbAdjectivePrepositionConjunctionPronounInterjectionArticle
Number of attempted sentences
Word complexity
More MathApps
MathApps/ProbabilityAndStatistics
Download Help Document