A monkey is sitting at a simplified keyboard that only includes the keys “a”, “b”, “c”, and “d”. The monkey presses the keys at random. Let X be the number of keys pressed until the monkey has pressed all the different keys at least once.

For example, if the monkey typed “accdaacbcdaadac. . . ” then X would equal 8 whereas if the monkey typed “cbadcdcddaabbcab. . . ” then X would equal 4.

What’s the probability X = 4?

I interpret this as:

Since the monkey can press as many keys as he can until he types 4 different letters, the geometric random variable formula can be applied in this case.

Is this a correct assumption?

  • $\begingroup$ Please tell us your understanding of the formula you have in mind and how it would be applied. (This problem is simple enough that it can be answered with straightforward counting, as in Paul Evans's answer.) $\endgroup$ – Barry Cipra Mar 2 '16 at 13:56

You want to use the geometric distribution when you repeat an experiment with a fixed probability of success, until it is successful.

In this case, if you think about each key typed as an experiment, you really don't get a fixed probability of success. Clearly, the first three experiments would have a probability of success of 0, since success requires having 4 keys typed, so this already kinda leaves out the geometric distribution.

Also, even after you typed three keys (possibly not all different), the probability of success could still be 0, depending on what keys where typed before. So, for example, if the first four keys where $aabb$, then the probability of success is still 0, because even if you get a $c$ or a $d$, you are not finished.

Only after getting three different keys do the rest of the draws conform to a geometric distribution with probability of success $p=\frac{1}{4}$, but I don't think this is useful in solving the entire problem.

Edit: @PaulEvans gives the right answer, but if you want to see where it is coming from, you should read about the Multinomial distribution, which can model this kind of problems where you have a fixed number of trials (in this case X=4), a fixed probability for each event (in this case $1/4$ for all events), and you want the probability of getting some combination of events (in this case, 1 of each kind).


The probably is $$\frac{4!}{4^4}$$ since the 4 keys may be pressed in any order.

  • $\begingroup$ ok. How do I know when to use discrete random variable or not? This problem doesn't use that, correct? $\endgroup$ – user274065 Mar 2 '16 at 13:59
  • $\begingroup$ It's the same as randomly drawing a ball from an urn of 4 differently coloured balls with replacement. It's the probably of drawing all 4 colours in the first 4 draws. $\endgroup$ – Paul Evans Mar 2 '16 at 14:08

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.