# What are the odds of flipping a coin 100 times and seeing HHHHT? [closed]

What are the odds of flipping a coin 100 times and seeing exactly four consecutive heads? Any more than four heads in a row, such as "HHHHH" would not be considered a string of four consecutive heads. Seeing 10 sets of "HHHHT" would allow a max of 20 consecutive patterns. How would you expect to find the number of times an isolated string of exactly 4 heads in a row in $n$ coin flips?

## closed as off-topic by Did, Michael Albanese, Edward Jiang, Zain Patel, Chill2MachtJul 25 '16 at 0:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Did, Michael Albanese, Edward Jiang, Zain Patel, Chill2Macht
If this question can be reworded to fit the rules in the help center, please edit the question.

• I don't understand, you seem to ask many questions at once. – Jorge Fernández Hidalgo Jul 24 '16 at 17:48
• Is your question the expected number of times you would expect to find $HHHHT$ in a sequence of $100$ flips? – Jorge Fernández Hidalgo Jul 24 '16 at 17:49
• I flip a coin 100 times. How many times should I see HHHH? A HHHHH or anything greater will not be considered as a HHHH. – Triumph Jul 24 '16 at 17:51
• No just HHHHT but THHHHT – Triumph Jul 24 '16 at 17:52
• I am pretty sure the question is "Suppose I flip a coin 100 times. How many subsequences of exactly four heads in a row (no more or less) should I expect to see?" – user326210 Jul 24 '16 at 17:54

## 3 Answers

In any sequence of $100$ flips, “mark” each spot $HHHH$ occurs (and occurs not within a longer run of $H$’s) between the middle $H$’s. For example, the sequence $$HHTHHHTTTHHHHTHT\dots TTHHHHHTHTHHTTHHHH$$ would be marked $${HHTHHHTTTHH}^{\color{red}|\!}{HHTHT\dots TTHHHHHTHTHHTTHH}^{\color{red}|\!}{HH}^{}.$$

Among the $97$ positions where marks could occur (from after the first two flips to before the final two), a mark does appear in each of the $2^{\rm nd}$ through $96^{\rm th}$ ($95$ in all) of those spots (as $THH^{\color{red}|\!}HHT$) with probability $\frac{1}{2^6}$ (the chance the surrounding sequence of six flips is $THHHHT$). In the first and last positions, the probability is $\frac{1}{2^5}$ (the chance of $HH^{\color{red}|\!}HHT$ for position $1$ and $THH^{\color{red}|\!}HH$ for position $97$).

By the linearity of expectation, the expected number of marks is $95\cdot\frac1{2^6}+2\cdot\frac1{2^5}=\frac{99}{64}$.

[Added] It may be easier to focus on the $H$’s and $T$’s instead of the spaces between them, so another way to mark the runs-of-$4$ is to color in red the last $H$ of each run, like $$HHTHHHTTTHHH\color{red}HTHT\dots TTHHHHHTHTHHTTHHH\color{red}H.$$ The first three $H$’s are colored red with probability $0$, the fourth with probability $\frac{1}{2^5}$, the next $95$ with probability $\frac{1}{2^6}$, and the last with probability $\frac{1}{2^5}$, giving the same result.

• Is it possible for you to let me know what the answer would be for 8 out of 100? – Triumph Jul 27 '16 at 1:48
• Try to modify my answer for runs of $8$. There are no new situations that come up, so it shouldn’t be very hard. – Steve Kass Jul 27 '16 at 18:32

This seems to fall easily to linearity of expectation. Let $a_1,a_2\dots a_n$ be your sequence of outcomes.

Let $X_1$ be the indicator variable that $a_1,a_2,a_3,a_4=H$ and $a_5=T$

Let $X_{97}$ be the indicator variable that $a_{96}=T$ and $a_{97},a_{98},a_{99},a_{100}=H$

Finally, for $2\leq n \leq 96$ let $X_n$ be the indicator that $a_{n-1}=T,a_n,a_{n+1},a_{n+2},a_{n+3}=H,a_{n+4}=T$

The random variable you want is $\sum_{i=1}^{97} X_n$.

By linearity of expectation its expectation is $E[X_1]+95E[X_2]+E[X_{97}]=\frac{1}{32}+\frac{95}{64}+\frac{1}{32}=\frac{99}{64}$

• What I answered is the expected number of times you can find a substring of the form $HHHH$ that does not have another $H$ to either side. Assuming the flips are independent, and each outcome has probability $\frac{1}{2}$. – Jorge Fernández Hidalgo Jul 24 '16 at 18:16
• When they are four $H$ it is $\frac{99}{64}$ and when there are three It is $\frac{1}{16}+\frac{96}{32}+\frac{1}{16}$. – Jorge Fernández Hidalgo Jul 24 '16 at 18:45
• then it is $\frac{1}{2^{11}}+\frac{89}{2^{12}}+\frac{1}{2^{11}}$ – Jorge Fernández Hidalgo Jul 24 '16 at 19:31
• if you throw $10000$ times then you should get $10$ consecutive (and not more) an expected number of $\frac{1}{2^{11}}+\frac{9989}{2^{12}}+\frac{1}{2^{11}}$ – Jorge Fernández Hidalgo Jul 24 '16 at 19:52
• I told you, $\frac{1}{2^{11}}+\frac{9989}{2^{12}}+\frac{1}{2^{11}}$, which is approximately $2.43$ – Jorge Fernández Hidalgo Jul 24 '16 at 21:10

For $i=1$ to $97$, let random variable $X_i$ be equal to $1$ if there is a string of HHHH that begins at $i$ and does not extend, and let $X_i=0$ otherwise. We want the expectation of $X_1+\cdots+X_{97}$. By the linearity of expectation, this is $E(X_1)+\cdots+E(X_{97})$.

So we need only calculate the $\Pr(X_i)=1$.

These are not all equal. If $i=1$ or $i=97$, we have $\Pr(X_i=1)=\frac{1}{32}$. For all the other $i$, we have $\Pr(X_i=1)=\frac{1}{64}$. That is because in all but "end" cases, the string of $4$ H must be flanked by T on both sides.

The required expectation is therefore $2\cdot \frac{1}{32}+95\cdot\frac{1}{64}$.

• Would this factor in the possibility of 10 heads in a row that would change you 100 coin flips into 90. From the start you should automatically drop the 100 flips down to 50 with the assumption that the other 50 flips would be tails correct? What are the odds of 5 heads or 6 heads each one of those will take more flips away from what you need to achieve 4 heads. – Triumph Jul 24 '16 at 18:14
• The expectation calculation (indirectly) takes care of $10$ heads in a row by not counting them, because then $X_i=0$ for $i=1$ to at least $11$. – André Nicolas Jul 24 '16 at 18:17