I recently failed to solve a problem relating to conditional expectation. The problem states:

A student is initially outside. He is given the choice with a probability of 0.4 of going to the playground, 0.3 of shopping in the mall and 0.3 of returning home. If he is in the playground, he takes 2 hrs of time and then decides to stay in the playground again or return back home. (he can continue to decide to stay in playground like a recursive process) Similarly, If he is in the mall, he takes 3 hrs of time and then decides to stay in the mall again or return back home. (he can continue to decide to stay in mall like a recursive process) For all cases, it takes 1 hr to return home. what is the expected hours the student was outside home?

Initially, I thought about using Law of Total Expectation here. Like:

\begin{align*} E[X] &= E[X|Y=1]P(Y=1) + E[X|Y=2]P(Y=2) + \\ &\,\,\,E[X|Y=3]P(Y=3) \end{align*}

X = total # hrs outside, Y = choice.

But I don't know how to handle the conditional expectations for each individual event. For instance, in the case where students stay in the playground, it would be

$$E[X|Y=1] = 2 + 1/0.4.$$

Is it correct? Similarly for staying in the mall, it would be

$$E[X|Y=2] = 3 + 1/0.3.$$

Am I correct or am I making some very basic errors? Help would be appreciated.


1 Answer 1


Your formula for the law of total expectation is correct : $$\mathbb E[X] = \mathbb E[X\mid Y=1]\mathbb P(Y=1) + \mathbb E[X\mid Y=2]\mathbb P(Y=2) +\mathbb E[X\mid Y=3]\mathbb P(Y=3)\tag1 $$ here is how to deal with the conditional expectations:

  • For the case $Y=1$ (when the student goes to the playground), you are being told that the student plays for 2 hours before deciding between playing 2 more hours or going home, in a recursive manner.
    By applying the law of total expectation to $X\mid Y=1$, we get the recursion $$\mathbb E[X\mid Y=1] = \mathbb E[X\mid Y=1, \text{student stays}] \mathbb P(\text{student stays}) + \mathbb E[X\mid Y=1, \text{student leaves}] \mathbb P(\text{student leaves})$$ Assuming that he stays in the playground with probability $0.4$, we get $$\mathbb E[X\mid Y=1] = (2+\mathbb E[X\mid Y=1])\cdot0.4 + 1\cdot0.6 $$ Which yields $\mathbb E[X\mid Y=1] \approx 2.33$
  • By the same reasoning, we find for the case $Y=2$ that $$\mathbb E[X\mid Y=2] = (3 + \mathbb E [X\mid Y=2])\cdot0.3 + 1\cdot0.7 $$ From which you can deduce $\mathbb E[X\mid Y=2]$
  • Lastly, the easiest case is $Y=3$, in which the student heads straight home (which takes one hour) : $$\mathbb E[X\mid Y=3] = 1 $$ You can now plug in all these values of the conditional expectations in the original equation $(1)$, and get an equation in $\mathbb E[X]$ that is easy to solve.
  • $\begingroup$ Thanks. For conditional expectation, I believe the student if staying in playground isn't restarting the process from scratch but either chooses to stay in playground or go home in the next iteration. (The original process had student with three choices: playground, mall or home) The same true for the mall. Shouldn't it be $$E[X|Y=1] = (2 + E[X|y=1] )0.4 + 0.6 $$ for playground and $$E[X|Y=2] = (3 + E[X|y=2] )0.3 + 0.7 $$ for mall? $\endgroup$ Oct 16, 2022 at 11:47
  • $\begingroup$ Oops, my bad I misread the problem statement. But anyway yes, you got it right : you need to solve for $E[X|Y=1]$ and $E[X|Y=2]$ separately and then plug in to the expression of $E[X]$. I will edit my answer shortly $\endgroup$ Oct 16, 2022 at 12:38
  • $\begingroup$ @ImranFarid see my edit. Hope it's clear enough ! $\endgroup$ Oct 16, 2022 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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