Tutorials › Statistical Theory I - Probability and Distribution Theory › Conditional-Density Derivation for Sums

Many-to-One Transformations · Tutorial 431 of 994

Conditional-Density Derivation for Sums

Learn to derive and apply the sum-density formula using conditional densities, including when the summands are dependent.

Intermediate 10 min read

What You'll Learn

  • State conditions under which a pair with a joint density yields a density for its sum.
  • Derive the sum-density formula by conditioning and by integrating over the joint density.
  • Determine the integration limits from the joint support.
  • Calculate sum densities for several dependent pairs.
  • Check a derived density for support, nonnegativity, and total probability.

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

Definition: Suppose \((X,Y)\) has joint density \(f_{X,Y}(x,y)\) with respect to two-dimensional Lebesgue measure. The marginal density of \(X\) is $$ f_X(x)=\int_{-\infty}^{\infty} f_{X,Y}(x,y)\,dy. $$ For \(x\) such that \(f_X(x)>0\), a conditional density of \(Y\) given \(X=x\) is $$ f_{Y\mid X}(y\mid x)=\frac{f_{X,Y}(x,y)}{f_X(x)}. $$ Where \(f_X(x)=0\), the conditional density can be assigned arbitrarily; those \(x\)-values have probability zero under \(X\).
Theorem: If \((X,Y)\) has a joint density, then \(S=X+Y\) has a density. For almost every \(s\), $$ f_S(s)=\int_{-\infty}^{\infty} f_X(x)f_{Y\mid X}(s-x\mid x)\,dx =\int_{-\infty}^{\infty} f_{X,Y}(x,s-x)\,dx. $$ The integrand is zero wherever \((x,s-x)\) lies outside the support of the joint density.

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\):

$$ \begin{aligned} P(S\in A) &=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \mathbf{1}_{A}(x+y)f_{X,Y}(x,y)\,dy\,dx\\ &=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \mathbf{1}_{A}(s)f_{X,Y}(x,s-x)\,ds\,dx\\ &=\int_A\left\{\int_{-\infty}^{\infty} f_{X,Y}(x,s-x)\,dx\right\}\,ds. \end{aligned} $$

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\):

$$ f_X(x)=\int_x^1 2\,dy=2(1-x),\qquad 0<x<1. $$

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

$$ f_S(s)=2\int_{\max(0,s-1)}^{\min(1,s/2)}dx =\begin{cases} s,&0<s<1,\\ 2-s,&1\leq s<2,\\ 0,&\text{otherwise}. \end{cases} $$

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\),

$$ (2x-1)(2y-1) =(s-1+2t)(s-1-2t) =(s-1)^2-4t^2. $$

Thus the density is the integral of \(1+\frac12[(s-1)^2-4t^2]\) over that centered interval:

$$ f_S(s)= \begin{cases} L+\dfrac12\left(L(s-1)^2-\dfrac{L^3}{3}\right),&0<s<2,\quad L=\begin{cases}s,&s\leq1,\\2-s,&s>1,\end{cases}\\[6pt] 0,&\text{otherwise}. \end{cases} $$

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

$$ 2\int_0^1\left\{(1-u)+\frac12\left((1-u)u^2-\frac{(1-u)^3}{3}\right)\right\}du =2\left\{\frac12+\frac12\left(\frac1{12}-\frac1{12}\right)\right\}=1. $$

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,

$$ f_S(s)= \begin{cases} s/2,&0<s<1,\\ 1/2,&1\leq s<2,\\ (3-s)/2,&2\leq s<3,\\ 0,&\text{otherwise}. \end{cases} $$

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.

1
Find the conditional density.
Integrate the joint density to obtain \(f_X(x)\), then divide by \(f_X(x)\) where it is positive.
2
Substitute the sum constraint.
In \(f_X(x)f_{Y\mid X}(y\mid x)\), set \(y=s-x\).
3
Determine the limits.
Impose the original support conditions on \((x,s-x)\); split the \(s\)-range wherever the resulting limits change.
4
Check the result.
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.

Key takeaway: For a pair with a joint density, the density of \(X+Y\) is obtained by integrating the joint density along \(y=s-x\). Conditioning shows why this works and handles dependent variables without an independence assumption.

Check Your Understanding

Use the conditional-density formula and pay particular attention to the support.

  1. In the conditional-density formula for \(S=X+Y\), why is the conditional density evaluated at \(s-x\)?
  2. For a joint density supported on \(0<x<y<1\), what inequalities determine the limits of integration at a fixed \(s\)?
  3. When can \(f_X(x)f_Y(s-x)\) be used in place of the joint density along the line \(y=s-x\)?
  4. 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\).
  5. Name two checks that can help detect an error in a derived sum density.