Conditional Distributions
& Marginalization
Master how to extract conditional probabilities from joint distributions and recover marginal distributions by summing or integrating out variables.
What Is a Joint Distribution?
A joint distribution describes the probability of two (or more) random variables taking on specific values simultaneously. For discrete variables \(X\) and \(Y\), the joint probability mass function is \(P(X = x, Y = y)\).
A Joint Probability Table
Consider two dice: \(X\) = the face of die 1 (simplified to Low/High) and \(Y\) = the face of die 2 (Low/High). Each cell holds \(P(X\!=\!x, Y\!=\!y)\).
| \(Y = \text{Low}\) | \(Y = \text{High}\) | \(P(X)\) | |
|---|---|---|---|
| \(X = \text{Low}\) | 0.25 | 0.25 | 0.50 |
| \(X = \text{High}\) | 0.25 | 0.25 | 0.50 |
| \(P(Y)\) | 0.50 | 0.50 | 1.00 |
Recovering the Marginal Distribution
Marginalization is the process of summing (or integrating) a joint distribution over one variable to obtain the distribution of the other variable alone.
Marginalization as Projection
The Conditional Distribution
A conditional distribution tells us the probability of one variable given that we know the value of another. It answers: "Now that I know \(Y = y\), what does the distribution of \(X\) look like?"
Core Rule: Law of Total Probability
The Law of Total Probability connects conditionals and marginals. It formalizes how you "un-condition" to recover the marginal.
This is precisely marginalization rewritten: the joint factors as conditional times marginal, and summing recovers the other marginal.
How Joint, Marginal, and Conditional Connect
Marginal vs. Conditional
| Marginal | Conditional | |
|---|---|---|
| Notation | \(P(X)\) or \(f_X(x)\) | \(P(X \mid Y\!=\!y)\) or \(f_{X|Y}(x|y)\) |
| What it tells you | Distribution of \(X\) alone | Distribution of \(X\) given \(Y\!=\!y\) |
| Obtained by | Summing/integrating out \(Y\) | Dividing joint by \(P(Y\!=\!y)\) |
| Sums/integrates to | 1 | 1 (for each fixed \(y\)) |
| Depends on \(y\)? | No | Yes: different \(y\) gives different distribution |
How to Compute Conditionals & Marginals
Example 1: Discrete Table
Survey data: \(X\) = Exercises (Yes/No), \(Y\) = Healthy weight (Yes/No).
| \(Y = \text{Yes}\) | \(Y = \text{No}\) | \(P(X)\) | |
|---|---|---|---|
| \(X = \text{Yes}\) | 0.36 | 0.14 | 0.50 |
| \(X = \text{No}\) | 0.22 | 0.28 | 0.50 |
| \(P(Y)\) | 0.58 | 0.42 | 1.00 |
Example 1: Full Conditional
Let us find the complete conditional distribution \(P(Y \mid X = \text{Yes})\).
Example 2: Continuous Joint
Suppose \(f_{X,Y}(x,y) = 6(1-y)\) for \(0 \le x \le y \le 1\), and 0 otherwise. Find \(f_X(x)\) and \(f_{Y \mid X}(y \mid x)\).
Example 3: Bayes via Marginalization
A disease has prevalence \(P(D) = 0.01\). A test has sensitivity \(P(+ \mid D) = 0.95\) and specificity \(P(- \mid D^c) = 0.90\). Find \(P(D \mid +)\).
Common Mistakes
Summary of Key Formulas
| Operation | Discrete | Continuous |
|---|---|---|
| Marginal of \(X\) | \(\displaystyle\sum_y P(X,Y)\) | \(\displaystyle\int f_{X,Y}\,dy\) |
| Conditional of \(X \mid Y\) | \(\dfrac{P(X,Y)}{P(Y)}\) | \(\dfrac{f_{X,Y}}{f_Y}\) |
| Product Rule | \(P(X,Y) = P(X\mid Y)\,P(Y)\) | \(f_{X,Y} = f_{X\mid Y}\cdot f_Y\) |
| Law of Total Prob. | \(\displaystyle\sum_y P(X\mid Y)\,P(Y)\) | \(\displaystyle\int f_{X\mid Y}\,f_Y\,dy\) |
| Bayes' Theorem | \(\dfrac{P(Y\mid X)\,P(X)}{P(Y)}\) | \(\dfrac{f_{Y\mid X}\,f_X}{f_Y}\) |
Question 1 of 5
Given a joint PMF table where \(P(X\!=\!1,\,Y\!=\!2) = 0.12\) and the marginal \(P(Y\!=\!2) = 0.40\), what is \(P(X\!=\!1 \mid Y\!=\!2)\)?
Question 2 of 5
To find the marginal distribution \(P(X)\) from a joint distribution \(P(X, Y)\), you should:
Question 3 of 5
If \(X\) and \(Y\) are independent, which of the following must be true?
Question 4 of 5
Given \(f_{X,Y}(x,y) = 2\) for \(0 < x < y < 1\) (and 0 otherwise), what is \(f_X(x)\)?
Question 5 of 5
A disease has prevalence \(P(D) = 0.02\). A test has \(P(+ \mid D) = 0.99\) and \(P(+ \mid D^c) = 0.05\). Using Bayes' theorem, approximately what is \(P(D \mid +)\)?