Aerith repeatedly flips a fair coin.

a) Find the expected number of flips to get two heads in a row.

b) Find the expected number of flips to get heads followed by tails.

#
a) Let $x$ be the expected number of flips. There is a $\frac{1}{4}$ chance that she gets two heads right away. There is a $\frac{1}{2}$ chance the first flip is tails, in which case she is basically starting over after the first flip, so it will take an expected $x+1$ flips total. Finally, there is a $\frac{1}{4}$ chance the first flip is heads and the second tails, in
which case she is basically starting over after 2 flips, so it will take an expected $x+2$ flips total. Thus we get

$$
x=\frac{1}{4} \cdot 2+\frac{1}{2}(x+1)+\frac{1}{4}(x+2)=\frac{3}{2}+\frac{3}{4} x .
$$

Solving this gives $x=6$.

b) Let the expected number of flips be $y$. There is a $\frac{1}{2}$ chance you get tails on the first flip, in which case she is basically starting over, so it will take an expected $y+1$ flips total. If she gets heads on the first flip, then she is just waiting until she first gets tails. She has a $\frac{1}{2}$ chance of getting tails on each flip, so it will be an expected 2 flips before she first gets tails, for an expected 3 flips total. Thus we get

$$
y=\frac{1}{2}(y+1)+\frac{1}{2} \cdot 3=\frac{1}{2} y+2 .
$$

Solving this gives $y=4$.