This page is a case zoo . The parent note gave you the formula and three examples. Here we deliberately hunt down every kind of Bayes problem you can meet — including the weird degenerate ones — and work each to the end.
Before symbols fly, one reminder of what each letter means, so you never have to scroll back:
Definition The four quantities (in plain words)
P ( H ) = prior — how much you believed hypothesis H before any evidence.
P ( E ∣ H ) = likelihood — if H were true, how often would you see evidence E ?
P ( E ∣ ¬ H ) = the rival likelihood — if H were false, how often would you still see E ?
P ( H ∣ E ) = posterior — your updated belief in H after seeing E .
The engine of every example below is the one form:
P ( H ∣ E ) = P ( E ∣ H ) P ( H ) + P ( E ∣ ¬ H ) P ( ¬ H ) P ( E ∣ H ) P ( H )
The symbol ¬ H just means "H is not true". The symbol ∏ means "multiply these all together".
Everything here rests on 1.3.01-Conditional-probability-and-independence and 1.3.02-Law-of-total-probability .
Every Bayes problem lands in one of these cells . The examples that follow are labelled by cell, and together they touch all of them.
Cell
What makes it distinct
Covered by
A. Rare-cause / low prior
prior tiny, test good → posterior still low
Ex 1
B. Balanced prior
prior near 0.5 , evidence does the work
Ex 2
C. Sequential update
apply Bayes twice, posterior becomes new prior
Ex 3
D. Degenerate: perfect evidence
P ( E ∣ ¬ H ) = 0 → posterior locks to 1
Ex 4
E. Degenerate: useless evidence
P ( E ∣ H ) = P ( E ∣ ¬ H ) → belief unchanged
Ex 4
F. Boundary priors
P ( H ) = 0 or P ( H ) = 1 → belief frozen
Ex 5
G. Multiple hypotheses (n > 2 )
normalize over a whole list
Ex 6
H. Naive-Bayes / product of features
many pieces of evidence multiply
Ex 7
I. Real-world word twist
you must extract the numbers first
Ex 8
J. Exam twist: reverse a false positive
given the posterior, solve for a hidden rate
Ex 9
The three curves you should keep in your head — how the posterior grows as evidence accumulates for different priors — are drawn here:
Notice the red curve (rare cause): even after strong evidence it climbs slowly. That is Cell A in one picture.
Worked example Ex 1 · The classic disease test, re-examined
A disease affects 0.5% of people. A test has sensitivity P ( T ∣ D ) = 0.99 and false-positive rate P ( T ∣ ¬ D ) = 0.02 . You test positive. Probability you have it?
Forecast: the test is 99% accurate — guess the answer before reading. Most people say "about 99%". Write your guess down.
Step 1. List the pieces.
P ( D ) = 0.005 , P ( ¬ D ) = 0.995 , P ( T ∣ D ) = 0.99 , P ( T ∣ ¬ D ) = 0.02.
Why this step? Bayes needs exactly these four numbers; naming them prevents mixing up P ( T ∣ D ) with P ( D ∣ T ) .
Step 2. Numerator = "true positives" weight.
P ( T ∣ D ) P ( D ) = 0.99 × 0.005 = 0.00495.
Why this step? This is the slice of people who are sick and test positive.
Step 3. Other term = "false positives" weight.
P ( T ∣ ¬ D ) P ( ¬ D ) = 0.02 × 0.995 = 0.0199.
Why this step? Healthy people who nonetheless test positive. They dilute the good news.
Step 4. Divide.
P ( D ∣ T ) = 0.00495 + 0.0199 0.00495 = 0.02485 0.00495 ≈ 0.1992.
Answer: ≈ 19.9%. Far below your gut guess.
Verify: false positives (0.0199 ) outnumber true positives (0.00495 ) roughly 4 : 1 , so the posterior should sit near 5 1 — and 0.199 ≈ 5 1 . ✓ Consistent with the red curve in the figure. See 2.1.05-Naive-Bayes-classifier for the same maths at scale.
Worked example Ex 2 · Two urns
Urn A holds 3 red, 1 blue. Urn B holds 1 red, 3 blue. You pick an urn at random (P ( A ) = P ( B ) = 0.5 ) and draw one ball: it is red . Which urn?
Forecast: guess the probability it was urn A .
Step 1. Priors and likelihoods.
P ( A ) = P ( B ) = 0.5 , P ( red ∣ A ) = 4 3 , P ( red ∣ B ) = 4 1 .
Why this step? "3 of 4 balls red" is the likelihood — it's a direct count.
Step 2. Numerator.
P ( red ∣ A ) P ( A ) = 4 3 × 2 1 = 8 3 .
Step 3. Evidence (denominator) via law of total probability.
P ( red ) = 4 3 ⋅ 2 1 + 4 1 ⋅ 2 1 = 8 3 + 8 1 = 2 1 .
Why this step? Red can come from either urn; sum both paths.
Step 4. Divide.
P ( A ∣ red ) = 1/2 3/8 = 4 3 = 0.75.
Answer: 75%. With equal priors the update ratio equals the likelihood ratio 3 : 1 .
Verify: by symmetry P ( B ∣ red ) = 4 1 , and 0.75 + 0.25 = 1 . ✓ Posteriors sum to 1 .
Worked example Ex 3 · Two independent tests
Same disease as Ex 1 (P ( D ) = 0.005 ). You take the test twice , independently, and both are positive. Now what?
Forecast: should two positives push you above or below 50%? Guess.
Step 1. First update — this is exactly Ex 1: posterior = 0.1992 .
Why this step? Sequential Bayes reuses old work; the first posterior becomes the new prior .
Step 2. New prior P ( D ) = 0.1992 , P ( ¬ D ) = 0.8008 . Same likelihoods.
Why this step? Tests are independent given true status, so the second test is scored the same way.
Step 3. Second update.
P ( D ∣ T 2 ) = 0.99 × 0.1992 + 0.02 × 0.8008 0.99 × 0.1992 .
Numerator = 0.19721 , other term = 0.016016 .
= 0.21322 0.19721 ≈ 0.9249.
Answer: ≈ 92.5%. Two independent positives overwhelm the low prior.
Verify (shortcut): the odds form odds post = odds prior × LR 2 where LR = 0.99/0.02 = 49.5 . Prior odds = 0.005/0.995 . So post-odds = 0.995 0.005 × 49. 5 2 = 12.318 , giving P = 13.318 12.318 = 0.9249 . ✓ Matches. This is the incremental spirit of 4.2.03-Bayesian-inference .
Worked example Ex 4 · When the test is perfect, and when it is worthless
Prior P ( H ) = 0.3 throughout.
Case D — perfect discriminator. P ( E ∣ H ) = 0.6 , P ( E ∣ ¬ H ) = 0 .
Step 1. Denominator = 0.6 × 0.3 + 0 × 0.7 = 0.18 .
Step 2. P ( H ∣ E ) = 0.18 0.18 = 1 .
Why? If ¬ H never produces E , then seeing E proves H . Posterior locks to certainty regardless of prior.
Case E — useless evidence. P ( E ∣ H ) = P ( E ∣ ¬ H ) = 0.5 .
Step 1. Numerator = 0.5 × 0.3 = 0.15 . Denominator = 0.5 × 0.3 + 0.5 × 0.7 = 0.5 .
Step 2. P ( H ∣ E ) = 0.5 0.15 = 0.3 .
Why? When both hypotheses explain E equally, the likelihood ratio is 1 — evidence carries no information, so posterior = prior, unchanged .
Answers: Case D → 1.0, Case E → 0.3.
Verify: Case E posterior equals the prior 0.3 exactly — the signature of a non-informative test. ✓
The way the likelihood ratio stretches the prior is drawn here:
Watch: ratio = 1 (mint dot) sits on the diagonal — no change. Large ratios bend the curve up; ratios below 1 bend it down.
Worked example Ex 5 · The dogmatic prior
Suppose you are certain : P ( H ) = 1 . A piece of evidence with P ( E ∣ H ) = 0.4 , P ( E ∣ ¬ H ) = 0.9 arrives.
Forecast: can any evidence move a belief that started at certainty?
Step 1. P ( ¬ H ) = 0 , so the rival term P ( E ∣ ¬ H ) P ( ¬ H ) = 0.9 × 0 = 0 .
Step 2. P ( H ∣ E ) = 0.4 × 1 + 0 0.4 × 1 = 0.4 0.4 = 1.
Why? Multiplying by a 0 prior kills the rival forever. Certainty is a black hole.
Answer: 1.0 — belief is frozen.
Verify: try P ( H ) = 0 instead: numerator = 0.4 × 0 = 0 , posterior = 0 . Both 0 and 1 are fixed points. ✓ Lesson: never set a prior to exactly 0 or 1 unless it truly is impossible/certain.
Worked example Ex 6 · Three factories
Bulbs come from three factories: A makes 50% , B makes 30% , C makes 20% of output. Defect rates: A : 2% , B : 3% , C : 5% . A bulb is defective . Which factory most likely made it?
Forecast: biggest producer A ? Or dirtiest producer C ?
Step 1. Joint weights P ( def ∣ F ) P ( F ) :
A : 0.02 × 0.5 = 0.010 , B : 0.03 × 0.3 = 0.009 , C : 0.05 × 0.2 = 0.010.
Why this step? Extended Bayes: each factory is one hypothesis; compute its numerator.
Step 2. Evidence = sum = 0.010 + 0.009 + 0.010 = 0.029 .
Why? Normalizer so the three posteriors sum to 1 .
Step 3. Posteriors:
P ( A ∣ def ) = 0.029 0.010 ≈ 0.345 , P ( B ) = 0.029 0.009 ≈ 0.310 , P ( C ) = 0.029 0.010 ≈ 0.345.
Answer: A and C tie at 34.5% — the big-clean factory and the small-dirty factory are equally suspect.
Verify: 0.345 + 0.310 + 0.345 = 1.000 . ✓ Sums to one.
Worked example Ex 7 · Spam with two words
Prior P ( S ) = 0.4 . Word "FREE": P ( F ∣ S ) = 0.8 , P ( F ∣ ¬ S ) = 0.1 . Word "money": P ( M ∣ S ) = 0.6 , P ( M ∣ ¬ S ) = 0.2 . An email contains both . Spam?
Forecast: two spammy words — over 90%?
Step 1. Naive assumption: features independent given class, so
P ( F , M ∣ S ) = 0.8 × 0.6 = 0.48 , P ( F , M ∣ ¬ S ) = 0.1 × 0.2 = 0.02.
Why this step? Multiplying likelihoods is the whole trick of Naive Bayes — see 2.1.05-Naive-Bayes-classifier .
Step 2. Numerator = 0.48 × 0.4 = 0.192 . Rival = 0.02 × 0.6 = 0.012 .
Step 3. P ( S ∣ F , M ) = 0.192 + 0.012 0.192 = 0.204 0.192 ≈ 0.941.
Answer: ≈ 94.1%.
Verify (ratio form): posterior odds = 0.6 0.4 × 0.1 0.8 × 0.2 0.6 = 3 2 × 8 × 3 = 16 , so P = 17 16 = 0.9412 . ✓ Two independent likelihood-ratio checks agree.
Worked example Ex 8 · The taxicab problem
A city has 85% Green cabs and 15% Blue cabs. A witness identifies a cab as Blue . In tests the witness is correct 80% of the time (so wrong 20% ). What is the probability the cab really was Blue?
Forecast: witness is 80% reliable — so 80%? (This is the classic trap.)
Step 1. Extract the hidden Bayes structure. Hypothesis B = "cab is Blue". Evidence W = "witness says Blue".
P ( B ) = 0.15 , P ( ¬ B ) = 0.85.
P ( W ∣ B ) = 0.8 (correct on a Blue cab). P ( W ∣ ¬ B ) = 0.2 (calls a Green cab Blue by error).
Why this step? The percentages are reliabilities , not posteriors — you must map them to likelihoods first.
Step 2. Numerator = 0.8 × 0.15 = 0.12 . Rival = 0.2 × 0.85 = 0.17 .
Step 3. P ( B ∣ W ) = 0.12 + 0.17 0.12 = 0.29 0.12 ≈ 0.4138.
Answer: ≈ 41.4% — more likely Green than Blue! Base rate of Green cabs beats the witness.
Verify: P ( G ∣ W ) = 0.29 0.17 = 0.5862 and 0.4138 + 0.5862 = 1 . ✓ The base-rate neglect trap in action.
Worked example Ex 9 · Reverse-engineer the false-positive rate
A screening test has sensitivity P ( T ∣ D ) = 0.9 on a disease with prior P ( D ) = 0.1 . The lab reports that a positive test gives posterior P ( D ∣ T ) = 0.5 . What false-positive rate f = P ( T ∣ ¬ D ) produces this?
Forecast: guess whether f is bigger or smaller than the sensitivity.
Step 1. Write Bayes with f unknown.
0.5 = 0.9 × 0.1 + f × 0.9 0.9 × 0.1 = 0.09 + 0.9 f 0.09 .
Why this step? We invert the usual problem: the posterior is given, the rate is the unknown.
Step 2. Cross-multiply: 0.5 ( 0.09 + 0.9 f ) = 0.09 , so 0.045 + 0.45 f = 0.09 .
Step 3. Solve: 0.45 f = 0.045 ⇒ f = 0.1.
Answer: false-positive rate = 0.1 (10%).
Verify (plug back): 0.9 × 0.1 + 0.1 × 0.9 0.9 × 0.1 = 0.18 0.09 = 0.5 . ✓ Recovers the given posterior. This algebraic inversion is cousin to 3.4.01-Maximum-likelihood-estimation where we solve for unknown parameters.
Recall Which cell? (reveal to check)
A test never fires on healthy people — what is your posterior after a positive? ::: 1 (Cell D, perfect discriminator).
Prior is 0.5 and likelihood ratio is 1 — new belief? ::: Still 0.5 (Cell E, useless evidence).
You start certain, P ( H ) = 1 — can evidence move you? ::: No, belief is frozen (Cell F).
Two independent positives on a rare disease pushed 0.199 → ? ::: ≈ 0.925 (Cell C).
Mnemonic The one habit that saves you
Before trusting a big likelihood, look at the prior . Rare cause + good test can still mean "probably fine". Always compute the rival term P ( E ∣ ¬ H ) P ( ¬ H ) — that is where intuition dies.