Borui Academy

Chapter 8

Counting & Casework — Systematic Enumeration

List · complement · pigeonhole · disjoint cases

Pigeonhole principle: 13 robots, only 12 distinct slots — one slot must repeat

By the end of this chapter you will:

  1. Enumerate combinations in a fixed order so you never miss or double-count
  2. Recognize when complement counting ("count what you don't want") beats direct
  3. Apply the pigeonhole principle to robot / color / day problems
  4. Split a problem into disjoint cases and recombine — without overcounting

8.0 Why this chapter dominates Part C

BC baseline: G6 introduces "listing all outcomes" for probability — but only for small finite spaces (4 coin flips, etc). There is no formal combinatorics, no pigeonhole, no complement principle, no casework discipline. This entire chapter is new material for a BC student.

Of the five Part-C problems on a typical Gauss 7 paper, three or four reduce to counting. 2024's Part C is a textbook example:

Q Problem Counting technique
21 5 squares filled with integers 1–6, two sum constraints Casework on the centre square
22 20×2420 \times 24 grid toothpicks — % inner Direct counting via formula
23 Painted cube, 50 unpainted, find VV Casework on dimensions
24 How many "Tiny" three-digit integers Casework on digit ordering
25 Prime system with constraints Bounded enumeration

🔑 The hard part is rarely "how do I count?" It's "how do I count without missing any or counting some twice?" That's what discipline-based casework solves.


8.1 List-everything counting — be systematic

Rule of thumb: order your enumeration by some clear rule — smallest first, lexicographic, by sum, etc. Then you can see whether you've covered everything.

Example — three-digit numbers using digits 1, 2, 3 (no repetition)

List by leading digit:

  • Leading 11: 123,132123, 132
  • Leading 22: 213,231213, 231
  • Leading 33: 312,321312, 321

6 numbers. The pattern: for nn distinct digits in nn positions, the count is n!n!. Here 3!=63! = 6.

When order matters vs doesn't

"How many arrangements" "How many selections"
Order matters n(n1)n \cdot (n-1) \cdots
Order doesn't List subsets
Example: pick 2 of 4 43=124 \cdot 3 = 12 (ordered) 122=6\frac{12}{2} = 6 (unordered)

Gauss usually phrases it: "in how many ways can …" → if the roles differ (first place, second place; treasurer, secretary), order matters. If you're just choosing a group (a team of 3 from 10), it doesn't.


8.2 Complement counting — "1 minus easy"

