Tutorials › Statistical Theory I - Probability and Distribution Theory › Conditional Densities from Joint Densities

Conditional Distribution Theory · Tutorial 251 of 994

Conditional Densities from Joint Densities

Learn to obtain a conditional density from a joint model, check its support and normalization, and use it to calculate conditional probabilities.

Intermediate 10 min read

What You'll Learn

  • Derive the marginal density needed to condition on a continuous random variable
  • Form the conditional density as the joint density divided by the conditioning variable’s marginal density
  • Identify the conditional support by slicing the joint support at a fixed conditioning value
  • Check that a proposed conditional density integrates to one
  • Calculate conditional probabilities by integrating the conditional density over the relevant set
  • Recognize why the ratio formula requires a positive marginal density and is understood up to null sets

Why a Joint Density Is Not a Conditional Density

A joint density describes two random variables together. To describe the distribution of \(X\) when \(Y\) is observed at a particular value \(y\), we need a density in \(x\) that is appropriate for that fixed \(y\). The joint density alone generally does not have this property: its total mass along a slice of the joint support need not be one.

The adjustment is to divide the joint density by the marginal density of the conditioning variable. This removes the slice’s total mass, leaving a conditional density. The calculation has three linked parts: find the marginal, determine the slice of the joint support, and verify that the resulting function integrates to one.

Definition: Suppose \((X,Y)\) has joint density \(f_{X,Y}(x,y)\), and let $$ f_Y(y)=\int_{-\infty}^{\infty} f_{X,Y}(x,y)\,dx $$ be a version of the marginal density of \(Y\). For values \(y\) where \(0<f_Y(y)<\infty\) and the integral defining \(f_Y(y)\) agrees with the joint-density slice, a conditional density of \(X\) given \(Y=y\) is $$ f_{X\mid Y}(x\mid y)=\frac{f_{X,Y}(x,y)}{f_Y(y)}. $$ The formula is understood up to sets of Lebesgue measure zero in \(x\) and sets of probability zero under the distribution of \(Y\).

The denominator is the marginal density of \(Y\), not the marginal density of \(X\). It depends on the value \(y\) being conditioned on. For a fixed admissible \(y\), the conditional density is a function of \(x\); its integral over all \(x\) must be one.

Deriving the Ratio Formula

The marginal density is obtained by integrating out \(X\). Since the joint density is nonnegative, Tonelli’s theorem allows the order of integration used below. For Borel sets \(A\) and \(B\), the joint probability that \(X\) lies in \(A\) and \(Y\) lies in \(B\) is

$$ P(X\in A,\;Y\in B) =\int_B\int_A f_{X,Y}(x,y)\,dx\,dy. $$

On values of \(y\) where \(f_Y(y)>0\), write the inner integrand as the marginal density times the ratio:

$$ f_{X,Y}(x,y) =f_Y(y)\frac{f_{X,Y}(x,y)}{f_Y(y)}. $$

Thus, with \(f_{X\mid Y}(x\mid y)=f_{X,Y}(x,y)/f_Y(y)\) on those values,

$$ P(X\in A,\;Y\in B) =\int_B f_Y(y)\left(\int_A f_{X\mid Y}(x\mid y)\,dx\right)dy. $$

This identity says that the joint law is recovered by weighting the conditional law at each \(y\) by the marginal density of \(Y\). It also shows why the ratio is the appropriate conditional density. The conditional law at a single value \(y\) is not obtained by dividing by \(P(Y=y)\): for a continuous \(Y\), that probability is typically zero.

Theorem: At every \(y\) for which \(0<f_Y(y)<\infty\) and \(f_Y(y)=\int f_{X,Y}(x,y)\,dx\), the ratio \(f_{X,Y}(x,y)/f_Y(y)\) is nonnegative and integrates to one as a function of \(x\). It defines a conditional density for almost every \(y\) under the marginal distribution of \(Y\).

Proof. Nonnegativity follows from nonnegativity of the joint density and positivity of the denominator. For any \(y\) satisfying the stated conditions,

$$ \int_{-\infty}^{\infty} f_{X\mid Y}(x\mid y)\,dx =\frac{1}{f_Y(y)}\int_{-\infty}^{\infty}f_{X,Y}(x,y)\,dx =\frac{f_Y(y)}{f_Y(y)} =1. $$

