Addition rule of probability
The addition rule of probability is the formula for P(A or B), the chance that at least one of two events happens: P(A) + P(B) − P(A and B).
Last updated: 07 Oct, 2026 · SciPy 1.18
Probability basics found the chance of one event by counting. Questions with an "or" in them, such as "a queen or a heart", combine two events, and the addition rule handles them. The video calls these questions common in aptitude tests and exams.
Adding mutually exclusive events
Recall that two events are mutually exclusive when they cannot occur on the same trial, so P(A and B) = 0. Then the chance of one or the other is the sum of their chances:
For a coin, heads and tails are mutually exclusive, so P(heads or tails) = 1/2 + 1/2 = 1: the coin is certain to land on one of them.
The video's second example rolls a die and asks for P(1 or 3 or 6). The three faces are mutually exclusive, so the rule extends to all three:
Adding events that overlap
Events that can occur on the same trial are not mutually exclusive. Pick one card at random from a deck of 52: it can be a queen and a heart at the same time, the queen of hearts. The video's question is the probability that the card is a queen or a heart.
- Queens: there are 4, so P(Q) = 4/52.
- Hearts: there are 13, so P(♥) = 13/52.
- Queen and heart: only the queen of hearts, so P(Q and ♥) = 1/52.
Adding 4/52 and 13/52 counts the queen of hearts twice, once as a queen and once as a heart. The general addition rule subtracts the overlap once:
The general rule covers both cases. For mutually exclusive events the overlap P(A and B) is 0 and the subtraction drops out. So there is one rule to remember, with a special case.
Checking the addition rule on a full deck
The code builds all 52 cards, counts the cards that are a queen or a heart directly, and compares the count with the rule.
from fractions import Fraction
from itertools import product
ranks = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]
suits = ["spades", "hearts", "diamonds", "clubs"]
deck = list(product(ranks, suits)) # 52 (rank, suit) cards
def P(event):
return Fraction(sum(1 for card in deck if event(card)), len(deck))
queen = lambda c: c[0] == "Q"
heart = lambda c: c[1] == "hearts"
print("cards:", len(deck))
print("P(Q) =", P(queen), " P(heart) =", P(heart), " P(Q and heart) =", P(lambda c: queen(c) and heart(c)))
print("rule: ", P(queen) + P(heart) - P(lambda c: queen(c) and heart(c)))
print("count: ", P(lambda c: queen(c) or heart(c)), "=", round(float(P(lambda c: queen(c) or heart(c))), 4))
print("without subtracting:", P(queen) + P(heart))
die = range(1, 7)
print("die P(1 or 3 or 6) =", Fraction(sum(1 for x in die if x in (1, 3, 6)), 6))cards: 52 P(Q) = 1/13 P(heart) = 1/4 P(Q and heart) = 1/52 rule: 4/13 count: 4/13 = 0.3077 without subtracting: 17/52 die P(1 or 3 or 6) = 1/2
What the deck count confirms
- P(Q) = 1/13 and P(heart) = 1/4: Fraction reduces 4/52 and 13/52; they are the same numbers as on the board.
- The rule and the direct count agree at 4/13, which is 16/52 and about 0.3077.
- Leaving out the overlap gives 17/52, one card too many: the queen of hearts counted twice.
- The die gives 1/2: the faces 1, 3 and 6 never overlap, so their chances add with nothing to subtract.
Mutually exclusive vs not mutually exclusive
| Mutually exclusive | Not mutually exclusive | |
|---|---|---|
| Can both happen on one trial? | No | Yes |
| P(A and B) | 0 | Greater than 0 |
| P(A or B) | P(A) + P(B) | P(A) + P(B) − P(A and B) |
| Example from the video | 1 or 3 or 6 on one roll: 1/2 | Queen or heart: 16/52 |
Where you use the addition rule
- Counting a target group once: customers who bought product A or product B, without counting those who bought both twice.
- Combining failure modes: the chance a part fails from heat or from vibration, when both can happen together.
- Checking a model's probabilities: a classifier's classes are mutually exclusive and together cover every case, so the probabilities it gives them must add up to 1.
Related
- Previous: Probability basics
- Next: Multiplication rule and independent events
- Find P(king or black card): change the events to
c[0] == "K"andc[1] in ("spades", "clubs"). Is it 4/52 + 26/52 − 2/52 = 7/13? - Find P(face card or heart) with
c[0] in ("J", "Q", "K"). How many cards are in the overlap? - Try two mutually exclusive events, a queen or a king. Is
P(Q and K)0, so that the rule adds the two?
You understood something today that you didn't yesterday.