1.3.13 · D3Probability & Statistics

Worked examples — Joint, marginal, and conditional distributions

2,335 words11 min readBack to topic

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.)

  1. 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.)
  2. 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.

  1. Marginal . Why this step? Now we condition on , so the denominator is the column total.
  2. . 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.

  1. Write the definition: . Why this step? The conditional formula requires the denominator . Here it is .
  2. 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.)

  1. Check it is a pdf: . ✓ Why this step? A density must integrate to before any question is legal.
  2. Marginal of : integrate away. Why this step? Marginal = "collapse the -direction," i.e. integrate out (the operator).
  3. 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.

Figure — Joint, marginal, and conditional distributions

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.)

  1. Check pdf: area of triangle , times height = . ✓ Why this step? Constant density region area must equal .
  2. 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.
  3. 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.

Figure — Joint, marginal, and conditional distributions

Ex 6 — Real-world word problem: medical test (Cell F)

Forecast: most people guess . Watch the base rate destroy that intuition.

  1. 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 .
  2. 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!)

  1. Covariance. By symmetry . Why this step? ; and kills the second term. See Covariance and correlation and Expectation and variance.
  2. , so : uncorrelated. Why this step? Odd powers of a symmetric variable average to .
  3. 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 .

  1. 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.
  2. 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 ?
The conditional is undefined — the denominator is , there is no world to re-normalize.
In Ex 4 the joint is ; why are independent?
The conditional drops ; equivalently the joint factors .
In Ex 5, what is the conditional distribution of given ?
Uniform on , density — its support shrinks with , so are dependent.
Ex 6: why is only ~17% despite 99% sensitivity?
The base rate is tiny, so false positives () outnumber true positives in the total.
Ex 7: what is the only reliable test of independence?
Factorization — zero covariance is necessary but not sufficient.
What is the difference between and / on this page?
is one event's probability (a number); / is a whole distribution function (pmf / pdf).

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.