Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I know that the probability of tossing $r$ heads in a row is eventually $1$, but how about tossing $r$ heads in a row before $s$ tails in a row? What's the easiest way to compute this probability? And what if the coin is biased, say, with probability $p$ showing a head?

share|improve this question
    
"in a roll"="in a row"? –  Byron Schmuland Sep 24 '12 at 12:31
    
@ByronSchmuland Seemingly. –  Did Sep 24 '12 at 14:44

1 Answer 1

Call $t=p^{r-1}$, $h=(1-p)^{s-1}$, and $A=[r\ \text{heads in a row before}\ s\ \text{tails in a row}]$.

Assume the first toss is a head. Then $A$ is equivalent to the event that $N$ is odd, where $N$ is the first $n$ such that $X_n=1$, where the sequence $(X_n)_{n\geqslant1}$ is independent with $\mathrm P(X_{2n-1}=1)=t$ and $\mathrm P(X_{2n}=1)=h$. In words, $X_n$ records whether the length of the $n$th row is at least $r$ or $s$, once started, or not. For every $n\geqslant0$, $\mathrm P(N=2n+1)=(1-t)^n(1-h)^nt$ hence $$ \mathrm P(A\mid\text{first toss is a head})=\sum\limits_{n\geqslant0}(1-t)^n(1-h)^nt=\frac{t}{t+h-th}. $$ Likewise, if the first toss is a tail, $A$ is equivalent to the event that $M$ is even, where $M$ is the first $n$ such that $Y_n=1$, where the sequence $(Y_n)_{n\geqslant1}$ is independent with $\mathrm P(Y_{2n-1}=1)=h$ and $\mathrm P(Y_{2n}=1)=t$. For every $n\geqslant1$, $\mathrm P(M=2n)=(1-h)^{n}(1-t)^{n-1}t$ , hence $$ \mathrm P(A\mid\text{first toss is a tail})=\sum\limits_{n\geqslant1}(1-h)^n(1-t)^{n-1}t=\frac{(1-h)t}{t+h-th}. $$ Finally, the first toss is a head with probability $p$ and a tail with probability $1-p$ hence $$ \mathrm P(A)=\frac{pt+(1-p)(1-h)t}{t+h-ht}=\frac{p^{r-1}(1-(1-p)^s)}{p^{r-1}+(1-p)^{s-1}-p^{r-1}(1-p)^{s-1}}. $$ If $p=\frac12$, this is $$ \mathrm P(A)=\frac{2^s-1}{2^r+2^s-2}. $$ Edit: A direct way to deduce $\mathrm P(A\mid\text{first toss is a tail})$ from $\mathrm P(A\mid\text{first toss is a head})$ is to note that these are probabilities of complementary events once one replaces $(t,h)$ by $(h,t)$.

share|improve this answer
    
Thank you. But this is the probability of $r$ heads before $s$ tails, not $r$ heads in a roll before $s$ tails in a roll. –  Voldemort Sep 24 '12 at 9:11
    
See revised version. –  Did Sep 24 '12 at 10:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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