= Solution
For an <integrable random variable> $X$, the <law of total expectation> on the finite or countable measurable partition is
$$
\boxed{\mathbb E(X)=\sum_{i:\,\mathbb P(B_i)>0}\mathbb P(B_i)\mathbb E(X\mid B_i).}
$$
Here $\mathbb E(X\mid B_i)=\mathbb E[X\mathbf1_{B_i}]/\mathbb P(B_i)$ for positive-probability cells; null cells contribute zero and need no conditional value. The series is absolutely convergent since its absolute terms sum to at most $\mathbb E|X|$. For a nonnegative $X$, the same identity is valid with possible value $+\infty$.
Back to article page