SR
May 9, 2026
Intuitive explanation of Bayes' Theorem with real-world examples
I'm studying probability and I understand the formula for Bayes' Theorem:
But I struggle to understand when to apply it. The theorem feels backwards somehow — we are using to find . Why would we ever know but not ?
Could someone provide a concrete real-world example where Bayes' Theorem is used, perhaps in medical testing or spam filtering?
1 answers273 views
Loading comments...
1 Answer
PR
Prof. Robert FischerMay 10, 2026 AcceptedBayes' Theorem is how we **update beliefs** when we see new evidence.
**Why it feels backwards:**
$P(A|B)$ is the probability of $A$ **after** seeing $B$. $P(A)$ is the probability **before** seeing $B$. Bayes tells us how evidence $B$ should change our belief in $A$.
We often know the \"likelihood\" $P(B|A)$ from data, and the \"prior\" $P(A)$ from background knowledge, and we want to compute the \"posterior\" $P(A|B)$.
**Medical Testing Example:**
A disease affects $1\%$ of the population: $P(D) = 0.01$.
A test is $99\%$ accurate: $P(\ ext{positive}|D) = 0.99$, $P(\ ext{negative}|\
eg D) = 0.99$.
If you test positive, what is $P(D|\ ext{positive})$?
$$P(D|+) = \frac{P(+|D)P(D)}{P(+)} = \frac{0.99 \ imes 0.01}{0.99 \ imes 0.01 + 0.01 \ imes 0.99} = \frac{0.0099}{0.0198} = 0.5$$
Surprisingly, only $50\%$! Even with a $99\%$ accurate test, the low base rate means a positive result is not definitive.
**Spam Filtering:**
Given an email containing the word \"free\", what is $P(\ ext{spam}|\ ext{free})$? We know:
- $P(\ ext{spam}) = 0.6$ (60% of emails are spam)
- $P(\ ext{free}|\ ext{spam}) = 0.8$ (80% of spam contains \"free\")
- $P(\ ext{free}|\ ext{not spam}) = 0.1$ (10% of legitimate emails contain \"free\")
$$P(\ ext{spam}|\ ext{free}) = \frac{0.8 \ imes 0.6}{0.8 \ imes 0.6 + 0.1 \ imes 0.4} = \frac{0.48}{0.52} \approx 0.923$$
Bayes' Theorem is the mathematical foundation of all rational learning from data.
Loading comments...