The Tower Property and Conditional Variance

Suppose an insurance company insures drivers of wildly different risk profiles. It only observes the accident count of each driver, not their hidden risk class. How can the company predict overall claims variability? It must work from what it knows about each class separately. The tower property and the law of total variance answer this exact kind of question. They let us build the mean and variance of a complicated random variable out of simpler pieces. This is done by conditioning on some auxiliary information. This matters because almost no real random variable lives in isolation. Most quantities we care about — insurance claims, stock returns, exam scores, particle counts — are naturally mixtures over some underlying category, group, or state. The tower property (law of total expectation) says that averaging a conditional average recovers the overall average. The law of total variance goes further. It splits total variability into a within-group piece and a between-group piece. This is exactly the logic behind analysis of variance, random-effects models, and the Rao–Blackwell idea in statistics. The big picture is that Conditional Expectation is not just a number attached to an event. It is itself a random variable — a function of the conditioning variable. This random object obeys its own calculus. Iterating expectations and variances through this random object matters greatly. It is what makes multi-stage random experiments tractable. These include random sums, hierarchical models, and branching processes. This works without ever writing down the full joint density. This article states and proves both laws with complete rigor. It works two asymmetric numerical examples: a random sum and a two-stage sampling model. It shows exactly what breaks when the underlying conditional expectation fails to exist. It also points toward the Bivariate Normal Distribution. There, these tools reappear to compute conditional means and variances in closed form.

Key takeaways
  • E[X]=E[E[X∣Y]]E[X]=E[E[X\mid Y]]: averaging a conditional average gives the unconditional average.
  • Var(X)=E[Var(X∣Y)]+Var(E[X∣Y])\mathrm{Var}(X)=E[\mathrm{Var}(X\mid Y)]+\mathrm{Var}(E[X\mid Y]): total variance splits into within-group and between-group parts.
  • Both laws hold whenever E[X2]<∞E[X^2]<\infty (variance version) or just E∣X∣<∞E|X|<\infty (mean version).
  • The proof uses the defining property of conditional expectation as a projection, applied twice — hence "tower."
  • Random sums, hierarchical/random-effects models, and Rao–Blackwellization are direct applications.
  • Key idea: conditioning creates a random variable E[X∣Y]E[X\mid Y], and iterating expectation/variance through it recovers exact global moments from local, conditional ones.

Where this lives today

