Slide explaining the proof of the law of total variance

The law of total variance decomposes the variance of a random variable $Y$ into two parts:

$$\operatorname{Var}(Y)=\mathbb{E}(\operatorname{Var}(Y\mid X))+\operatorname{Var}(\mathbb{E}(Y\mid X))$$

Intuitively, total variance consists of the average variation in $Y$ within groups defined by $X$, plus the variation between their conditional means.

The previous page explains this interpretation in detail. Here, we give a short proof using the law of iterated expectation.

Learning the proof probably will not give you much extra intuition for why the formula works! It is included partly because it is a neat application of the law of iterated expectation, and partly because short derivations like this are rather popular with examiners.


Proof of the Law of Total Variance

The proof is mostly an exercise in rewriting the definition of variance.

Start with

$$\operatorname{Var}(Y)=\mathbb{E}(Y^2)-(\mathbb{E}(Y))^2.$$

By the law of iterated expectation,

$$\mathbb{E}(Y^2)=\mathbb{E}(\mathbb{E}(Y^2\mid X))$$

and

$$\mathbb{E}(Y)=\mathbb{E}(\mathbb{E}(Y\mid X)).$$

Substituting these into the variance formula gives

$$\operatorname{Var}(Y)=\mathbb{E}(\mathbb{E}(Y^2\mid X))-(\mathbb{E}(\mathbb{E}(Y\mid X)))^2.$$

The key trick is now to add and subtract the same term:

$$\mathbb{E}((\mathbb{E}(Y\mid X))^2).$$

Since this is a number, it can be brought inside expectations. This lets us regroup the expression as

$$\operatorname{Var}(Y) \ = \ \mathbb{E}(\mathbb{E}(Y^2\mid X)-(\mathbb{E}(Y\mid X))^2) \ + \ \mathbb{E}((\mathbb{E}(Y\mid X))^2)-(\mathbb{E}(\mathbb{E}(Y\mid X)))^2.$$

The first part is

$$\mathbb{E}(\operatorname{Var}(Y\mid X)),$$

while the second is

$$\operatorname{Var}(\mathbb{E}(Y\mid X)).$$

Therefore,

$$\boxed{\operatorname{Var}(Y)=\mathbb{E}(\operatorname{Var}(Y\mid X))+\operatorname{Var}(\mathbb{E}(Y\mid X))}$$

This proves the law of total variance.


Background:

Found this useful?

Understanding Econometrics is completely free to use, and always will be.

If you found the site useful and would like to help me keep adding new material, please consider buying me a coffee!

Buy me a coffee ☕