Bayes' Theorem Calculator

Calculate conditional probabilities using Bayes' theorem.

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

What Is the Bayes' Theorem Calculator?

The Bayes' Theorem Calculator computes the posterior probability P(A|B) — the probability of hypothesis A given evidence B. Enter the prior probability P(A), the likelihood P(B|A) (probability of evidence given hypothesis), and P(B|¬A) (probability of evidence given the hypothesis is false). The tool applies the Law of Total Probability to find P(B), then Bayes' formula.

Formula

Bayes' Theorem: P(A|B) = P(B|A) × P(A) / P(B) Total Probability (Law): P(B) = P(B|A) × P(A) + P(B|¬A) × P(¬A) Complement: P(¬A) = 1 − P(A) Posterior for ¬A: P(¬A|B) = P(B|¬A) × P(¬A) / P(B) Note: P(A|B) + P(¬A|B) = 1

How to Use

Enter P(A) — your prior belief in hypothesis A (0 to 1). Enter P(B|A) — the probability of observing evidence B if A is true. Enter P(B|¬A) — the probability of observing B if A is false. Click Calculate to see the posterior probabilities.

Example Calculation

Medical test: Disease prevalence P(A) = 1% = 0.01 Test sensitivity P(B|A) = 95% = 0.95 False positive rate P(B|¬A) = 10% = 0.10 P(B) = 0.95×0.01 + 0.10×0.99 = 0.0095 + 0.099 = 0.1085 P(A|B) = (0.95×0.01)/0.1085 ≈ 8.76% A positive test only means ~8.8% chance of disease! This is the "base rate fallacy" — rare diseases mean most positives are false.

Understanding Bayes' Theorem

Bayes' Theorem, published posthumously by Reverend Thomas Bayes in 1763, is arguably the most important formula in probability theory. It provides the mathematical foundation for updating beliefs in the light of new evidence.

The theorem elegantly shows how prior knowledge and observed data combine to produce updated beliefs. This is exactly how rational reasoning should work: you start with some belief, observe evidence, and revise your belief accordingly.

The medical testing example is famously counterintuitive. Even a very accurate test can produce mostly false positives for rare diseases, because the prior probability (disease prevalence) is so low. Understanding this saves patients from unnecessary distress and procedures.

Frequently Asked Questions

What is the prior probability?

The prior P(A) is your initial belief in hypothesis A before seeing evidence. It represents background knowledge or base rate (e.g., disease prevalence in the population).

What is the posterior probability?

The posterior P(A|B) is the updated probability of A after observing evidence B. It combines your prior belief with how likely the evidence is under each hypothesis.

What is the base rate fallacy?

The base rate fallacy occurs when people ignore prior probabilities. A medical test with 95% sensitivity sounds impressive, but for a rare disease with 1% prevalence, most positive tests are still false positives.

What is the difference between frequentist and Bayesian statistics?

Frequentists interpret probability as long-run frequencies. Bayesians interpret it as a degree of belief that updates as evidence accumulates. Bayes' theorem is the formal update rule in Bayesian statistics.

What are real-world applications of Bayes' Theorem?

Spam filters (probability email is spam given keywords), medical diagnosis, Bayesian machine learning, forensic evidence analysis, and financial risk assessment all use Bayes' Theorem.

Related Tools