Probability – Expected Value of Two Successive Heads or Tails

conditional probabilityprobability

Problem:
This is problem 33 of section 2.6 (conditioning) in Bertsekas, Tsitsiklis intro to probability text.

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 isthe expected value of the number of tosses?

Solution:

Let $X$ be a random value that tracks the number of tosses. In addition, let $H_k, T_k$ be the event that a head or tail comes up on the kth flip respectively. The solution I am looking at involves using total expectation theorem.

I outline the following steps in the solution.

We can partition the sample space into $H_1$ and $T_1$, allowing us to invoke the total expectation theorem. Hence,

$E[X] = pE[X|H_1] + qE[X|T_1]$

Again by total expectation theorem, we can utilize another partition to obtain

$E[X|H_1] = pE[X|H_1,H_2] + qE[X|H_1,T_2] = 2p + q(1 + E[X|T_1])$

$E[X|T_1] = qE[X|T_1,T_2] + pE[X|T_1,H_2] = 2q + p(1+E[X|H_1])$

Stuck:
The solution follows up by saying that we can combine the above two relations and use the fact that p+q = 1 to obtain

$E[X|T_1] = \frac{2+p^2}{1-pq} , E[X|H_1] = \frac{2+q^2}{1-pq}$

I have been staring at this for a while now, but I cannot seem to see the steps of the computation. I'd be very grateful if someone could fill in the details regarding the computation. Thank you.

Best Answer

Let $x=E(X|H_1)$ and $y=E(X|T_1)$. Then we have the two equations $$x=2p+q+qy\quad\text{ and}\quad y=2q+p+px.$$ Two linear equations in two unknowns.

Solve in any of the familiar ways, for example by substituting $2p+q+px$ for $y$ in the first equation.