St · Statistics & Probability

How to Prove the Law of Total Expectation

Updated 13 October 2026

At a glance

  1. 1. Identify the information

    Choose the random variable or event information you are conditioning on.

  2. 2. Find conditional means

    Compute the expected value of the target variable for each relevant condition.

  3. 3. Average those means

    Weight each conditional mean by how likely its condition is, or integrate over the conditioning variable.

  4. 4. Use the definition

    For the general proof, apply the defining integral property of conditional expectation to the whole sample space.

The law of total expectation says that you can calculate an overall mean by first finding conditional means and then averaging them over the conditions. It is often called the tower property of expectation.

The key identity is E[Y]=E[E[Y∣X]]\mathbb{E}[Y]=\mathbb{E}[\mathbb{E}[Y\mid X]]. Below is a proof from the definition of conditional expectation, followed by the familiar discrete calculation and a worked example.

The law and its conditions

Let YY be an integrable random variable, meaning E[∣Y∣]<∞\mathbb{E}[|Y|]<\infty. Let XX represent information you are conditioning on. Then

E[Y]=E[E[Y∣X]].\mathbb{E}[Y]=\mathbb{E}[\mathbb{E}[Y\mid X]].

Here, E[Y∣X]\mathbb{E}[Y\mid X] is shorthand for conditioning on all the information determined by XX. It is itself a random variable: its value depends on the observed value of XX. The outer expectation averages that conditional mean across the distribution of XX.

The identity also applies when you condition on a partition or, more generally, on a sigma-algebra. If YY is nonnegative, it holds as well with expectations allowed to be infinite.

Proof from the definition

Let G\mathcal{G} be the information being conditioned on, and write Z=E[Y∣G]Z=\mathbb{E}[Y\mid\mathcal{G}]. The defining properties of conditional expectation say that ZZ is measurable with respect to G\mathcal{G} and that, for every event AA in G\mathcal{G},

E[Z1A]=E[Y1A].\mathbb{E}[Z\mathbf{1}_A]=\mathbb{E}[Y\mathbf{1}_A].

Take AA to be the entire sample space Ω\Omega. Since 1Ω=1\mathbf{1}_\Omega=1, this gives

E[Z]=E[Y].\mathbb{E}[Z]=\mathbb{E}[Y].

Substituting Z=E[Y∣G]Z=\mathbb{E}[Y\mid\mathcal{G}] proves

E[E[Y∣G]]=E[Y].\mathbb{E}[\mathbb{E}[Y\mid\mathcal{G}]]=\mathbb{E}[Y].

Choosing G\mathcal{G} to be the information determined by XX gives the usual form, E[E[Y∣X]]=E[Y]\mathbb{E}[\mathbb{E}[Y\mid X]]=\mathbb{E}[Y]. The proof is short because the definition of conditional expectation already guarantees that its average over the whole sample space matches the average of YY.

Discrete derivation

Suppose XX and YY are discrete. For values xx with P(X=x)>0P(X=x)>0, the conditional mean is

E[Y∣X=x]=∑yyP(Y=y∣X=x).\mathbb{E}[Y\mid X=x]=\sum_y yP(Y=y\mid X=x).

Weight each such mean by P(X=x)P(X=x) and sum over xx:

∑xE[Y∣X=x]P(X=x)=∑x∑yyP(Y=y∣X=x)P(X=x)=∑x∑yyP(X=x,Y=y)=E[Y].\begin{aligned} \sum_x \mathbb{E}[Y\mid X=x]P(X=x) &=\sum_x\sum_y yP(Y=y\mid X=x)P(X=x)\\ &=\sum_x\sum_y yP(X=x,Y=y)\\ &=\mathbb{E}[Y]. \end{aligned}

The second line uses P(Y=y∣X=x)P(X=x)=P(X=x,Y=y)P(Y=y\mid X=x)P(X=x)=P(X=x,Y=y). This calculation makes the averaging interpretation explicit. For a continuous XX with an appropriate conditional density, the analogous formula is

E[Y]=∫E[Y∣X=x]fX(x) dx,\mathbb{E}[Y]=\int \mathbb{E}[Y\mid X=x]f_X(x)\,dx,

where fXf_X is the density of XX. The conditional mean as a function of xx is averaged using the density of the conditioning variable.

Worked example: two routes

A delivery takes route A with probability 0.40.4 and route B with probability 0.60.6. On either route, the delivery earns \10ifitarrivesontimeandcostsif it arrives on time and costs$2ifitislate.RouteAisontimewithprobabilityif it is late. Route A is on time with probability0.8;routeBisontimewithprobability; route B is on time with probability 0.5.Let. Let Y$ be the net payoff.

First calculate the conditional expected payoff on each route:

E[Y∣A]=0.8(10)+0.2(−2)=7.6,E[Y∣B]=0.5(10)+0.5(−2)=4.\begin{aligned} \mathbb{E}[Y\mid A]&=0.8(10)+0.2(-2)=7.6,\\ \mathbb{E}[Y\mid B]&=0.5(10)+0.5(-2)=4. \end{aligned}

Now average these conditional expectations using the route probabilities:

E[Y]=0.4(7.6)+0.6(4)=5.44.\mathbb{E}[Y]=0.4(7.6)+0.6(4)=5.44.

As a check, the overall probability of arriving on time is 0.4(0.8)+0.6(0.5)=0.620.4(0.8)+0.6(0.5)=0.62. Calculating directly gives 0.62(10)+0.38(−2)=5.440.62(10)+0.38(-2)=5.44, the same result.

Common mistakes

  • Forgetting the outer expectation. The conditional expectation E[Y∣X]\mathbb{E}[Y\mid X] generally varies with XX. The law says to average that random variable; it does not say that each conditional mean equals the overall mean.
  • Using unweighted averages. In the discrete formula, each conditional mean is weighted by the probability of its condition. Conditions with different probabilities should not receive equal weight unless they are equally likely.
  • Assuming independence is needed. The law holds whether or not XX and YY are independent. Independence can make the conditional expectation simpler, but it is not required for the identity.
  • Conditioning on a zero-probability value. In a discrete model, E[Y∣X=x]\mathbb{E}[Y\mid X=x] is only defined by the usual conditional-probability formula when P(X=x)>0P(X=x)>0. In continuous models, conditional values at individual points are generally specified only up to sets of probability zero; the integral formula is the relevant statement.

References

  1. Introduction to Probability, 2nd edition, by Joseph K. Blitzstein and Jessica Hwang
  2. A First Course in Probability, by Sheldon Ross

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.