Bayes’ Rule
There is a rare disease: 1% of the population carries it, and the other 99% are healthy. Now there is a patient who takes the screening test for it, and the result comes back positive. Among people who carry the disease, the test comes back positive 95% of the time. Among healthy people, it comes back positive 10% of the time. How likely is it that this patient actually has the disease?
A positive result can happen in two ways. Either the patient carries the disease and the test caught it, or the patient is healthy and the test came back positive anyway:
- Carries the disease. 1% of the population carries it, and among these people the test comes back positive 95% of the time: .
- Healthy. The other 99% are healthy, and among these people the test comes back positive 10% of the time: .
Each product is a share of the whole population: the first is the share of people who both carry the disease and test positive; the second is the share who are healthy and still test positive.
Shares of a population are easier to picture as people. Out of every 10,000 people, the first product, , means 95 people carry the disease and test positive. The second, , means 990 people are healthy and test positive anyway. The 990 outnumber the 95 about ten to one: healthy people vastly outnumber sick ones, so even a 10% positive rate among the many healthy yields far more positive results than a 95% rate among the few sick. Every positive result is one or the other, so the probability that this patient has the disease is a plain count — 95 sick-and-positive people out of 1,085 positive results:
These two kinds of positive results have names: a positive result on someone who actually has the disease is a true positive (the 95), and a positive result on someone who does not have it is a false positive (the 990) — informally, a false alarm. Read in these terms, the patient’s probability is true positives over all positive results.
Notice that the 95 sick-and-positive people answer three different questions, with three different answers, depending on what they are divided by:
| divided by | count | answer | question |
|---|---|---|---|
| the 100 sick people | 95/100 | 95% | how often does a sick person test positive? |
| the 1,085 positive results | 95/1,085 | 8.8% | when a result is positive, how often is the patient actually sick? |
| all 10,000 tested people | 95/10,000 | 0.95% | how often does a tested person test positive and have the disease? |
Same 95 people — three different denominators. The patient’s case matches the middle row: the test result is known — positive — but the disease status is not. So the patient’s question is the middle one: given a positive result, how likely is the disease? Its answer is 8.8%. The 95% is a true fact about sick people, but it answers a question about a group the patient may not belong to.
Two different probabilities appear in this problem, and they condition on different groups. asks about the disease group: among people who carry the disease, what share tests positive? That is what the test specs tell us, 95%. asks about the positive group: among people who test positive, what share carries the disease? That is what the patient wants to know, 8.8%. Same two events, same two groups, but the conditioning runs in opposite directions. Bayes’ rule is the formula that converts one into the other. When you know the share of the observation inside each group, plus how large each group is, you can compute the share of each group inside the observation.
Now give every piece a name. The disease and healthy groups are mutually exclusive, so no one is both. They also cover all possibilities, so everyone is one or the other. In notation, this collection is called event set . The disease group is with probability . The healthy group is with . With more scenarios we would add , each with its own . The test result is event set . A positive result is with , which is the 1,085 out of 10,000 we already counted. A negative result would be . Within the two groups, the positive result has its own shares. means among the diseased, 95% test positive. means among the healthy, 10% test positive. Bayes’ rule takes exactly these numbers and combines them into the answer we computed. It gives the share of group within all positive results, . The next section states this as a formula.
The Rule
Bayes’ rule answers one kind of question: we know the share of the observation within each event, and we want the share of each event within the observation. The formula converts the first direction into the second. Its format is:
Each item in the formula:
- — the events of event set , mutually exclusive and covering all possibilities. One of them is true, and exactly which one is what we are trying to find out.
- — the observed event.
- — the share of event within the whole population: how much of the world this event covers. This is called the prior.
- — the share of the observation within event : how much of this event produces the observation. This is called the likelihood.
- — the event’s contribution: its slice of the population that ends up in the observation.
- — the same contribution summed over all events, using the index . Every event drops its slice into the observation, and this sum is all of it. It equals , the total share of the observation.
- — the share of event within the observation, which is the event’s contribution divided by the total. This is called the posterior.
The formula is nothing more than that division: one event’s slice over the whole observation. When there are only two events, the sum has two terms, and it is often written in the single-event form:
Derivation
Bayes’ rule follows from three tools we already know. Let’s derive it step by step.
Step 1: Start from the definition of conditional probability
By definition:
This says: “the probability of given is the probability of both happening, divided by the probability of .” The denominator normalizes — out of all ways can occur, what fraction also has ?
Step 2: Apply the multiplication rule to the numerator
The numerator can be rewritten using the multiplication rule:
Why this form? Because is usually given — it’s the “forward” probability (how likely the observation is under each scenario). The “reverse” probability is what we’re trying to find.
Substituting into Step 1:
Step 3: Apply the total probability theorem to the denominator
The denominator can be expanded using the total probability theorem (since the ’s form a partition):
Why expand? Because we don’t usually know directly — we know the priors and the likelihoods . The theorem lets us compute from what we have.
Substituting into Step 2:
That’s Bayes’ rule. Three steps: definition → multiplication → total probability.
The full chain
Each tool builds on the previous one. Bayes’ rule is the final step in this chain — it combines all three to reverse conditional probabilities.
Prior and Posterior
These three names describe the timeline of a Bayes calculation.
The prior is what you know before the observation. It is the group’s share of the population. The disease group has prior . One in a hundred people carry the disease, and this patient could be anyone.
The likelihood is what the model tells you about the observation inside each group. It is the share of the group that shows the result. The likelihood of a positive result is 0.95 in the disease group and 0.10 in the healthy group.
The posterior is what you know after the observation. It is the group’s share within the observed results. The disease group has posterior . This patient tested positive, and among all positive results 8.8% come from the disease group.
The movement from prior to posterior is the update. The disease group started at 1% of the population. After one positive test it stands at 8.8% of the positive results. The observation moved the number, and it could only move it this far because the group was small to begin with. A rare group needs strong evidence, or repeated evidence, to reach a high posterior.
Example: Disease Testing
In the notation of the last section: event is carries the disease, event is healthy, and event is the test result. The priors are and . The likelihoods are and . The posterior we want is : among all positive results, the share that comes from the disease event.
Plugging in:
The formula reproduces the by-hand count: the numerator is the disease event’s contribution, the denominator is all positive results.
The formula reproduces the by-hand count: the numerator is the sick-and-detected share, the denominator is all positive results.
| Event | Prior | Likelihood | Product |
|---|---|---|---|
| — disease | 0.01 | 0.95 | 0.0095 |
| — healthy | 0.99 | 0.10 | 0.099 |
| Total | 0.1085 |
The denominator (total positive probability) is 0.1085. Only 0.0095 of that comes from actual disease cases. The rest — 91% of positives — are false alarms from healthy people.
Key insight: When the prior is small (rare disease), even an accurate test produces mostly false positives. The posterior stays low because the prior was low — the observation can only update beliefs, not create them from scratch.
Example: Radar Detection
A radar detects airplanes:
Given detection, probability of plane:
Same pattern: false alarms dominate. Most detections come from empty sky, even though each empty-sky detection is only 10% likely.
Inference: Cause → Effect Reversed
Bayes’ rule is the foundation of inference — drawing conclusions from observations.
Causal Model: (Cause produces effect)
- We know — forward probability, how likely the effect given the cause
- This is usually given by the model (test specs, radar specs, etc.)
Inference Question: Given we observed , what caused it?
- We want — backward probability, how likely the cause given the effect
- This is what Bayes’ rule computes
This reversal — from causal direction to inference direction — is exactly what Bayes’ rule does. It lets you reason backwards from observations to causes.