2

A friend asked me the following question:

"In an experiment, we are tossing a fair coin 200 times. We say that a coin flip was a success if it's heads. What is the chance for having at least 6 consecutive successes?"

And according to him, the answer is nearly 100%.

My calculations were different. I'd like to know if I am mistaken or he is.

What I did:

I noticed that if we have 6 consecutive successes, then the first success in our winning streak can be anywhere from the first experiment to the 194'th experiment.

So when you think about it, we can have first 6 coin flips successful, and then whatever. or we can have first flip failure, and then 6 successes, and then whatever, or we can have 2 failures and then 6 successes and then whatever, and so on.

When you sum it all up, it looks like $S=(\frac{1}{2})^6+\frac{1}{2}*(\frac{1}{2})^6+(\frac{1}{2})^2*(\frac{1}{2})^6+...+(\frac{1}{2})^{193}*(\frac{1}{2})^6$

This is a geometric series, with $a_1=(\frac{1}{2})^6$, $n=194$, $q=\frac{1}{2}$.

Using the well known formula $S_n=\frac{a_1(q^n-1)}{q-1}$ I get that in our case $S_{194}=\frac{1}{32}$.

Was I mistaken somewhere? not really close to the 100% mark. Or is my friend mistaken.

Edit: I just realized my mistake. It's possible for example to have first one success, second one failure, and then 6 successes. I didn't take that into account. So my calculation is wrong. So how do I calculate this?

Oria Gruber
  • 12,739
  • My hunch is that this is combinatorially tedious to compute exactly, but it might be easier to get an estimate. – angryavian Dec 17 '14 at 03:10
  • One thing that is not clear to me is what happens if you get a run of $12$ heads in a row, do you count that as one occurrence of $6$ or more in a row or as $2$ occurrences of $6$? Also, what if you get $2$ runs of $7$ heads in the $200$ flips but "spaced" way apart like one comes early on and the other starts at toss/flip $170$ for example? – David Dec 17 '14 at 14:49
  • @David The question is such that if you actually get 6 heads in a row then you're done with the set of 200 tosses that you have and you start over again (for a fresh outcome of the experiment). The way its phrased so is to avoid confusions. – Sudarsan Dec 17 '14 at 18:54
  • @Sudarsan, I am not so sure about that. It makes a difference how the question is interpreted. For example, if when running a simulation, if you stop after the first run of $6$ heads vs. checking the remainder of the $200$ coin tosses. If you only consider the first occurrence, you may get one %, but if you count multiple occurrences per each $200$, you will get a different %. So I need the original poster, Oria Gruber, to tell me what is the correct interpretation before answering. – David Dec 18 '14 at 22:42

2 Answers2

2

Your evaluation is wrong in that, for example, if the third term is supposed to represent the probability of having the first "run" (6 consecutive heads) starting on coin 3, then you are assuming that the first two coins are tails, but that's not necessary (it could also be H T H H H H H H).

The correct derivation is not so simple. This problem has been asked (with variations) several times here. See for example here and linked question.

In Octave/Matlab:

> M=[ 1 1 0 0 0 0 0;
>     1 0 1 0 0 0 0;
>     1 0 0 1 0 0 0;
>     1 0 0 0 1 0 0;
>     1 0 0 0 0 1 0;
>     1 0 0 0 0 0 1;
>     0 0 0 0 0 0 2] /2 ;
> p=[1 0 0 0 0 0 0] * M^200 *[0 0 0 0 0 0 1]'
p =  0.80093

The simple approximation explained in the link above gives: $p\approx 1-(1-1/32)^{50}=0.79555\cdots$

Both agree in a probability of about 80%.

leonbloy
  • 63,430
1

Feller, "An Introduction to Probability Theory and Its Applications", Third Edition, gives a useful approximation on p. 325, equation 7.11.

Suppose we toss a possibly biased coin $n$ times, where the probability of a head is $p$ and $q = 1-p$. Let $q_n$ be the probability there is no run of $r$ successive heads. Then

$$q_n \sim \frac{1-px}{(r+1-rx)q} \cdot \frac{1}{x^{n+1}} $$

where $x$ is the smallest positive root of $1 - x + q p^r x^{r+1} = 0$.

For your problem, $p = q = 1/2$, $r = 6$, $n= 200$, and we find $x \approx 1.008276517$, so $q_n \approx 0.19906$ and $1-q_n$, the probability that there will be a run of at least 6 heads, is about $0.80093$.

awkward
  • 14,736