If the thing you want is hard to count, count its complement (what you don't want) and subtract from the total.

Example — Part B / lower Part C

How many 3-digit numbers have at least one digit equal to 77?

Direct attempt: case "the 77 is in the hundreds place", "the 77 is in the tens place", "the 77 is in the ones place" — but you'd overcount 773773 etc.

Complement: count 3-digit numbers with no 77.

  • Hundreds digit: 1199 excluding 7788 choices
  • Tens digit: 0099 excluding 7799 choices
  • Ones digit: 0099 excluding 7799 choices

Total 3-digit numbers with no 77: 899=6488 \cdot 9 \cdot 9 = 648.

Total 3-digit numbers: 900900.

With at least one 77: 900648=252900 - 648 = \mathbf{252}.

🔑 "At least one" is the canonical signal for complement counting. The complement of "at least one" is "none", which is much cleaner.


8.3 Pigeonhole principle — guaranteed collisions

Statement: If you put n+1n+1 items into nn boxes, some box has at least 2 items.

More generally, if you put kn+1kn + 1 items into nn boxes, some box has at least k+1k + 1 items.

2024 Q18 — worked in full

The Gaussbot factory assembles robots. Each robot comes in one of three colours: red, blue, or green. Each robot also has a number stamped on its head: 11, 22, 33, or 44. The nnth robot assembled is the first robot to have the same colour and the same number as a previously assembled robot. What is the greatest possible value of nn?

Reframe: a robot is a (colour, number) pair. There are 3×4=123 \times 4 = 12 distinct pairs.

If you want the nnth robot to be the first repeat, then robots 1,2,,n11, 2, \ldots, n-1 must all be different. That's at most 1212 different pairs. So n112n - 1 \le 12, i.e. n13n \le 13.

The greatest nn is therefore n=13n = \mathbf{13}. Answer (C). ✅

🔑 Pigeonhole flavor: when a problem asks "the first time something is forced to happen" or "how many do I need to guarantee …", count distinct slots and add 1.

Other pigeonhole flavors

  • "In any group of 2525 people, at least two share a birth month."2525 items, 1212 months → some month has 2\ge 2.
  • "A drawer has 1010 red, 1010 blue, 1010 green socks. How many do you need to grab to guarantee a pair?"33 colors → 44 socks guarantee.

8.4 Casework discipline — disjoint and complete

The two failure modes of casework:

  1. Overcounting — the cases overlap, so something gets counted twice
  2. Undercounting — the cases don't cover everything

Antidote: define the cases by a single splitting variable, and check the cases are disjoint and their union is everything.

2024 Q24 — Tiny three-digit integers

A three-digit integer is called Tiny if no rearrangement of its digits gives a three-digit integer that is smaller. For example, 138,207,566138, 207, 566 are Tiny but 452,360,727452, 360, 727 are not. How many three-digit integers are Tiny?

Reframe: abc\overline{abc} is Tiny iff abc\overline{abc} is the smallest 3-digit integer among the rearrangements of its digits {a,b,c}\{a, b, c\}.

A 3-digit integer must have a non-zero leading digit. The smallest rearrangement of digits {a,b,c}\{a, b, c\} (with the constraint that the leading digit ≠ 0) is what we want our number to equal.

Split into cases by how many of a,b,ca, b, c are 00:

Case 1 — No zeros (a,b,c{1,,9}a, b, c \in \{1, \ldots, 9\}). The smallest rearrangement is the digits in non-decreasing order. So Tiny abc\overline{abc} has abca \le b \le c, all in 1199.

Count: the number of non-decreasing triples from {1,,9}\{1, \ldots, 9\}. This is the "stars and bars" count: (9+313)=(113)=165\binom{9 + 3 - 1}{3} = \binom{11}{3} = 165. (Or: enumerate by aa — for each aa, count pairs (b,c)(b,c) with abc9a \le b \le c \le 9.)

Case 2 — Exactly one zero. WLOG the digits are {0,b,c}\{0, b, c\} with 1bc91 \le b \le c \le 9. The smallest 3-digit rearrangement is b0c\overline{b0c} (since the leading digit can't be 00, so we put the smallest nonzero first, then the 00, then the rest in order). For our number to BE this smallest, we need abc=b0c\overline{abc} = \overline{b0c}, i.e. a=ba = b — contradicting that one digit was 00. Wait — the digits are unordered {0,b,c}\{0, b, c\} but a,b,ca, b, c in the puzzle name the positions. Re-read: our number is a1a2a3\overline{a_1 a_2 a_3}, its digits are some multiset {d1,d2,d3}\{d_1, d_2, d_3\}, and we ask whether a1a2a3\overline{a_1 a_2 a_3} equals the smallest 3-digit rearrangement.

Reframing: pick the digit multiset, find the smallest 3-digit arrangement, and that arrangement is the unique Tiny number for this multiset. So we just count multisets (with non-zero leading possible).

Count of multisets of size 3 from {0,1,,9}\{0, 1, \ldots, 9\} with at least one non-zero:

Total multisets of 3 digits from 0–9: (10+313)=(123)=220\binom{10 + 3 - 1}{3} = \binom{12}{3} = 220.

Subtract the one "all zeros" multiset: 2201=219220 - 1 = 219.

Answer (E) 219. ✅

🔑 The win: by reframing "Tiny" as "is the smallest arrangement of its digit multiset", every digit multiset gives exactly one Tiny number. So count multisets, not numbers.

⚠️ Trap (the wrong answer (A) 255): students who count ordered (a,b,c)(a, b, c) with abca \le b \le c AND allow a=0a = 0 get a different count. Always check: is the leading digit allowed to be 00?


8.5 Tree counting (multi-stage)

When choices are sequential and constrained by earlier choices, draw a tree (or imagine one) and multiply along a branch, add across branches.

Example — 4-letter words from {A, B, C} with no two adjacent letters equal

  • Position 1: 33 choices
  • Position 2: 22 choices (any letter except position 1's)
  • Position 3: 22 choices
  • Position 4: 22 choices

Total: 3222=243 \cdot 2 \cdot 2 \cdot 2 = 24.

Tree shape: branches branch out from each position, and we multiply.


8.6 Trap Alerts ⚠️

  1. Leading zero — a "3-digit integer" cannot start with 00. Always check whether your enumeration accidentally includes "023023" etc.
  2. "Different" / "distinct" — when the problem says different digits or different integers, no repetition is allowed. Easy to miss.
  3. Pigeonhole gives "at least 2", NOT "exactly 2". If you only need 22 to collide, pigeonhole works; if you need 33, use kn+1kn + 1 form.
  4. Casework overlap — cases like "contains a 7" and "contains an even digit" overlap on numbers like 76. Use disjoint splits like "contains exactly one 7", "contains exactly two 7s", "contains three 7s".
  5. The complement of "at least one" is "none", not "exactly one".

8.7 Mnemonic

"Enumerate in order, complement when stuck, pigeonhole for guarantees, split into disjoint cases."

  • In order: lexicographic, or by leading digit, or by smallest element
  • Complement: if "at least one X", count "no X" and subtract
  • Pigeonhole: n+1n + 1 items in nn boxes → repeat guaranteed
  • Disjoint cases: split by a single attribute, check union = everything

Practice Set (10 problems, mixed difficulty)

  1. (Part A) How many 2-digit numbers contain the digit 55?
  2. (Part A) From the set {1,2,3,4,5,6,7,8}\{1, 2, 3, 4, 5, 6, 7, 8\}, how many ways are there to pick a pair that sums to 99?
  3. (Part B) How many 3-digit numbers have all distinct digits?
  4. (Part B) In a class of 3030 students, at least how many share a birth month?
  5. (Part B) A coin is flipped 4 times. How many outcomes have at least one heads?
  6. (Part B) A 4-digit number has digits summing to 55 (allowing zeros except leading). How many such numbers?
  7. (Part C) How many integers from 11 to 200200 are divisible by neither 33 nor 55?
  8. (Part C) In how many ways can 55 people be arranged in a row if two of them refuse to stand next to each other?
  9. (Part C) A bag has 44 red balls and 66 blue balls. How many ways are there to draw 33 balls so that at least one is red?
  10. (Part C) How many 4-digit "palindromes" (read same forwards and backwards) are divisible by 1111?

Answers: 1) 18 (10×2210 \times 2 - 2); 2) 4 ({1,8},{2,7},{3,6},{4,5}\{1,8\},\{2,7\},\{3,6\},\{4,5\}); 3) 998=6489 \cdot 9 \cdot 8 = 648; 4) 3 (30=212+630 = 2 \cdot 12 + 6, so some month has 3\ge 3); 5) 161=1516 - 1 = 15; 6) (5+313)(4+313)\binom{5+3-1}{3} - \binom{4+3-1}{3} leading-zero correction = (83)\binom{8}{3}\cdot … direct: pairs (d1,d2,d3,d4)(d_1, d_2, d_3, d_4) with d11d_1 \ge 1, sum 5 → 31; 7) 200200/3200/5+200/15=2006640+13=107200 - \lfloor 200/3 \rfloor - \lfloor 200/5 \rfloor + \lfloor 200/15 \rfloor = 200 - 66 - 40 + 13 = 107; 8) 5!24!=12048=725! - 2 \cdot 4! = 120 - 48 = 72; 9) Total (103)=120\binom{10}{3} = 120, no red (63)=20\binom{6}{3} = 20, so 100100; 10) palindrome abba\overline{abba}, divisible by 11 iff ab+ba=0a - b + b - a = 0, always true; count: a1..9a \in 1..9, b0..9b \in 0..99090.


End of chapter. Next: Probability, Mean, Median & Range.