Why Condition When Finding a Sum?
For \(S=X+Y\), the value of \(S\) combines both coordinates of the pair \((X,Y)\). At a fixed value \(s\), all contributing pairs lie on the line \(y=s-x\). If \(X\) and \(Y\) are dependent, their joint density need not factor into marginal densities; the conditional distribution of \(Y\) given \(X\) keeps that dependence in the calculation.
The key step is to fix \(X=x\). Given that value, \(S=x+Y\) is a shift of \(Y\), so its conditional density is the conditional density of \(Y\) evaluated at \(s-x\). Averaging this conditional density over the possible values of \(X\) gives the density of the sum.
The Conditional-Density Formula
The first expression emphasizes conditioning: for each fixed \(x\), evaluate the conditional density at \(s-x\), then average over \(X\). The second expression follows because \(f_X(x)f_{Y\mid X}(y\mid x)=f_{X,Y}(x,y)\) for almost every \((x,y)\). Importantly, neither expression assumes independence.
Why the Formula Gives a Density
A proof can be given directly from probabilities, so it also makes clear which integration is being performed. Let \(A\) be any Borel subset of the real line. Since \((X,Y)\) has joint density, Tonelli's theorem applies to the nonnegative integrand below. For each fixed \(x\), make the translation \(s=x+y\), which has \(dy=ds\):
The final equality again uses Tonelli's theorem, since the integrand is nonnegative. Thus the expression in braces is a density of \(S\), up to the usual freedom to change a density on a set of Lebesgue measure zero. Substituting the conditional-density definition into it gives the first form of the theorem. This also proves normalization: taking \(A=\mathbb{R}\) gives an integral of one.
Worked Dependent-Pair Examples
Worked Example: A Pair Ordered Within the Unit Interval
Suppose \((X,Y)\) has joint density \(f_{X,Y}(x,y)=2\) for \(0<x<y<1\), and zero elsewhere. Find the density of \(S=X+Y\).
First, integrate out \(y\) to find the marginal density of \(X\):
Consequently \(f_{Y\mid X}(y\mid x)=2/[2(1-x)]=1/(1-x)\) for \(x<y<1\). In the conditional formula, \(y=s-x\), so the integrand \(f_X(x)f_{Y\mid X}(s-x\mid x)\) equals \(2\) whenever \(0<x<s-x<1\), and equals zero otherwise. These inequalities require \(x<s/2\) and \(x>s-1\), in addition to \(0<x<1\). Hence
For \(0<s<1\), the integration interval is \((0,s/2)\), of length \(s/2\). For \(1\leq s<2\), it is \((s-1,s/2)\), of length \(1-s/2\). The support \(0<S<2\) agrees with \(0<X<Y<1\). As a check, \(\int_0^1s\,ds+\int_1^2(2-s)\,ds=1/2+1/2=1\).
Worked Example: A Smooth Dependent Density on the Unit Square
Let the joint density be \(f_{X,Y}(x,y)=1+\frac12(2x-1)(2y-1)\) for \(0<x<1\) and \(0<y<1\), and zero elsewhere. This is a valid density: the product lies between \(-1\) and \(1\), so the density is at least \(1/2\), and integrating the product term over the square gives zero. Find the density of \(S=X+Y\).
Integrating over \(y\) gives \(f_X(x)=1\) on \((0,1)\), because \(\int_0^1(2y-1)\,dy=0\). Therefore the conditional density \(f_{Y\mid X}(y\mid x)\) is the joint density itself on the unit square. For \(0<s<2\), define \(L=s\) if \(0<s\leq1\), and \(L=2-s\) if \(1<s<2\). The allowable \(x\)-interval has length \(L\). Center it at \(s/2\) by writing \(x=s/2+t\); the limits for \(t\) are \(-L/2\) and \(L/2\). Along \(y=s-x\),
Thus the density is the integral of \(1+\frac12[(s-1)^2-4t^2]\) over that centered interval:
Here \(\int_{-L/2}^{L/2}4t^2\,dt=L^3/3\), which gives the cubic term. The formula is nonnegative because it was obtained by integrating a joint density that is at least \(1/2\). To check its integral, use \(u=|s-1|\) on the two halves of the support. The integral is
The calculation retains the dependence in the joint density; replacing that density with a product of marginals would give a different answer.
Worked Example: A Slanted Conditional Support
Let \(X\) be uniform on \((0,1)\), and, given \(X=x\), let \(Y\) be uniform on \((x,x+1)\). Equivalently, the joint density is \(1\) on \(0<x<1,\ x<y<x+1\), and zero elsewhere. The support has area one, so this joint density is normalized. Find the density of \(S=X+Y\).
The marginal density of \(X\) is \(1\) on \((0,1)\), and the conditional density of \(Y\) given \(X=x\) is \(1\) on \((x,x+1)\). For the sum-density integral, require \(x<s-x<x+1\). Rearranging gives \((s-1)/2<x<s/2\); the additional condition \(0<x<1\) sets the actual limits. For \(0<s<1\), the limits are \(0\) and \(s/2\). For \(1\leq s<2\), they are \((s-1)/2\) and \(s/2\). For \(2\leq s<3\), they are \((s-1)/2\) and \(1\). Therefore,
The three pieces integrate to \(1/4\), \(1/2\), and \(1/4\), respectively, so the density integrates to one. The support \(0<S<3\) also follows from \(0<X<1\) and \(X<Y<X+1\).
Support, Dependence, and Common Mistakes
The support is not an afterthought: it determines which values of \(x\) contribute at each \(s\). In the integral, the line \(y=s-x\) must pass through the joint support. A reliable calculation states the support inequalities, substitutes \(y=s-x\), and solves those inequalities for \(x\) before integrating.
Integrate the joint density to obtain \(f_X(x)\), then divide by \(f_X(x)\) where it is positive.
In \(f_X(x)f_{Y\mid X}(y\mid x)\), set \(y=s-x\).
Impose the original support conditions on \((x,s-x)\); split the \(s\)-range wherever the resulting limits change.
Confirm that the density is nonnegative, vanishes outside the possible range of \(S\), and integrates to one.
A frequent error is to write \(f_X(x)f_Y(s-x)\) without establishing independence. That product is justified only when \(X\) and \(Y\) are independent; in general, it discards their dependence. The correction is to use \(f_X(x)f_{Y\mid X}(s-x\mid x)\), or equivalently \(f_{X,Y}(x,s-x)\).
Another common error is to integrate over all \(x\) even where \((x,s-x)\) is outside the joint support. The density is zero there, but incorrect limits can still lead to incorrect piecewise formulas or missed cases. Solve the support inequalities explicitly and verify the final normalization.
Check Your Understanding
Use the conditional-density formula and pay particular attention to the support.
- In the conditional-density formula for \(S=X+Y\), why is the conditional density evaluated at \(s-x\)?
- For a joint density supported on \(0<x<y<1\), what inequalities determine the limits of integration at a fixed \(s\)?
- When can \(f_X(x)f_Y(s-x)\) be used in place of the joint density along the line \(y=s-x\)?
- In the slanted-support example, explain why the density has different formulas on \(0<s<1\), \(1\leq s<2\), and \(2\leq s<3\).
- Name two checks that can help detect an error in a derived sum density.