Theorem Probability & Statistics โœ“ Live

Bayes' Theorem

Bayes' Theorem provides a precise mathematical rule for updating your beliefs about the probability of something in light of new evidence. Named after Thomas Bayes (published posthumously, 1763), it has become foundational to medical diagnosis, spam email filtering, legal reasoning about evidence, and much of modern machine learning and artificial intelligence.

Updating your beliefs correctly, given new evidence

Suppose a medical test for a rare disease is 99% accurate. You test positive. How worried should you be? Most people's gut instinct says "99% chance I have the disease" โ€” but that's usually wrong, and dangerously so. Bayes' Theorem gives the mathematically correct way to combine the test's accuracy with how rare the disease actually is in the first place, often yielding a surprisingly different โ€” and much more reassuring โ€” answer.

๐ŸŽฒ A concrete example: If the disease affects only 1 in 10,000 people, and the test is 99% accurate, a positive test result actually means roughly only a 1% chance you truly have the disease โ€” not 99%! The disease's rarity matters enormously, and Bayes' Theorem tells you exactly how to correctly account for it.

Why our gut instincts get this so wrong

Most people ignore what statisticians call the "base rate" โ€” how common something is in the first place โ€” and focus only on the test's accuracy. Because the disease is so rare, there are actually far more healthy people who wrongly test positive (false positives, even at a small 1% error rate, still a lot of people out of a huge healthy population) than sick people who correctly test positive. This surprising and counterintuitive result is sometimes called the base rate fallacy when people get it wrong.

Where you benefit from Bayesian reasoning daily

  • Spam filters: calculate the probability an email is spam, updating based on which specific words it contains
  • Medical diagnosis: doctors (should) combine test results with how common a condition is in the general population
  • Legal reasoning: correctly weighing forensic evidence requires accounting for how common a given piece of evidence would be even if the defendant were innocent
  • Machine learning: many AI systems use Bayesian methods to update predictions as new data arrives

The formula and worked example

Bayes' Theorem

P(A|B) = P(B|A)ยทP(A) / P(B)

In words: the probability of A given that B occurred equals the probability of B given A, times the prior probability of A, divided by the overall probability of B. In Bayesian terminology: P(A) is the prior (your belief before seeing evidence), P(A|B) is the posterior (your updated belief after seeing evidence B), and P(B|A) is the likelihood (how probable the evidence is, if A is true).

Working the medical test example precisely

Let D = "has disease" (prior P(D) = 0.0001, i.e., 1 in 10,000) and + = "tests positive" (test accuracy: P(+|D) = 0.99, and P(+|not D) = 0.01, a 1% false positive rate). Using the Law of Total Probability: P(+) = P(+|D)P(D) + P(+|not D)P(not D) = (0.99)(0.0001) + (0.01)(0.9999) โ‰ˆ 0.0101. Then:

P(D|+) = (0.99 ร— 0.0001) / 0.0101 โ‰ˆ 0.0098 โ‰ˆ 1%

Confirming the surprising result: despite a 99%-accurate test and a positive result, there's only roughly a 1% chance of actually having the rare disease.

Bayesian updating with multiple pieces of evidence

Bayes' Theorem can be applied repeatedly and sequentially: your posterior belief after one piece of evidence becomes your new prior belief before incorporating the next piece of evidence. This sequential updating process is the mathematical foundation of how spam filters improve as they process more and more emails, and how many modern machine learning systems refine their predictions as additional data becomes available over time.

Odds form of Bayes' Theorem

Bayes' Theorem is often more conveniently expressed using odds rather than probabilities directly: posterior odds = likelihood ratio ร— prior odds. This form is especially convenient in forensic science and legal contexts, directly showing precisely how much a specific new piece of evidence should shift your existing belief, all expressed as a single clear multiplicative factor.

Bayesian vs frequentist statistics and modern applications

Historical origins โ€” a posthumous publication

Thomas Bayes, an English Presbyterian minister and amateur mathematician, developed the core underlying idea but never published it during his own lifetime. His friend Richard Price discovered Bayes's papers after his death and arranged for publication in 1763 ("An Essay towards solving a Problem in the Doctrine of Chances"). Pierre-Simon Laplace independently and substantially further developed and generalised the underlying mathematical framework a few decades later, and is credited by many historians of statistics with the theorem's first fully general, systematic statement and applications.

The Bayesian vs frequentist statistical divide

As discussed in the Philosophy of Mathematics and Probability entries, Bayes' Theorem sits at the very heart of a long-running, historically significant methodological divide within statistics. Bayesian statistics treats probability fundamentally as a genuine, quantifiable degree of belief, updated systematically via Bayes' Theorem as new evidence accumulates โ€” allowing meaningful probability statements even about one-off events or unknown fixed parameters (e.g., "there is a 70% probability this specific scientific hypothesis is correct"). Frequentist statistics, by contrast, treats probability strictly as a long-run frequency and is generally reluctant to assign probabilities to fixed, one-off, non-repeatable hypotheses or unknown parameters in this same direct way. Both major statistical schools remain actively and legitimately used today, often for different specific classes of problems, and the methodological debate between them, while less heated than in past decades, has not been fully or universally resolved.

Naive Bayes classifiers in machine learning

A widely used and surprisingly effective machine learning technique, the Naive Bayes classifier, applies Bayes' Theorem directly to classification problems (such as spam detection), making the simplifying ("naive") assumption that all the individual pieces of evidence are conditionally independent of each other, given the outcome category. Despite this assumption being frequently and knowingly false in real-world data (word choices in an email, for instance, are rarely fully independent of one another), naive Bayes classifiers often perform remarkably well in practice, and remain widely used today specifically due to their computational simplicity, scalability, and generally solid real-world empirical performance.

Bayesian networks and modern AI

Judea Pearl's development of Bayesian networks (1980s) โ€” graphical models representing complex conditional probability relationships between many variables using the structure of a graph (see the Graph Theory entry) โ€” earned him the 2011 Turing Award (computer science's highest honour) and now forms a central foundational component of modern probabilistic artificial intelligence and causal inference methodology, extending well beyond Bayes' original comparatively simple two-event formula into large-scale, richly structured systems of interdependent probabilistic reasoning.

The prosecutor's fallacy

A commonly occurring and serious real-world legal misapplication of Bayesian reasoning, the prosecutor's fallacy, involves incorrectly conflating P(evidence | innocent) with P(innocent | evidence) โ€” these are generally very different quantities, and can genuinely be wildly, dramatically different from each other, especially in circumstances precisely analogous to the medical testing base-rate example discussed above. This specific statistical confusion has contributed directly to serious, well-documented miscarriages of justice in actual real-world criminal court cases, underscoring the significant real-world practical importance of correctly and rigorously understanding and applying Bayes' Theorem, well beyond its purely abstract mathematical or purely academic interest.

๐Ÿ“š Sources

Tier 1 Bayes, T. (1763). An essay towards solving a problem in the doctrine of chances. Philosophical Transactions of the Royal Society, 53, 370โ€“418. โ€” The original posthumous publication.
Tier 1 Gelman, A., Carlin, J.B., Stern, H.S. et al. (2013). Bayesian Data Analysis. 3rd ed. CRC Press. โ€” Standard modern reference.
Tier 2 McGrayne, S.B. (2011). The Theory That Would Not Die. Yale University Press. โ€” Accessible historical account.
Tier 3 Silver, N. (2012). The Signal and the Noise. Penguin Press.
Entry v1.0 ยท Added 2026-05-27 ยท Probability & Statistics ยท Theorem JSON Markdown Status