Bayes Theorem
Bayes' Theorem relates the conditional probability to its "reverse" via . In words: it tells you how to update your belief in a hypothesis after seeing evidence. It applies anywhere uncertainty is quantified — medical diagnosis, machine learning, forensics, signal processing, and scientific inference. Named for Thomas Bayes (c. 1701–1761), published posthumously in 1763.
Evidence does not tell you directly — it gives you . Bayes' Theorem is the bridge that flips this direction, and the flip requires you to bring in the prior — your belief before the evidence. The posterior is proportional to likelihood times prior. Forgetting the prior (the base rate) is the single most common error in probabilistic reasoning.
Formal Statement
For events and in a probability space with , the conditional probability of given is
Derivation hint: This is the definition; it renormalizes the probability of the joint event to the reduced sample space in which is known to have occurred. Here is the probability that both and occur, and is the (positive) probability of the conditioning event.
Let and be events with and . Then
Derivation hint: Apply Equation [1] twice — once for , once for — and note both share the symmetric joint term . The terms are named:
- — the posterior: belief in after observing .
- — the likelihood: probability of evidence if holds.
- — the prior: belief in before observing .
- — the evidence (or marginal likelihood): total probability of observing .
If is a partition of the sample space (mutually exclusive, exhaustive, each with positive probability), the denominator can be expanded:
Derivation hint: Write as a disjoint union over the partition, use countable additivity, then apply Equation [1] to each term. Substituting into Equation [2] gives the form used in practice:
Derivation hint: Substitute Equation [3] into the denominator of Equation [2] with . For the common binary case ( and its complement ):
Derivation hint: Equation [4] with the two-element partition .
Dividing the posterior for by that for , the evidence cancels, yielding the elegant odds form:
Derivation hint: Take the ratio of Equation [2] for and for ; the common denominator divides out. The likelihood ratio (or Bayes factor) is the multiplicative strength of the evidence — how many times more often occurs under than under .
Why It Holds / Derivation
We derive Equation [2] from the definition of conditional probability.
Step 1. By Equation [1], the conditional probability of given is
Step 2. By the same definition, swapping the roles of and ,
Step 3. The intersection is symmetric: , so . Solving Step 2 for this joint probability:
This is the multiplication rule.
Step 4. Substitute the result of Step 3 into Step 1:
This is Equation [2]. The entire content of the theorem is the symmetry of the joint probability viewed through two different conditionings. The expanded forms [4]–[6] are obtained by rewriting using the law of total probability or by taking ratios.
∎Thomas Bayes was an English Presbyterian minister and mathematician, a Fellow of the Royal Society. He never published his theorem in his lifetime; it appeared in "An Essay towards solving a Problem in the Doctrine of Chances", communicated to the Royal Society in 1763 by his friend Richard Price, two years after Bayes' death. Bayes' original problem was inverse: given a number of successes and failures in independent trials with unknown success probability , what can be said about ? He effectively solved a special case of inference for a binomial parameter using a uniform prior. The general formulation and its systematic use in inference are largely due to Pierre-Simon Laplace, who rediscovered and vastly extended the idea independently. Much of what we call "Bayesian" is really Laplacian.
Building Intuition
Think of probability as area. The whole sample space is a unit square. Event carves out a region; event carves out another; they overlap in . When you learn that happened, you erase everything outside — your world shrinks to the region. The question "how likely is now?" becomes: what fraction of the surviving -region also belongs to ? That fraction is — exactly Equation [1]. Bayes' Theorem is just the observation that you can compute that overlap two ways. You might naturally know "of all the -cases, what fraction are also " (the likelihood) plus "how big is to begin with" (the prior). Bayes assembles these into the overlap and divides by the size of to flip the conditioning. The crucial intuition is base rates: even if almost always accompanies (high likelihood), if is itself tiny (low prior), then most of region may come from the complement . A big slice of a rare event can be dwarfed by a tiny slice of a common one.
Worked Examples
Given: A disease affects 1 in 1000 people, so the prior is . A test has:
- Sensitivity (true positive rate):
- False positive rate: (so specificity ).
A randomly screened person tests positive. Find .
Step 1 — Prior of no disease: .
Step 2 — Evidence (total probability of a positive), Equation [3]:
Step 3 — Bayes, Equation [5]:
Despite a "99% accurate" test, a positive result means only about a 2% chance of actually having the disease — because false positives from the huge healthy population (0.04995) swamp the true positives (0.00099). This is the base-rate fallacy.
Given: A warehouse stocks bolts from two suppliers. Supplier 1 made 70% of the bolts with a 2% defect rate; Supplier 2 made 30% with an 8% defect rate. A randomly chosen bolt is defective. Find the probability it came from Supplier 2. Let = "from Supplier 2", = "from Supplier 1", = "defective".
Step 1 — Priors and likelihoods:
Step 2 — Prior odds (in favor of ):
Step 3 — Likelihood ratio (Equation [6]):
Step 4 — Posterior odds:
Step 5 — Convert odds to probability: odds give
Though Supplier 2 makes only 30% of bolts, its higher defect rate makes it the more likely source of any given defective bolt.
Common Misconceptions
Do not confuse the likelihood with the posterior — they are generally very different. In a courtroom, "the probability of this DNA match if the defendant is innocent is one in a million" () is not the same as "the probability the defendant is innocent given the match." With a database of millions of people, many innocent matches can occur. Equating these two reversed conditionals is the prosecutor's fallacy, and it has led to real wrongful convictions. Bayes' Theorem [2] shows the conversion requires the prior — which the fallacy silently ignores.
A common belief: "If a test is 99% accurate and I test positive, I'm 99% likely to have the condition." The medical example above is a direct counterexample: with and a low base rate , the posterior is only 1.94%. The same "99% accurate" test gives very different posteriors depending entirely on the prior:
| Prior | Posterior |
|---|---|
| 0.001 | 1.9% |
| 0.01 | 16.7% |
| 0.10 | 68.7% |
| 0.50 | 95.2% |
Accuracy is a property of the test; the posterior is a property of the test plus the population. There is no posterior without a prior.
Connections
Bayes' Theorem sits at the hub of probability and inference:
- It is an immediate corollary of Conditional Probability and the Law of Total Probability.
- It generalizes from events to densities, giving the foundation of Bayesian Inference, where one updates a Prior Distribution into a Posterior Distribution using a Likelihood Function.
- In its repeated/sequential form it is the engine of Bayesian Updating and recursive estimators like the Kalman Filter and Hidden Markov Models.
- The Naive Bayes Classifier applies it with a conditional-independence assumption for classification.
- It contrasts philosophically with Frequentist Inference and connects to Maximum Likelihood Estimation (the MAP estimate reduces to the MLE under a flat prior).
- The odds form links it to Information Theory via the log-likelihood ratio as evidence in bits.
Real-World Applications
Historical Development
Subtleties & Limits
Bayes' Theorem is mathematically uncontroversial, but its use in inference raises deep, partly unresolved issues:
- Choosing the prior. Where does come from when no frequency data exist? "Objective" or "non-informative" priors (uniform, Jeffreys, reference priors) attempt to encode ignorance, but a prior uniform in one parameterization is non-uniform in another — there is no universally canonical ignorance prior. For continuous infinite-dimensional spaces, ignorance can even be incoherent.
- Improper priors. Common non-informative priors (e.g. over all reals) do not integrate to 1; they sometimes yield proper posteriors and sometimes yield paradoxes or nonexistent posteriors.
- Sensitivity and robustness. With small data, conclusions can depend heavily on the prior; quantifying and bounding this sensitivity (robust Bayes) is an active area.
- Computation. Exact posteriors are intractable for most realistic models; MCMC and variational methods give approximations whose convergence and error are not always guaranteed.
- Calibration vs. coherence. Bayesian updates are internally coherent but need not be well-calibrated against reality if the model or prior is misspecified — the theorem cannot rescue a wrong model.
These are not flaws in the theorem (an exact identity) but open questions about how to deploy it as a theory of inference.
See Also
Conditional Probability · Law of Total Probability · Bayesian Inference · Prior Distribution · Posterior Distribution · Likelihood Function · Naive Bayes Classifier · Maximum Likelihood Estimation · Frequentist Inference · Markov Chain Monte Carlo