On average, how many times do you need to flip a fair coin before you have seen a run of an odd number of heads, followed by a tail?
The answer in the book is 6 which is obtained through solving the equation below which I understand
x = 1/2*(x+1) + 1/4*(2+x) + 1/4*1
What I don't understand why I get a different answer in book when I calculate the expected value of counts.
S = 2*(1/2)^2 + 4*(1/2)^4 + 6*(1/2)^6 + 8*(1/2)^8 + ....
S = 8/9.
why it is not equal to 6???
It's much less than $\ 6\ $ because your series $\ S\ $ doesn't give you the correct expected number for the count. It's evident from your expression for $\ S\ $ that it assumes there are no sequences of $\ 3, 5$ or $\ 7\ $ tosses and only one sequence of each of $\ 4, 6$ or $\ 8\ $ tosses where your first odd sequence of heads followed by a tail terminates. But that's not correct. The sequence $\ THT\ $ of $\ 3\ $ tosses, for instance, is obviously one where you've just seen your first run of an odd number of heads followed by a tail. In fact, it's possible to show that the number of sequences of $\ n\ $ tosses where you've first seen your run of odd heads followed by a tail is the $\ (n-1)^\text{nth}\ $ Fibonacci number $\ F_{n-1}\ $ (with $\ F_0=0, F_1=1\ $ etc.). A correct series for the expected count is therefore $$ S=\sum_{n=2}^\infty \frac{nF_{n-1}}{2^n}\ , $$ and this does in fact sum to $\ 6\ $.