The tower property is the engine behind martingale theory: a process (Mn)(M_n) is a martingale exactly when E[Mn+1∣Fn]=MnE[M_{n+1}\mid \mathcal F_n]=M_n, and the nested tower property is what lets us conclude E[Mn]=E[M0]E[M_n]=E[M_0] for all nn by repeated conditioning. In Bayesian statistics, the posterior mean and variance of a parameter are computed by exactly this machinery: the prior predictive variance of data decomposes into "variance given the parameter" (sampling noise) plus "variance of the conditional mean" (parameter uncertainty), which is the statistical content of Example 2 above. The Rao–Blackwell theorem in mathematical statistics uses the total variance law directly: if TT is a sufficient statistic and δ\delta an unbiased estimator, then E[δ∣T]E[\delta\mid T] has variance Var(E[δ∣T])≤Var(δ)\mathrm{Var}(E[\delta\mid T]) \le \mathrm{Var}(\delta), because the total variance law forces Var(δ)=Var(E[δ∣T])+E[Var(δ∣T)]\mathrm{Var}(\delta) = \mathrm{Var}(E[\delta\mid T]) + E[\mathrm{Var}(\delta\mid T)] with the second term nonnegative. In actuarial science and queueing theory, compound (random-sum) distributions — as in Example 1 — are the standard model for aggregate claims or workload, and the tower/total-variance formulas give the mean and variance of the aggregate without ever computing its full distribution. In machine learning, the bias-variance-type decompositions used to analyze prediction error (e.g., in random-effects or Bayesian model averaging) are direct descendants of the total variance law. In statistical genetics, the partition of phenotypic variance into genetic and environmental components (Fisher's variance components) is again a total-variance-law computation, conditioning on genotype. Finally, this machinery is the direct stepping stone to computing conditional means and variances in the Bivariate Normal Distribution, where E[X∣Y]E[X\mid Y] turns out to be an exact linear function of YY and Var(X∣Y)\mathrm{Var}(X\mid Y) is a constant (not random) — a strikingly special structural fact that simplifies the total variance law even further, foreshadowing the role of correlation ρ\rho in that setting. The underlying formalism also connects to Markov Chains, where the tower property with respect to the natural filtration encodes the Markov property itself.

:::quiz[If XX and YY are independent random variables with E[X2]<∞E[X^2]<\infty, what is Var(E[X∣Y])\mathrm{Var}(E[X\mid Y])?]

  • Var(X)\mathrm{Var}(X)
  • E[Var(X∣Y)]E[\mathrm{Var}(X\mid Y)]
  • 00 ✓
  • Undefined without more information

:::quiz[In the law of total variance Var(X)=E[Var(X∣Y)]+Var(E[X∣Y])\mathrm{Var}(X)=E[\mathrm{Var}(X\mid Y)]+\mathrm{Var}(E[X\mid Y]), which minimal hypothesis is required?]

  • XX and YY must be independent
  • E[X2]<∞E[X^2]<\infty ✓
  • YY must be discrete
  • XX and YY must be jointly normal

:::quiz[In the random-sum example (N∼N\sim Geometric(p=0.4p=0.4), Xi∼X_i\sim Exponential(λ=0.25\lambda=0.25)), what is E[Var(S∣N)]E[\mathrm{Var}(S\mid N)]?]

  • 1010
  • 1616
  • 4040 ✓
  • 6060

:::faq[Is E[X∣Y]E[X\mid Y] a number or a random variable?] It is a random variable — specifically, a function of YY, often written g(Y)g(Y) where g(y)=E[X∣Y=y]g(y) = E[X\mid Y=y]. Its randomness comes entirely through YY: once YY's value is revealed, E[X∣Y]E[X\mid Y] becomes the fixed number g(y)g(y). This is a common early confusion: E[X∣Y=y]E[X\mid Y=y] (a number, for each fixed yy) and E[X∣Y]E[X\mid Y] (a random variable, a function of the random YY) are related but distinct objects. The tower property and total variance law are statements about the random variable E[X∣Y]E[X\mid Y], since we take its expectation or variance over the randomness of YY.

:::faq[Why does the proof of total variance need the "orthogonality" of the residual R=X−E[X∣Y]R=X-E[X\mid Y]?] Variance does not decompose additively for an arbitrary sum X=A+BX=A+B unless AA and BB are uncorrelated: in general Var(A+B)=Var(A)+Var(B)+2Cov(A,B)\mathrm{Var}(A+B)=\mathrm{Var}(A)+\mathrm{Var}(B)+2\mathrm{Cov}(A,B). The whole proof hinges on showing the cross term Cov(R,E[X∣Y])=0\mathrm{Cov}(R, E[X\mid Y])=0, which follows from the defining property of conditional expectation (specifically, E[R∣Y]=0E[R\mid Y]=0, proved via "taking out what is known"). Without this orthogonality — which is a genuinely special feature of the conditional-expectation residual, not true for arbitrary decompositions X=A+BX=A+B — the total variance law would need an extra covariance correction term.

Ask the tutor: How does the law of total variance simplify when XX and YY are jointly normal, and why does Var(X∣Y)\mathrm{Var}(X\mid Y) become a constant?

DefinitionConditional expectation, tower property, and total variance

Let (Ω,F,P)(\Omega,\mathcal F,P) be a probability space and let X,YX,Y be random variables on it with E∣X∣<∞E|X|<\infty.

Conditional expectation. The conditional expectation of XX given YY, written E[X∣Y]E[X\mid Y], is (a.s. unique) a random variable of the form g(Y)g(Y) for some measurable gg, satisfying

E[X 1A]=E[g(Y) 1A]for every event A∈σ(Y).E\big[X\,\mathbf 1_A\big]=E\big[g(Y)\,\mathbf 1_A\big]\quad\text{for every event } A\in\sigma(Y).

Equivalently, E[X∣Y]=E[X∣σ(Y)]E[X\mid Y]=E[X\mid \sigma(Y)] is the a.s.-unique σ(Y)\sigma(Y)-measurable random variable satisfying

E[E[X∣Y] Z]=E[XZ]for every bounded σ(Y)-measurable Z.E\big[E[X\mid Y]\,Z\big]=E[XZ]\quad\text{for every bounded }\sigma(Y)\text{-measurable }Z.

When (X,Y)(X,Y) has a joint density fX,Yf_{X,Y}, this reduces to g(y)=∫x fX∣Y(x∣y) dxg(y)=\int x\,f_{X\mid Y}(x\mid y)\,dx where fX∣Y(x∣y)=fX,Y(x,y)/fY(y)f_{X\mid Y}(x\mid y)=f_{X,Y}(x,y)/f_Y(y).

Tower property (law of total expectation). For E∣X∣<∞E|X|<\infty,

E[X]=E[E[X∣Y]].E[X] = E\big[E[X\mid Y]\big].

More generally, for a sub-σ\sigma-algebra G1⊂G2⊂F\mathcal G_1\subset \mathcal G_2\subset\mathcal F,

E[E[X∣G2] ∣ G1]=E[X∣G1]a.s.E\big[E[X\mid \mathcal G_2]\,\big|\,\mathcal G_1\big] = E[X\mid \mathcal G_1]\quad\text{a.s.}

Conditional variance. Assuming E[X2]<∞E[X^2]<\infty, define

Var(X∣Y):=E[X2∣Y]−(E[X∣Y])2=E[(X−E[X∣Y])2 ∣ Y].\mathrm{Var}(X\mid Y) := E\big[X^2\mid Y\big] - \big(E[X\mid Y]\big)^2 = E\big[(X-E[X\mid Y])^2 \,\big|\, Y\big].

This is a random variable, a function of YY, and is nonnegative a.s.

Law of total variance. For E[X2]<∞E[X^2]<\infty,

Var(X)=E[Var(X∣Y)]+Var(E[X∣Y]).\mathrm{Var}(X) = E\big[\mathrm{Var}(X\mid Y)\big] + \mathrm{Var}\big(E[X\mid Y]\big).

Intuition

Think of YY as labeling a group or a "state of the world," and E[X∣Y=y]E[X\mid Y=y] as the average of XX within that group. The tower property says: if you average those within-group averages, weighting by how likely each group is, you get back the overall average — no information is lost or double-counted, because the within-group averages are computed with respect to the same underlying probability measure restricted to each group. The law of total variance is the variance analogue, but it is subtler because variance does not simply average like expectation does. Total spread in XX has two independent sources: (1) how spread out XX is inside each group — this is Var(X∣Y)\mathrm{Var}(X\mid Y), and we average this over groups since we don't know which group we're in — and (2) how much the group means themselves differ from each other — this is Var(E[X∣Y])\mathrm{Var}(E[X\mid Y]). Even if every group has zero internal spread (each group is a point mass), the group means can differ, contributing all the variance; conversely if all group means coincide, the total variance is entirely within-group. The formula shows these two sources add, with no cross term, because of an orthogonality property of conditional expectation (proved below).

Figure
Splitting total variance into within-group and between-group parts
Three groups Y=1,2,3 with different means and spreads value of X E[X|Y=1]=150 E[X|Y=2]=320 E[X|Y=3]=480 Between-group variance: spread of the dark dots (group means) Within-group variance: spread of pale dots around their own dark dot Total Var(X) = E[within] + Var[between]
TheoremTower property and law of total variance

Let XX be a random variable on (Ω,F,P)(\Omega,\mathcal F,P) and let YY be another random variable (or random vector) on the same space.

(A) Tower property. If E∣X∣<∞E|X|<\infty, then E[X∣Y]E[X\mid Y] exists (a.s. unique up to null sets), is integrable, and

E[E[X∣Y]]=E[X].E\big[E[X\mid Y]\big]=E[X].

More generally, if G1⊆G2\mathcal G_1\subseteq\mathcal G_2 are sub-σ\sigma-algebras of F\mathcal F, then

E[ E[X∣G2]∣G1 ]=E[X∣G1]almost surely.E\big[\,E[X\mid \mathcal G_2]\mid \mathcal G_1\,\big]=E[X\mid \mathcal G_1]\quad\text{almost surely}.

(B) Law of total variance. If E[X2]<∞E[X^2]<\infty, then E[X∣Y]E[X\mid Y] and Var(X∣Y)\mathrm{Var}(X\mid Y) are well defined (with Var(X∣Y)≥0\mathrm{Var}(X\mid Y)\ge 0 a.s.), E[X∣Y]∈L2E[X\mid Y]\in L^2, and

Var(X)=E[Var(X∣Y)]+Var(E[X∣Y]).\mathrm{Var}(X) = E\big[\mathrm{Var}(X\mid Y)\big] + \mathrm{Var}\big(E[X\mid Y]\big).
Proof

We give a complete proof using only the defining property of conditional expectation and standard L2L^2 orthogonality; this is the standard "projection" technique, and it is not circular since it uses no consequence of the theorem being proved.

Part (A), tower property with σ(Y)\sigma(Y). By definition, E[X∣Y]E[X\mid Y] is the a.s.-unique σ(Y)\sigma(Y)-measurable random variable such that

E[E[X∣Y] 1A]=E[X 1A]for all A∈σ(Y).(1)E\big[E[X\mid Y]\,\mathbf 1_A\big] = E[X\,\mathbf 1_A]\qquad\text{for all } A\in\sigma(Y). \tag{1}

Take A=Ω∈σ(Y)A=\Omega\in\sigma(Y). Since 1Ω≡1\mathbf 1_\Omega\equiv 1, (1) gives

E[E[X∣Y]]=E[X].E\big[E[X\mid Y]\big] = E[X].

This proves the basic tower identity. Integrability of E[X∣Y]E[X\mid Y] (needed for the expectation on the left to make sense) is part of the standard existence theorem for conditional expectation (via the Radon–Nikodym theorem applied to the signed measure A↦E[X1A]A\mapsto E[X\mathbf 1_A] on σ(Y)\sigma(Y), which is absolutely continuous with respect to P∣σ(Y)P|_{\sigma(Y)} since E∣X∣<∞E|X|<\infty); we take this existence as given, per the prerequisite Conditional Expectation.

Part (A), general nested σ\sigma-algebras. Let G1⊆G2⊆F\mathcal G_1\subseteq \mathcal G_2\subseteq\mathcal F. We must show

E[E[X∣G2]∣G1]=E[X∣G1]a.s.(2)E\big[E[X\mid\mathcal G_2]\mid \mathcal G_1\big]=E[X\mid \mathcal G_1]\quad\text{a.s.} \tag{2}

Write Z:=E[X∣G1]Z:=E[X\mid \mathcal G_1]; this is the unique (a.s.) G1\mathcal G_1-measurable random variable such that

E[Z 1A]=E[X 1A]for all A∈G1.(3)E[Z\,\mathbf 1_A] = E[X\,\mathbf 1_A]\quad\text{for all }A\in\mathcal G_1. \tag{3}

We show the left side of (2), call it W:=E[E[X∣G2]∣G1]W:=E[E[X\mid\mathcal G_2]\mid\mathcal G_1], satisfies the same defining property, hence equals ZZ a.s. by uniqueness. First, WW is G1\mathcal G_1-measurable by construction (it is a conditional expectation given G1\mathcal G_1). Second, for any A∈G1A\in\mathcal G_1, since G1⊆G2\mathcal G_1\subseteq \mathcal G_2 we have A∈G2A\in\mathcal G_2 as well, so by the defining property of E[⋅∣G1]E[\cdot\mid \mathcal G_1] applied to the random variable E[X∣G2]E[X\mid \mathcal G_2],

E[W 1A]=E[E[X∣G2] 1A]=E[X 1A],E[W\,\mathbf 1_A] = E\big[E[X\mid \mathcal G_2]\,\mathbf 1_A\big] = E[X\,\mathbf 1_A],

where the last equality uses the defining property of E[X∣G2]E[X\mid\mathcal G_2] with the set A∈G2A\in\mathcal G_2. This matches (3) exactly, so by a.s.-uniqueness of conditional expectation, W=ZW=Z a.s., proving (2). Setting G1={∅,Ω}\mathcal G_1=\{\emptyset,\Omega\} (the trivial σ\sigma-algebra) and G2=σ(Y)\mathcal G_2=\sigma(Y) recovers the basic tower identity, since E[X∣{∅,Ω}]=E[X]E[X\mid\{\emptyset,\Omega\}]=E[X] is a constant.

Part (B), law of total variance. Assume E[X2]<∞E[X^2]<\infty. First we check E[X∣Y]E[X\mid Y] is well defined and square-integrable, so that Var(E[X∣Y])\mathrm{Var}(E[X\mid Y]) makes sense. Conditional expectation is, in L2(Ω,F,P)L^2(\Omega,\mathcal F,P), the orthogonal projection onto the closed subspace L2(Ω,σ(Y),P)L^2(\Omega,\sigma(Y),P) of σ(Y)\sigma(Y)-measurable square-integrable random variables. A defining property of orthogonal projection in a Hilbert space is that it does not increase norm:

E[(E[X∣Y])2]≤E[X2]<∞,E\big[(E[X\mid Y])^2\big] \le E[X^2] < \infty,

so E[X∣Y]∈L2E[X\mid Y]\in L^2. (This inequality also follows directly from Jensen's inequality for conditional expectation: (E[X∣Y])2≤E[X2∣Y](E[X\mid Y])^2\le E[X^2\mid Y] a.s., then take expectations and apply the tower property to the right side.) Now define the residual R:=X−E[X∣Y]R:=X-E[X\mid Y]. We claim RR and E[X∣Y]E[X\mid Y] are uncorrelated, and moreover

E[R∣Y]=0a.s.(4)E[R\mid Y]=0\quad\text{a.s.} \tag{4}

Indeed, by linearity of conditional expectation,

E[R∣Y]=E[X∣Y]−E[E[X∣Y]∣Y]=E[X∣Y]−E[X∣Y]=0,E[R\mid Y]=E[X\mid Y]-E\big[E[X\mid Y]\mid Y\big]=E[X\mid Y]-E[X\mid Y]=0,

using that E[X∣Y]E[X\mid Y] is σ(Y)\sigma(Y)-measurable, so conditioning it again on YY leaves it unchanged (this is the "idempotent projection" fact, itself an instance of the nested tower property (2) with G1=G2=σ(Y)\mathcal G_1=\mathcal G_2=\sigma(Y), or directly from the defining identity: if WW is σ(Y)\sigma(Y)-measurable then E[W∣Y]=WE[W\mid Y] = W a.s., since WW itself satisfies the defining property (1) trivially). By (4) and the tower property applied to the product R⋅E[X∣Y]R\cdot E[X\mid Y]: since E[X∣Y]E[X \mid Y] is σ(Y)\sigma(Y)-measurable, we may pull it out of the conditional expectation ("taking out what is known"),

E[R⋅E[X∣Y] ∣ Y]=E[X∣Y]⋅E[R∣Y]=E[X∣Y]⋅0=0a.s.E\big[R\cdot E[X\mid Y]\,\big|\,Y\big] = E[X\mid Y]\cdot E[R\mid Y] = E[X\mid Y]\cdot 0 = 0\quad\text{a.s.}

Taking expectations of both sides and applying the tower property (Part A),

E[R⋅E[X∣Y]]=0.(5)E\big[R\cdot E[X\mid Y]\big]=0. \tag{5}

Also, from (4) and the tower property,

E[R]=E[E[R∣Y]]=E[0]=0.(6)E[R] = E\big[E[R\mid Y]\big] = E[0]=0. \tag{6}

Now decompose X=E[X∣Y]+RX = E[X\mid Y] + R and compute the variance using Var(X)=E[X2]−(E[X])2\mathrm{Var}(X)=E[X^2]-(E[X])^2. First,

E[X2]=E[(E[X∣Y]+R)2]=E[(E[X∣Y])2]+2E[R⋅E[X∣Y]]+E[R2].E[X^2] = E\big[(E[X\mid Y]+R)^2\big] = E\big[(E[X\mid Y])^2\big] + 2E\big[R\cdot E[X\mid Y]\big] + E[R^2].

By (5) the cross term vanishes, so

E[X2]=E[(E[X∣Y])2]+E[R2].(7)E[X^2] = E\big[(E[X\mid Y])^2\big] + E[R^2]. \tag{7}

Also E[X]=E[E[X∣Y]]+E[R]=E[E[X∣Y]]E[X]=E[E[X\mid Y]]+E[R] = E[E[X\mid Y]] by (6) and the tower property, so

(E[X])2=(E[E[X∣Y]])2.(8)(E[X])^2 = \big(E[E[X\mid Y]]\big)^2. \tag{8}

Subtracting (8) from (7),

Var(X)=(E[(E[X∣Y])2]−(E[E[X∣Y]])2)+E[R2]=Var(E[X∣Y])+E[R2].(9)\mathrm{Var}(X) = \Big(E[(E[X\mid Y])^2] - (E[E[X\mid Y]])^2\Big) + E[R^2] = \mathrm{Var}\big(E[X\mid Y]\big) + E[R^2]. \tag{9}

It remains to identify E[R2]E[R^2] with E[Var(X∣Y)]E[\mathrm{Var}(X\mid Y)]. By definition,

Var(X∣Y)=E[(X−E[X∣Y])2∣Y]=E[R2∣Y].\mathrm{Var}(X\mid Y) = E\big[(X-E[X\mid Y])^2\mid Y\big] = E[R^2\mid Y].

Taking expectations and using the tower property once more,

E[Var(X∣Y)]=E[E[R2∣Y]]=E[R2].(10)E\big[\mathrm{Var}(X\mid Y)\big] = E\big[E[R^2\mid Y]\big] = E[R^2]. \tag{10}

Combining (9) and (10) gives exactly

Var(X)=E[Var(X∣Y)]+Var(E[X∣Y]),\mathrm{Var}(X) = E\big[\mathrm{Var}(X\mid Y)\big] + \mathrm{Var}\big(E[X\mid Y]\big),

as claimed. Nonnegativity of Var(X∣Y)\mathrm{Var}(X\mid Y) a.s. follows since it is (a.s.) the conditional expectation of the nonnegative random variable R2R^2, and conditional expectation preserves a.s. nonnegativity (immediate from the defining identity (1): if Z≥0Z\ge0 a.s. and E[Z∣Y]<0E[Z\mid Y]<0 on a set A∈σ(Y)A\in\sigma(Y) of positive probability, then E[Z1A]=E[E[Z∣Y]1A]<0E[Z\mathbf 1_A] = E[E[Z\mid Y]\mathbf1_A] <0, contradicting Z≥0Z\ge 0). ■\blacksquare

∎

Worked examples

Example 1: A random sum with a geometric number of exponential claims (asymmetric parameters). An insurer receives a random number NN of claims in a period, where N∼Geometric(p)N\sim\text{Geometric}(p) on {1,2,3,… }\{1,2,3,\dots\} with success probability p=0.4p=0.4, so P(N=n)=(1−p)n−1p=(0.6)n−1(0.4)P(N=n)=(1-p)^{n-1}p = (0.6)^{n-1}(0.4), giving E[N]=1/p=2.5E[N]=1/p=2.5 and Var(N)=(1−p)/p2=0.6/0.16=3.75\mathrm{Var}(N)=(1-p)/p^2 = 0.6/0.16 = 3.75. Given N=nN=n, the total claim amount is S=∑i=1nXiS = \sum_{i=1}^n X_i where X1,X2,…X_1,X_2,\dots are i.i.d. exponential with rate λ=0.25\lambda=0.25 (mean 44, variance 1616), independent of NN. We compute E[S]E[S] and Var(S)\mathrm{Var}(S) using the tower property and total variance law, conditioning on Y=NY=N. Conditional mean and variance given N=nN=n. Since the XiX_i are i.i.d. with mean μ=4\mu=4 and variance σ2=16\sigma^2=16, and S=∑i=1nXiS=\sum_{i=1}^n X_i is a sum of a fixed number nn of i.i.d. terms once we condition on N=nN=n,

E[S∣N=n]=nμ=4n,Var(S∣N=n)=nσ2=16n.E[S\mid N=n] = n\mu = 4n, \qquad \mathrm{Var}(S\mid N=n) = n\sigma^2 = 16n.

So as random variables in NN:

E[S∣N]=4N,Var(S∣N)=16N.E[S\mid N] = 4N, \qquad \mathrm{Var}(S\mid N) = 16N.

Applying the tower property.

E[S]=E[E[S∣N]]=E[4N]=4⋅E[N]=4(2.5)=10.E[S] = E\big[E[S\mid N]\big] = E[4N] = 4\cdot E[N] = 4(2.5) = 10.

Applying the law of total variance. We need both pieces:

E[Var(S∣N)]=E[16N]=16E[N]=16(2.5)=40,E\big[\mathrm{Var}(S\mid N)\big] = E[16N] = 16 E[N] = 16(2.5) = 40,
Var(E[S∣N])=Var(4N)=16 Var(N)=16(3.75)=60.\mathrm{Var}\big(E[S\mid N]\big) = \mathrm{Var}(4N) = 16\,\mathrm{Var}(N) = 16(3.75) = 60.

Therefore

Var(S)=E[Var(S∣N)]+Var(E[S∣N])=40+60=100.\mathrm{Var}(S) = E[\mathrm{Var}(S\mid N)] + \mathrm{Var}(E[S\mid N]) = 40 + 60 = 100.

So E[S]=10E[S]=10 and Var(S)=100\mathrm{Var}(S)=100 (a standard deviation of 1010). Notice the two contributions are comparable in size (40 vs 60): the "between-group" variability — driven by not knowing how many claims there will be — actually dominates slightly here, illustrating that randomness in the count NN can be as important a source of overall variance as randomness in the individual claim sizes. This is the compound-distribution / random-sum formula

E[S]=E[N]E[X],Var(S)=E[N]Var(X)+Var(N)(E[X])2,E[S] = E[N]E[X],\qquad \mathrm{Var}(S) = E[N]\mathrm{Var}(X) + \mathrm{Var}(N)\big(E[X]\big)^2,

recovered here as a direct instance of the general theorem, with E[N]Var(X)=2.5(16)=40E[N]\mathrm{Var}(X) = 2.5(16)=40 and Var(N)(E[X])2=3.75(16)=60\mathrm{Var}(N)(E[X])^2 = 3.75(16) = 60, matching exactly.

Example 2: Two-stage sampling — a mixture with different within-group shapes (Beta-Binomial style setup). A factory has machines whose defect probability Θ\Theta varies from batch to batch: Θ∼Beta(α,β)\Theta\sim\text{Beta}(\alpha,\beta) with α=2, β=3\alpha=2,\ \beta=3 (so most batches have relatively low defect rates, but with a right skew allowing worse batches). Recall for Θ∼Beta(α,β)\Theta\sim\mathrm{Beta}(\alpha,\beta),

E[Θ]=αα+β=25=0.4,Var(Θ)=αβ(α+β)2(α+β+1)=625⋅6=0.04.E[\Theta]=\frac{\alpha}{\alpha+\beta} = \frac{2}{5} = 0.4, \qquad \mathrm{Var}(\Theta) = \frac{\alpha\beta}{(\alpha+\beta)^2(\alpha+\beta+1)} = \frac{6}{25\cdot 6} = 0.04.

Given Θ=θ\Theta=\theta, we inspect n=10n=10 items from that batch, and XX (the number defective) is Binomial(10,θ)\mathrm{Binomial}(10,\theta) conditionally. This is the Beta-Binomial model. We find E[X]E[X] and Var(X)\mathrm{Var}(X). Conditional moments. For X∣Θ=θ∼Binomial(10,θ)X\mid \Theta=\theta \sim \text{Binomial}(10,\theta),

E[X∣Θ]=10Θ,Var(X∣Θ)=10Θ(1−Θ).E[X\mid \Theta] = 10\Theta, \qquad \mathrm{Var}(X\mid\Theta) = 10\Theta(1-\Theta).

Tower property.

E[X]=E[10Θ]=10E[Θ]=10(0.4)=4.E[X] = E[10\Theta] = 10E[\Theta] = 10(0.4) = 4.

Total variance — between-group term.

Var(E[X∣Θ])=Var(10Θ)=100 Var(Θ)=100(0.04)=4.\mathrm{Var}(E[X\mid \Theta]) = \mathrm{Var}(10\Theta) = 100\,\mathrm{Var}(\Theta) = 100(0.04) = 4.

Total variance — within-group term. We need E[Θ(1−Θ)]=E[Θ]−E[Θ2]E[\Theta(1-\Theta)] = E[\Theta]-E[\Theta^2]. Since Var(Θ)=E[Θ2]−(E[Θ])2\mathrm{Var}(\Theta)=E[\Theta^2]-(E[\Theta])^2, we get E[Θ2]=0.04+0.16=0.20E[\Theta^2] = 0.04 + 0.16 = 0.20. Hence

E[Θ(1−Θ)]=E[Θ]−E[Θ2]=0.4−0.20=0.20,E[\Theta(1-\Theta)] = E[\Theta] - E[\Theta^2] = 0.4 - 0.20 = 0.20,

and so

E[Var(X∣Θ)]=E[10Θ(1−Θ)]=10(0.20)=2.0.E[\mathrm{Var}(X\mid\Theta)] = E[10\Theta(1-\Theta)] = 10(0.20) = 2.0.

Combine.

Var(X)=E[Var(X∣Θ)]+Var(E[X∣Θ])=2.0+4.0=6.0.\mathrm{Var}(X) = E[\mathrm{Var}(X\mid\Theta)] + \mathrm{Var}(E[X\mid\Theta]) = 2.0 + 4.0 = 6.0.

So E[X]=4E[X]=4, Var(X)=6\mathrm{Var}(X)=6. As a check against the closed-form Beta-Binomial variance formula

Var(X)=nαβ(α+β)2⋅n+α+βα+β+1=10⋅625⋅10+56=10⋅0.24⋅2.5=6.0,\mathrm{Var}(X) = n\frac{\alpha\beta}{(\alpha+\beta)^2}\cdot \frac{n+\alpha+\beta}{\alpha+\beta+1} = 10\cdot\frac{6}{25}\cdot\frac{10+5}{6} = 10\cdot 0.24\cdot 2.5 = 6.0,

which matches exactly. Notice here the between-batch variance (4.04.0) exceeds the within-batch binomial variance (2.02.0): heterogeneity across batches is again the dominant source of overall variability, a common pattern in hierarchical/random-effects data (this is sometimes called "overdispersion" relative to a plain Binomial(10,0.4)(10, 0.4), whose variance would only be 10(0.4)(0.6)=2.410(0.4)(0.6)=2.4).

CounterexampleDropping square-integrability breaks the total-variance decomposition

The law of total variance requires E[X2]<∞E[X^2]<\infty. If we only assume E∣X∣<∞E|X|<\infty but Var(X)=∞\mathrm{Var}(X)=\infty (or undefined), the decomposition can fail to even make sense, and worse, the individual terms can behave pathologically even when they look finite. Let YY take values in {1,2,3,… }\{1,2,3,\dots\} with P(Y=n)=c/n3P(Y=n) = c/n^3 for the normalizing constant c=1/ζ(3)c = 1/\zeta(3) (so E[Y]<∞E[Y]<\infty but let us push further). Given Y=nY=n, let X∣Y=nX\mid Y=n be a random variable taking value n2n^2 with probability 1/21/2 and −n2-n^2 with probability 1/21/2. Then for every nn,

E[X∣Y=n]=0,Var(X∣Y=n)=E[X2∣Y=n]=n4.E[X\mid Y=n] = 0, \qquad \mathrm{Var}(X\mid Y=n) = E[X^2\mid Y=n] = n^4.

So E[X∣Y]≡0E[X\mid Y]\equiv 0 identically, forcing Var(E[X∣Y])=0\mathrm{Var}(E[X\mid Y])=0 trivially — this piece is perfectly well defined and finite. But the other piece is

E[Var(X∣Y)]=∑n=1∞n4⋅cn3=c∑n=1∞n=∞.E[\mathrm{Var}(X\mid Y)] = \sum_{n=1}^\infty n^4 \cdot \frac{c}{n^3} = c\sum_{n=1}^\infty n = \infty.

Here E[X2]=E[E[X2∣Y]]=E[Var(X∣Y)]=∞E[X^2]=E[E[X^2\mid Y]] = E[\mathrm{Var}(X\mid Y)] = \infty as well (consistent, since X2≥0X^2\ge 0 and the tower property for nonnegative random variables holds by monotone convergence even when the common value is +∞+\infty). So Var(X)\mathrm{Var}(X) itself is not finite: it is not merely "large," the decomposition

Var(X)=E[Var(X∣Y)]+Var(E[X∣Y])\mathrm{Var}(X) = E[\mathrm{Var}(X\mid Y)] + \mathrm{Var}(E[X\mid Y])

degenerates to "∞=∞+0\infty = \infty + 0," which is technically consistent as an extended-real-number statement but useless as a finite decomposition: we cannot say anything quantitative about how much of the (undefined/infinite) variance is "within" versus "between." In a genuine application (say, comparing within-batch vs. between-batch variability numerically, as in Example 2), losing finiteness destroys the entire purpose of the formula. This shows the hypothesis E[X2]<∞E[X^2]<\infty is not a technical nicety — it is exactly what guarantees both terms on the right side are finite nonnegative numbers that meaningfully add up to a finite total.

Scope, edge cases & common traps

SituationWhat holdsWhat can fail
E∣X∣<∞E|X|<\infty onlyTower property E[X]=E[E[X∣Y]]E[X]=E[E[X\mid Y]] holdsVar(X∣Y)\mathrm{Var}(X\mid Y) may not be defined; total variance law not applicable
E[X2]<∞E[X^2]<\inftyFull law of total variance holds, both terms finite and ≥0\ge 0—
X,YX,Y independentE[X∣Y]=E[X]E[X\mid Y]=E[X] a.s. (constant), so Var(E[X∣Y])=0\mathrm{Var}(E[X\mid Y])=0 and Var(X)=E[Var(X∣Y)]=Var(X)\mathrm{Var}(X)=E[\mathrm{Var}(X\mid Y)]=\mathrm{Var}(X): consistent but degenerate — no information gained by conditioningCommon trap: assuming the "between" term is always the interesting one; here it vanishes
YY a deterministic function of XX, e.g. Y=XY=XE[X∣Y]=XE[X\mid Y]=X a.s., so Var(X∣Y)=0\mathrm{Var}(X\mid Y)=0 a.s. and Var(X)=Var(E[X∣Y])\mathrm{Var}(X)=\mathrm{Var}(E[X\mid Y])All variance is "explained"; within term is zero, not the other way around
Conditioning on the wrong σ\sigma-algebra orderNested tower property E[E[X∣G2]∣G1]=E[X∣G1]E[E[X\mid\mathcal G_2]\mid \mathcal G_1]=E[X\mid \mathcal G_1] requires G1⊆G2\mathcal G_1\subseteq\mathcal G_2Reversing the order, E[E[X∣G1]∣G2]E[E[X\mid \mathcal G_1]\mid \mathcal G_2], generally gives E[X∣G1]E[X\mid\mathcal G_1] itself (a different, usually incorrect, simplification) whenever G1⊂G2\mathcal G_1\subset\mathcal G_2 — a very common bookkeeping error
Treating Var(X∣Y)\mathrm{Var}(X\mid Y) as a numberIt is a random variable, a function of YYWriting "Var(X∣Y=y)\mathrm{Var}(X\mid Y=y)" (a number, for fixed yy) versus "Var(X∣Y)\mathrm{Var}(X\mid Y)" (random) are different objects; the total variance law needs the latter, then take E[⋅]E[\cdot] over YY

The mathematician behind it

Origins · 1 minAndrey Nikolaevich Kolmogorov and how this was discovered
AN
Andrey Nikolaevich Kolmogorov
1903–1987 · Soviet Union, 20th century

Kolmogorov built the measure-theoretic foundations of probability in his 1933 monograph Grundbegriffe der Wahrscheinlichkeitsrechnung, defining conditional expectation via the Radon–Nikodym theorem and thereby making rigorous exactly the kind of iterated-conditioning arguments — the tower property and its variance analogue — that this article formalizes. Before Kolmogorov's axiomatization, "conditioning on a random variable" was handled informally through conditional densities; his framework extended it cleanly to conditioning on arbitrary sub-σ\sigma-algebras, which is precisely the generality needed for the nested tower property proved above.

History
- 1933: Kolmogorov's Grundbegriffe establishes measure-theoretic probability and defines conditional expectation via Radon–Nikodym derivatives.
- 1930s–1940s: The "law of total probability/expectation" becomes standard textbook machinery for discrete conditioning (Feller-style treatments).
- 1940s–1950s: Rao–Blackwell theorem (Calyampudi Radhakrishna Rao, David Blackwell) exploits the total variance decomposition to show conditioning on a sufficient statistic never increases variance of an unbiased estimator.
- 1950s onward: Martingale theory (Joseph Doob) formalizes iterated conditional expectations E[X∣Fn]E[X\mid\mathcal F_n] as the core object of stochastic processes, generalizing the nested tower property to filtrations.
- 1970s–present: Hierarchical and random-effects statistical models (variance components, mixed models) make the within/between variance split from the total variance law a standard tool in applied statistics.
Why is it called the "tower" property?

The name evokes stacking layers of conditioning: conditioning on more information (G2\mathcal G_2) and then conditioning that result on less information (G1⊆G2\mathcal G_1\subseteq \mathcal G_2) collapses to conditioning on the smaller σ\sigma-algebra directly, as if descending a tower of nested filtrations one level at a time. Visually, you can imagine a tower of σ\sigma-algebras {∅,Ω}⊆G1⊆G2⊆⋯⊆F\{\emptyset,\Omega\}\subseteq \mathcal G_1\subseteq \mathcal G_2\subseteq \cdots \subseteq \mathcal F, and the property says you can always "telescope" down to the coarsest one in the chain by successive conditioning, in either one big step or many small steps, with the same result. This telescoping is exactly what makes multi-stage models (e.g., martingale filtrations, Markov chains, hierarchical Bayes) tractable, since it lets you compute expectations stage by stage.

Can the "between-group" variance term ever exceed the total variance?

No. Since E[Var(X∣Y)]≥0E[\mathrm{Var}(X\mid Y)]\ge 0 always (as conditional variance is a.s. nonnegative), the law of total variance immediately gives Var(E[X∣Y])≤Var(X)\mathrm{Var}(E[X\mid Y]) \le \mathrm{Var}(X), with equality exactly when Var(X∣Y)=0\mathrm{Var}(X\mid Y)=0 a.s. — that is, when XX is (a.s.) a deterministic function of YY. This inequality, Var(E[X∣Y])≤Var(X)\mathrm{Var}(E[X\mid Y])\le \mathrm{Var}(X), is precisely the mathematical content of the Rao–Blackwell theorem: replacing an estimator by its conditional expectation given a sufficient statistic never increases variance, since it removes only "noise" that is orthogonal to information already captured by that statistic.

Does the law of total variance require XX and YY to have a joint density, or joint discreteness?

No. The proof given uses only the abstract projection characterization of conditional expectation in L2(Ω,F,P)L^2(\Omega,\mathcal F,P), valid for arbitrary random variables (or random vectors) YY on any probability space, discrete, continuous, or neither. Joint densities or joint probability mass functions are a computational convenience — they let you write E[X∣Y=y]=∫xfX∣Y(x∣y)dxE[X\mid Y=y]=\int x f_{X\mid Y}(x\mid y)dx explicitly — but the theorem itself holds in full generality as long as E[X2]<∞E[X^2]<\infty.

How does this relate to ANOVA (analysis of variance) in statistics?

One-way ANOVA partitions the total sum of squares in a dataset into "between-group" and "within-group" sums of squares, exactly mirroring the two terms in the law of total variance, with the group label playing the role of YY. If YY denotes a randomly drawn group label and XX a randomly drawn observation from that group, then the population version of the ANOVA decomposition is precisely Var(X)=E[Var(X∣Y)]+Var(E[X∣Y])\mathrm{Var}(X)=E[\mathrm{Var}(X\mid Y)]+\mathrm{Var}(E[X\mid Y]); ANOVA's F-statistic is built from sample estimates of these two population quantities, testing whether the between-group term is large relative to the within-group term.

What happens if YY is a random vector instead of a single random variable?

Everything goes through unchanged: the theorem and proof never use that YY is real-valued, only that σ(Y)\sigma(Y) is a well-defined sub-σ\sigma-algebra of F\mathcal F. So Y=(Y1,…,Yk)Y=(Y_1,\dots,Y_k) can be any random vector (or even, most generally, any sub-σ\sigma-algebra G\mathcal G directly, with E[X∣Y]E[X\mid Y] replaced by E[X∣G]E[X\mid \mathcal G] throughout). This flexibility is exactly what is used when conditioning on an entire history Fn=σ(Y1,…,Yn)\mathcal F_n=\sigma(Y_1,\dots,Y_n) in martingale and Markov chain theory.

Where this leads