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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have another coin toss question:

Assume I am tossing a biased coin n times with probability p of coming up heads. What is the probability that x heads come up, before y consecutive tails?

A code example would be preferable.

share|cite|improve this question
    
Just to be clear about what you mean, is HTHTT a case where $x=2$ heads come up before $y=2$ consecutive tails? Or did you mean to say "$x$ consecutive heads"? – Barry Cipra Jan 8 '14 at 17:42
    
@BarryCipra, Yes, the heads do not need to be consecutive. – user27 Jan 8 '14 at 17:46
up vote 0 down vote accepted

Consider the following events:

$A_{x,y}$: You observe $x$ heads before $y$ consecutive tails.

$B_{x,y}$: You observe $y$ consecutive tails before $x$ heads.

Let $X_{i}$ follow a Geometric(p). This means that $X_{i}$ denotes the number of tail counts until you observe the first head with a biased coin. Observe that, in particular, $P(A_{1,y}) = P(X_{1} < y)$.

In order to solve for the general case, consider $X_{1},\ldots,X_{x}$ i.i.d. Geometric(p). I claim that:

\begin{align*} P(A_{x,y}) = P(X_{1} < y, \ldots,X_{x} < y) = P(X_{1} < y)^{x} \end{align*}

In order to understand the claim, you can think of $X_{i}$ as the number of observed tails it takes until you observe a head after having already observed $i-1$ heads in the past. Hence, we only need to find $P(X_{1} < y)$. This is well known and equals $1-(1-p)^{y}$.

Hence, in general $P(A_{x,y}) = (1-(1-p)^{y})^{x}$

share|cite|improve this answer
    
Thank you! Though this does not answer my question exactly, since I was asking for a specific maximum number of tosses. On second thought, I don't actually need to know this, so I marked your answer as accepted. – user27 Jan 9 '14 at 16:09

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.