The sum rule needs disjointness
|A ∪ B| = |A| + |B| only when nothing is in both. Overlap means double-counting, and “The Inclusion-Exclusion Principle” is the general repair.
Two rules underlie all of counting. The sum rule handles disjoint alternatives; the product rule handles independent successive choices. Almost every error in this course is applying one where the other belongs.
Core ideas
The arithmetic is trivial. Deciding which rule applies is the entire content of the lesson.
|A ∪ B| = |A| + |B| only when nothing is in both. Overlap means double-counting, and “The Inclusion-Exclusion Principle” is the general repair.
The number of second choices must not depend on which first choice was made. The number itself may vary if it varies uniformly — but then say so.
Split into disjoint cases (sum), count each by stages (product), and add. That template solves most of this course.
The material
Statements, the conditions they need, and how they combine.
If a task can be done in one of n₁ ways or in one of n₂ ways, and the two sets of ways are disjoint, then there are n₁ + n₂ ways to do it. For k pairwise disjoint sets, |A₁ ∪ ⋯ ∪ A_k| = |A₁| + ⋯ + |A_k|.
If a task consists of two successive choices, with n₁ ways to make the first and, for each of those, n₂ ways to make the second, then there are n₁n₂ ways in total. For k stages the count is the product of the stage counts.
The product rule is where |A × B| = |A| · |B| came from in Sets, Relations, and Functions, and where truth tables get their 2ⁿ rows: n successive independent binary choices.
How many strings of length 3 over {a,…,z} start with a vowel or end with z? Vowel first: 5 · 26 · 26 = 3380. Ending z: 26 · 26 · 1 = 676. These overlap — strings starting with a vowel AND ending in z, of which there are 5 · 26 · 1 = 130. So the answer is 3380 + 676 − 130 = 3926, not 4056.
That subtraction is “The Inclusion-Exclusion Principle” arriving early. The sum rule as stated does not apply, because the two sets are not disjoint; using it anyway over-counts by exactly the size of the overlap.
The product rule is often stated as needing "independent" choices, which is imprecise. What it needs is that the number of second choices is the same whichever first choice was made. Choosing an ordered pair of distinct letters has 26 first choices and 25 second ones — the second count is 25 regardless of the first — so the product rule applies and gives 650.
When the count genuinely varies, split into cases and use the sum rule on the cases. That is the standard repair and it is what makes the two rules a complete toolkit rather than two heuristics.
|A| = |U| − |Ā|. When the objects satisfying a condition are hard to count and those failing it are easy, count the failures.
How many 4-digit PINs contain at least one 7? Directly this needs cases for one, two, three or four sevens. By complement: all PINs number 10⁴ = 10000, and those with no 7 number 9⁴ = 6561, so the answer is 3439. "At least one" is almost always a signal to count the complement.
Interactive
Enumerated while enumeration is possible
Method
Ask two questions before writing any arithmetic.
"Either… or…" suggests the sum rule; "first… then…" suggests the product rule. Most problems have both, nested.
If an object could be counted in two cases, the sum rule over-counts. Fix the cases or use “The Inclusion-Exclusion Principle”.
It must be the same number for every first choice. If not, split into cases where it is constant.
"At least one", "not all" and "at least two" usually count more easily as total minus failures.
Length 6 to 8, from 26 letters and 10 digits, containing at least one digit.
Two rules, each used once. The sum rule handled the three lengths, which are disjoint because a password has exactly one length; complementary counting handled "at least one digit" within each length. Counting the digit-containing passwords directly would need eight overlapping cases.
Count the 4-digit PINs with at least two identical digits. Do it by complement, and say in one sentence why the direct count would be harder. That sentence is the skill.
Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.
No recommendations yet for this lesson.