# when tossing a coin ten times, what is the probability of an outcome which has a string of 3 or more heads as well as a string of 3 or more tails?

here is an experiment from my Stat textbook

"Try this experiment: Write down a sequence of heads and tails that you think imitates 10 tosses of a balanced coin. How long was the longest string (called a run) of consecutive heads or consecutive tails in your tosses? Most people will write a sequence with no runs of more than two consecutive heads or tails. Longer runs don’t seem “random” to us. In fact, the probability of a run of three or more consecutive heads or tails in 10 tosses is greater than 0.8, and the probability of both a run of three or more heads and a run of three or more tails is almost 0.2."

I've already proven that "the probability of a run of three or more consecutive heads or tails in 10 tosses is greater than 0.8" using the same logic from the other question whichi is already posted in this forum: Four consecutive heads from ten coin flips

However, I've no idea how to prove "the probability of both a run of three or more heads and a run of three or more tails is almost 0.2", please help.

Actually, you can show @Henry's answer is exact: If you talk about number of sequences rather than probabilities, you get that N(heads run or tails run) equals N(heads run) + N(tails run) - N(Both run) and this is exact.

Another way to find the number of arrangements with both 3 running heads and 3 running tails is as follows:

Let $R(N$) be the number of arrangements of $N$ outcomes such that there are three consecutive of one particular result (say 3 consecutive heads) among the $N$. Then $$R(2) = R(1) = 0 \\ R(3) = 3 \\ R(N) = 2^{N-3} + R(N-3) + R(N-2) + R(N-1)$$ where the first term comes if the first three results are HHH, the second if they are HHT, the third if the first two are HT, and the last term if the first result is T. Using this recursion it is easy to tabulate values of $R(N) = \{ 1,3,8,20,47,107,238, 520 \}$.

Now define $B(N;1)$ as the number of arrangements of $N$ results giving both a run of heads and a run of tails, given that coming in we have only one consecutive head or tail. And define $B(N;1)$ as the number of arrangements of $N$ results giving both a run of heads and a run of tails, given that coming in we already have two consecutive heads or tails. Then the desired number of arrangements will be $2B(9;1)$ because on the first toss we get either heads or tails and in eaither case that leaves us with 9 tosses and a start of only 1 in a row. $$B(1;2) = B(2;2) = B(3;2) = B(1;1) = B(2;1) = B(3;1) = B(4;1) = 0 \\ B(4;2) = B(5;1) = 1; \\ B(N;1) = B(N-1;2)+B(N-1;1) \\ B(N;2) = R(N-1) + B(N-1;1)$$ To explain those last two equations, if you come in with a run of 1, the next toss either matches it (and you have a run of two with $N-1$ tosses to go) or it does not match and you have a run of 1 to start $N-1$ tosses. And if you come in with two in a row you either match those and have to find a run of three of the other specific type, or you miss and are in the one-in-a-row case with $N-1$ tosses left.

These equations are easy to tabulate, and you get in the last step $$B(9;1) = B(8;2)+B(8;1) = 60 + 37 = 97$$ so the desired probability is $\frac{2\cdot 97}{1024}$.

If you can show that in $10$ tosses:

• the probability of a run of three or more consecutive heads or tails is $\frac{846}{2^{10}}$
• the probability of a run of three or more consecutive heads is $\frac{520}{2^{10}}$
• the probability of a run of three or more consecutive tails is $\frac{520}{2^{10}}$

then the probability of a run of three or more consecutive heads and tails is about $$\frac{520}{2^{10}}+\frac{520}{2^{10}}-\frac{846}{2^{10}}=\frac{194}{2^{10}}$$ by inclusion/exclusion, and this is almost $0.2$.