Why Average a Conditional Average?
A conditional expectation gives the average value of a random variable after information about another random variable is known. The law of iterated expectation says that if those conditional averages are then averaged over the distribution of the conditioning variable, the result is the original unconditional mean. The identity is simple to state, but its justification depends on how the conditional average is formed and on whether the relevant expectations exist.
For example, an insurer might estimate average claim payment separately for several hypothetical risk classes. Averaging those class-specific means using the proportions of policies in each class must reproduce the overall mean payment. The same principle applies when the conditioning variable is continuous, but the weighted sum becomes an integral.
The notation \(E[X\mid Y=y]\) denotes a number, when the conditional distribution at \(Y=y\) is defined. The notation \(E[X\mid Y]\) denotes the random variable obtained by evaluating that conditional-mean function at the random value \(Y\). For values \(y\) having probability zero, the conditional mean may be assigned arbitrarily without changing \(E[X\mid Y]\) as a random variable.
Derivation for Discrete Random Variables
Suppose \(X\) and \(Y\) have a joint probability mass function \(p_{X,Y}(x,y)=P(X=x,Y=y)\), and suppose \(E[|X|]<\infty\). For any \(y\) with \(P(Y=y)>0\), the conditional probability mass function is
The conditional mean is found by summing \(x\) times this conditional probability. Averaging that conditional mean over the possible values of \(Y\) gives the result:
The key step is cancellation of \(P(Y=y)\) in the conditional probability formula: multiplying \(P(X=x\mid Y=y)\) by \(P(Y=y)\) recovers the joint probability. The inner sum over \(y\) is the marginal probability \(P(X=x)\). The condition \(E[|X|]<\infty\) ensures that the sums can be rearranged without an ambiguity from an undefined difference of infinite positive and negative parts.
Worked Example: Recovering a Mean From a Joint Probability Table
A hypothetical insurer classifies a randomly selected policy as low-risk (\(Y=L\)) or high-risk (\(Y=H\)). Let \(X\) be the number of claims reported by that policy during a specified year. The joint probabilities are shown below. Find \(E[X\mid Y=L]\), \(E[X\mid Y=H]\), and \(E[X]\), then verify the law of iterated expectation.
| Risk class \(Y\) | \(P(X=0,Y)\) | \(P(X=1,Y)\) | \(P(X=2,Y)\) | \(P(Y)\) |
|---|---|---|---|---|
| \(L\) | 0.20 | 0.10 | 0.10 | 0.40 |
| \(H\) | 0.10 | 0.30 | 0.20 | 0.60 |
Method and condition check. This is a finite discrete distribution, so each expectation is a probability-weighted sum. The joint probabilities add to \(0.20+0.10+0.10+0.10+0.30+0.20=1.00\); \(X\) is bounded between 0 and 2, so \(E[|X|]<\infty\).
Low-risk conditional mean. Divide each joint probability in the \(L\) row by \(P(Y=L)=0.40\). Thus the conditional probabilities for \(X=0,1,2\) are \(0.20/0.40=0.50\), \(0.10/0.40=0.25\), and \(0.10/0.40=0.25\). Therefore,
High-risk conditional mean. Divide the \(H\) row by \(P(Y=H)=0.60\). The conditional probabilities are \(0.10/0.60=1/6\), \(0.30/0.60=1/2\), and \(0.20/0.60=1/3\). Hence,
Average the conditional means. Weight the two results by their class probabilities:
Direct check. The marginal probabilities are \(P(X=0)=0.20+0.10=0.30\), \(P(X=1)=0.10+0.30=0.40\), and \(P(X=2)=0.10+0.20=0.30\). Thus \(E[X]=0(0.30)+1(0.40)+2(0.30)=1.00\), matching the iterated expectation. The method avoids the common mistake of treating a conditional mean as the overall mean without weighting it by the probability of its conditioning class.
Derivation for Continuous Random Variables
Now suppose \((X,Y)\) has a joint density \(f_{X,Y}(x,y)\), and suppose \(E[|X|]<\infty\). Where the marginal density \(f_Y(y)\) is positive, the conditional density is \(f_{X\mid Y}(x\mid y)=f_{X,Y}(x,y)/f_Y(y)\). The conditional mean is the integral of \(x\) against this density. Substituting this definition and using \(f_{X,Y}(x,y)=f_{X\mid Y}(x\mid y)f_Y(y)\) gives
The joint density is zero outside its support, so the double integral covers only possible pairs \((x,y)\). The change in order of integration is justified by absolute integrability: \(\int\int |x|f_{X,Y}(x,y)\,dx\,dy=E[|X|]<\infty\). Also, the conditional mean is integrable because
This inequality follows because the absolute value of a conditional average cannot exceed the conditional average of the absolute value. Thus both sides of the law are finite under the stated condition.
Worked Example: Conditioning on a Continuous Measurement
For a hypothetical model, let \(X\) and \(Y\) have joint density \(f_{X,Y}(x,y)=2\) on \(0<x<y<1\), and zero elsewhere. Find \(E[X\mid Y=y]\), then use it to calculate \(E[X]\). Check the result by integrating the joint density directly.
Method and condition check. The support is a triangle of area \(1/2\), so the density integrates to \(2(1/2)=1\). Since \(0<X<1\), \(E[|X|]\leq 1\), and the required integrability condition holds.
Find the marginal density of \(Y\). For fixed \(y\) between 0 and 1, \(x\) ranges from 0 to \(y\). Therefore,
Find the conditional density and mean. For \(0<y<1\), divide the joint density by \(f_Y(y)\):
The conditional density is uniform over \((0,y)\), and direct integration gives
Average over \(Y\). Using the marginal density,
Direct check. Integrate \(x\) against the joint density over its triangular support:
The direct calculation agrees with the iterated expectation. A common error is to average \(y/2\) using a uniform density for \(Y\). The marginal density is \(2y\), not 1; using the correct marginal is essential.
Finite Mixtures and the Meaning of the Weights
When \(Y\) is a category, \(E[X\mid Y]\) is a category-specific mean. The unconditional mean is the weighted average of those means, with weights \(P(Y=y)\). The weights must reflect how frequently each category occurs in the population or model. They are not generally equal, and they are not the conditional probabilities within a category.
Worked Example: Combining Conditional Claim-Payment Means
A hypothetical portfolio has two contract types, \(Y=A\) and \(Y=B\), with \(P(Y=A)=0.25\) and \(P(Y=B)=0.75\). Let \(X\) be the annual claim payment, in thousands of dollars. Conditional on type \(A\), \(X\) is 0, 2, or 8 with probabilities 0.50, 0.25, and 0.25. Conditional on type \(B\), those same amounts have probabilities 0.70, 0.20, and 0.10. Find the overall expected payment and verify it using the marginal distribution.
Method and condition check. Apply the law of iterated expectation, then check by calculating the mixture probabilities. The payment is bounded between 0 and 8 thousand dollars, so it is integrable.
Conditional means. For type \(A\),
For type \(B\),
Weight by contract type. The probabilities \(0.25\) and \(0.75\) give
Thus the expected annual payment is 1.525 thousand dollars, or $1,525.00.
Marginal-distribution check. The joint mixture gives \(P(X=0)=0.25(0.50)+0.75(0.70)=0.125+0.525=0.650\); \(P(X=2)=0.25(0.25)+0.75(0.20)=0.0625+0.1500=0.2125\); and \(P(X=8)=0.25(0.25)+0.75(0.10)=0.0625+0.0750=0.1375\). These probabilities sum to \(0.6500+0.2125+0.1375=1.0000\). Hence,
The two methods agree. The exam trap is to take the simple average \((2.50+1.20)/2=1.85\), which incorrectly assigns equal portfolio weight to the two contract types.
When the Identity Applies
The standard finite-mean version requires \(E[|X|]<\infty\). This condition is stronger than merely writing down a conditional mean for some values of \(Y\): it ensures that \(E[X]\) exists as a finite number and that the conditional means can be averaged without an undefined rearrangement of infinite quantities. A useful sufficient check is that \(X\) is bounded; more generally, verify that the expectation of its absolute value is finite.
If \(X\) is nonnegative, the corresponding equality holds in the extended sense, allowing both sides to be \(+\infty\). That is not a finite-mean conclusion. For a signed random variable with infinite positive and negative parts, \(E[X]\) may be undefined, and the finite law cannot be invoked to assign it a value. Always check integrability before using the identity as an equation between finite expectations.
Confirm that \(E[|X|]<\infty\) when a finite unconditional mean is required.
Use a conditional probability mass function for discrete conditioning or a conditional density for continuous conditioning.
Use \(P(Y=y)\) as weights in a discrete sum or \(f_Y(y)\) in an integral.
When practical, compute the marginal distribution of \(X\) and evaluate \(E[X]\) directly.
The law is a basic consistency principle for conditional calculations and is aligned with the SOA VEE Mathematical Statistics syllabus. It does not say that every conditional mean equals the unconditional mean; it says that their properly weighted average does. The distinction matters whenever the conditioning groups have different probabilities or a continuous conditioning variable has a nonuniform marginal density.
Check Your Understanding
For each problem, check both the conditional calculation and the weights used to average it.
- A hypothetical portfolio has \(P(Y=A)=0.30\) and \(P(Y=B)=0.70\). Given \(A\), a claim count \(X\) is 0, 4, or 10 with probabilities 0.20, 0.50, and 0.30. Given \(B\), it is 0, 4, or 10 with probabilities 0.10, 0.20, and 0.70. Find \(E[X\mid A]\), \(E[X\mid B]\), and \(E[X]\). (Answer: \(E[X\mid A]=5\), \(E[X\mid B]=7.8\), and \(E[X]=6.96\).)
- Let \(X,Y\) have density \(2\) on \(0<y<x<1\) and zero elsewhere. Find \(E[Y\mid X=x]\) and then \(E[Y]\). (Answer: \(E[Y\mid X=x]=x/2\) and \(E[Y]=1/3\).)
- A hypothetical service-cost variable \(X\), in dollars, has conditional means \(E[X\mid Y=1]=15\), \(E[X\mid Y=2]=8\), and \(E[X\mid Y=3]=2\). If the three conditioning probabilities are 0.20, 0.50, and 0.30, find \(E[X]\). (Answer: \(7.6\) dollars.)
- Let \(P(X=n)=c/n^2\) and \(P(X=-n)=c/n^2\) for every positive integer \(n\), where \(c\) is the positive constant that makes the probabilities sum to 1. Set \(Y=X\). Is the finite-mean law applicable, and is \(E[X]\) defined? (Answer: No; \(E[|X|]=2c\sum_{n=1}^{\infty}1/n=\infty\), and the positive and negative parts both have infinite expectation, so \(E[X]\) is undefined.)
- A hypothetical portfolio has \(P(Y=C)=0.40\) and \(P(Y=D)=0.60\). Given \(C\), a payment \(X\) is 0 or 5 thousand dollars with probabilities 0.80 and 0.20; given \(D\), it is 0 or 5 thousand dollars with probabilities 0.30 and 0.70. Find the conditional means and the overall mean, in thousands of dollars. (Answer: \(E[X\mid C]=1\), \(E[X\mid D]=3.5\), and \(E[X]=2.5\) thousand dollars.)