iterated expectation
\[ \mathbb{E}[X] = \mathbb{E}[\mathbb{E}[X \mid Y]] \]
1. proof for two finite discrete random variables
\[\begin{align*} \mathbb{E}[\mathbb{E}[X \mid Y]] &= \sum_{y} P(Y=y) \mathbb{E}[X \mid Y]] \\ &= \sum_{y} P(Y=y) \sum_{x} P(X = x \mid Y = y) x \\ &= \sum_{y} \sum_{x} P(X = x \mid Y = y) P(Y = y) x \\ &= \sum_{y} \sum_{x} P(X = x, Y = y) x \\ &= \sum_{x} x \sum_{y} P(X = x, Y = y) \\ &= \sum_{x} x P(X = x) \\ &= \mathbb{E}[x] \end{align*}\]