Flipping coin $20$ times

combinatorics

Amy flipped a coin $20$ times, and got the sequence THHTTTHTTHHTHTTTTTHH. She noticed that $3$ times a heads followed a heads, $7$ times a tails followed a tails, $4$ times a tails followed a heads, and $5$ times a heads followed a tails. How many such sequences are possible?

Here's the solution given in the back of the book:

Counting heads and tails based on Amy's observations, we see that

  • $8$ times a heads follows something,
  • $7$ times something follows a heads,
  • $11$ times a tails follows something,
  • $12$ times something follows a tails.

This implies that any such sequence must have $8$ heads and $12$ tails, and must start with a T and end with an H.

Okay, I've followed the reasoning up to this point. But this next part I don't get.

"$3$ times a heads followed a head" means that the $8$ heads must occur in $8 – 3 = 5$ groups. There are $\binom{7}{4} = 35$ ways to split the $8$ heads into $5$ positive groups. Similarly, "$7$ times a tail followed a tail" means that the $12$ tails must occur in $12 – 7 = 5$ groups; there are $\binom{11}{4} = 330$ ways to split the into groups.

Therefore, there are $(35)(330) = 11550$ solutions.

Can anyone explain why it follows that $8$ heads must occur in $8 -3 = 5$ groups? And why $12$ tails must occur in $12 – 7 = 5$ groups?

Best Answer

Can anyone explain why it follows that $8$ heads must occur in $8−3=5$ groups?

As pointed out in comments, it seems they were counting number of beginnings of groups of $H$. Out of all $H$'s, we are given 3 of $H$s are preceeded by another $H$, so these 3 cannot be a beginning of a group, hence only the remaining $8-3=5$ of $H$s correspond to a group beginning.

However this seems unnecessarily complicated, as we can count number of these groups "directly", without complementing (subtracting) ... Since the whole sequence starts with $T$ (already recognized in the solution), we know all groups of $H$ must start with $TH$, and by problem statement there are exactly $5$ of these...

Or we can also count the number of ends of these groups directly - there are $4$ cases of $HT$, plus there is one case of $H$ at the end of the whole sequence (these are the only two ways the group of $H$ can end), so $4+1=5$ groups in total.

The tails case is similar...