在有些时候,直接计算随机变量的方差非常麻烦,此时可以用方差分解公式,将方差分解为条件期望的方差加条件方差的期望:
\[\text{Var}(X)=\text{Var}[\text{E}(X|Y)]+\text{E}[\text{Var}(X|Y)]
\]
证明非常简单,注意到
\[\begin{aligned}
\text{Var}[\text{E}(X|Y)] =& \text{E}\left\{\left[\text{E}(X|Y)\right]^2\right\} - \left\{\text{E}\left[\text{E}(X|Y)\right]\right\}^2\\
=& \text{E}\left\{\left[\text{E}(X|Y)\right]^2\right\} - \left[\text{E}(X)\right]^2
\end{aligned}
\]
和
\[\begin{aligned}
\text{E}[\text{Var}(X|Y)] =& \text{E}\left\{\text{E}(X^2|Y) - [\text{E}(X|Y)]^2\right\}\\
=& \text{E}(X^2) - \text{E}\left\{\left[\text{E}(X|Y)\right]^2\right\}
\end{aligned}
\]
将上面两式相加,即得证。