Worked examples — Joint, marginal, and conditional distributions
The scenario matrix
Before any example, let us list every distinct kind of case this topic can throw at you. Read the table as a checklist — every row gets its own worked example below.
| Cell | Case class | What is tricky about it | Example |
|---|---|---|---|
| A | Discrete 2×2, get marginal + conditional | must sum a whole row, not grab a cell | Ex 1 |
| B | Discrete: both directions of the bar | Ex 2 | |
| C | Degenerate slice: condition on a zero-probability event | division by — undefined | Ex 3 |
| D | Continuous, independent density (conditional loses ) | joint must factor as | Ex 4 |
| E | Continuous, dependent density (limits depend on ) | marginal support changes; not separable | Ex 5 |
| F | Real-world word problem (medical test, Bayes) | base-rate / prosecutor's fallacy | Ex 6 |
| G | Uncorrelated but dependent (limiting/degenerate check) | zero covariance independence | Ex 7 |
| H | Exam twist: 3-variable chain rule / marginalize the middle | law of total probability under the hood | Ex 8 |
Cells A–H below are each labelled. Together they touch every branch: discrete/continuous, both bar directions, independent/dependent, a zero-denominator degeneracy, a real-world base-rate trap, and a multivariable extension.
Ex 1 — Discrete marginal + conditional (Cell A)
Forecast: guess now — is bigger or smaller than the raw ? (Car owners commute far more, so we expect it bigger.)
- Marginal . Why this step? To "forget" we sum the whole row — that erases the commute info, leaving pure car-ownership probability. (This is the operator from the notation box.)
- Conditional . Why this step? We restrict the world to car owners (total mass ), then ask what fraction of that world commutes far. Dividing re-normalizes the slice back to sum .
Verify: the two conditionals in the row must sum to : . ✓ And , matching the forecast.
Ex 2 — Both directions of the bar (Cell B)
Forecast: will the two match? They almost never do — the denominators differ.
- Marginal . Why this step? Now we condition on , so the denominator is the column total.
- . Why this step? Same joint cell , different normalizer — that is exactly why the bar is not symmetric.
Verify: cross-check with Bayes' theorem: . ✓ Same number two ways.
Ex 3 — Degenerate slice: zero-probability condition (Cell C)
Forecast: feel the trouble coming — dividing by zero.
- Write the definition: . Why this step? The conditional formula requires the denominator . Here it is .
- Conclusion: the conditional is undefined. Why this step? "Restrict to the world where " is meaningless — that world has probability , there is nothing to re-normalize. The definition in the parent note explicitly demanded ; the same guard applies to .
Verify: any assignment satisfies , so no unique value exists → genuinely undefined, not "" and not "". This is the degenerate corner of the matrix: always check the denominator before dividing.
Ex 4 — Continuous, independent density (Cell D)
Forecast: the joint is a product — that is shape. Guess whether the conditional will still contain . (Prediction: it should drop , the signature of independence.)
- Check it is a pdf: . ✓ Why this step? A density must integrate to before any question is legal.
- Marginal of : integrate away. Why this step? Marginal = "collapse the -direction," i.e. integrate out (the operator).
- Conditional: . Why this step? Slice at fixed , then divide by the marginal so the slice integrates to in . The cancels.
Verify: conditional integrates to ? . ✓ Independent? does not depend on ⇒ knowing tells you nothing about ⇒ independent. Equivalently the joint factors: . ✓ This is the true Cell D: a genuinely independent continuous case where conditioning loses .
Look at the figure: the plot below shows the three conditional slices at . They lie exactly on top of each other — the single line . That coincidence is independence: the shape of never changes when you move . Contrast this with Ex 5, where the slices will visibly differ.

Ex 5 — Continuous, dependent (support depends on ) (Cell E)
Forecast: the tricky part is the limits: given , ranges only over , not . Guess whether the conditional keeps this time. (Prediction: yes — so dependent.)
- Check pdf: area of triangle , times height = . ✓ Why this step? Constant density region area must equal .
- Marginal of : for a fixed , runs from to . Why this step? The integration limits depend on because the support is a triangle — this is exactly what makes dependent.
- Conditional: for . Why this step? Given , is uniform on — an interval whose length shrinks as grows. The conditional depends on ⇒ dependent.
Verify: . ✓ And marginal check . ✓
Look at the figure: the lavender triangle is the support. The coral vertical strip is the slice at : notice is trapped in , a shorter interval than the full . Because that interval shrinks as grows, the conditional density changes with — the opposite of Ex 4's identical slices. Watching the strip get shorter is watching dependence happen.

Ex 6 — Real-world word problem: medical test (Cell F)
Forecast: most people guess . Watch the base rate destroy that intuition.
- Total probability of a positive (marginalize over disease status): Why this step? can come from a sick person or a healthy false positive; we sum both routes — the law of total probability. Everything here is an event probability, so we use uppercase . Numerically .
- Bayes' theorem: Why this step? We want but were given ; Bayes flips the bar using the marginal denominator from step 1.
Verify: the two posteriors must sum to : , and . ✓ Only ~ — the tiny base rate dominates. This is the base-rate cell of the matrix.
Ex 7 — Uncorrelated but dependent (Cell G)
Forecast: guess whether zero covariance forces independence. (The parent warned: no!)
- Covariance. By symmetry . Why this step? ; and kills the second term. See Covariance and correlation and Expectation and variance.
- , so : uncorrelated. Why this step? Odd powers of a symmetric variable average to .
- Dependence via factorization. Take : but . Since , ⇒ dependent. Why this step? The only real test of independence is — correlation is a weaker summary. See Independence and conditional independence.
Verify: (step 2) yet . Both hold ⇒ uncorrelated-but-dependent confirmed. ✓
Ex 8 — Exam twist: 3-variable chain rule + marginalize the middle (Cell H)
Forecast: the trap is thinking you need the full 8-cell joint. You do not — marginalize , then .
- Marginal of (sum out via total probability): Why this step? depends on , not directly on (that is what the chain structure of a graphical model encodes). So we only need , obtained by marginalizing out.
- Marginal of (sum out ): Why this step? Same law of total probability, one link further down the chain — this is how the chain rule composes conditionals into a marginal without ever forming the whole joint.
Verify: probabilities in range and ; sanity: , and . ✓
Coverage check
Recall Did we hit every cell?
A discrete marginal+conditional (Ex 1) ::: ✓ B both bar directions differ (Ex 2) ::: ✓ C zero-probability condition → undefined (Ex 3) ::: ✓ D continuous independent density, conditional loses (Ex 4) ::: ✓ E continuous with -dependent support (Ex 5) ::: ✓ F real-world Bayes / base-rate (Ex 6) ::: ✓ G uncorrelated but dependent (Ex 7) ::: ✓ H multivariable chain + marginalize middle (Ex 8) ::: ✓
Active recall
How do you handle conditioning on an event with probability ?
In Ex 4 the joint is ; why are independent?
In Ex 5, what is the conditional distribution of given ?
Ex 6: why is only ~17% despite 99% sensitivity?
Ex 7: what is the only reliable test of independence?
What is the difference between and / on this page?
Connections
- Bayes' theorem — Ex 2 and Ex 6 flip the bar.
- Marginalization and the law of total probability — the denominators in Ex 6 and Ex 8.
- Independence and conditional independence — Ex 4, 5, 7 test factorization.
- Covariance and correlation — Ex 7's uncorrelated-yet-dependent case.
- Probabilistic graphical models — Ex 8's chain factorization.
- Naive Bayes classifier — uses conditional independence like Ex 4/8.
- Expectation and variance — the moments in Ex 7.