Skip to content

Eve’s Law: Total Variance

Theorem

For random variables XX and YY with E[Y2]<∞\mathbb{E}[Y^2]<\infty,

Var⁡(Y)=E[Var⁡(Y∣X)]+Var⁡(E[Y∣X]).\operatorname{Var}(Y)=\mathbb{E}[\operatorname{Var}(Y\mid X)] +\operatorname{Var}(\mathbb{E}[Y\mid X]).

Consequence: the residual Y−E[Y∣X]Y-\mathbb{E}[Y\mid X] is uncorrelated with every function h(X)h(X) that has E[h(X)2]<∞\mathbb{E}[h(X)^2]<\infty (or satisfies another assumption that makes the products integrable):

Cov⁡(Y−E[Y∣X], h(X))=0.\begin{aligned} \operatorname{Cov}(Y-\mathbb{E}[Y\mid X],\,h(X))=0. \end{aligned}

The first term averages the Conditional Variance Given a Random Variable; the second is the ordinary Variance and Standard Deviation of the conditional mean. To derive the identity, apply Adam’s Law: Total Expectation to Y2Y^2 and expand both variances as second moment minus squared mean.


Interpretation

Total spread consists of average spread within conditional groups plus spread between their conditional means. Knowing XX splits the variance of YY into a part that XX explains, how much the group centres move, and a part that remains, how much YY varies inside a group.

Points of Y in three groups for X = 1, 2 and 3, each with a short line at its group mean, and a long line at the overall mean, showing the spread within groups and between group means.

The figure groups values of YY by X=1,2,3X=1,2,3. The short red lines are the group means E[Y∣X=x]\mathbb{E}[Y\mid X=x] and the dashed line is the overall mean EY\mathbb{E}Y. The first term, E[Var⁡(Y∣X)]\mathbb{E}[\operatorname{Var}(Y\mid X)], averages the spread of the points around their own red line (the arrow "within"). The second term, Var⁡(E[Y∣X])\operatorname{Var}(\mathbb{E}[Y\mid X]), measures how far the red lines lie from the dashed line (the arrow "between").

Two extreme cases show what each term means. If YY is a function of XX, every group is a single point, the first term is 00 and all variance lies between groups. If YY is independent of XX, every group mean equals EY\mathbb{E}Y by conditional expectation and independence, so the second term is 00 and XX explains nothing. Both terms are nonnegative, which gives the Key Result Var⁡(E[Y∣X])≤Var⁡(Y)\operatorname{Var}(\mathbb{E}[Y\mid X])\le\operatorname{Var}(Y): replacing YY by its conditional mean can only reduce variance.

The practical form of the identity is the conditioning trick for variance. A frequent slip is to drop one of the two terms, or to write the first term as the random variable Var⁡(Y∣X)\operatorname{Var}(Y\mid X) instead of its average E[Var⁡(Y∣X)]\mathbb{E}[\operatorname{Var}(Y\mid X)].


Key Results

  • Var⁡(E[Y∣X])≤Var⁡(Y)\operatorname{Var}(\mathbb{E}[Y\mid X])\le\operatorname{Var}(Y).
  • The residual R=Y−E[Y∣X]R=Y-\mathbb{E}[Y\mid X] has mean zero and Cov⁡(R,h(X))=0\operatorname{Cov}(R,h(X))=0 for every square-integrable h(X)h(X).

Examples

  • If X∼Exp⁡(2)X\sim\operatorname{Exp}(2) and Y∣X∼Pois⁡(X)Y\mid X\sim\operatorname{Pois}(X), then Var⁡(Y)=EX+Var⁡(X)=1/2+1/4=3/4\operatorname{Var}(Y)=\mathbb{E}X+\operatorname{Var}(X)=1/2+1/4=3/4.
  • If X∼Unif⁡(0,1)X\sim\operatorname{Unif}(0,1) and Y∣X∼Bin⁡(n,X)Y\mid X\sim\operatorname{Bin}(n,X), then Var⁡(Y)=n/6+n2/12=n(n+2)/12\operatorname{Var}(Y)=n/6+n^2/12=n(n+2)/12.

Prerequisites

Sources

Aliases: law of total variance, variance decomposition formula Symbols: infinity

Last updated: 22 October 2026 19:04