# How does conditional expectation work when the conditional value isn't given?

For example, if we have the following random variables:

$Y\sim Bern\left(\frac{1}{5}\right),$ $Z = \left\{ \begin{array}{l l} X & \quad \text{Y=1}\\ -4X & \quad \text{Y=0} \end{array} \right.$

(where $X$ is another random variable)

And I want to find $E\left(Z\middle| Y\right)$. The solution my course sheets give is: $E\left(Z\middle| Y\right)=\sum_y\left(Z=z\middle|Y=y\right) \cdot P(Y=y)=X\cdot\frac{1}{5}-4X\cdot\frac{4}{5}$ but according to the formal definition of conditional expectation, the sum should be done over values of $z$ and not $y$. This solution seems to be finding $E(Z)$ and not $E(Z|Y)$.

Calculating $E(Z|Y=0)$ or $E(Z|Y=1)$ is easy, because once the value of $Y$ is known then the value of $Z$ is known immediately.

But how can I solve $E(Z|Y)$ without a specific value being given for $Y$? More generally, how do I interpret conditional expectation when the conditional value isn't given?

• Essentially you want $E(Z|Y)=h(y)$ for some function $h$. I would assume you just define a piecewise function where has value when $y=1$ and other value when $y=0$ Commented Oct 17, 2014 at 7:58
• @Kamster The context of this problem was in finding $E(ZY)$ and doing it by calculating $E(E(ZY|Y))=E(Y\cdot E(Z|Y))$.. If $E(Z|Y)$ isn't a specific value (but rather a function), then is this solution valid?
– Lior
Commented Oct 17, 2014 at 8:02

Let $f:\left\{ 0,1\right\} \rightarrow\mathbb{R}$ be defined by $f\left(1\right)=1$ and $f\left(0\right)=-4$.

$\mathbb{E}\left(Z\mid Y=1\right)=\mathbb{E}X$ and $\mathbb{E}\left(Z\mid Y=0\right)=-4\mathbb{E}X$ so: $$\mathbb{E}\left(Z\mid Y\right)=f\left(Y\right).\mathbb{E}X$$

edit (comment doesn't work okay)

$$\mathbb{E}\left(Y.\mathbb{E}\left(Z|Y\right)\right)=\mathbb{E}\left(Y.f\left(Y\right).\mathbb{E}X\right)=\mathbb{E}X.\mathbb{E}\left(Y.f(Y\right))$$ It only remains to calculate $\mathbb{E}\left(Y.f(Y\right))$. You can do that :)

• Thanks for the explanation, I understand now that $E(Z|Y)$ isn't a set value but rather dependent on whatever value you insert into $Y$. How can I use this result in calculating something like $E(Y\cdot E(Z|Y))$?
– Lior
Commented Oct 17, 2014 at 8:09
• @Lior See edit. Commented Oct 17, 2014 at 8:17