🎓 Prepared by students from Boğaziçi University

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.

Short answer

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.

Applying Bayes' Theorem
  1. 1
    Start with the prior
    P(A) — what you believed before new evidence.
  2. 2
    Gather the likelihood
    P(B|A) — how likely the evidence is if A is true.
  3. 3
    Compute the evidence
    P(B) — total probability of the evidence across all cases.
  4. 4
    Update to the posterior
    P(A|B) = P(B|A)P(A)/P(B) — your revised belief.
01

Try it: interactive calculator

P(A|B) — posterior probability
0.09
= (0.9*0.01)/0.1
02

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%)
03

Flashcards

04

Quick quiz

Q1.Bayes' theorem is used to calculate…

Correct answer: B. It updates prior beliefs using new evidence to produce a posterior probability.

Q2.In P(A|B) = P(B|A)P(A)/P(B), what does P(B) represent?

Correct answer: C. P(B) is the total (marginal) probability of observing the evidence B.

Q3.A test is 99% accurate but the disease is rare (0.1% prevalence). A positive result is…

Correct answer: B. With a low prior, even a low false-positive rate produces many false positives relative to true positives — the base rate fallacy.

Q4.If P(B|A) = 0.8, P(A) = 0.25, P(B) = 0.4, what is P(A|B)?

Correct answer: A. P(A|B) = (0.8×0.25)/0.4 = 0.2/0.4 = 0.5.
📄Download this topic as a printable worksheet (PDF)Summary + 10 questions + answer key — print it, share it in class.
Study better with Bounlu apps
Notek
Notek

The full card deck, worked steps and AI-tutor support for “What is Bayes' Theorem?” are in Notek — study by hand before your exam.

Get it free
Notek 1Notek 2Notek 3Notek 4Notek 5
05

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.

06

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).

Related topics