Why the Direction of a Slice Matters
A joint density describes probability over a two-dimensional region. To find the density of one variable alone, integrate the joint density across the values of the other variable that are possible at the chosen value. The key task is therefore geometric: identify exactly which part of the support lies on each vertical or horizontal slice.
A slice can change form as it moves across a support. For example, a vertical slice through a triangle may meet one sloping boundary on the left and another on the right. A horizontal slice through a region between a curve and a line may switch which boundary determines its endpoint. In these cases the marginal integral must be written piecewise.
The slice is taken at a fixed value of the variable whose marginal is being found. Thus, to find \(f_X(x)\), hold \(x\) fixed and integrate vertically with respect to \(y\). To find \(f_Y(y)\), hold \(y\) fixed and integrate horizontally with respect to \(x\). Values outside the range reached by the support have marginal density zero.
A Justification for the Marginal Formula
The marginal formula follows by adding the joint probability across the full range of the variable being removed. For an interval \((a,b)\), the event \(a<X<b\) includes all points of the support whose \(x\)-coordinate is between \(a\) and \(b\). Its probability is the joint density integrated over that vertical strip:
The expression in square brackets is therefore the density that contributes at each \(x\), namely \(f_X(x)\). The same reasoning, using horizontal strips, gives \(f_Y(y)\). This change in the order of integration is valid for a nonnegative joint density; the support bounds must still describe the same region exactly.
Worked Examples on Changing Slices
Worked Example: A Triangle with a Changing Vertical Boundary
Let \((X,Y)\) have joint density \(f_{X,Y}(x,y)=1\) on the triangular support with vertices \((0,0)\), \((2,0)\), and \((1,1)\), and density zero elsewhere. Find both marginal densities.
Method. First describe the support using vertical slices. Its lower boundary is \(y=0\). The upper boundary is \(y=x\) for \(0<x<1\), then \(y=2-x\) for \(1<x<2\). The density is already normalized: the triangle has base \(2\), height \(1\), and area \(2(1)/2=1\).
For a fixed \(x\), integrate vertically. The upper boundary changes at \(x=1\), so \(f_X\) must be piecewise:
For a fixed \(y\), a horizontal slice starts at the line \(y=x\), or \(x=y\), and ends at \(y=2-x\), or \(x=2-y\). This applies for \(0<y<1\):
Outside \(0<y<1\), \(f_Y(y)=0\). Check both marginals: \(\int_0^1x\,dx+\int_1^2(2-x)\,dx=1/2+1/2=1\), and \(\int_0^1(2-2y)\,dy=1\). Both are nonnegative on their supports and integrate to one.
Common mistake avoided: using \(0<y<x\) for every \(0<x<2\) extends the slice above the triangle when \(x>1\). The correct upper boundary switches from \(x\) to \(2-x\) at \(x=1\).
Worked Example: A Quarter-Disk Support
Suppose \((X,Y)\) is uniform on the quarter disk \(R=\{(x,y):x\geq0,\ y\geq0,\ x^2+y^2\leq1\}\). Find the joint density and the two marginal densities.
Method. A uniform density on a region is the reciprocal of its area. The quarter disk has area \(\pi/4\), so \(f_{X,Y}(x,y)=4/\pi\) on \(R\), and zero elsewhere. For a fixed \(x\) between 0 and 1, the circle gives \(0\le y\le\sqrt{1-x^2}\). Therefore,
For a fixed \(y\) between 0 and 1, the same circle gives \(0\le x\le\sqrt{1-y^2}\). Hence,
Both densities are zero outside their stated ranges. To check normalization, substitute \(x=\sin\theta\) in the integral for \(f_X\): \(\int_0^1(4/\pi)\sqrt{1-x^2}\,dx=(4/\pi)\int_0^{\pi/2}\cos^2\theta\,d\theta=(4/\pi)(\pi/4)=1\). The \(f_Y\) integral is identical.
Common mistake avoided: replacing the curved boundary with \(y=1-x\) would describe a triangle, not a quarter disk. The circle equation must be solved for the coordinate being integrated out.
Worked Example: A Curved Region with a Changing Horizontal Slice
Let the support be \(R=\{(x,y):0<x<1,\ x^2<y<2-x\}\), with a uniform joint density on \(R\). Find the normalized joint density and both marginals.
Method. The vertical description is direct: for each \(0<x<1\), \(y\) ranges from \(x^2\) to \(2-x\). The area is
Thus the uniform joint density is \(c=1/(7/6)=6/7\) on \(R\). Integrating vertically gives
and \(f_X(x)=0\) otherwise. For the horizontal slices, \(y\) ranges from 0 to 2. The support inequalities require \(x^2<y\), so \(x<\sqrt y\), and \(y<2-x\), so \(x<2-y\); also \(x>0\). The right endpoint is the smaller of \(\sqrt y\) and \(2-y\). To find where it switches, set them equal. With \(t=\sqrt y\), the equation is \(t=2-t^2\), or \(t^2+t-2=0\). Its nonnegative solution is \(t=1\), hence \(y=1\).
Check \(f_X\): its integral is \((6/7)(7/6)=1\), using the area calculation above. Check \(f_Y\): \(\int_0^1(6/7)\sqrt y\,dy+\int_1^2(6/7)(2-y)\,dy=(6/7)(2/3+1/2)=1\).
Common mistake shown and corrected: using \(\sqrt y\) as the horizontal endpoint for all \(0<y<2\) is wrong. For \(y>1\), it exceeds \(2-y\), so it includes points above the line \(y=2-x\). The line supplies the correct endpoint on that interval.
A Reliable Procedure and Common Traps
When a support has several boundaries, writing the inequalities first is safer than guessing integration limits from a sketch. Then hold one coordinate fixed and solve the inequalities for the other. The following procedure makes the point where a slice changes explicit.
Include every boundary and state the ranges of the coordinates.
For \(f_X\), fix \(x\) and find the vertical range of \(y\). For \(f_Y\), fix \(y\) and find the horizontal range of \(x\).
Compare candidate boundary curves and solve for their intersections within the support.
Use the joint density in every integral, set the marginal to zero outside its support, and check nonnegativity and total integral one.
A common exam trap is to find plausible bounds for one direction and reuse them in the other. The horizontal limits are not obtained by merely swapping the symbols \(x\) and \(y\); each boundary must be solved for the coordinate that is being integrated. Another trap is to miss an intersection that changes which boundary is active. A quick check is to test one point on each side of the proposed breakpoint against the support inequalities.
Check Your Understanding
For each problem, identify the slice bounds before integrating. Answers are included for checking.
- A joint density is uniform on the triangle \(0<x<3,\ 0<y<\min(x,3-x)\). Find its constant density and \(f_X(x)\), including the change point. (Answer: \(c=4/9\); \(f_X(x)=4x/9\) for \(0<x<3/2\), \(f_X(x)=4(3-x)/9\) for \(3/2\le x<3\), and zero otherwise.)
- A joint density is uniform on the first-quadrant ellipse \(x^2/4+y^2/9<1\). Find its constant density and \(f_Y(y)\). (Answer: \(c=2/(3\pi)\); \(f_Y(y)=\frac{4}{3\pi}\sqrt{1-y^2/9}\) for \(0<y<3\), and zero otherwise.)
- A joint density is uniform on \(0<x<1,\ x^2<y<1\). Normalize it and find the horizontal-slice marginal \(f_Y(y)\). (Answer: \(c=3/2\); \(f_Y(y)=\frac32\sqrt y\) for \(0<y<1\), and zero otherwise.)
- A joint density is uniform on \(0<x<1,\ 0<y<\sqrt{x}\). Find its normalizing constant and both marginal densities. (Answer: \(c=3/2\); \(f_X(x)=\frac32\sqrt{x}\) for \(0<x<1\), and \(f_Y(y)=\frac32(1-y^2)\) for \(0<y<1\); both are zero elsewhere.)
- A joint density is uniform on \(0<x<1,\ 0<y<1-x^2\). Find the constant and the horizontal-slice marginal \(f_Y(y)\), stating the support. (Answer: \(c=3/2\); \(f_Y(y)=\frac32\sqrt{1-y}\) for \(0<y<1\), and zero otherwise.)