Bayes Theorem Calculator – Updating Probability with Evidence
Bayes' Theorem is the mathematical rule for updating a belief once new evidence arrives. It converts a prior probability — what you believed before seeing the evidence — into a posterior probability, the updated belief after accounting for how likely that evidence is under each possible explanation. The formula is P(A|B) = [P(B|A) × P(A)] / P(B), and it underlies everything from medical diagnostics and spam filters to legal reasoning and machine learning classifiers.
Two-Event Bayes: A and Not A
The simplest case updates a single hypothesis A against its complement ¬A. Given the prior P(A), the likelihood P(B|A) (how probable the evidence is if A is true), and the false-positive rate P(B|¬A) (how probable the evidence is if A is false), the calculator first finds P(B) via the Law of Total Probability: P(B) = P(B|A) × P(A) + P(B|¬A) × P(¬A). That normalizing constant is then divided into the numerator to yield P(A|B), the posterior.
Multiple Hypotheses (Law of Total Probability)
Many real problems involve more than two possibilities — three factories producing a part, four candidate diagnoses, or several competing models. For n mutually exclusive, exhaustive hypotheses H₁…Hₙ, the calculator generalizes the formula to P(Hᵢ|E) = [P(E|Hᵢ) × P(Hᵢ)] / Σⱼ P(E|Hⱼ) × P(Hⱼ). Because the hypotheses must cover every possibility exactly once, their priors are required to sum to 1 — the calculator validates this before computing results and flags the actual sum if it drifts.
The Base-Rate Fallacy
Bayes' Theorem is famous for correcting a common intuition error: assuming P(A|B) ≈ P(B|A). Consider a disease with 1% prevalence and a test that is 95% accurate in both directions. Naively, a positive result feels like 95% certainty of disease. In reality, because healthy people vastly outnumber sick people, the false positives from that much larger healthy pool swamp the true positives — the actual posterior probability of disease given a positive test is only around 16%. This gap between test accuracy and real-world certainty is the base-rate fallacy, and it is exactly what Bayes' Theorem is built to correct.
Natural Frequencies Make It Intuitive
Probabilities expressed as fractions between 0 and 1 are easy to miscalculate mentally. The calculator also expresses results as a natural frequency breakdown— for example, "out of 1,000 people, 10 have the condition; of those, about 9.5 test positive; of the 990 without it, about 49.5 also test positive." Framing the same math as whole-number counts out of a population is a well-documented way to make conditional probability intuitive without requiring formal notation.
Prior, Likelihood, and Posterior
Three terms recur throughout Bayesian reasoning. The prior is your belief before evidence; the likelihood is how probable the evidence is under a given hypothesis; and the posterior is your updated belief after combining the two. Note that P(B|A) and P(B|¬A) come from separate conditional distributions and are not required to sum to 1 — each must simply fall between 0 and 1 independently.
Common Use Cases
Clinicians interpret diagnostic test results against disease prevalence; spam filters weigh word frequencies against prior spam rates; quality-control engineers trace defective units back to the most likely production line; and students verify textbook Bayes' Theorem problems step by step. In every case, the same core idea applies: combine what you believed before with how surprising the new evidence is, to get a properly calibrated updated belief.