A monkey at a typewriter types each if the 26 letters of the alphabet exactly once, the order being random.

A. What is the probanility that the word HAMLET appears somewhere in the string if letters? B. How many independent monkey typists would you need in order that the probability that the word appears is at least 0.90?

Attempted solution:

A. Sample space = 26! Now the challenge was to find the size of the event. I said that there are $26 - 6 + 1 = 21$ ways that hamlet could be written in our sequence. Now take that with $20! $ different ways the other letters of the alphabet could be arranged and i end up with: $$P(event) = \frac {20! × 21}{26!} $$

B. This one i found a little trickier, but if this was the probability for one monkey and they want a probabikity for 9 would i set it up like this: $$ 0.90 = \frac {20! × 21}{26!} × n $$ where n is just the number of monkies and then solve?


The first part is right, but the second part is wrong (although not an absolutely terrible estimate.)

Basically, when you do the trial $n$ times, the value you computed is the expected number of occurrences of HAMLET.

This is a case where using the negative probability is better. The probability that you do not get HAMLET from one monkey is:

$$1-\frac{20!\times 21}{26!}$$

So the probability that you don't get HAMLET from $n$ monkeys is:

$$\left(1-\frac{20!\times 21}{26!}\right)^n$$

So the probability that you got at least one HAMLET from $n$ monkeys is:

$$1-\left(1-\frac{20!\times 21}{26!}\right)^n$$

Solve for that $\geq 0.90$.

I get $n\geq 18175684.7\dots$.

Your approach would give you $n=7104240$ which is off by a factor of approximately $2.5$.

  • $\begingroup$ Awesome, and thanks for breaking down the thought process $\endgroup$ – dc3rd May 26 '15 at 0:22
  • $\begingroup$ Why doesn't a binomial distribution with p= 20!*21/26! work? we can solve backwards from P(X>=1), right? Putting that here, we get a number of trials needed is 26,390,400. Why is that different? $\endgroup$ – QuantumHoneybees Sep 9 '19 at 1:09
  • $\begingroup$ Nevermind, Binomial works, I should've just changed P(X>=1) to P(X>0) and solved for 1-P(X=0) >= 0.9. That solution is available here $\endgroup$ – QuantumHoneybees Sep 9 '19 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.