Imagine you take a screening test for a rare disease and the result comes back positive. The test is described as 99% accurate. It feels obvious that you almost certainly have the disease. Yet for a genuinely rare condition, the honest answer can be closer to one chance in six. That gap between the intuitive answer and the correct one is not a trick of wording — it is a direct consequence of how probability behaves when evidence meets a rare event.
This article explains Bayes' theorem, the rule that resolves the paradox. It is the mathematics of updating a belief: you start with what you knew, you observe something new, and you compute what you should believe now.
Why this calculation matters
Bayes' theorem is the formal answer to a question that comes up everywhere: given a piece of evidence, how should it change my estimate of something I cannot observe directly? Medical screening is the classic case, but the same structure appears in spam filtering, fault diagnosis, quality inspection, search-and-rescue, sensor fusion, and the inference engines behind much of machine learning.
The reason the theorem matters so much is that human intuition systematically mishandles one ingredient: the base rate, also called the prior. When a condition is rare, even an accurate test produces a flood of false positives simply because there are so many more healthy people to test. Most of the positive results come from that large healthy group, not from the small group that is actually affected. Ignore the base rate and you will badly overestimate what a positive result means. Bayes' theorem forces the base rate back into the calculation, where it belongs, and that single correction is what separates a defensible conclusion from a confident wrong one.
The core formula
Bayes' theorem relates two conditional probabilities — the one you want and the one you can measure:
P(A|B) = P(B|A) * P(A) / P(B)
Read it piece by piece. P(A) is the prior: the probability of A before any evidence. P(B|A) is the likelihood: how probable the evidence B is when A is true. P(B) is the total probability of seeing the evidence at all. And P(A|B), the posterior, is the answer: the updated probability of A now that B has been observed.
The denominator usually has to be assembled rather than looked up. The evidence B can arise in two ways — either A is true, or it is not — so you add both routes using the law of total probability:
P(B) = P(B|A) * P(A) + P(B|not A) * P(not A)
Here P(B|not A) is the false-positive rate: the chance of the evidence appearing when A is actually false. P(not A) is simply 1 minus P(A). Once you have P(B), the main formula delivers the posterior. The structure is always the same: prior times likelihood, divided by the total probability of the evidence.
A worked example
Take the screening scenario concretely. A disease affects 1% of a population, so the prior is P(A) = 0.01. The test detects the disease correctly 99% of the time, giving a likelihood P(B|A) = 0.99. But it also returns a positive result for 5% of healthy people — a false-positive rate of P(B|not A) = 0.05.
Step 1 — find the probability of a positive test. A positive result comes from two groups: genuinely sick people who test positive, and healthy people who test positive by error. Add both contributions:
P(B) = P(B|A)*P(A) + P(B|not A)*P(not A)
P(B) = 0.99 * 0.01 + 0.05 * 0.99
P(B) = 0.0099 + 0.0495
P(B) = 0.0594
Step 2 — apply Bayes' theorem. Divide the sick-and-positive route by the total positive rate:
P(A|B) = P(B|A) * P(A) / P(B)
P(A|B) = 0.99 * 0.01 / 0.0594
P(A|B) = 0.0099 / 0.0594
P(A|B) = 0.167
Step 3 — interpret the result. After a positive test, the probability of actually having the disease is about 0.167 — only a 17% chance. The result is far from meaningless: it has raised the estimate from 1% to 17%, a seventeenfold jump. But it is nowhere near a confirmed diagnosis. Look back at Step 1 to see why. Of the 0.0594 total positives, the false positives (0.0495) dwarf the true positives (0.0099), purely because healthy people vastly outnumber sick ones. That imbalance, not any flaw in the test, is what holds the posterior down.
Common mistakes
Confusing P(B|A) with P(A|B). These are different quantities, and swapping them is the single most common error. "The probability of a positive test given the disease" is not "the probability of the disease given a positive test." The whole point of Bayes' theorem is to convert the first into the second.
Dropping the base rate. Reasoning only from the test's accuracy and ignoring how rare the condition is leads straight to the overconfident answer. For a rare event, the prior dominates; no amount of test accuracy can fully overcome it in a single step.
Forgetting the false-positive route in P(B). The denominator must account for evidence arising when A is false. Leaving out the P(B|not A) term shrinks P(B) and inflates the posterior, often dramatically.
Assuming a near-perfect test cannot mislead. A 99% true-positive rate sounds decisive, but applied to a population that is 99% healthy, even a small false-positive rate generates many more false alarms than true detections. Accuracy and predictive value are not the same thing.
Stopping after one update. A single positive result rarely settles the matter. The posterior from one test becomes the prior for the next, which is exactly why a second, independent test sharply changes the picture and why doctors confirm a screening result before acting on it.
Try the interactive NovaSolver calculator
The numbers in the worked example are easy to follow once written out, but the real insight comes from changing them. The Bayes' Theorem Visualizer on NovaSolver lets you adjust the prior probability, the true-positive rate, and the false-positive rate, and shows the posterior update in real time, along with the total positive-test rate, the Bayes factor, the test specificity, and the negative predictive value. Drag the prior down toward a rare condition and watch the posterior collapse — the base-rate effect becomes obvious in a way that a single calculation never quite conveys.
Related calculators
- Naive Bayes classifier — see Bayes' theorem scaled up to many features at once, the engine behind spam filters and text classification.
- Normal distribution calculator — the continuous distribution that often supplies the likelihoods a Bayesian update needs.
- Probability distributions — compare the distributions that describe priors and evidence across different problems.
You can browse the rest in the mathematics tools hub.
Closing note
Bayes' theorem is a short equation with an outsized lesson: evidence updates a belief, it does not replace it. The prior always stays in the calculation, and for rare events it stays loud. A positive result on an accurate test can still leave you well short of certainty, simply because the population it was drawn from was mostly healthy. Identify the prior, the likelihood, and the false-positive route, assemble the total probability of the evidence, and let the theorem do the rest. Reasoning this way protects you from one of the most reliable mistakes in applied probability.
Top comments (0)