Learn
Interactive·

Conditional Probability & Bayes’ Theorem

The probability of an event changes when new information becomes available.

Suppose a customer has a 40% chance of completing a purchase. If we learn that the customer has already added three items to the cart, that probability may change.

Conditional probability recalculates the chance of an event after a condition is known.

Key question

How should an existing probability be updated when new evidence arrives?

1

Concept

What is conditional probability?

A condition narrows the sample space

P(A|B) is the probability of A among cases in which B has occurred. We restrict attention to B and then ask what proportion of those cases also belong to A.

Conditional probability

P(A|B) = P(A ∩ B) ÷ P(B)

EventCustomers
At least three items in cart200
Completed purchase among them120
Conditional completion probability120/200 = 60%
2

Why It Matters

How does independence relate to conditioning?

If events are independent, conditioning changes nothing

When A and B are independent, learning B does not change the probability of A: P(A|B) = P(A).

Meaning of independence

With two fair coins, the first coin landing heads does not change the probability for the second coin.

Conversely

If P(A|B) differs from P(A), then B carries information about A.

3

How It Works

What does Bayes’ theorem update?

Bayes’ theorem reverses the direction of conditioning

Bayes’ theorem lets us calculate P(A|B) when P(B|A) is easier to specify.

Bayes’ theorem

P(A|B) = P(B|A)P(A) ÷ P(B)

Prior probability

How plausible the hypothesis was before the evidence

Likelihood

How likely the evidence is under each hypothesis

Posterior probability

The updated probability after seeing the evidence

The prior is the probability before evidence; the posterior is the updated probability after evidence.

4

Example

Why do base rates matter?

A good test can still produce many false positives when the base rate is low

Suppose prevalence is 1% and both sensitivity and specificity are 95%. The test sounds accurate, but true cases are so rare that false positives can outnumber true positives.

Base-rate neglect

“The test is 95% accurate” does not mean “a positive result implies a 95% chance of disease.”

5

Interactive

Change the prior and test performance

Change the prior and test performance

Adjust prevalence, sensitivity, and specificity to see how the posterior probability changes.

Prior probability

5.0%

Sensitivity

90%

Specificity

95%

Posterior probability

48.6%

Among 1,000 cases

true positives ≈ 45, false positives ≈ 48

Key lesson

Bayes’ theorem combines new evidence with the probability that existed before the evidence.

Key takeaways

  • Conditional probability is probability after a condition is known.
  • Independent events do not change one another’s probabilities.
  • Bayes’ theorem converts P(B|A) into P(A|B).
  • The prior comes before evidence; the posterior comes after.
  • Low base rates can produce many false positives even with a good test.

Go Deeper

Random Variables & Distributions