What is the expected number of (fair) coin flips to get a sequence HTT? I know similar questions have been asked before and that the answer should be $8$, but I can't seem to get my head around this one. I'd like to solve it using conditional expectation technique (rather than Markov chains).
So let $X$ be the random variable "number of flips needed to get the sequence HTT". I condition on first 3 flips. Then the set of 4 events $\{HTT, T, HTH, HH\}$ partitions the sample space. We have
$E(X) = E(X|HTT)P(HTT) + E(X|T)P(T) + E(X|HTH)P(HTH) + E(X|HH)P(HH),$
Now $E(X|HTT) = 3$, $\quad E(X|T) = 1+E(X).$
Corresponding probabilities are $P(HTT) = \frac{1}{8}$, $\quad P(T) = \frac{1}{2}$, $\quad P(HTH) = \frac{1}{8}$, $\quad P(HH) = \frac{1}{4}$.
What I don't know is how to compute $E(X|HTH)$ and $E(X|HH)$. Please help.
Let $X$ be the number of flips to get $HTT$.
The goal is to compute $E(X)$.
For each sequence $Y\in\{H,HT\}$, let $X|Y$ be the number of flips to get $HTT$ assuming an initial sequence $Y$ where the sequence $Y$ is allowed to potentially be used to form $HTT$ but where the flip count starts at $0$ after the initial sequence $Y$ (i.e., the length of $Y$ doesn't count toward the flip count).
Then we get the equations $$ \left\lbrace \begin{align*} E(X)&={\small{\frac{1}{2}}}\bigl(1+E(X|H)\bigr)+{\small{\frac{1}{2}}}\bigl(1+E(X)\bigr)\\[4pt] E(X|H)&={\small{\frac{1}{2}}}\bigl(1+E(X|H)\bigr)+{\small{\frac{1}{2}}}\bigl(1+E(X|HT)\bigr)\\[4pt] E(X|HT)&={\small{\frac{1}{2}}}\bigl(1+E(X|H)\bigr)+{\small{\frac{1}{2}}}\\[4pt] \end{align*} \right. $$ which is a system of $3$ linear equations in the $3$ unknowns $E(X),E(X|H),E(X|HT)$.
Solving the system yields $E(X)=8$.