Bayes’ Theorem Explained: Formula, Examples and the Base Rate Fallacy

August 27, 2026
A medical test is 99% accurate and comes back positive. Most people assume they’re 99% likely to have the disease. They’re usually wrong — often dramatically wrong. The Statistics Made Simple Complete Bundle works through this exact paradox and the theorem that resolves it.

Imagine a disease that affects 1 in 1,000 people. A test for it is 99% accurate — meaning it correctly identifies 99% of sick people as sick, and correctly identifies 99% of healthy people as healthy. You test positive. What’s the probability you actually have the disease?

Most people’s gut answer is “99%.” The real answer is roughly 9%. This isn’t a trick question or a quirk of unusual numbers — it’s a direct, mechanical consequence of a single equation that governs how we should update our beliefs in light of new evidence: Bayes’ Theorem. Once you understand why the intuitive answer is so far off, you’ll never look at a positive test result, a courtroom statistic, or a spam filter the same way again.

What Is Bayes’ Theorem?

Bayes’ Theorem describes how to update the probability of a hypothesis given new evidence. It connects two conditional probabilities that are easy to confuse but mean very different things: the probability of evidence given a hypothesis, and the probability of a hypothesis given evidence.

In the disease example, “the probability the test is positive given that you’re sick” (99%) is a completely different quantity from “the probability you’re sick given that the test is positive” (roughly 9%). Confusing these two is called the base rate fallacy, and it is one of the most common and consequential errors in interpreting statistical evidence — in medicine, in courtrooms, and in everyday reasoning.

The Formula

Bayes’ Theorem states:

P(A | B) = [P(B | A) × P(A)] / P(B)

Each term has a name worth knowing, because the vocabulary itself clarifies the logic:

P(A) is the prior probability — what you believed about A before seeing any evidence. In the disease example, this is the base rate: 1 in 1,000, or 0.001.

P(B | A) is the likelihood — the probability of observing the evidence B, assuming A is true. This is the test’s sensitivity: 99%, or 0.99.

P(B) is the total probability of the evidence, across every way it could have arisen — both from true positives and false positives combined.

P(A | B) is the posterior probability — your updated belief about A after seeing the evidence B. This is what you actually want to know, and it’s almost never equal to the likelihood, no matter how tempting that shortcut feels.

Chapter 12 of Statistics Made Simple derives Bayes’ Theorem directly from the definition of conditional probability, so the formula stops feeling like something to memorise and starts feeling like something you could rebuild from scratch.

Worked Example: The Disease Test

Let’s solve the opening puzzle properly. Define events: D = has the disease, + = tests positive.

Given information: P(D) = 0.001 (1 in 1,000 have the disease). P(+ | D) = 0.99 (99% sensitivity — correctly detects sick people). P(+ | not D) = 0.01 (1% false positive rate — the flip side of 99% specificity).

We want P(D | +) — the probability of having the disease given a positive test. Bayes’ Theorem requires us to first find P(+), the total probability of testing positive, by summing over both ways a positive result can occur:

P(+) = P(+ | D) × P(D) + P(+ | not D) × P(not D)

P(+) = (0.99 × 0.001) + (0.01 × 0.999) = 0.00099 + 0.00999 = 0.01098

Now apply Bayes’ Theorem:

P(D | +) = [P(+ | D) × P(D)] / P(+) = (0.99 × 0.001) / 0.01098 = 0.00099 / 0.01098 ≈ 0.0902

Despite a “99% accurate” test, a positive result means only about a 9% chance of actually having the disease. The reason is that the disease is rare (a low prior), so even a small false-positive rate applied to the enormous pool of healthy people produces far more false positives in absolute terms than true positives from the tiny pool of actually-sick people. This is exactly why doctors order confirmatory follow-up tests rather than treating a single positive result as definitive.

The Law of Total Probability

The denominator calculation above — summing P(+ | D) × P(D) across every possible scenario — is itself a named result called the Law of Total Probability. For any partition of the sample space into mutually exclusive, exhaustive events A₁, A₂, …, An, the total probability of any event B is:

P(B) = ∑ P(B | Ai) × P(Ai)

This is the mechanism that lets Bayes’ Theorem handle more than two competing hypotheses at once, which is exactly what the next example requires.

Worked Example: Three Suppliers

A factory receives components from three suppliers: A supplies 50% of components with a 2% defect rate, B supplies 30% with a 3% defect rate, and C supplies 20% with a 5% defect rate. A randomly inspected component is found defective. What’s the probability it came from supplier C?

First, find the total probability of a defect using the Law of Total Probability:

P(Defective) = (0.50 × 0.02) + (0.30 × 0.03) + (0.20 × 0.05) = 0.010 + 0.009 + 0.010 = 0.029

Now apply Bayes’ Theorem for supplier C specifically:

P(C | Defective) = [P(Defective | C) × P(C)] / P(Defective) = (0.05 × 0.20) / 0.029 = 0.010 / 0.029 ≈ 0.345

