Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

As a punishment for committing a particularly heinous crime you have been sentenced to jail under the following terms. Upon entering jail you draw a ball from a box containing balls numbered 0, 1, and 17 respectively. If you draw the ball numbered 0, you get out of jail immediately. If you draw 1 or 17, you replace the ball in the box and stay that many years in jail, at which time you draw again, under the same conditions. This is repeated until you draw the zero and go free. How long do you expect to be in jail? What is the variance of the time you will spend in jail?

What I did: let Y = time you have to stay in jail let X = the number on the first draw I think the goal is to find $EY = E(E(Y|X))$, so I would have to find: $E(Y|X=0)$, $E(Y|X=1)$, and $E(Y|X=17)$. I know that $E(Y|X=0) = 0$, but how do I calculate the other two conditional probabilities?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

If we neglect death, the expected time $t$ in jail satisfies the recurrence relation

$$ t=\frac13(0+(1+t)+(17+t)) $$

with unique solution $t=18$. The expected squared time $s$ satisfies

$$ s=\frac13\left(0+(1+2t+s)+(17^2+34t+s)\right) $$

with unique solution $s=36t+290=938$. Thus the variance of the time in jail is $s-t^2=614$, so the standard deviation is about $25$ years.

[Edit in response to the comments:]

By linearity of expectation, since we have a $1/3$ chance each of drawing the $0$, a $1$ or a $17$, the expected jail time $t$ is the average of the expected jail times in those three cases. If we draw the $0$, we're certain to go free immediately, so in this case the expected jail time is $0$. If we draw the $1$, we're certain to spend $1$ year in jail, and then we're back were we started, and the expected jail time beyond that is again $t$. Analogously for $17$.

To use linearity of expectation to derive the variance, we can express it as the expected squared jail time minus the square of the expected jail time. Again, if we draw the $0$, the squared jail time is certain to be $0$. If we draw the $1$, the expected squared jail time is the expectation value of $(1+\tau)^2$, where $\tau$ is the additional jail time from the draw after the $1$ year. That's $1+2\tau+\tau^2$, and the expected value of $\tau$ is $t$ and that of $\tau^2$ is $s$. Analogously for $17$.

share|improve this answer
    
Do you have any suggestions how to solve the question using the idea I described above? –  woaini Nov 5 '12 at 8:36
    
@woaini: Isn't that what I did? –  joriki Nov 5 '12 at 8:41
    
Can you explain the reasoning behind the recurrence relations? –  woaini Nov 5 '12 at 8:46
    
@woaini: I did. –  joriki Nov 5 '12 at 22:11

To compute the expectation and the variance, @joriki's approach is the one to use. This answer complements it, using somewhat less elementary tools.

A representation of $Y$ is $$Y=X+\mathbf 1_{X\ne0}\cdot\bar Y, $$ where $X$ and $\bar Y$ are independent and $\bar Y$ is distributed as $Y$. The distribution of $Y$ is fully encoded in this identity.

For example, taking expectations of both sides yields $\mathbb E(Y)=\mathbb E(X)+\mathbb P(X\ne0)\cdot\mathbb E(Y)$, thus $$ \mathbb E(Y)=\frac{\mathbb E(X)}{\mathbb P(X=0)}. $$ Likewise, $Y^2=X^2+2X\bar Y+\mathbf 1_{X\ne0}\cdot \bar Y^2$ and, taking expectations of both sides yields the identity $\mathbb E(Y^2)=\mathbb E(X^2)+2\mathbb E(X)\cdot\mathbb E(Y)+\mathbb P(X\ne0)\cdot\mathbb E(Y^2)$, that is, $$ \mathbb E(Y^2)=\frac{\mathbb P(X=0)\cdot\mathbb E(X^2)+2\mathbb E(X)^2}{\mathbb P(X=0)^2}. $$ More generally, for every nonnegative real number $s$, $g(s)=\mathbb E(\mathrm e^{-sY})$ solves $$ g(s)=\mathbb E(\mathrm e^{-sX}\cdot g(s\mathbb 1_{X\ne0}))=\mathbb P(X=0)+g(s)\cdot\mathbb E(\mathrm e^{-sX};X\ne0), $$ hence $$ \mathbb E(\mathrm e^{-sY})=\frac{\mathbb P(X=0)}{\mathbb P(X=0)+1-\mathbb E(\mathrm e^{-sX})}. $$ Finally, note that $Y$ may also be represented as $$ Y=\sum_{n=1}^{N-1}X_n, $$ where $(X_n)_{n\geqslant1}$ is i.i.d. and distributed as $X$ and $N=\inf\{n\geqslant1\,\mid\,X_n=0\}$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.