Why Conditional Means Need a Conditional Density
A joint density describes two continuous random variables together, but it does not by itself give the mean of one variable after the other has been observed. To answer a question such as “What is the expected value of \(Y\) when \(X=x\)?”, first determine the distribution of \(Y\) at that fixed value of \(X\). The resulting conditional density supplies both the correct weights and the correct range of integration.
This calculation matters whenever the variables are dependent or their possible values are linked by the support. For example, if a joint density is positive only when \(0<y<x\), observing \(X=x\) restricts \(Y\) to the interval from \(0\) to \(x\). Integrating over a different range, or using the joint density without adjusting it, will not produce a conditional mean.
The conditional support is the set of \(y\)-values for which the joint density can be positive when \(X=x\) is fixed. It may depend on \(x\), and it may be bounded or unbounded. The formula for the conditional density applies only where \(f_X(x)>0\). At values with \(f_X(x)=0\), the density ratio is undefined; values assigned to a conditional distribution there do not affect probabilities under the distribution of \(X\).
From a Joint Density to a Conditional Mean
The calculation has three main parts: find the marginal density, form the conditional density on the appropriate support, and integrate \(y\) against that density. The marginal is obtained by integrating the joint density over all possible values of the other variable. In particular, if the joint support at a fixed \(x\) allows \(y\) to range from \(a(x)\) to \(b(x)\), then
The limits must describe the joint support at that value of \(x\). Once \(f_X(x)\) is known and positive, dividing by it normalizes the joint density along the slice where \(X=x\).
Integrate the joint density over the full permitted range of the variable being conditioned on.
Divide the joint density by the marginal density of the variable whose value is fixed.
Multiply the conditional density by \(y\) and integrate over the conditional support, checking that the integral is finite.
Why the Density Ratio Works
The marginal density is the total joint density along a slice at \(X=x\). Dividing the joint density on that slice by its total makes the conditional density integrate to one:
This is also consistent with conditioning on a narrow interval around \(x\). The joint probability of \(Y\) lying in a set and \(X\) lying in that interval is divided by the probability that \(X\) lies in the interval. As the interval narrows, the ratio of the corresponding densities gives \(f_{X,Y}(x,y)/f_X(x)\), under the usual regularity conditions for densities. The conditional mean then follows from the definition of the mean of a continuous random variable, applied to this conditional density.
Worked Examples
Worked Example: A Uniform Density on a Triangular Support
Suppose \((X,Y)\) has joint density \(f_{X,Y}(x,y)=2\) when \(0<y<x<1\), and zero elsewhere. Find \(E[Y\mid X=0.6]\). The joint support is a bounded triangle, and the conditional range of \(Y\) changes with \(x\).
Method: marginalize, normalize, then integrate. At a fixed \(x\) between 0 and 1, the support for \(y\) is \(0<y<x\). Therefore
The joint density is normalized because
For \(0<x<1\), the conditional density is
It integrates to one on its conditional support:
Thus the conditional mean at a general \(x\) is
At \(x=0.6\), \(E[Y\mid X=0.6]=0.6/2=0.3\). As a check, the conditional density is uniform from \(0\) to \(0.6\), whose midpoint is \(0.3\). A common mistake is to stop at the unnormalized integral \(\int_0^{0.6}2y\,dy=0.36\), which uses the joint density but is not a conditional mean. Dividing by \(f_X(0.6)=1.2\) gives \(0.36/1.2=0.3\), as does using the conditional density directly.
Worked Example: A Nonuniform Conditional Density
Suppose the joint density is \(f_{X,Y}(x,y)=6y\) for \(0<y<x<1\), and zero elsewhere. Find the conditional density of \(Y\) given \(X=x\), then calculate \(E[Y\mid X=0.75]\).
Method: integrate the joint density over the changing slice. For \(0<x<1\),
The stated joint density is normalized, since
For \(0<y<x<1\), divide by the marginal density:
This conditional density is nonnegative and integrates to one:
Now calculate the conditional mean:
At \(x=0.75\), this is \(2(0.75)/3=1.5/3=0.5\). The result lies within the conditional support \(0<Y<0.75\), as required. The common mistake is to treat the conditional distribution as uniform merely because the support is an interval. Here the density is proportional to \(y\), so larger values receive more weight; the correct mean is \(0.5\), not the interval midpoint \(0.375\).
Worked Example: An Unbounded Conditional Support
Let \(X\) have density \(e^{-x}\) for \(x>0\). Given \(X=x\), suppose \(Y\) has an exponential density with rate \(x+1\), so that the joint density is
Find \(E[Y\mid X=1]\). The conditional support \(y>0\) is unbounded.
Method: use the marginal to isolate the conditional density. Integrating over \(y>0\) gives
The marginal integrates to \(\int_0^\infty e^{-x}\,dx=1\). Dividing the joint density by \(f_X(x)\) yields
Put \(\lambda=x+1>0\). Integration by parts gives
The boundary term is zero because \(ye^{-\lambda y}\) tends to zero as \(y\) tends to infinity and is zero at \(y=0\). Therefore \(E[Y\mid X=x]=1/(x+1)\), and at \(x=1\) the answer is \(1/2=0.5\). The conditional density integrates to one, and the computed mean is finite. A common error is to integrate only over a bounded interval despite the support being all \(y>0\); the correct integral uses the limits \(0\) and \(\infty\).
Checks and Common Traps
A conditional mean calculation is most reliable when the support and normalization are checked explicitly. In particular, the denominator in the conditional density is the marginal density of the variable being fixed—not a probability for an unrelated event. The integration limits come from the joint support after fixing that variable, and can vary with its value.
- Using the wrong slice. To find \(E[Y\mid X=x]\), integrate the joint density over \(y\) to obtain \(f_X(x)\), and integrate the conditional mean over the permitted \(y\)-values.
- Forgetting the normalizing divisor. The integral \(\int y f_{X,Y}(x,y)\,dy\) is not generally the conditional mean. Divide by \(f_X(x)\), or use the conditional density that already includes this division.
- Assuming the conditional support is fixed. In a triangular region such as \(0<y<x<1\), the upper limit for \(y\) is \(x\), not always 1.
- Ignoring existence. A conditional mean requires \(\int |y| f_{Y\mid X}(y\mid x)\,dy<\infty\). For an unbounded support, this must not be assumed without checking.
Check Your Understanding
For each problem, find the requested conditional density or mean by identifying the marginal and the conditional support before integrating.
- The joint density is \(1/2\) on \(0<y<x<2\) and zero elsewhere. Find \(f_{Y\mid X}(y\mid x)\) and \(E[Y\mid X=1.4]\). (Answer: \(f_{Y\mid X}(y\mid x)=1/x\) for \(0<y<x\); \(E[Y\mid X=1.4]=0.7\).)
- The joint density is \(2\) on \(0<x<y<1\) and zero elsewhere. Find \(f_{X\mid Y}(x\mid y)\) and \(E[X\mid Y=0.6]\). (Answer: \(f_{X\mid Y}(x\mid y)=1/y\) for \(0<x<y\); \(E[X\mid Y=0.6]=0.3\).)
- The joint density is \(e^{-x}/(2x)\) on \(x>0,\ 0<y<2x\), and zero elsewhere. Find \(f_X(x)\), \(f_{Y\mid X}(y\mid x)\), and \(E[Y\mid X=1.2]\). (Answer: \(f_X(x)=e^{-x}\) for \(x>0\); \(f_{Y\mid X}(y\mid x)=1/(2x)\) for \(0<y<2x\); \(E[Y\mid X=1.2]=1.2\).)
- The joint density is \(e^{-x}(x+3)e^{-(x+3)y}\) for \(x>0,\ y>0\), and zero elsewhere. Find \(f_{Y\mid X}(y\mid x)\) and \(E[Y\mid X=1]\). (Answer: \(f_{Y\mid X}(y\mid x)=(x+3)e^{-(x+3)y}\) for \(y>0\); \(E[Y\mid X=1]=1/4\).)
- The joint density is \((x+1)e^{-(x+1)y}\) for \(0<x<1,\ y>0\), and zero elsewhere. Find \(f_X(x)\), \(f_{Y\mid X}(y\mid x)\), and \(E[Y\mid X=0.5]\). (Answer: \(f_X(x)=1\) for \(0<x<1\); \(f_{Y\mid X}(y\mid x)=(x+1)e^{-(x+1)y}\) for \(y>0\); \(E[Y\mid X=0.5]=2/3\).)