Learning outcomes
By the end of this lesson you should be able to: state the three rules of probability (complement, addition, multiplication) and say when each applies; compute a conditional probability from a joint and a marginal probability; test whether two events are independent using the multiplication rule; and avoid the mistake of adding probabilities that overlap.
Prerequisites
Lesson 1 (What is data & variables). You have used counts and proportions to summarise data, and that is all this lesson needs. Comfort with fractions is enough — every computation here is done with exact fractions before it is turned into a decimal.
The big idea
Almost everything that goes wrong in applied probability goes wrong in one of two ways: adding two probabilities that overlap and double-counting the overlap, or multiplying two probabilities when the events are not independent. The rules below fix both, and they are short enough to carry in your head as long as you remember what each one is correcting for.
The three rules and what each one corrects
The complement rule is almost trivially true and enormously useful. If the chance of rain is 0.3, the chance of no rain is 0.7. It is the tool for questions phrased as 'at least one', because it is usually easier to count the opposite event: the chance of at least one six in five rolls of a die is 1 minus the chance of no six at all, which is 1 - (5/6) to the fifth power.
The addition rule handles 'or'. Adding P(A) and P(B) counts every outcome that is A and every outcome that is B — and an outcome that is both gets counted twice. Subtracting P(A and B) once removes the double count. When the events are mutually exclusive (disjoint), P(A and B) = 0 and the addition rule collapses to a simple sum, which is why adding probabilities is safe for non-overlapping categories and unsafe otherwise.
The multiplication rule handles 'and'. For independent events, P(A and B) = P(A) x P(B): the two do not influence each other, so the share of A-and-B repetitions is the product of the two shares. In general, P(A and B) = P(A) x P(B | A) — the chance of A times the chance of B once A is known. Conditional probability is therefore not a new rule but a rearrangement of this one.
| Rule | Statement | When to use it | Trap it prevents |
|---|---|---|---|
| Complement | P(not A) = 1 - P(A) | Questions phrased as 'at least one' or 'none' | Assuming 'at least one' is a common outcome |
| Addition (general) | P(A or B) = P(A) + P(B) - P(A and B) | Any 'or' between events that may overlap | Double-counting the overlap |
| Addition (disjoint) | P(A or B) = P(A) + P(B) | 'Or' between mutually exclusive categories | Subtracting an overlap of zero |
| Multiplication | P(A and B) = P(A) x P(B | A) | Any 'and' | Multiplying unconditionally when events are dependent |
| Conditional | P(A | B) = P(A and B) / P(B) | 'Given that B happened' | Mistaking P(A | B) for P(B | A) |
Worked example 1: the complement rule on a die
A fair six-sided die is rolled once. The complement rule turns 'not six' into a subtraction from 1, and it is exact because a fair die has equally likely outcomes.
from fractions import Fraction as F
p_six = F(1, 6)
print("P(six):", p_six, "=", round(float(p_six), 4))
print("P(not six) = 1 - P(six):", 1 - p_six, "=", round(float(1 - p_six), 4))P(six): 1/6 = 0.1667
P(not six) = 1 - P(six): 5/6 = 0.8333Method: a fair die has six equally likely outcomes and exactly one is a six, so P(six) = 1/6. The remaining five outcomes are 'not a six', so the complement is 5/6, about 0.8333. The complement rule earns its keep when the wanted event is hard to count directly: the chance of at least one six in five rolls is 1 - (5/6) to the fifth power = 1 - 3125/7776 = 4651/7776, about 0.598, whereas counting 'at least one' directly means summing the one-case, two-case, three-case and beyond probabilities separately.
Worked example 2: the general addition rule
Two events with known probabilities and a known overlap. Naively adding them gives the wrong answer by exactly the size of the overlap.
from fractions import Fraction as F
p_a, p_b, p_ab = F(1, 2), F(3, 10), F(1, 10)
print("P(A or B) = P(A) + P(B) - P(A and B):", p_a + p_b - p_ab, "=", float(p_a + p_b - p_ab))
print("P(A) x P(B) if they were independent:", p_a * p_b, "=", float(p_a * p_b))
print("independent?", p_a * p_b == p_ab)
print("P(A | B) = P(A and B) / P(B):", p_ab / p_b, "=", round(float(p_ab / p_b), 4))P(A or B) = P(A) + P(B) - P(A and B): 7/10 = 0.7
P(A) x P(B) if they were independent: 3/20 = 0.15
independent? False
P(A | B) = P(A and B) / P(B): 1/3 = 0.3333Method: P(A or B) = 1/2 + 3/10 - 1/10 = 5/10 + 3/10 - 1/10 = 7/10 = 0.7. The same numbers also settle independence. If A and B were independent, the overlap would have to be P(A) x P(B) = 1/2 x 3/10 = 3/20 = 0.15. The observed overlap is 1/10 = 0.1, which is smaller, so the events are not independent — knowing that B happened makes A less likely than it is overall. Conditional probability confirms it: P(A | B) = P(A and B) / P(B) = (1/10) / (3/10) = 1/3, about 0.3333, against an unconditional P(A) of 0.5.
Watch outP(A | B) and P(B | A) are different numbers in general. Here P(B | A) = (1/10) / (1/2) = 1/5 = 0.2 while P(A | B) = 1/3. Reversing a conditional probability without recomputing is one of the classic errors of medical and legal reasoning alike.
Worked example 3: independence and dependence on a table
A contingency table is the other way to meet these rules, and it makes the double-counting visible. Suppose 100 patients are classified by treatment and outcome.
| Recovered | Not recovered | Row total | |
|---|---|---|---|
| Treatment A | 30 | 10 | 40 |
| Treatment B | 20 | 40 | 60 |
| Column total | 50 | 50 | 100 |
Method: from the table, P(treatment A) = 40/100 = 0.4 and P(recovered) = 50/100 = 0.5. Adding them gives 0.9, but 30 patients lie in both categories, so the true P(A or recovered) = 0.4 + 0.5 - 0.3 = 0.6 — that is 30 + 10 + 20 = 60 of the 100 patients. Independence fails here: P(A and recovered) = 0.3 while P(A) x P(recovered) = 0.4 x 0.5 = 0.2, so recovery is more likely under treatment A. The conditional probabilities say the same thing in the form a clinician would use: P(recovered | A) = 30/40 = 0.75 against P(recovered | B) = 20/60 = 0.33.
Common mistakes
Watch outAdding probabilities when the events overlap. Add only when the events are mutually exclusive; otherwise subtract the overlap first. Two events with P = 0.5 each can have a union anywhere from 0.5 to 1, so '0.5 + 0.5 = 1' is an assumption, not a calculation.
Watch outMultiplying probabilities for dependent events. Independence must be justified by the situation — separate coin flips, separate dice — or checked with the multiplication rule; two events drawn from the same patient's record are rarely independent.
Watch outReading P(A | B) as P(B | A). The conditioning event is the denominator, and reversing the two produces nonsense such as 'a positive test means a 99% chance of disease' when the disease is rare.
Watch outTreating probabilities as guarantees about single trials. P(A) = 0.7 describes long-run frequency; one roll of the die that gives no six does not make the 1/6 wrong.
Check your understanding
P(A) = 0.6, P(B) = 0.5 and P(A and B) = 0.35. What is P(A or B), and are A and B independent?
A fair coin is flipped three times. What is the probability of at least one head, and which rule is easiest?
In the treatment table above, what is P(treatment B | recovered), and how does it compare with P(recovered | B)?
Multiple choice
P(A) = 0.4 and P(B) = 0.3, and A and B are mutually exclusive. What is P(A or B)?
P(A) = 0.5, P(B) = 0.3 and P(A and B) = 0.1. What is P(A or B)?
For two events A and B, which statement is equivalent to 'A and B are independent'?
A doctor knows P(disease) = 0.01 and P(positive test | disease) = 0.99. Which statement about P(disease | positive test) is correct?
A fair die is rolled five times. What is the probability of at least one six?
Summary and next
Three rules carry most of the weight. The complement rule, P(not A) = 1 - P(A), is the tool for 'at least one' questions. The general addition rule, P(A or B) = P(A) + P(B) - P(A and B), corrects the double-count when events overlap, and collapses to a plain sum only when the events are disjoint. Conditional probability, P(A | B) = P(A and B) / P(B), rearranges the multiplication rule, and independence is the special case where P(A and B) = P(A) x P(B).
Next: random variables and expectation. So far each event has been analysed on its own. A random variable collects all the outcomes of a process into a single number with a probability attached to each value, which lets you compute one summary — the expected value — that says what the process pays in the long run.