Confusion in sample space.

Solution 1:

The official answer is wrong. You are right.
We can solve the problem with conditional expectation.

  1. Let $X_1$ represent the number of times a fair coin needs to be tossed till the head appear for the first time, we calculate the expectation: $E(X_1)=2$
    (P.S. $X_1$ satisfies the geometric distribution.)
  2. Let $X_2$ represent the number of times a fair coin needs to be tossed till two consecutive heads appear for the first time, we have $$ \begin{align} E(X_2|X_1)&=\frac{1}{2}(X_1+1)+\frac{1}{2}(X_1+E(X_2)+1) \\ E(E(X_2|X_1))&=E(X_2)=E(X_1)+1+\frac{1}{2}E(X_2) \end{align} $$ then $E(X_2)=6$.

Solution 2:

Here is another way.

The diagram shows a state machine Excuse the crude image. enter image description here

Let $l_k$ be the expected length starting from State $k$. We want to compute $l_0$.

It is not hard to see that the set of sequences is a subset of the set of sequences ending in $HH$, so the $l_k$ are finite.

Note that $l_0 = {1 \over 2} (1+ l_0) + \frac12 (1+l_1)$ and $l_1 = {1 \over 2} (1+ l_0) + \frac12 (1)$. Solving gives $l_0 = 6$.