Confusion in sample space. Let the random variable X represent the number of times a fair coin needs to be tossed till two
consecutive heads appear for the first time. The expectation of X is.
1st solution and This is the Official answer.
sample space
1.HH
2.THH
3.TTHH
4.TTTHH
5.TTTTHH
.............
$$ E[x]=\left(2*\frac{1}{4}\right)+\left(3*\frac{1}{8}\right)+\left(4*\frac{1}{16}\right)+\left(5*\frac{1}{32}\right)...........=1.5 $$
But I have confusion related to sample Space.
when we 4 times toss then the probability of 2 consecutive heads coming is $\left(\frac{2}{16}\right)$, not$\left(\frac{1}{16}\right)$.and so on in the next round toss. but in the official answer, they consider only $\left(\frac{1}{16}\right)$.
1.HH
2.THH
3.TTHH,HTHH
4.TTTHH,THTHH,HTTHH
5.TTTTHH,TTHTHH,THTTHH,HTTTHH,HTHTHH
...........................................
so, where I am thinking wrong?
 A: The official answer is wrong. You are right.
We can solve the problem with conditional expectation.

*

*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.)

*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$.

A: Here is another way.
The diagram shows a state machine Excuse the crude image. 
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$.
