# Expected value of two successive heads or tails ( I do not understand the answer)

Problem: This is problem 33 of section 2.6 (conditioning) in Bertsekas, Tsitsiklis Introduction to Probability 2nd:

We are given that a coin has probability of heads equal to p and tails equal to q and it is tossed successively and independently until a head comes twice in a row or a tail comes twice in a row. What is the expected value of the number of tosses?

I don't understand the answer. Why $$E[X\mid H1,T2] = 1+E[X\mid T1]$$ Is there any relationship? Thanks!

• Not every one may have the book you refer to. Either provide a link to it or type out the question. – R_D Mar 29 '16 at 11:04
• Think about states. Other than at the Start or End, the only thing that matters is whether the last toss was $H$ or $T$. Both paths $HT$ and $T$ lead to state $T$, so the expectation (from there) is the same. The path $HT$ is one longer then the path $T$ so the expectation along that path is $1$ more. – lulu Mar 29 '16 at 11:11
• Er... I am sorry , but I have written the question here @ Rise – stander Qiu Mar 29 '16 at 15:24
• Yep, get it , thx@ lulu – stander Qiu Mar 29 '16 at 15:44

The equation $$E[X\mid H_1,T_2]=1+E[X\mid T_1]$$ reads as follows:
The $1+$ in the RHS stands for the first toss that missed to bring a result (the first was Heads and the second Tails, so the first toss in know irrelevant, it is a failure. But keep the Tails in the second toss, you might toss again Tails in the third so this is not yet a failure).
So, to make it clearer: In the first toss you tossed a Head and in the second Tails. Where are you standing now, just before the third toss? You have tossed Tails and you are starting over. So, the Heads in the first toss are irrelevant now and the only thing that matters is the Tails that you tossed in the second toss. Name this toss $1$ and start over. Do you see it now?