The conditional probability formula
P(A | B) = P(A ∩ B) ÷ P(B) Example: P(A ∩ B) = 15%, P(B) = 40% P(A | B) = 15% ÷ 40% = 37.5% In words: out of all the times B happens, what fraction of those times does A also happen? P(B) must be greater than 0 — if B can never occur, the condition "given B" is meaningless. P(A ∩ B) can never exceed P(B) either, since the times both A and B happen are necessarily a subset of the times B happens alone.
P(A|B) is not the same as P(B|A)
This is the single most common mistake with conditional probability — treating "probability of A given B" as interchangeable with "probability of B given A." They usually are not equal. Building a table from raw counts makes the difference concrete:
| B | Not B | |
|---|---|---|
| A | 10 | 10 |
| Not A | 40 | 40 |
P(A | B) = 10 ÷ (10 + 40) = 10 ÷ 50 = 20% P(B | A) = 10 ÷ (10 + 10) = 10 ÷ 20 = 50% Same 100 data points, same 10 people in both categories — but a 20% chance versus a 50% chance depending on which direction you ask the question. Confusing the two is common enough in legal and medical contexts that it has a name: the prosecutor's fallacy.
Bayes' theorem: working backwards from evidence
Bayes' theorem answers a specific, very common question: given a positive test result, what's the real probability of having the condition being tested for? It requires three things — how common the condition is (the prior), how often the test is right when the condition is present (sensitivity), and how often it falsely triggers when the condition is absent (the false-positive rate).
P(A | B) = [P(B | A) × P(A)] ÷ P(B) where P(B) = P(B|A)×P(A) + P(B|not A)×P(not A) The classic example: a rare disease, an accurate test
Suppose a disease affects 1% of the population. A test for it is 99% accurate for people who have the disease (sensitivity), but also gives a false positive 5% of the time for people who don't. You test positive. What is the actual probability you have the disease?
P(Positive) = (99% × 1%) + (5% × 99%) = 0.99% + 4.95% = 5.94% P(Disease | Positive) = 0.99% ÷ 5.94% = 16.67% Despite a "99% accurate" test, a positive result only means a 16.67% chance of actually having the disease — because the disease is rare, the much larger healthy population generates more false positives (4.95%) in absolute terms than the small sick population generates true positives (0.99%). This is the single most important intuition in Bayesian reasoning: the rarer the condition, the more a positive result is dominated by false alarms, no matter how accurate the test sounds.
Frequently asked questions
What is conditional probability?
Conditional probability is the chance of an event happening given that another event is already known to have happened. It's written P(A|B), read "probability of A given B," and calculated as P(A ∩ B) ÷ P(B).
How do you find conditional probability from a table?
Find the count where both events occur, and divide it by the total count for the "given" event's column or row. For P(A|B), divide the A-and-B count by the total count of B (both A-and-B plus not-A-and-B).
What is Bayes' theorem used for?
Bayes' theorem reverses a conditional probability — it converts "probability of a positive test given the disease" into the more useful "probability of the disease given a positive test." It's used throughout medical testing, spam filtering, forensic evidence, and machine learning.
Why isn't a "99% accurate" test 99% reliable?
"99% accurate" usually describes sensitivity — how often the test is right when the condition is present — not the chance you have the condition given a positive result. For rare conditions, false positives from the much larger healthy population can outnumber true positives, pulling the real probability far below 99%, as the disease example above shows.
Can P(A|B) be greater than P(A)?
Yes, whenever A and B are positively associated — knowing B happened makes A more likely than it was on its own. If they're negatively associated, P(A|B) is lower than P(A). If A and B are independent, P(A|B) equals P(A) exactly, since knowing about B tells you nothing about A.