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}$.
Really interesting question! Thanks for posting. I don't think you have received an answer yet so I will take a bit of time to talk you through it all. Let us use a little formal notation and define some sets that will help us solve this problem. We are going to define and examine 3:
$\bf{\Omega:}$
Let us define $\Omega$ as our sample space of $\textbf{all}$ outcomes. I.e $\Omega$ is the set of all different sequences of $30$ coin flips. Clearly the size of $\Omega$ is $2^{30} $
$\bf{\mathcal{S}}: $
We define $\mathcal{S} \subset \Omega$ As the set of $\bf{all} $ successful sequences. i.e $HHHHHHHTHHHHTHHHHHHHHHHHHHHHTTT \in \mathcal{S} $ Clearly the probability we are after is $\frac{|\mathcal{S}|}{|\Omega|}$ and as we already have $|\Omega|$ all we need is $|\mathcal{S}|$ and we are done. Eyes on the prize.
$\bf{\mathcal{U}:}$
Now call $\mathcal{U}$ this set of unique ways to reach the position where #H = #T $+2$ for the first time. Elements of $\mathcal{U}$ are a sort of truncation of element from $\mathcal{S}$
For example: $HH , THHH, $and the example you gave are all some elements of $\mathcal{U} $
Notice that $\mathcal{U} \not \subset \Omega $ as $\mathcal{U} $ is $\textbf{not}$ a set of $\textbf{full}$ sequences of 30 flips, it is just the opening moves to reach this net $+2$ heads. Elements of $\mathcal{U} $ will correspond somewhat to elements of $\mathcal{F}$ eventually. For example:
$ \mathcal{U} \ni HH \not \in \Omega $ but $HHHHHHHTHHHHTHHHHHHHHHHHHHHHTTT \in \mathcal{S} \subset \Omega$ Every element of $\mathcal{S}$ has one unique corresponding element in $\mathcal{U}$
We are going to solve this problem in 5 distinct steps.
Firstly we will construct a partition of $\Omega$ into $3$ pieces
We will show that $2$ of these pieces belong to $\mathcal{S}$
We will then construct more elements of $\mathcal{S}$ that are not in our initial partitions of $\Omega$
We will then show that $\mathcal{S}$ contains only elements of these three sets, the two partitions of $\Omega$ and the final set we constructed in step 3
The sum of the size of these $3$ pieces make up the size of $\mathcal{S}$ (what we are after)
$\textbf{Step 1:}$
Call $\Omega_{16}, \Omega_{>16} $ and $\Omega_{<16}$ respectively the elements of $\Omega$ that contain 16, more than 16 and less than 16 heads. This is clearly a mutually disjoint partition.
Examples: 16 heads followed by 14 tails is in $\Omega_{16}.$ All heads and all tails a respectively in $\Omega_{>16}$ and $\Omega_{<16}$
$\textbf{Step 2:}$
Clearly elements of $\Omega_{16}$ and $ \Omega_{>16} $ are all elements of $\mathcal{S}$ as these are sequences with at least 16 heads and thus at most 14 tails and as such there exists (at least one) point in which we have 2 more heads than tails. Hence $\Omega_{16} \cup \Omega_{>16} \subseteq \mathcal{S} $
$\textbf{Step 3:}$
What I intended to do now is, for $\textbf{every single element of} $ $\bf{\Omega_{>16}}$, generate another element of $\mathcal{S} $ that is in $\Omega_{<16}$
For each element $x \in \Omega_{>16} \subset \mathcal{S} $ we shall call $u$ the corresponding element in $\mathcal{U}$ For example if $ x = HTHTHTHHHHHHHTTTHHHHHHHHHHHHHHH$ then $u = HTHTHTHH$ or if $ x = HHHHHHHHHHHHHHHHHHHHHHHHHHHHH$ then $u = HH$
Now call $l$ the "leftover" of $x$ when we take away $u$
Examples: if $ x = HTHTHTHHHHHHHTTTHHHHHHHHHHHHHHH$ then $u = HTHTHTHH$ and $l = HHHHHTTTHHHHHHHHHHHHHHH$
Now define a function "flipped", $f:$ Sequences $\to$ Sequences by flipping each tail to a head and each head to a tail.
Example: $f(HTHTTT) = THTHHH $
Now finally for each $x \in \Omega_{>16} $ define $g(x): \mathcal{S} \to \mathcal{S} $ by $g(x) := u +f(l) $
Example: If $x = TTHHHHHHHHHHHTHTHHHHHHHHHHHHHH $ then $g(x) = TTHHHH + f(HHHHHHHTHTHHHHHHHHHHHHHH) = TTHHHH + TTTTTTTHTHTTTTTTTTTTTTTT = TTHHHHTTTTTTTHTHTTTTTTTTTTTTTT$
Properties of g:
- If $x \in \mathcal{S} \implies g(x) \in \mathcal{S} $ as g does not change the inital elements $u$ that result in a net $+2$ heads
- Notice that $g$ is its own inverse as g never changes the beginning terms, it simply flips the last and the "flipping" function is clearly its own inverse. Hence $g(g(x)) = x $
- g is a bijection.
- $g : \Omega_{>16} \to \Omega_{< 16}$ or $g : \Omega_{<16} \to \Omega_{> 16}$
As if $x$ has $h$ heads and $t$ tails with $h_u$ heads in $u$ and $h_u - 2$ tails in $u$ with $h$ > 16 (i.e it is in $\Omega_{>16} $ ) then $g(x) $ has $h_u$ heads in $u$ and $t-(h^u-2) = t + 2 - h^u$ heads in $l$ Hence has $t + 2$ heads in total. And as $h = 30 - t > 16 $ we have $t +2 < 16 $ Hence $g(x) \in \Omega_{<16} \iff x \in \Omega_{>16} $ and visa versa
Define $ \Omega_{<16} \supset \Omega_{G} := g(\Omega_{>16}) \subset \mathcal{S} $ as everything in $ \Omega_{>16} $ is in $\mathcal{S} $ and property 1) of g shows that it will keep everything in $\mathcal{S} $
$\textbf{Step 4:}$
We now have $3$ disjoint sets: $\Omega_{16} , \Omega_{>16} , \Omega_{G} $
Define $\mathcal{B} := \Omega_{16} \cup \Omega_{>16} \cup \Omega_{G}$
We will prove $\mathcal{B} = \mathcal{S}$
We have already show that everything in $\Omega_{16} , \Omega_{>16} , \Omega_{G} $ is in $\mathcal{S}$ Hence $\mathcal{B} \subseteq \mathcal{S}$ Thus all we wish to show for equality is : $\mathcal{S} \subseteq \mathcal{B}$
Finally assume $ x \in \mathcal{S}$ we have $3$ options as to which of $\Omega_{16} , \Omega_{>16} , \Omega_{<16} $ $x$ belongs to. If $x$ is in one of the first two then great! As this would imply $x \in \mathcal{B} $
If $ x \in \Omega_{<16} \cap \mathcal{S} \implies g(x) \in \Omega_{>16} \implies g(g(x)) = x \in g(\Omega_{>16}) = \Omega_{G} \implies x \in \mathcal{B} $
Hence $\mathcal{S} \subseteq \mathcal{B}$ and as $\mathcal{B} \subseteq \mathcal{S}$ we have $\mathcal{B} = \mathcal{S}$
$\textbf{Step 5:}$
$|\mathcal{S}| = |\mathcal{B}| = |\Omega_{16} \cup \Omega_{>16} \cup \Omega_{G}| = |\Omega_{16}|+ |\Omega_{>16}|+|\Omega_{G}| $ (as they are disjoint sets.) $ = {30 \choose 16} + \sum\limits_{i=17}^{30}{30 \choose i} + |\Omega_G|$
However $\Omega_G$ is the image of an bijective map from a finite set and as such its size is equal to the size of its domain and as thus$ |\Omega_{>16}|=|\Omega_{G}| = \sum\limits_{i=17}^{30}{30 \choose i} $
And thus : $|\mathcal{S}| = {30 \choose 16} + 2\sum\limits_{i=17}^{30}{30 \choose i} $
And hence probability to have won this game, $\frac{|\mathcal{S}|}{|\Omega|} $ = $\frac{{30 \choose 16} + 2\sum\limits_{i=17}^{30}{30 \choose i}}{2^{30}} \approx 0.720100131817 $
I hope this helped.
Oskar
Best Answer
Let me fix your work.
Let $X$ be the number of heads in 6 coins (it's confusing that you use also $H$ for the same thing).
Then (abusing notation: $P(X) = P(X=X)$ ):
$$P(X | X>2) = \frac{P(X \cap X>2)}{P(X>2)} = \frac{P(X) \, I(X>2)}{P(X>2)} $$
where $$P(X)=\frac{1}{2^6}\binom{6}{X}$$ and $I()$ is the indicator function.
Then $$P(X>2) = \frac{1}{2^6}\left(\binom{6}{3} +\binom{6}{4}+\binom{5}{6}+\binom{6}{6}\right)=0.890625$$
And $$E[X | X>2]=\frac{3\binom{6}{3} +4\binom{6}{4}+5\binom{5}{6}+6\binom{6}{6}}{\binom{6}{3}+\binom{6}{4}+\binom{5}{6}+\binom{6}{6}}=\frac{156}{42}=3.7142857$$
This is essentially your second approach, which is the right one.
Your first method would be right if you were told that "the first two coins are head". But you are not told that, you are only told that at least two coins are head.