much more clearly stated than my babbling. I’m tickled that I’ve shown that it can be evaluated one flip at a time, based merely on the parity of contiguous Hs.
here is my argument, expressed by plagiarizing your expression:
Let e be the expected number of flips from the initial (even) state
There are two states that are easy to analyze and cover all the possibilities:
E is the initial state, it also represents the state of having seen an even number of H (including zero), since the beginning or the most recent T.
O is the odd state, representing the fact of having seen an odd contiguous run of H.
State E requires e more flips. In this state, H changes to state O, while T remains in state E
State O requires o more flips. In this state, H changes to state E, while T terminates with a win.
That allows us to write an expression for x as the sum of these terms, weighted by their respective probabilities, all 1/2.
e = 1/2{1+e} + 1/2{1+o}
o = 1/2{1+e} + 1/2
substitute o into e
e = 1/2{1+e} + 1/2{1+1/2{1+e} + 1/2}
= 1/2{1+e} + 1/2+1/4+e/4 + 1/4
= 3/2 + 3e/4
e/4 = 3/2
e = 6