# Chapter 9 Conditional Expectation

We learned about conditional distributions, but what about expectations? ($$E[X|Y=y]$$)

$E[X|Y=y] = \sum_x x P(X=x|Y=y) E[X|Y=y] = \int_x x f(x|y) dx E[E[X|Y]] = \sum_y E[X|Y=y]P(Y=y) = E[X]$

Example: A mouse is put into a labyrinth with 3 passages, at the end of the labyrinth there is cheese. First passage leads to the cheese in 3 mins. Second passage delays the mouse for 5 minutes and returns the mouse to the starting point. Third is the same as the second but the travel time is 10 minutes. It is equally likely that the mouse chooses any of those passages. What is the expected amount of time that the mouse will get to cheese?

Say $$T$$ is time and $$Y$$ is the passage chosen.

$E[T] = E[E[T|Y]] = 1/3 E[T|Y=1] + 1/3 E[T|Y=3] + 1/3 E[T|Y=3]$

$E[T|Y=1] = 3$ $E[T|Y=2] = 5 + E[T]$ $E[T|Y=3] = 10 + E[T]$

$E[T] = 1/3 (3 + 5 + E[T] + 10 + E[T]) = 18$