Even though supplier C only provides 20% of components, a defective part is nearly 35% likely to have come from them — because their defect rate is more than double the average. This kind of calculation is exactly how quality-control teams identify which supplier to investigate first when defects spike.

Statistics Made Simple
The theorem behind every diagnostic test.
246 pages of explanation and 1,569 practice questions with fully worked answers — Bayes’ Theorem covered alongside every conditional probability topic it builds on, with the full disease-testing and legal-reasoning case studies worked start to finish.

Get both books — $16, save $5 →

Real-World Applications

Bayes’ Theorem is not a classroom curiosity — it is the mathematical backbone of entire industries. In medicine, it explains why screening for rare conditions in a low-risk population produces so many false alarms, which is precisely why doctors weigh a patient’s prior risk factors before ordering a test, and why a positive screening result is nearly always followed by a more specific confirmatory test. In spam filtering, Naive Bayes classifiers estimate the probability an email is spam given the words it contains, updating that probability word by word using exactly this formula — an algorithm that predates modern machine learning but still works remarkably well. In the legal system, Bayesian reasoning underlies how forensic evidence should be weighed: a DNA match with a 1-in-a-million random match probability does not mean a 1-in-a-million chance of innocence, a confusion known as the prosecutor’s fallacy, which has contributed to real wrongful convictions.

Bayesian vs Frequentist Thinking

Bayes’ Theorem also sits at the centre of a long-running philosophical divide in statistics. The frequentist approach, which underlies most of the hypothesis testing covered elsewhere in this series, treats probability as a long-run frequency and typically doesn’t assign a probability to a fixed hypothesis being true — only to how extreme observed data would be under that hypothesis. The Bayesian approach treats probability as a degree of belief, explicitly updated via priors and Bayes’ Theorem as new evidence arrives. Both are mathematically rigorous and widely used; they simply answer different questions, and modern applied statistics — from A/B testing platforms to machine learning pipelines — increasingly blends both.

Common Mistakes

The base rate fallacy. As the opening example showed, ignoring how rare or common a condition is in the first place — the prior — and treating the test’s accuracy alone as the answer is the single most common Bayes’ Theorem error. A highly accurate test applied to a rare condition still produces mostly false positives in absolute terms.

Confusing P(A | B) with P(B | A). “The probability of a positive test given disease” and “the probability of disease given a positive test” sound similar but are numerically very different quantities whenever the base rate is far from 50%. This confusion has a name in the courtroom context — the prosecutor’s fallacy — precisely because it recurs so often in evaluating forensic evidence.

Forgetting to use the Law of Total Probability for the denominator. Students sometimes plug numbers directly into the numerator of Bayes’ formula and stop, forgetting that P(B) in the denominator must itself be calculated by summing over every way the evidence could have occurred.

Practice Question

A university has two admission pools: 60% of applicants come through standard admission, with a 20% acceptance rate, and 40% come through early decision, with a 45% acceptance rate. A randomly selected accepted student is chosen. What is the probability they applied through early decision?

Answer: Let E = early decision, S = standard, Acc = accepted.

P(Acc) = P(Acc|S) × P(S) + P(Acc|E) × P(E) = (0.20 × 0.60) + (0.45 × 0.40) = 0.12 + 0.18 = 0.30

P(E | Acc) = [P(Acc|E) × P(E)] / P(Acc) = (0.45 × 0.40) / 0.30 = 0.18 / 0.30 = 0.60

Although early decision applicants are only 40% of the total applicant pool, they make up 60% of accepted students — because their acceptance rate is more than double the standard pool’s, and Bayes’ Theorem correctly reweights the pools accordingly.

Bayes’ Theorem problems reward repetition — the setup pattern is always the same once you’ve internalised it. The Statistics Made Simple Practice Questions workbook has a full chapter of these with fully worked solutions.

References

1. Bayes, T. (1763) ‘An Essay towards Solving a Problem in the Doctrine of Chances’, Philosophical Transactions of the Royal Society, 53, pp. 370–418.
2. McGrayne, S.B. (2011) The Theory That Would Not Die. Yale University Press.
3. Moore, D.S., McCabe, G.P. and Craig, B.A. (2021) Introduction to the Practice of Statistics. W.H. Freeman.
4. Ross, S.M. (2020) A First Course in Probability. Pearson.
5. Gigerenzer, G. (2002) Calculated Risks: How to Know When Numbers Deceive You. Simon & Schuster.

Related Posts

Skewness and Kurtosis: Measuring the Shape of a Distribution

Two datasets can share the exact same mean and standard deviation and still look completely different when plotted — because mean and variance say nothing about the shape of a distribution. Skewness and kurtosis fill that gap, and they matter far beyond the...

Skewness and Kurtosis: Measuring the Shape of a Distribution

Two datasets can share the exact same mean and standard deviation and still look completely different when plotted — because mean and variance say nothing about the shape of a distribution. Skewness and kurtosis fill that gap, and they matter far beyond the...