Back to courseLesson 6 of 14

Conditional probability

What you'll learn

Update a probability once you know something happened — the idea behind Bayes' rule.

Learning something changes the odds. The chance it rained is one number; the chance it rained given that the ground is wet is another. Conditional probability is how you update.

Probability given something known

The probability of A given B — written P(A | B) — is the fraction of the B outcomes that are also A outcomes:

P(AB)=P(AB)P(B)P(A \mid B) = \frac{P(A \cap B)}{P(B)}

You've shrunk the world down to just the cases where B happened, and asked how often A shows up inside that smaller world.

Multiplying along a tree

Rearranging that formula gives the chain rule, and a tree diagram makes it visual — multiply the probabilities along a path:

0.30.70.80.20.10.9RainNo rainLateOn timeLateOn time= 0.3 × 0.8 = 0.24
Each branch is a conditional probability. Multiply along a path — P(Rain) × P(Late | Rain) — to get the joint probability of both happening: 0.24.

Each branch is a conditional probability, and a full path multiplies to a joint probability: P(Rain) × P(Late | Rain) = 0.3 × 0.8 = 0.24.

Bayes' rule: flipping the condition

Often you know P(B | A) but want P(A | B) — the reverse. Bayes' rule flips it:

P(AB)=P(BA)P(A)P(B)P(A \mid B) = \frac{P(B \mid A)\,P(A)}{P(B)}

This is the engine behind the famous medical-test surprise: a test that's 99% accurate can still be wrong most of the time it flags a rare disease, because the disease's low base rate P(A) dominates. Conditioning without Bayes is how smart people misread test results.

Why this matters

Conditional probability is how evidence updates belief — the basis of spam filters, medical diagnosis, and every machine-learning classifier. The key habit it builds: always ask "probability given what?" A number with no condition stated is often the wrong number.

Check your understanding

Question 1 of 2

Conditional probability P(A | B) equals:

Next lesson