We have a biased coin, P(heads) = p, X is the number of times we throw is before we see at least two heads and one tail in any order (and anywhere).

I know how to find the PMF for just one head or one tail. It would be P(X = n) = $p^n$ where n is 1, 2, 3, 4, ... and 0 otherwise.

I think I know how to find one head and one tail but I'm not sure. I think it would be P(X = n) = $p^n * (1-p)^n$ where n is 2, 3, 4... and 0 otherwise?

I get stuck with the order issue of the order when I need two heads and one tail. I could see something like $<h,t^x,h>$ or $<h^x,t>$ or $<t^x,h,t^x,h>$ where x is any number > 0.

For example if I got h,h,h,h,h,h,h,h,t I would stop after 9 tosses but if I saw t,h,h,h,h,h,h,h,h I would have stopped after 3 tosses and never seen the rest of the flips.

What I don't know is how to include this idea of order into the PMF.

Thank you!

  • $\begingroup$ Do we want the last three tosses to contain $2$ heads and $1$ tail (with this not happening earlier) or are two heads and one tail anywhere enough? For example, if we get HTTH do we stop or must we continue? $\endgroup$ – André Nicolas Feb 17 '16 at 17:30
  • $\begingroup$ Two heads and one tails anywhere count $\endgroup$ – Indigo Feb 17 '16 at 18:14

We condition on the result of the first two tosses.

If we get HT or TH (probability $2p(1-p)$) we are waiting for the third head. The probability that the additional waiting time is $k$ is $(1-p)^{k-1}p$. So in that case we have $\Pr(X=n)=(1-p)^{n-3}p$. That gives a contribution of $$2p(1-p)(1-p)^{n-3}p$$ to the pmf.

If we get HH, (probability $p^2$) the contribution to the pmf is, by a similar argument, $$p^2p^{n-3}(1-p).$$ Finally, we deal with the case TT. We are then waiting for two heads. The probability that this takes exactly $k$ additional trials is the probability of one head in the first $k-1$ additional trials, and head on the $k$-th. The probability of this is $\binom{k-1}{1}p^1(1-p)^{k-2}p$, for a total contribution to the pmf of $$(1-p)^2 \binom{n-3}{1}p(1-p)^{n-4}p.$$ Add up and, if desired, simplify.

  • $\begingroup$ I understand all but the n-3 choose 1 on the last case. This term grows rather than decreases with n which goes against my intuition that a larger number of flips is less likely. $\endgroup$ – Indigo Feb 17 '16 at 22:02
  • $\begingroup$ Indeed this part of the expression grows. The term $(1-p)^{n-4}$ decreases, in the long run faster than $n-3$ grows, so your general intuition is perhaps not badly violated. We need a total of two heads. If heads are fairly unlikely ($1-p$ close to $1$), it is not unreasonable that we will likely have to wait a while. Here I used the special case waiting time until the second "success" in the negative binomial distribution. $\endgroup$ – André Nicolas Feb 17 '16 at 22:12
  • $\begingroup$ Ahh I see, I was thinking it was n! vs p ^ n but the n! cancels out to just n so it works. Thanks! $\endgroup$ – Indigo Feb 17 '16 at 23:20
  • $\begingroup$ You are welcome. $\binom{n-3}{1}$ is just plain old $n-3$, but I wrote it in binomial coefficient form to give the "source" of the formula. That is also why I did not do the obvious simplifications. $\endgroup$ – André Nicolas Feb 17 '16 at 23:24

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.