Probability Question relating prison break
Let's go through it for part (a) first. Let $X$ denote the number of days until this prisoner gains freedom. I think you already have $E[X|D=1], E[X|D=2], E[X|D=3]$:
$E[X|D=1] = E[X + 2]$
$E[X|D=2] = E[X + 3]$
$E[X|D=3] = E[0]$
So we have
$E[X^2|D=1] = E[(X + 2)^2] = E[X^2] + 4E[X] + 4$
$E[X^2|D=2] = E[(X + 3)^2]= E[X^2] + 6E[X] + 9$
$E[X^2|D=3] = E[0^2] = 0 $
and now you can solve it b/c you have $E[X]$ already?
You can find the generating function for the discrete probability distribution. For example, this will give the probabilities for stopping time N, as the corresponding coefficient of the $z^{-N+2}$ term. $$p+\frac{q}{z}+\frac{(p*z+q)^2}{z*(z^3-p*z-q)} $$ where $p$ is the probability for delay 2 (I guess door A) and $q$ for delay 3 (door B).
$$ \text{Prob}(N=1) = 0 \\ \text{Prob}(N=2) = p \\ \text{Prob}(N=3) = q \\ \text{Prob}(N=4) = p^2 \\ \text{Prob}(N=5) = 2pq $$