# Coin toss: run of successive heads or tails

A coin is tossed repeatedly. A head has probability $p$ and a tail $1-p$. The outcomes of the tosses are independent. Let $E$ denote the event that the first run of $r$ successive heads occurs earlier than the first run of $s$ successive tails. And let $A$ denote the outcome of the first toss. How do you show that

$\mathbb{P}(E|A=$ head$)=p^{r-1}+(1-p^{r-1})\mathbb{P}(E|A=$ tail$)$.

And what is a similar expression for $\mathbb{P}(E|A=$ tail$)$? And what is $\mathbb{P}(E)$? Thanks in advance!

For $i=1,\ldots,r,\;$ define event $B_i = \text{"First tail occurs on$i^{th}$toss"}$. Since the process ends after $r$ successive heads then, given initially that $A=H$, exactly one of these $r$ events must occur.

Note that, given $A=H$, if $B_r$ occurs then $E$ also occurs, which is to say $P(E\mid B_r\cap A=H) = 1$. Also, given $A=H$, if any of the other $B_i$ events occur then it is like we are starting over but, instead, initially given $A=T$. Therefore, conditioning on whether or not $B_r$ occurs,

$\\$

Next, we can find $P(E\mid A=T)$ by way of $P(E^c\mid A=T)$ and that is found in a similar way to $P(E\mid A=H)$. For $i=1,\ldots,s,\;$ define event $C_i = \text{"First head occurs on$i^{th}$toss"}$. Then,

\begin{eqnarray*} P(E\mid A=T) &=& 1 - P(E^c\mid A=T) \\ && \\ &=& 1 - [P(E^c\mid C_r\cap A=T)P(C_r\mid A=T) + P(E^c\mid C_r^c\cap A=T)P(C_r^c\mid A=T)] \\ && \\ &=& 1 - [1\cdot (1-p)^{s-1} + P(E^c\mid A=H)(1-(1-p)^{s-1})] \\ && \\ &=& 1 - [(1-p)^{s-1} + (1 - P(E\mid A=H))(1-(1-p)^{s-1})] \\ && \\ &=& (1-(1-p)^{s-1}) P(E\mid A=H). \qquad\qquad\qquad\qquad\qquad(2) \\ && \\ \end{eqnarray*}

We now proceed to find $P(E)$. Substitute $(2)$ into $(1)$:

\begin{eqnarray*} P(E\mid A=H) &=& p^{r-1} + (1-p^{r-1}) (1-(1-p)^{s-1}) P(E\vert A=H) \\ && \\ \therefore P(E\mid A=H) &\times& (p^{r-1} - p^{r-1}(1-p)^{s-1} + (1-p)^{s-1}) \;\; = \;\; p^{r-1} \\ && \\ P(E\mid A=H) &=& \dfrac{p^{r-1}}{p^{r-1} - p^{r-1}(1-p)^{s-1} + (1-p)^{s-1}} \qquad\qquad\qquad(3) \\ \end{eqnarray*}

Substitute this into $(2)$:

$\\$
Finally, using results $(3)$ and $(4)$,