1. ## Consecutive Heads/Tails in weighted coin toss

Hi,

Supposing you have a weighted coin which lands heads up 70% of the time and tails up 30% of the time.

Q. What is the probability that it lands on tails 20 or more times in a row if I did this 1000 times?

*Also could I have the equation on how you worked this out so that I can change the weighting, number of trials etc (I need to know this for my business!!!)

Thank you very much.

Zak

2. Originally Posted by slyone
Hi,

Supposing you have a weighted coin which lands heads up 70% of the time and tails up 30% of the time.

Q. What is the probability that it lands on tails 20 or more times in a row if I did this 1000 times?

*Also could I have the equation on how you worked this out so that I can change the weighting, number of trials etc (I need to know this for my business!!!)

Thank you very much.

Zak
Hi Zak,

I don't know how to compute the probability you seek exactly, but I think I can give a pretty good approximation.

To generalize the problem, let's suppose you have a possibly biased coin which comes up tails with probability p and heads with probability q, where p+q = 1. You flip the coin N times and look for a run of R or more successive tails. We would like to know the probability that at least one such run occurs. The "at least one" part is my interpretation of your problem statement; you didn't say that, but I'm guessing that's what you mean.

As I said, I haven't come up with a reasonable way to compute the exact probability of having at least one run of length R, but think I can solve a closely associated problem which can be used to obtain an approximate answer.

Let $\lambda$ be the expected number of runs of R or more successive tails. It can be shown that

$\lambda = p^R \,[(N - R) q + 1]$.

That is an exact result, not an approximation. (I derived this formula from scratch, but I suppose it must be a well-known result.) So in your case, for example, we have N = 1000, R = 20, p = 0.3 and q = 0.7, so $\lambda = 2.4 * 10^{-8}$.

Now comes the approximation. Let's suppose the number of runs, say X, has a Poisson distribution with mean $\lambda$. It doesn't, but for small values of $\lambda$ it should be pretty close. Then

$Pr(X > 0) = 1 - Pr(X = 0) = 1 - e^{-\lambda}$.

For small values of $\lambda$ this value can be hard to compute precisely, but we can use another approximation:

$1 - e^{-\lambda} = \lambda$ (approximately),

so the answer to your question is (once again, approximately) $\lambda = 2.4 * 10^{-8}$.

3. ## Re: Consecutive Heads/Tails in weighted coin toss

Hi, great answer from awkward. But how did you figure out the expected number of runs of R or more successive tails:
\lambda = p^R \,[(N - R) q + 1].
You derived this formula from scratch. I tried to figure by myself this result and tried to Google it and did not find an answer.
Could you share your Derivation ?
Thanks
Otto

4. ## Re: Consecutive Heads/Tails in weighted coin toss

The chance of getting 20 tails in a row in 20 tosses is 0.320. When tossing a coin 1000 times there is are (1000-20+1)=981 times where you can have 20 of an outcome in a row. Since it is 20 or more we don't care what the other 980 tosses are.
Since the chance of getting 20 in a row in one attempt is 0.320 and you get 981 attempts the chance of getting 20 in a row through the whole 1000 tosses is 981(0.320)

5. ## Re: Consecutive Heads/Tails in weighted coin toss

Originally Posted by ottof
Hi, great answer from awkward. But how did you figure out the expected number of runs of R or more successive tails:
$\lambda = p^R \,[(N - R) q + 1]$
You derived this formula from scratch. I tried to figure by myself this result and tried to Google it and did not find an answer.
Could you share your Derivation ?
Thanks
Otto
Let
$X_i = \begin{cases} 1 &\text{if there is a run of at least R tails starting with flip i}\\0 &\text{otherwise} \end{cases}$
Then $X_1 = 1$ if the first R flips are tails,
but for $i > 1$, $X_i = 1$ if the (i-1)st flip is a head and the next R flips are tails.

So
$E(X_1)=\Pr(X_1 = 1) = p^R$
and
$E(X_i)=\Pr(X_i = 1) = q p^R$ for $i > 1$

Applying the theorem that E(X+Y) = E(X) + E(Y), we have

$E \left( \sum_{i=0}^{N-R+1} X_i \right) = \sum_{i=0}^{N-R+1} E(X_i) = p^R + (N-R)q p^R = p^R [(N-R)q + 1]$