A coin that comes up heads with probability p is continually flipped until the pattern T T T H appears. Let X denote the number of flips, find EX.
If I use Markov chains is there a simpler way to set up the states than using each state as a different combo? Or should I proceed in that way so that I have 16 states?
Probably the most straightforward approach is to set up a Markov chain with only 4 states (plus a stopping state that occurs when you finally get TTTH). The states are
Let $(E_i)$ be the expected number of moves to stopping after reaching state $S_i$. The number you are after is $E_0$.
The transition equations are:
$$ \begin{array} {c} E_3 = p +(1-p)(1+E_3) \\ E_2 = (1-p)(1+E_3) + p(1+E_0) \\ E_1 = (1-p)(1+E_2) + p(1+E_0) \\ E_0 = (1-p)(1+E_1) + p(1+E_0) \end{array} $$ You can handle these from the bottom up, always working with just 2 of the $E_i$: $$ E_1 = E_0 - \frac{1}{1-p} $$ $$ E_2 = E_0 - \frac{2-p}{(1-p)^2} $$ and so forth.