Tossing coin until we obtain a tail that immediately preceded by a head I was reading Introduction to Probability, 2nd Edition, and the following question appears as exercise $23 (b)$ in the 2nd chapter:

A fair coin is tossed repeatedly and independently until we obtain a tail that is immediately preceded by a head.
Find the PMF and the expected value of the number of tosses.

My question is: if we let $X$ be the random variable that represents the number of tosses until we obtain a tail that is immediately preceded by a head, can we decompose it into two random variables:
$$X = Y + Z$$
such that $Y$ is the number of tossed until a head appears, and $Z$ is the number of tosses until a tail appears (starting from the moment after the head appears).
The calculation of expectations shows that $E[X] = E[Y] + E[Z]$ but is that just a coincidence or what? and If is true can we assume that $Y, Z$ are independent and thus calculating the variance with ease?
Also, are there conditions for such decomposition so one can prove or disprove his solution?
 A: 
such that Y is the number of tossed until a head appears, and Z is the number of tosses until a tail appears (starting from the moment after the head appears).


*

*None of the tails before the first head can follow a head.

*All of the results between that first head and the next tail will be heads.

*Therefore that tail will be the first tail to follow a head; and it shall be immediately.

*Thus $Y + Z$ is the count of tosses until the first tail to immediately follow a head.

Use the Linearity of Expectation and the Law of Total Probability:
$$\mathsf E(X)=\mathsf E(Y)+\mathsf E(Z)$$
$$\mathsf P(X=k)=\sum_{j=1}^{k-1} \mathsf P(Y=j, Y+Z=k)$$
Additionally, since the toss of each coin is independent, the variables $Y$ and $Z$ are likewise independent as they represent counts for disjoint sequences of tosses (ie: the count for $Z$ proceeds only after the count for $Y$ terminates.)  So indeed:
$$\mathsf{Var}(X) = \mathsf {Var}(Y)+\mathsf {Var}(Z)$$

As you have noted: Both $Y$ and $Z$ follow a $\mathcal{Geo}_1(1/2)$ distribution.
A: One approach is to enumerate potential sequences and look for a pattern.
HH, TT
HTT, THH
HTHH, THTT
$E[X] = \frac 12\cdot 2 + \frac 14\cdot 3+\frac 18\cdot 4+\cdots$
And resolve this infinite series.
$E[X] = 3$
Whatever the first flip is, you have a $\frac 12$ probability of getting a match on the second flip, and $\frac 12$ of being the same distance from completion as you were just one flip before.
$E[X] = 1+\frac 12 + \frac 12E[X]\\
E[X] = 3$