The marginal-density identity holds for almost every \(y\), as follows from integrating the joint density to obtain the marginal. Where \(f_Y(y)=0\), the ratio is undefined; such values have probability zero under \(Y\), and the conditional density can be specified there arbitrarily without changing the joint law. The integral identity above then gives the required conditional-law representation. \(\square\)

Support: Fix the Conditioning Value First

To find the conditional support, begin with the region where the joint density is positive, then hold \(y\) fixed and identify the allowable \(x\)-values. This is a slice through the joint support. The ratio does not create positive density outside that slice, because its numerator is zero there.

More precisely, for an admissible \(y\), the conditional density is positive wherever \(f_{X,Y}(x,y)>0\), apart from changes on sets of \(x\)-values of measure zero. In practice, support boundaries can be included or excluded without changing probabilities when they have probability zero. The slice can vary with \(y\), so it is important not to assume that the conditional support is the same for every conditioning value.

Worked Example: A Triangular Support

Suppose $$ f_{X,Y}(x,y)= \begin{cases} 2,&0<x<y<1,\\ 0,&\text{otherwise}. \end{cases} $$ Find \(f_Y(y)\), the conditional density of \(X\) given \(Y=y\), its support, and \(P(X<Y/2\mid Y=y)\).

Check the joint density first. The support is a triangle of area \(1/2\), so the integral of the density is \(2(1/2)=1\). It is a properly normalized joint density.

For fixed \(0<y<1\), the allowed \(x\)-values are \(0<x<y\). Therefore $$ f_Y(y)=\int_0^y 2\,dx=2y,\qquad 0<y<1. $$ The marginal integrates to one: \(\int_0^1 2y\,dy=1\). The ratio gives $$ f_{X\mid Y}(x\mid y)=\frac{2}{2y}=\frac{1}{y},\qquad 0<x<y,\quad 0<y<1, $$ and it is zero outside \(0<x<y\). Its normalization is $$ \int_0^y \frac{1}{y}\,dx=1. $$ Finally, $$ P(X<Y/2\mid Y=y)=\int_0^{y/2}\frac{1}{y}\,dx =\frac{y/2}{y} =\frac{1}{2},\qquad 0<y<1. $$ The probability is one-half because the conditional density is uniform on the interval \((0,y)\).

Worked Example: A Conditional Support With a Moving Lower Boundary

Suppose $$ f_{X,Y}(x,y)= \begin{cases} 3x,&0<y<x<1,\\ 0,&\text{otherwise}. \end{cases} $$ Find the marginal density of \(Y\), the conditional density of \(X\) given \(Y=y\), and \(P(X>3/4\mid Y=1/2)\).

Check normalization. Integrating first over \(0<y<x\), $$ \int_0^1\int_0^x 3x\,dy\,dx =\int_0^1 3x^2\,dx =1. $$ For fixed \(y\), the support requires \(y<x<1\). Hence $$ f_Y(y)=\int_y^1 3x\,dx =\frac{3}{2}(1-y^2),\qquad 0<y<1. $$ This is a valid marginal density because $$ \int_0^1 \frac{3}{2}(1-y^2)\,dy =\frac{3}{2}\left(1-\frac{1}{3}\right) =1. $$ The conditional density is therefore $$ f_{X\mid Y}(x\mid y)=\frac{3x}{\frac{3}{2}(1-y^2)} =\frac{2x}{1-y^2},\qquad y<x<1. $$ Its integral over that conditional support is $$ \int_y^1\frac{2x}{1-y^2}\,dx =\frac{1-y^2}{1-y^2} =1. $$ At \(y=1/2\), the density is \(8x/3\) on \(1/2<x<1\). Thus $$ P(X>3/4\mid Y=1/2) =\int_{3/4}^1\frac{8x}{3}\,dx =\frac{4}{3}\left(1-\frac{9}{16}\right) =\frac{4}{3}\cdot\frac{7}{16} =\frac{7}{12}. $$ The lower endpoint of the conditional support is \(1/2\), not zero: fixing \(Y=1/2\) in the joint support forces \(X>1/2\).

