= Solution
For an <integrable random variable> $X$ and a <partition of a sample space> $(B_i)$, the <law of total expectation> states
$$
\boxed{\mathbb E[X]=\sum_{i:\mathbb P(B_i)>0}
\mathbb E[X\mid B_i]\,\mathbb P(B_i).}
$$
It follows by writing $X=\sum_iX\mathbf1_{B_i}$ and using $\mathbb E[X\mathbf1_{B_i}]=\mathbb P(B_i)\mathbb E[X\mid B_i]$. Integrability justifies the countable sum. The same equality is valid with nonnegative, possibly infinite expectations when $X\ge0$.
Back to article page