Infinite monkey theorem
   HOME

TheInfoList



OR:

The infinite monkey theorem states that a monkey hitting keys at
random In common usage, randomness is the apparent or actual lack of pattern or predictability in events. A random sequence of events, symbols or steps often has no order and does not follow an intelligible pattern or combination. Individual ra ...
on a
typewriter A typewriter is a mechanical or electromechanical machine for typing characters. Typically, a typewriter has an array of keys, and each one causes a different single character to be produced on paper by striking an inked ribbon selectivel ...
keyboard for an
infinite Infinite may refer to: Mathematics * Infinite set, a set that is not a finite set *Infinity, an abstract concept describing something without any limit Music *Infinite (group), a South Korean boy band *''Infinite'' (EP), debut EP of American m ...
amount of time will
almost surely In probability theory, an event is said to happen almost surely (sometimes abbreviated as a.s.) if it happens with probability 1 (or Lebesgue measure 1). In other words, the set of possible exceptions may be non-empty, but it has probability 0 ...
type any given text, such as the complete works of
William Shakespeare William Shakespeare ( 26 April 1564 – 23 April 1616) was an English playwright, poet and actor. He is widely regarded as the greatest writer in the English language and the world's pre-eminent dramatist. He is often called England's nation ...
. In fact, the monkey would almost surely type every possible finite text an infinite number of times. However, the
probability Probability is the branch of mathematics concerning numerical descriptions of how likely an event is to occur, or how likely it is that a proposition is true. The probability of an event is a number between 0 and 1, where, roughly speakin ...
that monkeys filling the entire
observable universe The observable universe is a ball-shaped region of the universe comprising all matter that can be observed from Earth or its space-based telescopes and exploratory probes at the present time, because the electromagnetic radiation from these ob ...
would type a single complete work, such as Shakespeare's ''
Hamlet ''The Tragedy of Hamlet, Prince of Denmark'', often shortened to ''Hamlet'' (), is a tragedy written by William Shakespeare sometime between 1599 and 1601. It is Shakespeare's longest play, with 29,551 words. Set in Denmark, the play depicts ...
'', is so tiny that the chance of it occurring during a period of time hundreds of thousands of
orders of magnitude An order of magnitude is an approximation of the logarithm of a value relative to some contextually understood reference value, usually 10, interpreted as the base of the logarithm and the representative of values of magnitude one. Logarithmic dis ...
longer than the
age of the universe In physical cosmology, the age of the universe is the time elapsed since the Big Bang. Astronomers have derived two different measurements of the age of the universe: a measurement based on direct observations of an early state of the universe, ...
is ''extremely'' low (but technically not zero). The theorem can be generalized to state that any sequence of events which has a non-zero probability of happening will almost certainly eventually occur, given enough time. 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 A metaphor is a figure of speech that, for rhetorical effect, directly refers to one thing by mentioning another. It may provide (or obscure) clarity or identify hidden similarities between two different ideas. Metaphors are often compared wi ...
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 Félix Édouard Justin Émile Borel (; 7 January 1871 – 3 February 1956) was a French mathematician and politician. As a mathematician, he was known for his founding work in the areas of measure theory and probability. Biography Borel was ...
in 1913, but the first instance may have been even earlier. Variants of the theorem include multiple and even infinitely many typists, and the target text varies between an entire library and a single sentence.
Jorge Luis Borges Jorge Francisco Isidoro Luis Borges Acevedo (; ; 24 August 1899 – 14 June 1986) was an Argentine short-story writer, essayist, poet and translator, as well as a key figure in Spanish-language and international literature. His best-known b ...
traced the history of this idea from
Aristotle Aristotle (; grc-gre, Ἀριστοτέλης ''Aristotélēs'', ; 384–322 BC) was a Greek philosopher and polymath during the Classical period in Ancient Greece. Taught by Plato, he was the founder of the Peripatetic school of ph ...
's ''
On Generation and Corruption ''On Generation and Corruption'' ( grc, Περὶ γενέσεως καὶ φθορᾶς; la, De Generatione et Corruptione), also known as ''On Coming to Be and Passing Away'' is a treatise by Aristotle. Like many of his texts, it is both scie ...
'' and
Cicero Marcus Tullius Cicero ( ; ; 3 January 106 BC – 7 December 43 BC) was a Roman statesman, lawyer, scholar, philosopher, and academic skeptic, who tried to uphold optimate principles during the political crises that led to the esta ...
's ''
De Natura Deorum ''De Natura Deorum'' (''On the Nature of the Gods'') is a philosophical dialogue by Roman Academic Skeptic philosopher Cicero written in 45 BC. It is laid out in three books that discuss the theological views of the Hellenistic philosophies ...
'' (On the Nature of the Gods), through Blaise Pascal and
Jonathan Swift Jonathan Swift (30 November 1667 – 19 October 1745) was an Anglo-Irish satirist, author, essayist, political pamphleteer (first for the Whigs, then for the Tories), poet, and Anglican cleric who became Dean of St Patrick's Cathedral, Dubl ...
, 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 a straightforward proof of this theorem. As an introduction, recall that if two events are
statistically independent Independence is a fundamental notion in probability theory, as in statistics and the theory of stochastic processes. Two events are independent, statistically independent, or stochastically independent if, informally speaking, the occurrence of o ...
, then the probability of both happening equals the product of the probabilities of each one happening independently. For example, if the chance of rain in
Moscow Moscow ( , US chiefly ; rus, links=no, Москва, r=Moskva, p=mɐskˈva, a=Москва.ogg) is the capital and largest city of Russia. The city stands on the Moskva River in Central Russia, with a population estimated at 13.0 millio ...
on a particular day in the future is 0.4 and the chance of an
earthquake An earthquake (also known as a quake, tremor or temblor) is the shaking of the surface of the Earth resulting from a sudden release of energy in the Earth's lithosphere that creates seismic waves. Earthquakes can range in intensity, fr ...
in
San Francisco San Francisco (; Spanish for " Saint Francis"), officially the City and County of San Francisco, is the commercial, financial, and cultural center of Northern California. The city proper is the fourth most populous in California and 17th ...
on any particular day is 0.00003, then the chance of both happening on the same day is , assuming that they are indeed independent. Consider the probability of typing the word ''banana'' on a typewriter with 50 keys. Suppose that the keys are pressed randomly and independently, 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 :(1/50) × (1/50) × (1/50) × (1/50) × (1/50) × (1/50) = (1/50)6 = 1/15,625,000,000. 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 ''X''''n'' of not typing ''banana'' in any of the first ''n'' blocks of 6 letters is :X_n=\left(1-\frac\right)^n. As ''n'' grows, ''X''''n'' gets smaller. For ''n'' = 1 million, ''X''''n'' is roughly 0.9999, but for ''n'' = 10 billion ''X''''n'' is roughly 0.53 and for ''n'' = 100 billion it is roughly 0.0017. As ''n'' approaches infinity, the probability ''X''''n'' approaches zero; that is, by making ''n'' large enough, ''X''''n'' can be made as small as is desired, – Isaac generalizes this argument immediately to variable text and alphabet size; the common main conclusion is on page 50. 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, ''X''''n'' = (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 as quickly as it would be produced by 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 uniformly at random, any given finite string almost surely occurs as a
substring In formal language theory and computer science, a substring is a contiguous sequence of characters within a string. For instance, "''the best of''" is a substring of "''It was the best of times''". In contrast, "''Itwastimes''" is a subsequenc ...
at some position. * Given an infinite sequence of infinite strings, where each character of each string is chosen 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 ''E''''k'' be the event that the ''k''th string begins with the given text. Because this has some fixed nonzero probability ''p'' of occurring, the ''E''''k'' are independent, and the below sum diverges, :\sum_^\infty P(E_k) = \sum_^\infty p = \infty, the probability that infinitely many of the ''E''''k'' 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 ''E''''k'' the event where the ''k''th block equals the desired string.


Probabilities

However, for physically meaningful numbers of monkeys typing for physically meaningful lengths of time the results are reversed. If there were as many monkeys as there are atoms in the observable universe typing extremely fast for trillions of times the life of the universe, the probability of the monkeys replicating even a ''single page'' of Shakespeare is unfathomably small. Ignoring punctuation, spacing, and capitalization, a monkey typing letters uniformly at random has a chance of one in 26 of correctly typing the first letter of ''
Hamlet ''The Tragedy of Hamlet, Prince of Denmark'', often shortened to ''Hamlet'' (), is a tragedy written by William Shakespeare sometime between 1599 and 1601. It is Shakespeare's longest play, with 29,551 words. Set in Denmark, the play depicts ...
.'' It has a chance of one in 676 (26 × 26) of typing the first two letters. Because the probability shrinks
exponentially Exponential may refer to any of several mathematical topics related to exponentiation, including: *Exponential function, also: **Matrix exponential, the matrix analogue to the above *Exponential decay, decrease at a rate proportional to value *Expo ...
, at 20 letters it already has only a chance of one in 2620 = 19,928,148,895,209,409,152,340,197,376 (almost 2 × 1028). In the case of the entire text of ''Hamlet'', the probabilities are so vanishingly small as to be inconceivable. The text of ''Hamlet'' contains approximately 130,000 letters. Thus there is a probability of one in 3.4 × 10183,946 to get the text right at the first trial. The average number of letters that needs to be typed until the text appears is also 3.4 × 10183,946, or including punctuation, 4.4 × 10360,783. Even if every proton in the observable universe (which is estimated at roughly 1080) were a monkey with a typewriter, typing from the Big Bang until the
end of the universe The ultimate fate of the universe is a topic in physical cosmology, whose theoretical restrictions allow possible scenarios for the evolution and ultimate fate of the universe to be described and evaluated. Based on available observational ev ...
(when protons might no longer exist), they would still need a far greater amount of time – more than three hundred and sixty thousand ''orders of magnitude'' longer – to have even a 1 in 10500 chance of success. To put it another way, for a one in a trillion chance of success, there would need to be 10360,641 observable universes made of protonic monkeys. As
Kittel 220px, A kittel A ''kittel'' ( yi, קיטל) is a white linen or cotton robe worn by religious Ashkenazi Jews on holidays, in the synagogue or at home when leading the Passover seder. Kittels are sometimes worn by grooms. It is also customary for ...
and Kroemer put it in their textbook on
thermodynamics Thermodynamics is a branch of physics that deals with heat, work, and temperature, and their relation to energy, entropy, and the physical properties of matter and radiation. The behavior of these quantities is governed by the four laws of th ...
, the field whose statistical foundations motivated the first known expositions of typing monkeys, "The probability of ''Hamlet'' is therefore zero in any operational sense of an event ...", and the statement that the monkeys must eventually succeed "gives a misleading conclusion about very, very large numbers." In fact there is less than a one in a trillion chance of success that such a universe made of monkeys could type any particular document a mere 79 characters long.


Almost surely

The probability that an infinite randomly generated string of text will contain a particular finite substring is 1. However, this does not mean the substring's absence is "impossible", despite the absence having a prior probability of 0. For example, the immortal monkey ''could'' randomly type G as its first letter, G as its second, and G as every single letter thereafter, producing an infinite string of Gs; at no point must the monkey be "compelled" to type anything else. (To assume otherwise implies the gambler's fallacy.) However long a randomly generated finite string is, there is a small but nonzero chance that it will turn out to consist of the same character repeated throughout; this chance approaches zero as the string's length approaches infinity. There is nothing special about such a monotonous sequence except that it is easy to describe; the same fact applies to any nameable specific sequence, such as "RGRGRG" repeated forever, or "a-b-aa-bb-aaa-bbb-...", or "Three, Six, Nine, Twelve…". If the hypothetical monkey has a typewriter with 90 equally likely keys that include numerals and punctuation, then the first typed keys might be "3.14" (the first three digits of pi) with a probability of (1/90)4, which is 1/65,610,000. Equally probable is any other string of four characters allowed by the typewriter, such as "GGGG", "mATh", or "q%8e". The probability that 100 randomly typed keys will consist of the first 99 digits of pi (including the separator key), or any other ''particular'' sequence of that length, is much lower: (1/90)100. If the monkey's allotted length of text is infinite, the chance of typing only the digits of pi is 0, which is just as ''possible'' (mathematically probable) as typing nothing but Gs (also probability 0). The same applies to the event of typing a particular version of ''Hamlet'' followed by endless copies of itself; or ''Hamlet'' immediately followed by all the digits of pi; these specific strings are equally infinite in length, they are not prohibited by the terms of the thought problem, and they each have a prior probability of 0. In fact, ''any'' particular infinite sequence the immortal monkey types will have ''had'' a prior probability of 0, even though the monkey must type something. This is an extension of the principle that a finite string of random text has a lower and lower probability of ''being'' a particular string the longer it is (though all specific strings are equally unlikely). This probability approaches 0 as the string approaches infinity. Thus, the probability of the monkey typing an endlessly long string, such as all of the digits of pi in order, on a 90-key keyboard is (1/90) which equals (1/∞) which is essentially 0. At the same time, the probability that the sequence ''contains'' a particular subsequence (such as the word MONKEY, or the 12th through 999th digits of pi, or a version of the King James Bible) increases as the total string increases. This probability approaches 1 as the total string approaches infinity, and thus the original theorem is correct.


Correspondence between strings and numbers

In a simplification of the thought experiment, the monkey could have a typewriter with just two keys: 1 and 0. The infinitely long string thusly produced would correspond to the
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two digits (0 and 1) * Binary function, a function that takes two arguments * Binary operation, a mathematical operation that ta ...
digits of a particular
real number In mathematics, a real number is a number that can be used to measure a ''continuous'' one-dimensional quantity such as a distance, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small variations. Every ...
between 0 and 1. A countably infinite set of possible strings end in infinite repetitions, which means the corresponding real number is
rational Rationality is the quality of being guided by or based on reasons. In this regard, a person acts rationally if they have a good reason for what they do or a belief is rational if it is based on strong evidence. This quality can apply to an abi ...
. Examples include the strings corresponding to one-third (010101...), five-sixths (11010101...) and five-eighths (1010000...). Only a subset of such real number strings (albeit a countably infinite subset) contains the entirety of ''Hamlet'' (assuming that the text is subjected to a numerical encoding, such as
ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because ...
). Meanwhile, there is an ''
uncountably In mathematics, an uncountable set (or uncountably infinite set) is an infinite set that contains too many Element (mathematics), elements to be countable set, countable. The uncountability of a set is closely related to its cardinal number: a se ...
'' infinite set of strings which do not end in such repetition; these correspond to the
irrational numbers In mathematics, the irrational numbers (from in- prefix assimilated to ir- (negative prefix, privative) + rational) are all the real numbers that are not rational numbers. That is, irrational numbers cannot be expressed as the ratio of two inte ...
. These can be sorted into two uncountably infinite subsets: those which contain ''Hamlet'' and those which do not. However, the "largest" subset of all the real numbers are those which not only contain ''Hamlet'', but which contain every other possible string of any length, and with equal distribution of such strings. These irrational numbers are called
normal Normal(s) or The Normal(s) may refer to: Film and television * ''Normal'' (2003 film), starring Jessica Lange and Tom Wilkinson * ''Normal'' (2007 film), starring Carrie-Anne Moss, Kevin Zegers, Callum Keith Rennie, and Andrew Airlie * ''Norma ...
. Because almost all numbers are normal, almost all possible strings contain all possible finite substrings. Hence, the probability of the monkey typing a normal number is 1. The same principles apply regardless of the number of keys from which the monkey can choose; a 90-key keyboard can be seen as a generator of numbers written in base 90.


History


Statistical mechanics

In one of the forms in which probabilists now know this theorem, with its "dactylographic" .e., typewritingmonkeys (french: singes dactylographes; the French word ''singe'' covers both the monkeys and the apes), appeared in
Émile Borel Félix Édouard Justin Émile Borel (; 7 January 1871 – 3 February 1956) was a French mathematician and politician. As a mathematician, he was known for his founding work in the areas of measure theory and probability. Biography Borel was ...
's 1913 article "''Mécanique Statistique et Irréversibilité''" ('' Statistical mechanics and irreversibility''), (The journal appears to not be archived back to 1913) and in his book "Le Hasard" in 1914. (available in full a
Internet Archive
/ref> His "monkeys" are not actual monkeys; rather, they are a metaphor for an imaginary way to produce a large, random sequence of letters. Borel said that if a million monkeys typed ten hours a day, it was extremely unlikely that their output would exactly equal all the books of the richest libraries of the world; and yet, in comparison, it was even more unlikely that the laws of statistical mechanics would ever be violated, even briefly. The physicist Arthur Eddington drew on Borel's image further in ''The Nature of the Physical World'' (1928), writing: These images invite the reader to consider the incredible improbability of a large but finite number of monkeys working for a large but finite amount of time producing a significant work, and compare this with the even greater improbability of certain physical events. Any physical process that is even less likely than such monkeys' success is effectively impossible, and it may safely be said that such a process will never happen. It is clear from the context that Eddington is not suggesting that the probability of this happening is worthy of serious consideration. On the contrary, it was a rhetorical illustration of the fact that below certain levels of probability, the term ''improbable'' is functionally equivalent to ''impossible''.


Origins and "The Total Library"

In a 1939 essay entitled "The Total Library", Argentine writer
Jorge Luis Borges Jorge Francisco Isidoro Luis Borges Acevedo (; ; 24 August 1899 – 14 June 1986) was an Argentine short-story writer, essayist, poet and translator, as well as a key figure in Spanish-language and international literature. His best-known b ...
traced the infinite-monkey concept back to
Aristotle Aristotle (; grc-gre, Ἀριστοτέλης ''Aristotélēs'', ; 384–322 BC) was a Greek philosopher and polymath during the Classical period in Ancient Greece. Taught by Plato, he was the founder of the Peripatetic school of ph ...
's ''Metaphysics.'' Explaining the views of
Leucippus Leucippus (; el, Λεύκιππος, ''Leúkippos''; fl. 5th century BCE) is a pre-Socratic Greek philosopher who has been credited as the first philosopher to develop a theory of atomism. Leucippus' reputation, even in antiquity, was obscured ...
, who held that the world arose through the random combination of atoms, Aristotle notes that the atoms themselves are homogeneous and their possible arrangements only differ in shape, position and ordering. In ''
On Generation and Corruption ''On Generation and Corruption'' ( grc, Περὶ γενέσεως καὶ φθορᾶς; la, De Generatione et Corruptione), also known as ''On Coming to Be and Passing Away'' is a treatise by Aristotle. Like many of his texts, it is both scie ...
'', the Greek philosopher compares this to the way that a tragedy and a comedy consist of the same "atoms", ''i.e.'', alphabetic characters. Three centuries later,
Cicero Marcus Tullius Cicero ( ; ; 3 January 106 BC – 7 December 43 BC) was a Roman statesman, lawyer, scholar, philosopher, and academic skeptic, who tried to uphold optimate principles during the political crises that led to the esta ...
's ''De natura deorum'' (''On the Nature of the Gods'') argued against the atomist worldview: Borges follows the history of this argument through Blaise Pascal and
Jonathan Swift Jonathan Swift (30 November 1667 – 19 October 1745) was an Anglo-Irish satirist, author, essayist, political pamphleteer (first for the Whigs, then for the Tories), poet, and Anglican cleric who became Dean of St Patrick's Cathedral, Dubl ...
, then observes that in his own time, the vocabulary had changed. By 1939, the idiom was "that a half-dozen monkeys provided with typewriters would, in a few eternities, produce all the books in the British Museum." (To which Borges adds, "Strictly speaking, one immortal monkey would suffice.") Borges then imagines the contents of the Total Library which this enterprise would produce if carried to its fullest extreme: Borges' total library concept was the main theme of his widely read 1941 short story " The Library of Babel", which describes an unimaginably vast library consisting of interlocking hexagonal chambers, together containing every possible volume that could be composed from the letters of the alphabet and some punctuation characters.


Actual monkeys

In 2002, lecturers and students from the
University of Plymouth The University of Plymouth is a public research university based predominantly in Plymouth, England, where the main campus is located, but the university has campuses and affiliated colleges across South West England. With students, it is the ...
MediaLab Arts course used a £2,000 grant from the Arts Council to study the literary output of real monkeys. They left a computer keyboard in the enclosure of six
Celebes crested macaque The Celebes crested macaque (''Macaca nigra''), also known as the crested black macaque, Sulawesi crested macaque, or the black ape, is an Old World monkey that lives in the Tangkoko reserve in the northeastern tip of the Indonesian island of Su ...
s in Paignton Zoo in Devon, England for a month, with a radio link to broadcast the results on a website. Not only did the monkeys produce nothing but five total pages largely consisting of the letter "S", the lead male began striking the keyboard with a stone, and other monkeys followed by soiling it. Mike Phillips, director of the university's Institute of Digital Arts and Technology (i-DAT), said that the artist-funded project was primarily
performance art Performance art is an artwork or art exhibition created through actions executed by the artist or other participants. It may be witnessed live or through documentation, spontaneously developed or written, and is traditionally presented to a pu ...
, and they had learned "an awful lot" from it. He concluded that monkeys "are not random generators. They're more complex than that. ... They were quite interested in the screen, and they saw that when they typed a letter, something happened. There was a level of intention there."


Applications and criticisms


Evolution

In his 1931 book ''The Mysterious Universe'', Eddington's rival
James Jeans Sir James Hopwood Jeans (11 September 187716 September 1946) was an English physicist, astronomer and mathematician. Early life Born in Ormskirk, Lancashire, the son of William Tulloch Jeans, a parliamentary correspondent and author. Jeans was ...
attributed the monkey parable to a "Huxley", presumably meaning
Thomas Henry Huxley Thomas Henry Huxley (4 May 1825 – 29 June 1895) was an English biologist and anthropologist specialising in comparative anatomy. He has become known as "Darwin's Bulldog" for his advocacy of Charles Darwin's theory of evolution. The stori ...
. This attribution is incorrect. Today, it is sometimes further reported that Huxley applied the example in a now-legendary debate over
Charles Darwin Charles Robert Darwin ( ; 12 February 1809 – 19 April 1882) was an English naturalist, geologist, and biologist, widely known for his contributions to evolutionary biology. His proposition that all species of life have descended ...
's ''
On the Origin of Species ''On the Origin of Species'' (or, more completely, ''On the Origin of Species by Means of Natural Selection, or the Preservation of Favoured Races in the Struggle for Life''),The book's full original title was ''On the Origin of Species by Me ...
'' with the Anglican Bishop of Oxford, Samuel Wilberforce, held at a meeting of the British Association for the Advancement of Science at Oxford on 30 June 1860. This story suffers not only from a lack of evidence, but the fact that in 1860 the typewriter itself had yet to emerge. Despite the original mix-up, monkey-and-typewriter arguments are now common in arguments over evolution. As an example of
Christian apologetics Christian apologetics ( grc, ἀπολογία, "verbal defense, speech in defense") is a branch of Christian theology that defends Christianity. Christian apologetics has taken many forms over the centuries, starting with Paul the Apostle in ...
Doug Powell argued that even if a monkey accidentally types the letters of ''Hamlet'', it has failed to produce ''Hamlet'' because it lacked the intention to communicate. His parallel implication is that natural laws could not produce the information content in DNA. A more common argument is represented by Reverend
John F. MacArthur John Fullerton MacArthur Jr. (born June 19, 1939) is an American Protestant pastor and author known for his internationally syndicated Christian teaching radio and television program ''Grace to You''. He has been the pastor of Grace Community Chu ...
, who claimed that the genetic mutations necessary to produce a tapeworm from an amoeba are as unlikely as a monkey typing Hamlet's soliloquy, and hence the odds against the evolution of all life are impossible to overcome.
Evolutionary biologist Evolutionary biology is the subfield of biology that studies the evolutionary processes (natural selection, common descent, speciation) that produced the diversity of life on Earth. It is also defined as the study of the history of life for ...
Richard Dawkins employs the typing monkey concept in his book '' The Blind Watchmaker'' to demonstrate the ability of
natural selection Natural selection is the differential survival and reproduction of individuals due to differences in phenotype. It is a key mechanism of evolution, the change in the heritable traits characteristic of a population over generations. Cha ...
to produce biological complexity out of random
mutation In biology, a mutation is an alteration in the nucleic acid sequence of the genome of an organism, virus, or extrachromosomal DNA. Viral genomes contain either DNA or RNA. Mutations result from errors during DNA replication, DNA or viral repl ...
s. In a simulation experiment Dawkins has his
weasel program The weasel program or Dawkins' weasel is a thought experiment and a variety of computer simulations illustrating it. Their aim is to demonstrate that the process that drives evolutionary systems—random variation combined with non-random cumula ...
produce the Hamlet phrase ''METHINKS IT IS LIKE A WEASEL'', starting from a randomly typed parent, by "breeding" subsequent generations and always choosing the closest match from progeny that are copies of the parent, with random mutations. The chance of the target phrase appearing in a single step is extremely small, yet Dawkins showed that it could be produced rapidly (in about 40 generations) using cumulative selection of phrases. The random choices furnish raw material, while cumulative selection imparts information. As Dawkins acknowledges, however, the weasel program is an imperfect analogy for evolution, as "offspring" phrases were selected "according to the criterion of resemblance to a ''distant ideal'' target." In contrast, Dawkins affirms, evolution has no long-term plans and does not progress toward some distant goal (such as humans). The weasel program is instead meant to illustrate the difference between non-random cumulative selection, and
random In common usage, randomness is the apparent or actual lack of pattern or predictability in events. A random sequence of events, symbols or steps often has no order and does not follow an intelligible pattern or combination. Individual ra ...
single-step selection. In terms of the typing monkey analogy, this means that ''Romeo and Juliet'' could be produced relatively quickly if placed under the constraints of a nonrandom, Darwinian-type selection because the
fitness function {{no footnotes, date=May 2015 A fitness function is a particular type of objective function that is used to summarise, as a single figure of merit, how close a given design solution is to achieving the set aims. Fitness functions are used in geneti ...
will tend to preserve in place any letters that happen to match the target text, improving each successive generation of typing monkeys. A different avenue for exploring the analogy between evolution and an unconstrained monkey lies in the problem that the monkey types only one letter at a time, independently of the other letters. Hugh Petrie argues that a more sophisticated setup is required, in his case not for biological evolution but the evolution of ideas: James W. Valentine, while admitting that the classic monkey's task is impossible, finds that there is a worthwhile analogy between written English and the
metazoa Animals are multicellular, eukaryotic organisms in the biological kingdom Animalia. With few exceptions, animals consume organic material, breathe oxygen, are able to move, can reproduce sexually, and go through an ontogenetic stage in ...
n genome in this other sense: both have "combinatorial, hierarchical structures" that greatly constrain the immense number of combinations at the alphabet level.


Literary theory

R. G. Collingwood argued in 1938 that art cannot be produced by accident, and wrote as a sarcastic aside to his critics,
Nelson Goodman Henry Nelson Goodman (7 August 1906 – 25 November 1998) was an American philosopher, known for his work on counterfactuals, mereology, the problem of induction, irrealism, and aesthetics. Life and career Goodman was born in Somerville, M ...
took the contrary position, illustrating his point along with Catherine Elgin by the example of Borges' "
Pierre Menard, Author of the Quixote "Pierre Menard, Author of the ''Quixote''" (original Spanish title: "Pierre Menard, autor del ''Quijote''") is a short story by Argentine writer Jorge Luis Borges. It originally appeared in Spanish in the Argentine journal '' Sur'' in May 1939. ...
", In another writing, Goodman elaborates, "That the monkey may be supposed to have produced his copy randomly makes no difference. It is the same text, and it is open to all the same interpretations. ..." Gérard Genette dismisses Goodman's argument as begging the question. For Jorge J. E. Gracia, the question of the identity of texts leads to a different question, that of author. If a monkey is capable of typing ''Hamlet'', despite having no intention of meaning and therefore disqualifying itself as an author, then it appears that texts do not require authors. Possible solutions include saying that whoever finds the text and identifies it as ''Hamlet'' is the author; or that Shakespeare is the author, the monkey his agent, and the finder merely a user of the text. These solutions have their own difficulties, in that the text appears to have a meaning separate from the other agents: What if the monkey operates before Shakespeare is born, or if Shakespeare is never born, or if no one ever finds the monkey's typescript?


Random document generation

The theorem concerns a
thought experiment A thought experiment is a hypothetical situation in which a hypothesis, theory, or principle is laid out for the purpose of thinking through its consequences. History The ancient Greek ''deiknymi'' (), or thought experiment, "was the most anc ...
which cannot be fully carried out in practice, since it is predicted to require prohibitive amounts of time and resources. Nonetheless, it has inspired efforts in finite random text generation. One computer program run by Dan Oliver of Scottsdale, Arizona, according to an article in ''
The New Yorker ''The New Yorker'' is an American weekly magazine featuring journalism, commentary, criticism, essays, fiction, satire, cartoons, and poetry. Founded as a weekly in 1925, the magazine is published 47 times annually, with five of these issues ...
'', came up with a result on 4 August 2004: After the group had worked for 42,162,500,000 billion billion monkey-years, one of the "monkeys" typed, "VALENTINE. Cease toIdor:eFLP0FRjWK78aXzVOwm)-‘;8.t" The first 19 letters of this sequence can be found in "The Two Gentlemen of Verona". Other teams have reproduced 18 characters from "Timon of Athens", 17 from "Troilus and Cressida", and 16 from "Richard II". – a review of A website entitled ''The Monkey Shakespeare Simulator'', launched on 1 July 2003, contained a
Java applet Java applets were small applications written in the Java programming language, or another programming language that compiles to Java bytecode, and delivered to users in the form of Java bytecode. The user launched the Java applet from a ...
that simulated a large population of monkeys typing randomly, with the stated intention of seeing how long it takes the virtual monkeys to produce a complete Shakespearean play from beginning to end. For example, it produced this partial line from '' Henry IV, Part 2'', reporting that it took "2,737,850 million billion billion billion monkey-years" to reach 24 matching characters: :RUMOUR. Open your ears; 9r"5j5&?OWTY Z0d Due to processing power limitations, the program used a probabilistic model (by using a
random number generator Random number generation is a process by which, often by means of a random number generator (RNG), a sequence of numbers or symbols that cannot be reasonably predicted better than by random chance is generated. This means that the particular outc ...
or RNG) instead of actually generating random text and comparing it to Shakespeare. When the simulator "detected a match" (that is, the RNG generated a certain value or a value within a certain range), the simulator simulated the match by generating matched text. More sophisticated methods are used in practice for natural language generation. If instead of simply generating random characters one restricts the generator to a meaningful vocabulary and conservatively following grammar rules, like using a context-free grammar, then a random document generated this way can even fool some humans (at least on a cursory reading) as shown in the experiments with
SCIgen SCIgen is a paper generator that uses context-free grammar to randomly generate nonsense in the form of computer science research papers. Its original data source was a collection of computer science papers downloaded from CiteSeer. All elem ...
, snarXiv, and the Postmodernism Generator. In February 2019, the
OpenAI OpenAI is an artificial intelligence (AI) research laboratory consisting of the for-profit corporation OpenAI LP and its parent company, the non-profit OpenAI Inc. The company conducts research in the field of AI with the stated goal of promo ...
group published the Generative Pre-trained Transformer 2 (GPT-2)
artificial intelligence Artificial intelligence (AI) is intelligence—perceiving, synthesizing, and inferring information—demonstrated by machines, as opposed to intelligence displayed by animals and humans. Example tasks in which this is done include speech r ...
to
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continu ...
, which is able to produce a fully plausible news article given a two sentence input from a human hand. The AI was so effective that instead of publishing the full code, the group chose to publish a scaled-back version and released a statement regarding ''"concerns about large language models being used to generate deceptive, biased, or abusive language at scale."''


Testing of random-number generators

Questions about the statistics describing how often an ideal monkey is expected to type certain strings translate into practical tests for random-number generators; these range from the simple to the "quite sophisticated". Computer-science professors
George Marsaglia George Marsaglia (March 12, 1924 – February 15, 2011) was an American mathematician and computer scientist. He is best known for creating the diehard tests, a suite of software for measuring statistical randomness. Research on random numbers ...
and
Arif Zaman Arif Zaman is a Pakistani mathematician, academic scientist, and a retired professor of Statistics and Mathematics from Syed Babar Ali School of Science and Engineering, Lahore University of Management Sciences (LUMS), Lahore, Pakistan. Befor ...
report that they used to call one such category of tests "overlapping m-
tuple In mathematics, a tuple is a finite ordered list (sequence) of elements. An -tuple is a sequence (or ordered list) of elements, where is a non-negative integer. There is only one 0-tuple, referred to as ''the empty tuple''. An -tuple is defi ...
tests" in lectures, since they concern overlapping m-tuples of successive elements in a random sequence. But they found that calling them "monkey tests" helped to motivate the idea with students. They published a report on the class of tests and their results for various RNGs in 1993.


In popular culture

The infinite monkey theorem and its associated imagery is considered a popular and proverbial illustration of the mathematics of probability, widely known to the general public because of its transmission through popular culture rather than through formal education. This is helped by the innate humor stemming from the image of literal monkeys rattling away on a set of typewriters, and is a popular visual gag. A quotation attributed to a 1996 speech by Robert Wilensky stated, "We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." The enduring, widespread popularity of the theorem was noted in the introduction to a 2001 paper, "Monkeys, Typewriters and Networks: The Internet in the Light of the Theory of Accidental Excellence". In 2002, an article in ''
The Washington Post ''The Washington Post'' (also known as the ''Post'' and, informally, ''WaPo'') is an American daily newspaper published in Washington, D.C. It is the most widely circulated newspaper within the Washington metropolitan area and has a large nati ...
'' said, "Plenty of people have had fun with the famous notion that an infinite number of monkeys with an infinite number of typewriters and an infinite amount of time could eventually write the works of Shakespeare". In 2003, the previously mentioned Arts Council funded experiment involving real monkeys and a computer keyboard received widespread press coverage. – some press clippings. In 2007, the theorem was listed by ''
Wired ''Wired'' (stylized as ''WIRED'') is a monthly American magazine, published in print and online editions, that focuses on how emerging technologies affect culture, the economy, and politics. Owned by Condé Nast, it is headquartered in San ...
'' magazine in a list of eight classic
thought experiment A thought experiment is a hypothetical situation in which a hypothesis, theory, or principle is laid out for the purpose of thinking through its consequences. History The ancient Greek ''deiknymi'' (), or thought experiment, "was the most anc ...
s. American playwright
David Ives David Ives (born July 11, 1950) is an American playwright, screenwriter, and novelist. He is perhaps best known for his comic one-act plays; ''The New York Times'' in 1997 referred to him as the "maestro of the short form". Ives has also written ...
' short
one-act play A one-act play is a play that has only one act, as distinct from plays that occur over several acts. One-act plays may consist of one or more scenes. The 20-40 minute play has emerged as a popular subgenre of the one-act play, especially in wri ...
'' Words, Words, Words'', from the collection '' All in the Timing'', pokes fun of the concept of the infinite monkey theorem. In 2015 Balanced Software released Monkey Typewriter on the Microsoft Store. The software generates random text using the Infinite Monkey theorem string formula. The software queries the generated text for user inputted phrases. However the software should not be considered true to life representation of the theory. This is a more of a practical presentation of the theory rather than scientific model on how to randomly generate text.


See also

* * * , another thought experiment involving infinity * * * * , explains the multiverse in which every possible event will occur infinitely many times * * * *


Notes


References


External links

* * – a bibliography with quotations * – on populating the cosmos with monkey particles * – Matt Kane's application of the ''Infinite Monkey Theorem'' on pixels to create images. * – April Fools' Day RFC on the implementation of the ''Infinite Monkey Theorem''. {{DEFAULTSORT:Infinite Monkey Theorem Articles containing proofs Metaphors referring to monkeys Infinity Literary theory Probability theorems Statistical randomness Random text generation Thought experiments