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
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:
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: