# How do you compute E[z]?

X and Z are two random variables. X is equal to 1 with probability 0.3, and equal to 0 with probability 0.7. You also know that E [Z | X = 1] = 10; and E [Z | X = 0] = 1: Compute E [Z]?

I am studying for an exam and am stuck on this review problem. I was thinking that

E[z] = E [Z | X = 1] + E [Z | X = 0]

but I think that is too simple. I would really appreciate some helpful hints. Thank you.

We call this the Law of Iterated Expectation. \begin{align} \mathsf E(Z) & = \mathsf E(\mathsf E(Z\mid X)) \\[1ex] & = \mathsf E(Z\mid X{=}1)\,\mathsf P(X{=}1)+\mathsf E(Z\mid X{=}0)\,\mathsf P(X{=}0) \\[1ex] & = 10\cdot 0.3 + 1\cdot 0.7 \\[1ex] & = 3.7 \end{align}