Why Variance Splits Into Two Parts
A conditional distribution describes variation after some information is known. The unconditional distribution combines that remaining variation with changes in the conditional mean across possible information values. The law of total variance makes this separation exact: total variation is the average variation within the conditional distributions plus the variation among their means.
This identity is useful when a model is naturally organized into groups, when a conditional distribution is easier to analyze than a marginal one, or when we want to distinguish individual-level variation from differences between groups. Its proof rests on a precise fact: once we subtract the conditional mean, the residual has conditional mean zero and is uncorrelated with any square-integrable quantity determined by the conditioning information.
Definition and Assumptions
Let \(X\) be a random variable with \(E[X^2]<\infty\), and let \(\mathcal G\) be a sigma-field representing the information on which we condition. Write \(M=E[X\mid\mathcal G]\). Conditional expectation is characterized by being \(\mathcal G\)-measurable and satisfying \(E[M1_A]=E[X1_A]\) for every \(A\in\mathcal G\). In particular, \(E[M]=E[X]\). Conditional Jensen's inequality gives \(E[M^2]\leq E[X^2]\), so \(M\) is square-integrable too.
The definition centers \(X\) at its conditional mean before taking the conditional expectation of the squared deviation. Thus \(\operatorname{Var}(X\mid\mathcal G)\) can vary with the information observed; it is not generally a fixed number. Its expectation, \(E[\operatorname{Var}(X\mid\mathcal G)]\), is an ordinary nonnegative number.
Proof of the Decomposition
Set \(M=E[X\mid\mathcal G]\), and define the residual \(Z=X-M\). Then \(Z\) is square-integrable and \(E[Z\mid\mathcal G]=0\). We first justify why the residual contributes no cross-product with \(M-E[X]\). Let \(H=M-E[X]\), which is square-integrable and \(\mathcal G\)-measurable. For each positive integer \(k\), truncate it to \(H_k=\max(-k,\min(H,k))\). This is bounded and \(\mathcal G\)-measurable, so the defining property of conditional expectation gives \( E[ZH_k]=E[E[Z\mid\mathcal G]H_k]=0 \). Also \(H_k\to H\) in mean square: \(|H-H_k|^2\leq |H|^2\), and \(|H-H_k|^2\to0\) almost surely, so dominated convergence applies. By Cauchy–Schwarz, \( |E[Z(H-H_k)]|\leq (E[Z^2])^{1/2}(E[(H-H_k)^2])^{1/2}\to0 \). Consequently \(E[ZH]=0\).
Now \(X-E[X]=Z+H\). Squaring and taking expectations, with all terms integrable by square-integrability, yields
By the tower property applied to the nonnegative integrable variable \(Z^2\), \(E[Z^2]=E[E[Z^2\mid\mathcal G]]=E[\operatorname{Var}(X\mid\mathcal G)]\). Since \(M=E[X\mid\mathcal G]\), substituting gives the stated decomposition. Each term is finite because \(X\) and \(M\) are square-integrable. \(\square\)
Finite Groups: The Within- and Between-Group Form
If \(Y\) takes finitely many values, conditioning on \(Y\) gives the familiar weighted form. For each value \(y\) with \(P(Y=y)>0\), let \(m_y=E[X\mid Y=y]\) and \(v_y=\operatorname{Var}(X\mid Y=y)\). Then the theorem says
The first sum averages the conditional variances. The second is the variance, under the group probabilities, of the group-specific conditional means. Values of \(y\) with probability zero make no contribution and need not be assigned conditional moments.
Worked Example: A Bernoulli Outcome in Two Groups
Let \(Y\) label two equally likely groups. Suppose \(X\mid Y=0\) is Bernoulli with success probability \(0.2\), and \(X\mid Y=1\) is Bernoulli with success probability \(0.8\). Compute both terms of the decomposition and check the marginal variance.
For a Bernoulli variable with success probability \(p\), the mean is \(p\) and the variance is \(p(1-p)\). Thus each group has conditional variance \(0.2(0.8)=0.16\), and \(E[\operatorname{Var}(X\mid Y)]=(0.16+0.16)/2=0.16\).
The conditional mean is \(0.2\) in the first group and \(0.8\) in the second. Its overall mean is \(E[X]=(0.2+0.8)/2=0.5\). Therefore \( \operatorname{Var}(E[X\mid Y])=\{(0.2-0.5)^2+(0.8-0.5)^2\}/2=0.09 \). The two contributions sum to \(0.16+0.09=0.25\).
As a direct check, the marginal success probability is \(P(X=1)=(0.2+0.8)/2=0.5\), so \(X\) is Bernoulli with variance \(0.5(1-0.5)=0.25\). This agrees with the decomposition.
Worked Example: Unequal Group Probabilities and Overlapping Outcomes
Let \(P(Y=0)=1/3\) and \(P(Y=1)=2/3\). Given \(Y=0\), let \(X\) be equally likely to be 0 or 2; given \(Y=1\), let \(X\) be equally likely to be 2 or 4. Find the two variance contributions and verify them using the marginal distribution.
In either group, the two possible values are separated by 2, so the conditional variance is 1. Hence \(E[\operatorname{Var}(X\mid Y)]=(1/3)(1)+(2/3)(1)=1\). The conditional means are \(m_0=1\) and \(m_1=3\). Their weighted mean is \(E[X]=(1/3)(1)+(2/3)(3)=7/3\), so
The decomposition gives \(\operatorname{Var}(X)=1+8/9=17/9\). To check directly, the marginal probabilities are \(P(X=0)=1/6\), \(P(X=2)=1/2\), and \(P(X=4)=1/3\). Thus \(E[X^2]=(1/6)(0)+(1/2)(4)+(1/3)(16)=22/3\), and \( \operatorname{Var}(X)=E[X^2]-E[X]^2=22/3-(7/3)^2=17/9 \). The two calculations agree.
A Continuous Conditional Model
The same theorem applies when the conditioning variable is continuous. Conditional moments are then functions of the observed conditioning value, and the expectation of a conditional variance averages those functions over the conditioning variable's distribution.
Worked Example: A Normal Outcome With a Uniformly Varying Mean
Let \(Y\sim\operatorname{Uniform}(0,1)\), and suppose that conditional on \(Y=y\), \(X\sim N(y,1+y)\), where the second parameter is the variance. Compute the expected conditional variance, the variance of the conditional mean, and the marginal variance.
The conditional mean and variance are \(E[X\mid Y]=Y\) and \(\operatorname{Var}(X\mid Y)=1+Y\). Therefore \(E[\operatorname{Var}(X\mid Y)]=E[1+Y]=1+1/2=3/2\). Since a uniform random variable on \((0,1)\) has variance \(1/12\), \(\operatorname{Var}(E[X\mid Y])=\operatorname{Var}(Y)=1/12\). The decomposition predicts \( \operatorname{Var}(X)=3/2+1/12=19/12 \).
Check this result from unconditional moments. The tower property gives \(E[X]=E[Y]=1/2\). From the conditional mean and variance, \(E[X^2\mid Y]=\operatorname{Var}(X\mid Y)+E[X\mid Y]^2=1+Y+Y^2\). Consequently \(E[X^2]=1+E[Y]+E[Y^2]=1+1/2+1/3=11/6\), and \( \operatorname{Var}(X)=11/6-(1/2)^2=22/12-3/12=19/12 \). This matches the sum of the two conditional contributions.
Interpretation and a Common Pitfall
The first contribution, \(E[\operatorname{Var}(X\mid\mathcal G)]\), is the average residual variation after conditioning. The second, \(\operatorname{Var}(E[X\mid\mathcal G])\), measures how much the conditional mean changes with the information. Since the second term is nonnegative, the expected conditional variance cannot exceed the unconditional variance. If the conditional mean is constant almost surely, the between-means term is zero; otherwise it records an additional source of variation.
A common mistake is to average conditional standard deviations and call the result the unconditional standard deviation. The theorem is an identity for variances, not standard deviations: it adds the expected conditional variance to the variance of the conditional mean. Even after finding the total variance, the standard deviation is obtained by taking the square root of the entire sum. For example, in the continuous model above, the terms are \(3/2\) and \(1/12\); the total standard deviation is \(\sqrt{19/12}\), not \(\sqrt{3/2}+\sqrt{1/12}\).
A reliable calculation therefore proceeds in three steps: find the conditional mean and variance, average the conditional variance and calculate the variance of the conditional mean, then add those two quantities. In discrete settings, the averages use group probabilities; in continuous settings, they use expectation over the conditioning variable.
Check Your Understanding
Use the assumptions and decomposition above to answer these questions.
- What square-integrability condition ensures that the law of total variance has finite terms?
- If \(E[\operatorname{Var}(X\mid Y)]=4\) and \(\operatorname{Var}(E[X\mid Y])=3\), what is \(\operatorname{Var}(X)\)?
- In a finite-group calculation, what does the variance of the group-specific conditional means measure?
- Why does the cross-product between \(X-E[X\mid\mathcal G]\) and \(E[X\mid\mathcal G]-E[X]\) have expectation zero?
- Can the expected conditional variance exceed the unconditional variance under the theorem's assumptions? Explain.