# Four consecutive heads from ten coin flips [duplicate]

This question already has an answer here:

If we flip a fair coin $10$ times, what is the probability we get $\ge 4$ consecutive heads?

An approach would be to consider the probability of all consecutive heads, cut off by tails, e.g.,

HHHHTxxxxx

THHHHTxxxx

...

HHHHHTxxxx

THHHHHTxxxx

...

but this is complicated, and also has a problem that some patterns overlap (e.g., HHHHTHHHHT). Is there a simpler way to do this?

## marked as duplicate by David K, Hamou, rogerl, BlackAdder, hardmathOct 13 '14 at 0:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

## 2 Answers

There are several ways of solving this, but for such a small number recursion may be the easiest.

Let $P_4(n)$ be the probability that you have at least $4$ consecutive heads after $n$ flips. Clearly $P_4(0)=P_4(1)=P_4(2)=P_4(3)=0$ and $P_4(4)=2^{-4}$.

For more flips, either you have achieved $4$ consecutive heads already or you have a string without $4$ consecutive heads followed by THHHH. So for $n\gt 4$: $$P_4(n)=P_4(n-1)+2^{-5}(1-P_4(n-5))$$.

I will leave the calculation to you, but you can check your result at OEIS A$050232$

• Expanding on this a little: it is the sum of having had a sequence already P4(n-1) with having the previous sequence end with THHH (only way to create a new 4 H sequence with the next toss), AND next toss being H AND there having been no valid sequence before that. They are all independent - So (1/2)^4.(1/2).(1-P4(n-5)). – Subu Sankara Subramanian Aug 19 at 14:22

Total number of possible outcomes is $2^{10} = 1024$. Two sequences of heads with length $4$ or more can be possible only in three following ways: $$HHHHTHHHHT$$ $$HHHHTTHHHH$$ $$THHHHTHHHH$$ $$HHHHHTHHHH$$ $$HHHHTHHHHH$$

Now try to find number of outcomes giving one sequence of $4$ tails in a row, so $n = 4$. Starting from the combination $$HHHH******$$ we reason in the following way: left and right adjacent results must be $T$ (as we currently mention only $n = 4$), the rest do not matter. So for each of $HHHH******$ and $******HHHH$ we have one definite $T$ and $5$ arbitrary values and should exclude $3$ outcomes (to not include abovementioned cases with two sequences of $4$ or more $H$ in a row). If $HHHH$ is not in the beginning or in the end of the line (so, the first $H$ is on the $2^{nd}-6^{th}$ position), then we have $2$ definite $T$ (before and after $HHHH$) and $4$ arbitrary values and should one outcome for $*HHHH*****$ and one for $*****HHHH*$. Hence, total number of suitable outcomes for $n=4$ is $$2 * (2^5 - 3) + 2 * (2^4 - 1) + 3 * 2^4 = 58 + 30 + 48 = 136$$
Similarly, for $n = 5$: $$2 * (2^4 - 1) + 4 * 2^3 = 30 + 32 = 62$$ For $n = 6, 7, 8$: $$2 * 2^{9-n} + (9-n) * 2^{8-n}$$ The total sum of suitable outcomes for $6$, $7$ and $8$ together is $$28 + 12 + 5 = 45$$ If $n=9$ then we have only $2$ possible sequence and $1$ for $n=10$.
Thus, the total sum is $$136+62+45+10+2+1 = 256$$ and the probability of such event is $\frac {256}{1024} = \frac 14$.