Expected number of flips needed that at least two heads and one tail have been flipped

2.9k Views Asked by At

The original question is shown below (References from the book of Introduction to Probability Models Tenth Edition):

A coin, having probability $p$ of landing heads, is continually flipped until at least one head and one tail have been flipped.

(a) Find the expected number of flips needed.

(d) Repeat part (a) in the case where flipping is continued until a total of at least two heads and one tail have been flipped.

I solve the question (a), but I am not sure my answer for question (d).

My answer is shown:

Let $N$ is the number of flips at least two head and one tail.

$$ \begin{align*} E[N] &= E[E[N|Y]]\\ &= E[N|HH]P(H)P(H) + E[N|HT]P(H)P(T) + E[N|TH]P(T)P(H) \end{align*} $$

$E[N|HH]$ means the first two are heads until a tail appeared;

$E[N|HT]$ means the first two are head and tail until a head appeared;

$E[N|TH]$ means the first two are head and tail a head appeared;

Let $E[T] = 1/q = 1/1-p$, $E[H] = 1/p$

Then, $E[N] = (2+1/q)pp + (2+1/p)p(1-p) + (2+1/p)p(1-p)$ ←Ans.

I am not sure whether I am right? Thanks a lot.

2

There are 2 best solutions below

4
On BEST ANSWER

Let $q=1-p$, $P=1/p$, and $Q=1/q$ for convenience. Some brief scratch paper work will verify that $pP=qQ=1$, $pQ=Q-1$, and $qP=P-1$.

Let's solve part (a) first, since it will be useful. Your first flip is either heads or tails. If it is heads, then we expect it will take $Q$ flips for the first tails to come up. If it is tails, then we expect it will take $P$ flips for the first heads to come up. Therefore, if $A$ is the expected number of flips before we see both heads and tails, then $$E[A]=p(1+Q)+q(1+P)\\=p+pQ+q+qP\\=1+(Q-1)+(P-1)=P+Q-1\\=(P-p)+(Q-q)$$

The same effort applies to the second part. Your first flip is either heads or tails. If it is heads, then we expect it will take $A$ flips to get another head and a tail. If it is tails, then we expect it will take $2P$ flips for two heads to come up. Therefore, $$E[B]=p(1+E[A])+q(1+2P)\\=p(P+Q)+q(1+2P)\\=pP+pQ+q+2qP \\=1+(Q-1)+q+2(P-1)\\=Q+q+2P-2\\=Q+q+2P-(2p+2q)\\=2P-2p+Q-q=2(P-p)+(Q-q)$$

Thanks to bof for recognizing that this collapses into an elegant form.

0
On

Let $p$ be the probability of heads $(0\lt p\lt1)$ and $q=1-p$ the probability of tails.

Define random variables $W,X,Y,Z$ as follows: $W$ is the number of flips until you have flipped at least two heads and one tail; the second head comes on the $X^\text{th}$ flip; the first tail comes on the $Y^\text{th}$ flip; and $Z=\min(X,Y)$. Then $W=\max(X,Y)=X+Y-\min(X,Y)=X+Y-Z$, so $$E[W]=E[X+Y-Z]=E[X]+E[Y]-E[Z]=\frac2p+\frac1q-(1+p)$$$$=\frac2p+\frac1q-(2p+q)=2\left(\frac1p-p\right)+\left(\frac1q-q\right)=\frac2p+\frac{p^2}q.$$


More generally, if $W_{m,n}$ is the number of flips until you have flipped at least $m$ heads and $n$ tails, $$E[W_{m,n}]=\frac mp+\frac nq-\sum_{i=0}^{m-1}\sum_{j=0}^{n-1}\binom{i+j}ip^iq^j$$ and in particular $$E[W_{m,1}]=\frac mp+\frac{p^m}q.$$