Given two random variables, we define the conditional variance of \(X\) given \(Y\) by

\[ \text{Var}(X | Y ) = E(X^2 | Y ) – (\,E(X | Y )\,)^2 \]

Show that

\[ \text{Var}(X ) = E (\text{Var}(X | Y ) ) +\text{Var}( E(X | Y ) ) \,. \]

Of course \( E(X | Y )\) is just random variable so we have that

\[ \text{Var}( E(X | Y ) ) = E [\,E(X | Y )^2\,] – [\,E(\,E(X | Y )\,)\,]^2 \]

also is is useful to recall that \(E(E(X | Y ))= E(X )\).