The Multiplication Rule
Probability Theory
When Do A and B Both Happen? Chain Your Probabilities
The multiplication rule calculates the probability of A and B both occurring. It chains conditional probabilities to find joint likelihoods.
- General rule — P(A and B) equals P(A) times P(B given A)
- Independent events — When A does not affect B, the formula simplifies to P(A) times P(B)
- Sequential events — Drawing cards without replacement is the classic application
- Tree diagrams — Visualize conditional paths through multi-stage experiments
What You'll Learn
- 1Derive the general multiplication rule from the definition of conditional probability
- 2Compute joint probabilities for dependent sequences such as draws without replacement
- 3Decide when the simplified product form P(A) times P(B) is legitimate and when it silently fails
- 4Extend the rule to long chains, including the birthday problem and language model likelihoods
Every joint probability question — two aces in a row, a passing grade on both exams, a packet surviving three routers — is a question about a sequence of conditions. The multiplication rule is the bookkeeping device: multiply the chance of the first stage by the chance of each later stage given everything before it. Get the conditioning right and long chains collapse into a single product; skip it and you will overcount or undercount in ways simulations eventually expose.
The General Rule, Derived in One Line
Conditional probability is defined as for . Multiply both sides by and the joint probability falls out immediately:
No independence assumption appears anywhere in that line — it is always valid. What changes across problems is which form of you can compute. In a card deck without replacement, drawing an ace first shrinks both the deck and the ace count, so the second factor differs from the marginal. In a coin flip followed by a die roll, the second factor equals because nothing physical connects the devices. Reading a problem correctly means identifying which situation you are in before touching a calculator.
| Scenario | Conditioning needed? | Joint probability form |
|---|---|---|
| Cards drawn without replacement | Yes | with reduced counts |
| Cards drawn with replacement | No | |
| Coin flip then die roll | No | |
| Two exams from the same student | Usually yes | Scores share an underlying ability |
| Independent manufactured parts | No, if truly independent | Product of defect rates |
Two Aces in a Row: Sampling Without Replacement
What is the probability that the first two cards from a well-shuffled deck are both aces? There are four aces among 52 cards, so the first draw succeeds with probability . After that ace is removed, three aces remain among 51 cards, giving for the second. Multiply:
The same pattern generalizes: the probability of drawing specified cards in attempts without replacement is a falling factorial ratio, which is exactly how hypergeometric probabilities are built. Swap "without replacement" for "with replacement" and the second factor returns to , inflating the joint probability to — a 32 percent overstatement that models a physically different game.
import numpy as np
deck = [f"{rank} of {suit}"
for suit in ['Hearts', 'Diamonds', 'Clubs', 'Spades']
for rank in ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']]
aces = [c for c in deck if c.startswith('A')]
p_first_ace = len(aces) / len(deck)
remaining = [c for c in deck if c not in aces]
kings_remaining = [c for c in remaining if c.startswith('K')]
p_king_given_ace = len(kings_remaining) / len(remaining)
p_both = p_first_ace * p_king_given_ace
print(f"P(First is Ace) = {p_first_ace:.4f} = 4/52")
print(f"P(King | First was Ace)= {p_king_given_ace:.4f} = 4/51")
print(f"P(Ace then King) = {p_both:.6f} = 16/2652 = 4/663")
Independence: When Conditioning Disappears
Two events are independent when knowing occurred leaves untouched, that is, . Substituting into the general rule gives the familiar shortcut:
The shortcut is dangerous precisely because it is short. Independence is a property of the data-generating process, not a feeling you get from similar wording. "Rain today" and "rain tomorrow" are plainly dependent; "my bus is late" and "my manager is late" may look independent until you recall they share a traffic system. The only safe route is to argue from the mechanism — or to test the equality on observed frequencies, as the simulation below does for a coin and a die.
np.random.seed(42)
n_sim = 100_000
coins = np.random.choice(['H', 'T'], n_sim)
dice = np.random.randint(1, 7, n_sim)
p_heads = np.mean(coins == 'H')
p_six = np.mean(dice == 6)
p_both = np.mean((coins == 'H') & (dice == 6))
print(f"P(Heads) = {p_heads:.4f}")
print(f"P(6) = {p_six:.4f}")
print(f"P(Heads and 6) = {p_both:.4f}")
print(f"Product = {p_heads * p_six:.4f}")
print(f"Independent? {np.isclose(p_both, p_heads * p_six, atol=0.004)}")
The Birthday Problem: Chain of Conditionals
Twenty-three people in a room: is a shared birthday more likely than not? Answer it with the multiplication rule applied to the complement. Line the people up and ask for the probability that every birthday differs. The first person certainly has a free birthday. The second avoids the first person's day with probability , the third avoids two prior days with probability , and so on. After 23 people the chain has 22 factors:
So , slightly better than a coin flip. The intuition fails because people anchor on 365 days and 23 people rather than on the pairs that could match. Each pair only needs to collide, and 253 modest chances compound quickly. The same chain-of-conditionals machinery sizes risk in quality control, reliability engineering, and any "at least one failure in a batch" audit.
def all_birthdays_distinct(n_people):
p = 1.0
for i in range(n_people):
p *= (365 - i) / 365
return p
for n in [10, 23, 30, 50, 70]:
p_distinct = all_birthdays_distinct(n)
print(f"{n:3d} people: P(shared birthday) = {1 - p_distinct:.4f}")
np.random.seed(7)
trials = 100_000
bdays = np.random.randint(0, 365, size=(trials, 23))
simulated = np.mean([len(set(row)) < 23 for row in bdays])
print(f"\nSimulated P(shared birthday), 23 people: {simulated:.4f}")
print(f"Closed form: {1 - all_birthdays_distinct(23):.4f}")
The Chain Rule for Three or More Events
Nothing in the rule stops at two events. Applying it repeatedly produces the probability of an entire sequence:
This is the exact identity behind autoregressive language models. The probability of the sentence "the cat sat" factorizes as , and a transformer simply estimates each conditional from context. Naive Bayes classifier makes the opposite trade: it assumes the later factors collapse to their marginals given the class, which multiplies many small probabilities into a usable score at the cost of a known approximation. Recognizing which factorization a system uses tells you immediately where its assumptions live.
# Chain rule in language modeling
tokens = {'P(the)': 0.05, 'P(cat|the)': 0.40, 'P(sat|the cat)': 0.30}
chain = 1.0
for k, v in tokens.items():
print(f"{k} = {v}")
chain *= v
print(f"\nP('the cat sat') = 0.05 x 0.40 x 0.30 = {chain:.6f}")
print("Every autoregressive LM is this product, computed at token scale.")
When the Multiplication Rule Goes Wrong
Three mistakes account for most joint-probability errors. Treating dependent draws as independent inflates rare-event probabilities, as in the with-replacement card example. Multiplying empirical percentages that were estimated from overlapping samples double-uses the same data — survey answers from one respondent are not independent trials. And chaining conditionals with the wrong order is harmless for the final number (), but writing when you meant silently flips the sign of the effect. Write the tree, label each branch with the information available at that node, and only then translate branches into numbers.
Common Mistakes
Assuming independence because the events sound unrelated
Fix: Argue from the generating mechanism or test P(A and B) against P(A) times P(B) on data before using the shortcut.
Using P(B) instead of P(B given A) when sampling without replacement
Fix: Update both the numerator and denominator counts after every draw; the conditional factor changes each stage.
Chaining more than two events while keeping marginal probabilities throughout
Fix: Each factor must be conditioned on the full intersection of all earlier events, per the chain rule.
Best Practices
- Draw a tree for any multi-stage problem before computing; label every branch with its conditioning information
- State whether draws are with or replacement explicitly in quality and reliability calculations
- Verify independence claims with a contingency table or frequency comparison when data are available
- Use the complement identity P(at least one) = 1 − P(none) whenever the direct union is messy
Key Takeaways
- The general rule P(A and B) = P(A) times P(B given A) needs no independence assumption and always holds
- Independence collapses the conditional factor, giving the familiar product P(A) times P(B)
- Long sequences use the chain rule: multiply each stage conditioned on every earlier event
- The birthday problem shows how 253 pair-wise chances at 1/365 each compound past 50 percent by 23 people
Frequently Asked Questions
Does the order of events matter in the multiplication rule?
The joint probability is the same either way — — but the factorization differs: versus . Pick the order whose conditional you can actually compute; card problems usually favor drawing the restricted suit first.
How is the multiplication rule different from the addition rule?
Multiplication targets "A and B" (intersection), addition targets "A or B" (union). The addition rule subtracts the overlap you would otherwise double-count; the multiplication rule chains conditional stages. Bayes' theorem glues the two together by rewriting a conditional with both an intersection and a marginal.
Why does the birthday problem surprise people?
Because humans count days and people, not pairs. With 23 people there are 253 possible matching pairs, each with a tiny 1/365 chance, and the multiplication rule compounds those tiny chances across the whole chain of distinct birthdays until the complement drops below one half.
Interview Questions
Q1: State the general multiplication rule and when the simplified version applies.
P(A and B) = P(A) times P(B given A) always. When A and B are independent, P(B given A) equals P(B), so it simplifies to P(A) times P(B). Independence must be justified from the mechanism or tested from data, never assumed from wording.
Q2: Two cards are drawn without replacement. Write the joint probability of ace then king.
P(ace then king) = (4/52) times (4/51) = 16/2652, about 0.00604. The second factor uses 4 kings over the 51 cards remaining after the first draw.
Q3: How do language models use the multiplication rule?
They apply the chain rule: the probability of a token sequence is the product of each token conditioned on all previous tokens. Training maximizes the log of that product, which turns the chain into a sum of per-token log losses.