# Probability Question relating prison break

I am stuck in a question regarding a prisoner trapped in a cell with 3 doors that actually has a probability associated with each door chosen(say $.5$ for door $A$, $.3$ for door $B$ and $.2$ for door $C$). The first door leads to his own cell after traveling $2$ days, whereas the second door leads to his own cell after $3$ days and the third to freedom after $1$ day.

"A prisoner is trapped in a cell containig three doors. The first door leads to a tunnel that returns him to his cell after two days of travel. The second leads to a tunnel that returns him to his cell after three days of travel. The third door leads immediately to freedom. a) Assuming that the prisoner will always select doors 1,2,and 3 with probability 0.5, 0.3, 0.2 what is teh expected number of days until he reaches freedom? b) Assuming that the prisoner is always equally likely to choose among those doors that he not used, what is the expected number of days until he reaches freedom? (In this version, for instance, if the prisoner initially tries door1, then when he returns to the cell, he will now select only from doors 2 and 3) c) For parts (a) and (b) find the variance of the number of days until the prisoner reaches freedom. "

In the problem I was able to find the $E[X]$ (Expected number of days until prisoner is free where X is # of days to be free). Where I get stuck is how to find the variances for this problem. I do not know how to find $E[X^2$ given door $1$ (or $2$ or $3$) chosen$]$. My understanding is that he does not learn from choosing the wrong door. Could anyone help me out? Thank you very much

• Wait, you are trying to find the expected value of the square of the time? I couldn't tell from your question. Mar 30 '13 at 19:08
• Thank you I already edited the question. Mar 30 '13 at 19:42
• The problem is incompletely described. If the prisoner returns to her cell, does she try again, and again? Do the same probabilities apply, that is, has she learned nothing? What is the definition of $X$? Mar 30 '13 at 19:42
• André, forgive me for not clarifying the question. Is that better now? Mar 30 '13 at 19:54
• Note that you have different numbers in the first and second paragraphs. - In (b), there are only 5 possible sequences of door-tryings; just compute each of those 5 probabilities, and you should be able to compute the expectation, variance, and any other measure of the probability distribution. Mar 31 '13 at 2:20

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?

• Thank you for your input. I am not so sure you could do that, since only the X term is squared. This is what I mean : $E[X^{^{2}}|D=1]=E[X^{^{2}}]+2$ and $E[X^{^{2}}|D=2]=E[X^{^{2}}]+3$ What do you think about that? Sorry for the delay. Apr 16 '13 at 19:40

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$$

• I have to take a look at your solution and try to understand it. Once I got it, I will get back to you. This will take sometime. Thank you. Apr 18 '13 at 4:51

Let $J$ be the number of days spent in jail. Let $D$ be the chosen door. We know that if the prisoner chooses door $1$. His expected time will be $2 + E[J]$ because the process restarts. If he chooses door $2$, his expected time is now $3 + E[J]$

$$\begin{eqnarray} E[J] & = & \sum _{i=1}^3 E[J | D = i] P(D = i) \\ & = & (2 + E[J]) 0.5 + (3 + E[J]) 0.3 + (0) 0.2 \\ & = & 1.9 + 0.8 E[J] \end{eqnarray}$$

which results in $E[J] = 9.5$

Now in order to find the variance let's use the second moment,

$$\begin{eqnarray} E[J^2] & = & \sum _{i=1}^3 E[J^2 | D = i] P(D = i) \\ & = & (2 + E[J])^2 0.5 + (3 + E[J])^2 0.3 + (0)^2 0.2 \\ & = & (4 + 4E[J] + E[J^2]) 0.5 + (9 + 6E[J] + E[J^2]) 0.3\\ & = & 2 + 2E[J] + 0.5E[J^2] + 2.7 + 1.8E[J] + 0.3E[J^2]\\ & = & 4.7 + 3.8 E[J] + 0.8 E[J^2] \\ & = & 4.7 + 3.8 (9.5) + 0.8 E[J^2] \end{eqnarray}$$

Which means that: $0.2 E[J^2] = 40.8 \Leftrightarrow E[J^2] = 204$.

And the Variance equals: 204 - $E[J]^2$ = 204 - 90.25 = 113.75.