Worked Example: A Conditional Density on a Rectangular Support

Suppose \(f_{X,Y}(x,y)=x+y\) for \(0<x<1\) and \(0<y<1\), and is zero elsewhere. Find \(f_{X\mid Y}(x\mid y)\), then calculate \(P(X>1/2\mid Y=1/2)\).

The joint density is normalized: $$ \int_0^1\int_0^1(x+y)\,dx\,dy =\int_0^1\left(\frac{1}{2}+y\right)dy =1. $$ For \(0<y<1\), the marginal density is $$ f_Y(y)=\int_0^1(x+y)\,dx=\frac{1}{2}+y. $$ The slice support is \(0<x<1\), so $$ f_{X\mid Y}(x\mid y)=\frac{x+y}{\frac{1}{2}+y},\qquad 0<x<1. $$ Its integral is $$ \int_0^1\frac{x+y}{\frac{1}{2}+y}\,dx =\frac{\frac{1}{2}+y}{\frac{1}{2}+y} =1. $$ At \(y=1/2\), the conditional density is \(x+1/2\) on \(0<x<1\). Consequently, $$ P(X>1/2\mid Y=1/2) =\int_{1/2}^1\left(x+\frac{1}{2}\right)dx =\left[\frac{x^2}{2}+\frac{x}{2}\right]_{1/2}^1 =1-\frac{3}{8} =\frac{5}{8}. $$

A Reliable Calculation Check

For each fixed \(y\) with positive marginal density, the conditional density must integrate to one over the \(x\)-slice permitted by the joint support. This gives a direct way to catch common errors: a wrong marginal, a missing support boundary, or an incorrect division usually makes the integral differ from one.

1
Read the joint support.
Write the allowed values of \(x\) for a fixed \(y\); these determine the limits for the marginal integral.
2
Integrate out \(x\).
Compute \(f_Y(y)=\int f_{X,Y}(x,y)\,dx\), using the support slice as the limits.
3
Divide and check.
Form \(f_{X,Y}(x,y)/f_Y(y)\) where \(f_Y(y)>0\), then integrate over the conditional support and confirm the result is one.
4
Integrate for a probability.
For an event restricting \(X\) to a set, integrate the conditional density over that set, intersected with the conditional support.

Common Mistakes and Why the Ratio Matters

  • Using an unnormalized joint function as a density. A proposed joint density must integrate to one over its entire support. For example, the constant \(3\) on \(0<x<y<1\) has integral \(3/2\), so it is not a joint density. The constant \(2\) on that triangle is normalized.
  • Using the wrong marginal in the denominator. Conditioning on \(Y=y\) requires \(f_Y(y)\), found by integrating the joint density over \(x\).
  • Ignoring the slice of the support. In the second example, the conditional support is \(y<x<1\). Integrating from zero would include values impossible under the joint model.
  • Assuming the ratio is defined everywhere. If \(f_Y(y)=0\), division is not defined. Such conditioning values have marginal probability zero; the ratio formula applies where the marginal density is positive, with conditional laws understood up to null sets.
  • Forgetting to normalize. The joint slice generally has integral \(f_Y(y)\), not one. Dividing by that integral is precisely what produces the conditional density.
Key takeaway: For an admissible conditioning value \(y\), divide the joint density by the marginal density of \(Y\). Then verify that the result integrates to one over the \(x\)-values allowed by the joint support.

Check Your Understanding

Use the joint-density ratio and the conditional support in each calculation.

  1. For the density \(2\) on \(0<x<y<1\), derive \(f_Y(y)\) and state the support of \(X\) given \(Y=y\).
  2. Why must a proposed joint density equal to \(3\) on \(0<x<y<1\) be rejected?
  3. If \(f_{X,Y}(x,y)=x+y\) on the unit square, what is \(f_Y(y)\)?
  4. For the density \(3x\) on \(0<y<x<1\), explain why the conditional support at \(Y=y\) is not the entire interval \((0,1)\).
  5. What condition on \(f_Y(y)\) is needed to use the pointwise ratio formula, and why can the conditional law be specified arbitrarily where \(f_Y(y)=0\)?