Why the Triangle’s Shape Matters
For a point chosen uniformly from a triangle, the joint density is constant over the triangle. The conditional distribution of one coordinate, however, depends on the slice of the triangle left after the other coordinate is fixed. Because the triangle narrows or widens, the slice limits usually change with the conditioned value. Getting those limits right is the central step.
This tutorial develops conditional densities and means for such models. The method is useful whenever a joint distribution is uniform over a bounded region with sloping edges, including hypothetical models of two measurements subject to a linear constraint. It is aligned with the SOA VEE Mathematical Statistics syllabus.
The word uniformly means that equal-area subsets of the triangle have equal probability. It does not mean that either coordinate is automatically uniform over its entire range. For example, a horizontal slice might be long near the base and short near the top; values of \(Y\) near the top then receive less probability because fewer points in the triangle have those heights.
From Slice Length to Conditional Density
Suppose a horizontal slice at height \(y\) runs from \(L(y)\) to \(U(y)\). Its length is \(U(y)-L(y)\). Integrating the joint density across that slice gives the marginal density of \(Y\):
Where this marginal density is positive, the conditional density of \(X\) given \(Y=y\) is the joint density divided by the marginal density:
Thus, conditional on \(Y=y\), \(X\) is uniform across the horizontal slice. The same argument using a vertical slice gives the conditional law of \(Y\) given \(X=x\).
The conditioning value is not an event with positive probability: for a continuous variable, \(P(Y=y)=0\). The conditional density is defined through the density ratio above, not by dividing by \(P(Y=y)\). This ratio also makes clear why both the support and its length matter.
A Reliable Procedure
A triangle’s edges are straight lines, so slice endpoints are linear functions within a range where the same edges form the boundaries. But the endpoints can switch edges at a vertex. In that case, write separate formulas on either side of the switch rather than extending one line beyond its valid range.
Express the triangle as inequalities or identify its vertices and edge equations.
For \(Y=y\), find the leftmost and rightmost \(x\)-values in the triangle. For \(X=x\), find the lowest and highest \(y\)-values.
Multiply the slice length by the constant joint density \(1/A\).
Divide the joint density by the marginal density to obtain the conditional density on the slice.
Integrate the conditional density for probabilities, or use the midpoint for the conditional mean. Confirm the support and that the density integrates to one.
Worked Examples
Worked Example: A Right Triangle with a Shrinking Horizontal Slice
A point \((X,Y)\) is chosen uniformly from the triangle with vertices \((0,0)\), \((6,0)\), and \((0,3)\). Find the conditional density and mean of \(X\) given \(Y=1\), and calculate \(P(X>2\mid Y=1)\).
Method. First describe the horizontal slice using the sloping edge. The area is \(A=(6)(3)/2=9\), so the joint density is \(1/9\) inside the triangle.
The sloping edge joins \((6,0)\) to \((0,3)\). Its equation is \(y=3-x/2\), or \(x=6-2y\). Therefore the full support is \(0\leq y\leq3\) and \(0\leq x\leq6-2y\). At \(y=1\), the slice is \(0\leq x\leq4\).
The marginal density at \(y=1\) is the slice length multiplied by the joint density: \(f_Y(1)=4(1/9)=4/9\). The conditional density is therefore \(f_{X\mid Y}(x\mid1)=(1/9)/(4/9)=1/4\) for \(0\leq x\leq4\), and zero otherwise.
The conditional mean is the midpoint of the slice: \(E[X\mid Y=1]=(0+4)/2=2\). The event \(X>2\) occupies the interval \((2,4]\), of length \(2\), so \(P(X>2\mid Y=1)=2/4=1/2=0.5000\).
Check. The conditional density integrates to \(\int_0^4(1/4)\,dx=1\), and the conditional mean \(2\) lies within the slice. The common mistake avoided here is using the full range \(0\leq X\leq6\) after conditioning; the slice ends at \(4\) when \(Y=1\).
Worked Example: The Same Triangle Has Different Limits in the Other Direction
A point is chosen uniformly from the triangle defined by \(0\leq y\leq x\leq4\). Find the conditional density and mean of \(X\) given \(Y=1\), calculate \(P(X\geq3\mid Y=1)\), and also find \(E[Y\mid X=3]\).
Method. The vertices are \((0,0)\), \((4,0)\), and \((4,4)\), so the area is \(4(4)/2=8\), and the joint density is \(1/8\). The inequalities \(0\leq y\leq x\leq4\) specify the support without needing another edge equation.
Fix \(Y=1\). The inequality \(y\leq x\leq4\) becomes \(1\leq x\leq4\), a slice of length \(3\). Thus \(f_Y(1)=3/8\), and \(f_{X\mid Y}(x\mid1)=(1/8)/(3/8)=1/3\) for \(1\leq x\leq4\).
The conditional mean is \((1+4)/2=2.5\). The part of this slice with \(X\geq3\) runs from \(3\) to \(4\), with length \(1\). Hence \(P(X\geq3\mid Y=1)=1/3=0.3333\).
For the other conditioning direction, fix \(X=3\). The support inequality \(0\leq y\leq x\) gives \(0\leq y\leq3\), a vertical slice of length \(3\). The marginal density is \(f_X(3)=3/8\), and the conditional density is \((1/8)/(3/8)=1/3\) on that interval. Therefore \(E[Y\mid X=3]=(0+3)/2=1.5\).
Check. Each conditional density is constant on its own slice and integrates to one. The common mistake avoided is assuming that conditioning on \(Y\) and conditioning on \(X\) produce the same support limits: here \(X\mid Y=1\) ranges from \(1\) to \(4\), while \(Y\mid X=3\) ranges from \(0\) to \(3\).
Worked Example: A Centered Triangle Requires Piecewise Limits
A point is chosen uniformly from the triangle with vertices \((0,0)\), \((4,0)\), and \((2,3)\). Find the conditional law of \(Y\) given \(X=x\), including its support on both sides of \(x=2\). Then calculate \(E[Y\mid X=1]\) and \(P(Y>1\mid X=1)\).
Method. The area is \((4)(3)/2=6\), so the joint density is \(1/6\). The left edge from \((0,0)\) to \((2,3)\) has equation \(y=3x/2\). The right edge from \((2,3)\) to \((4,0)\) has equation \(y=3(4-x)/2\). The bottom edge is \(y=0\).
For \(0\leq x\leq2\), the vertical slice runs from \(0\) to \(3x/2\). For \(2\leq x\leq4\), it runs from \(0\) to \(3(4-x)/2\). Define the upper limit \(h(x)\) by these two formulas. Its slice length is \(h(x)\), so \(f_X(x)=h(x)/6\) for \(0\leq x\leq4\).
At \(x=1\), the applicable formula is the first one: \(h(1)=3/2\). Thus \(f_X(1)=(3/2)/6=1/4\), and the conditional density is \((1/6)/(1/4)=2/3\) on \(0\leq y\leq3/2\).
The conditional mean is \((0+3/2)/2=3/4=0.75\). For \(Y>1\), the part of the slice has length \(3/2-1=1/2\), so \(P(Y>1\mid X=1)=(1/2)/(3/2)=1/3=0.3333\).
Check. The two pieces meet at \(x=2\), where both upper-limit formulas give \(3\). The slice lengths also integrate to the triangle’s area: \(\int_0^2(3x/2)\,dx=3\) and \(\int_2^4 3(4-x)/2\,dx=3\), for a total of \(6\). The common mistake avoided is applying the left-edge formula for all \(x\); to the right of \(2\), the right edge determines the limit.
Why the Formula Works—and What to Check
The density-ratio formula follows directly from the definitions. For a small interval of \(x\)-values within the slice at height \(y\), the joint probability in a thin horizontal strip is approximately the joint density times the interval width and strip thickness. The marginal probability of that strip is approximately \(f_Y(y)\) times the strip thickness. Dividing these quantities cancels the strip thickness, leaving the conditional density \(f_{X,Y}(x,y)/f_Y(y)\). In the uniform-triangle case, the joint density is \(1/A\), while \(f_Y(y)=(U(y)-L(y))/A\); their ratio is \(1/(U(y)-L(y))\).
This derivation also explains the normalization check:
For a uniform density on an interval, the mean is its midpoint. One way to verify this is to integrate \(x\) against the conditional density:
Before accepting a result, check three things: the slice really lies inside the triangle, the conditional density integrates to one over that slice, and the conditional mean lies between its endpoints. If the boundary changes at a vertex, determine whether separate formulas are needed before calculating a marginal or conditional density. These checks are especially valuable in exam problems because an incorrect limit can still produce a plausible-looking density or mean.
Check Your Understanding
For each problem, identify the correct slice before calculating. Answers are included for checking.
- A point is uniform on the triangle with vertices \((0,0)\), \((5,0)\), and \((0,2)\). Find the conditional density of \(X\) given \(Y=0.5\), and its conditional mean. (Answer: \(f_{X\mid Y}(x\mid0.5)=4/15\) for \(0\leq x\leq3.75\), zero otherwise; mean \(1.875\).)
- A point is uniform on \(0\leq y\leq x\leq6\). Given \(Y=2\), find \(E[X\mid Y=2]\) and \(P(X\geq5\mid Y=2)\). (Answer: \(4\) and \(0.2500\).)
- A point is uniform on the triangle with vertices \((0,0)\), \((6,0)\), and \((3,4)\). Given \(X=2\), find the conditional mean of \(Y\) and \(P(Y>2\mid X=2)\). (Answer: \(E[Y\mid X=2]=4/3\) and probability \(0.2500\).)
- A point is uniform on the triangle with vertices \((0,0)\), \((5,0)\), and \((5,5)\). Given \(X=4\), find the conditional density of \(Y\), its mean, and \(P(Y<1.5\mid X=4)\). (Answer: density \(1/4\) for \(0\leq y\leq4\), zero otherwise; mean \(2\); probability \(0.3750\).)
- A point is uniform on the triangle with vertices \((0,0)\), \((8,0)\), and \((0,4)\). Given \(Y=1.5\), find the conditional mean of \(X\) and \(P(1<X<4\mid Y=1.5)\). (Answer: mean \(2.5\); probability \(0.6000\).)