Every counting problem comes down to one question: am I doing things in a sequence of steps (multiply), or choosing one of several separate cases (add)?
The product rule
If a procedure is a sequence of tasks and task can be done in ways (no matter how the earlier tasks were done), then the procedure can be done in
- Assign 3 employees to 10 different offices: .
- Chair labels "letter + integer 1–99": .
- Bit strings of length 6: .
- Plates with 4 letters then 5 digits: .
Let and .
- All functions : each of the inputs picks one of outputs, so .
- One-to-one functions: if , and if .
- Subsets of an -set: . Each element is in or out, like a bit string.
- Cartesian product: .
- Relations from to (subsets of ): .
The sum rule
If a task can be done in one of ways or one of ways, and none of the ways is the same as any of the ways, then there are ways.
Use it to split into cases (by length, by first letter, …), count each case, then add.
A name is 1 or 2 alphanumeric characters (case-insensitive), starting with a letter, and 10 two-character names are reserved.
Length 1: . Length 2: . Total: .
6 to 9 characters, each an uppercase letter or digit, with at least one digit.
For length : all strings minus strings with no digits, . Total: .
Counting "at least one" directly usually double counts. The complement is almost always easier.
The subtraction rule (inclusion–exclusion)
If a task can be done in ways or ways, and some ways are shared, subtract the overlap:
"Start with 0 or end with 11": count each, then subtract the strings that do both.
Length-8 bit strings that start with 0 or end with 11:
350 applicants: 210 CS, 150 sociology, 50 both. Neither?
, so neither .
- Multiples of in : .
- Multiples of in : .
- "Divisible by both and " means divisible by . For 4 and 6 that is 12, not 24.
The division rule
If every outcome you want is counted exactly times in your count, divide by : there are ways.
people around a round table, rotations considered the same: .
If reflections also count as the same ("same two neighbors, ignoring left/right"): .
Class Problem 16: 5 people, same right and left neighbor means same seating, so .
400 legs counted, each goat counted 4 times, so goats. That's the division rule.
Tree diagrams
When the choices at each step depend on earlier choices, draw a tree and count the leaves.
Solution
Branch on each bit, pruning any branch that would create "00":
- Start 1: 1010, 1011, 1101, 1110, 1111 (5 strings)
- Start 0 (next must be 1): 0101, 0110, 0111 (3 strings)
Total: 8. (These counts are Fibonacci numbers: the answer for length is .)
5 sizes; four sizes come in 4 colors, L in 3, XL in 2: . A tree, or the sum rule over sizes.
Strategy
- Decide what one outcome looks like (a string? a set? an arrangement?).
- Sequence of choices? Multiply (product rule). Make sure each step's count doesn't depend on which earlier choice was made.
- Separate cases? Add (sum rule). Make sure cases don't overlap.
- "At least one"? Total minus none.
- "Or" with overlap? Inclusion–exclusion.
- Each outcome counted times? Divide.
- Sanity check with a tiny case you can list by hand.
- Leading zeros: "positive integers between 100 and 999" have a first digit of 1–9.
- "Between 50 and 100": check whether the endpoints matter.
- Counting -digit numbers with distinct digits: , not (first digit nonzero, second can be 0).
- Adding overlapping cases without subtracting the overlap.
- Problem 7 (): the bit should be if , the subset, not .
- Problem 13: . Your notes wrote "" at the end.
- Problem 14: the line "" should read ; the final answer 40 is right.
- Sum rule note: if are disjoint then , so .
Exam checklist
- Product rule with restrictions (no repeats, first digit nonzero, fixed positions).
- Count functions, one-to-one functions, subsets, relations.
- Split into cases and add; use the complement for "at least one."
- Inclusion–exclusion for "or," including divisibility counts with floors.
- Circular arrangements (division rule).
- Small tree-diagram counts.