Calculating probability of an analogy in Francis Crick’s book Life Itself

probabilityprobability theorysimulation

There is, in fact, a vanishingly small hope of even a billion monkeys, on a billion typewriters, ever typing correctly even one sonnet of Shakespeare’s during the present lifetime of the universe.(see Page 52 in internet archive)

I am trying to calculate probability of this in mathematical values

Sonnet is a fourteen-line poem written

No. of keys in typewriter

There are 44 keys of the typewriter and 26 alphabets along with backspace, shift keys, tab set, margin set, error key, and colour selector.

Now, I am trying to calculate probability of this event but this term

"during present lifetime of the universe"

Is causing me problem as I even have to use time as factor in probability which I don't know. So, please help for this

There are 154 sonnets written by Shakespeare

Key Assumptions
14 lines;
5 words in each line;
5 letters in each word +space +enter key

Every monkey presses 25 keys in a minute


So for every line, require 30 keys(5*5 words +space+enter)
For 14 lines it requires 419 (as last line, no use of enter key)

So, any of 419 combinations can work (154 sonnets)

For every key, there is 44 choices
So, 154*1/(44 power 419) for 1 monkey pressing any of 419 key choices

Now, I require help in consider the fact billion monkeys with typewriters typing for 13.7 billion years(age of universe)

Motive of question:There is very rare possibility for nature to produce flags/symbols of nations in patterns but sometimes it does during sunrise, sunset, flower petals etc. So, I am thinking what author is trying to convey a infinite rare possibility might be more probable.

Note: ignore punctuation marks

Best Answer

There is, in fact, a vanishingly small hope of even a billion monkeys, on a billion typewriters, ever typing correctly even one sonnet of Shakespeare’s during the present lifetime of the universe.

TL;DR: This claim would be true even if it were made for $10^{100}$ monkeys, each typing $10^{100}$ random keystrokes per second for $10^{100}$ years, hoping to obtain any of $10^{100}$ sonnets!

NB: Obviously, this assumes the claim is referring to a kind of "thought experiment" in which idealizations are made to allow a simplistic mathematical model:

  1. Monkeys, typewriters, universe, sonnets, etc., are all idealized such that there results a sequence of any finite number of keystrokes, generated at any finite typing rate for any finite duration of time, by any finite number of monkeys.
  2. Keystrokes are independent and identically distributed, uniformly random on the set of possible keystrokes with a 44-key typewriter.
  3. Some symbols require a simultaneous (SHIFT + key) combination, so to obtain a conservative probability calculation, any such combination is counted as a single keystroke. This has the effect of almost doubling the number of possible keystrokes, from 44 to about 86 (i.e. about 42 of the 44 keys have also a SHIFTed version).
  4. The shortest sonnet is assumed to require at least 420 keystrokes, which seems very conservative.
  5. The most restrictive assumption is that, corresponding to any sonnet there is only one specific sequence of keystrokes that can produce it; i.e., there can be no variation in any symbol of the sonnet, such as the wrong case, missing or extra spaces, misspelling, etc. (Typefaces with varying sizes and styles are not represented.)

Let $X_n$ be the sequence of $n$ random keystrokes, concatenating the keystrokes of all the monkeys. Let "S" abbreviate "Sonnet", and suppose there are $s$ sonnets. Let the sonnet requiring the least number of keystrokes be called the "shortest" sonnet ("S.S."), and let $k$ be this number of keystrokes. Then
$$\begin{align}p&:= P[\text{At least one S appears in $X_n$}]\\ &= P[\text{(S#1 appears in $X_n$) OR (S#2 appears in $X_n$) OR ... OR (S#s appears in $X_n$)}]\\ &\le^* P[\text{S#1 appears in $X_n$]+P[S#2 appears in $X_n$]+ ... +P[S#s appears in $X_n$]}\\ &\le s\ P[\text{S.S. appears in $X_n$}]\quad\text{(because S.S. has the largest probability)}\\ &\le s\ P[\text{(S.S. begins on keystroke#1) OR ... OR (S.S. begins on keystroke#$(n-k+1))$}]\\ &\le^* s\ (n-k+1) (1/86)^k\\[1ex] p&\lt s\ n\ 86^{-k} \end{align}$$

The above inequalities marked by ($^*$) follow from Boole's inequality (also called the "union bound"): the probability of any countable union of events cannot exceed the sum of their probabilities.

NB: $(1/86)^k$ is the probability that $k$ random keystrokes will coincide with the $k$ specific keystrokes that produce the shortest sonnet, and $n-k+1$ is the number of places in $X_n$ where this could occur. The effect of the former factor dominates the overall probability, as $86^{-420}<10^{-812}$(!)

Supposing there are $10^{100}$ monkeys, each typing $10^{100}$ keystrokes per second, that they do this for $10^{100}$ years, and that there are $10^{100}$ sonnets, the shortest of which requires at least $420$ keystrokes, then:

$$\begin{align}p&\lt \underbrace{(10^{100})}_{s}\ \underbrace{(10^{100}\text{monkeys})(10^{100}\text{keystrokes/s/monkey)}(10^{8}\text{s/yr})(10^{100}\text{yrs})}_{n}\ (86^{-420})\\[1ex] p&\lt 10^{-404}.\end{align}$$

Notes:

  • $10^{100}$ yrs. is many many orders of magnitude longer than Crick's estimate of the "age of the universe".
  • $10^{100}$ monkeys & typewriters would occupy many many orders of magnitude more volume than that of the observable universe.
  • $10^{100}$ keystrokes per second would require motion at speeds many many orders of magnitude greater than the speed of light.
Related Question