What is Bayes' Theorem?
Bayes' theorem describes how to update the probability of an event based on new evidence. It connects conditional probabilities in both directions, making it a cornerstone of statistics, machine learning, and medical testing.
Bayes' theorem states P(A|B) = P(B|A)·P(A) / P(B) — it lets you calculate the probability of A given B by reversing a known conditional probability.
- 1↓Start with the priorP(A) — what you believed before new evidence.
- 2↓Gather the likelihoodP(B|A) — how likely the evidence is if A is true.
- 3↓Compute the evidenceP(B) — total probability of the evidence across all cases.
- 4Update to the posteriorP(A|B) = P(B|A)P(A)/P(B) — your revised belief.
Try it: interactive calculator
Step-by-step worked examples
A disease affects 1% of a population. A test is 90% sensitive and has a 5% false-positive rate. If a person tests positive, what is the probability they have the disease?
P(Disease) = 0.01, P(No disease) = 0.99 P(Positive|Disease) = 0.90, P(Positive|No disease) = 0.05 P(Positive) = 0.90×0.01 + 0.05×0.99 = 0.009 + 0.0495 = 0.0585 P(Disease|Positive) = 0.009/0.0585 ≈ 0.154 (about 15.4%)
Machine A makes 60% of products with a 2% defect rate; Machine B makes 40% with a 5% defect rate. A random product is defective — what is the probability it came from Machine B?
P(A) = 0.6, P(B) = 0.4 P(Defect|A) = 0.02, P(Defect|B) = 0.05 P(Defect) = 0.6×0.02 + 0.4×0.05 = 0.012 + 0.02 = 0.032 P(B|Defect) = 0.02/0.032 = 0.625 (62.5%)
20% of emails are spam. 30% of spam emails contain the word 'free'; 5% of legitimate emails contain 'free'. An email contains 'free' — what is the probability it's spam?
P(Spam) = 0.2, P(Legit) = 0.8 P(free|Spam) = 0.3, P(free|Legit) = 0.05 P(free) = 0.3×0.2 + 0.05×0.8 = 0.06 + 0.04 = 0.10 P(Spam|free) = 0.06/0.10 = 0.6 (60%)
Flashcards
Quick quiz
Q1.Bayes' theorem is used to calculate…
Q2.In P(A|B) = P(B|A)P(A)/P(B), what does P(B) represent?
Q3.A test is 99% accurate but the disease is rare (0.1% prevalence). A positive result is…
Q4.If P(B|A) = 0.8, P(A) = 0.25, P(B) = 0.4, what is P(A|B)?
The full card deck, worked steps and AI-tutor support for “What is Bayes' Theorem?” are in Notek — study by hand before your exam.
Common mistakes
Confusing P(A|B) with P(B|A). — Correct: These are generally different — Bayes' theorem is precisely the tool that converts one into the other.
Ignoring the base rate (prior) when interpreting test results. — Correct: A low prior can make even an accurate test produce mostly false positives — always factor in P(A).
Forgetting to compute P(B) using the law of total probability. — Correct: P(B) = P(B|A)P(A) + P(B|¬A)P(¬A) — sum over all cases that lead to B.
Treating posterior probability as certainty. — Correct: The posterior is still a probability, not a guarantee — further evidence can update it again.
FAQ
What is Bayes' theorem?
It's a formula, P(A|B) = P(B|A)P(A)/P(B), that updates the probability of an event based on new evidence.
What is the formula for Bayes' theorem?
P(A|B) = P(B|A)·P(A) / P(B), where P(A) is the prior and P(A|B) is the posterior.
What are real-world examples of Bayes' theorem?
Medical test interpretation, spam email filtering, and machine learning classifiers all apply Bayes' theorem.
How do you calculate Bayes' theorem step by step?
Multiply the likelihood P(B|A) by the prior P(A), then divide by the marginal probability P(B).




