Math Core

Module 2.5 · Counting and Probability

Complementary counting

Sometimes the things you want are messy to count, but the things you don't want are easy. Then count everything, count the unwanted cases, and subtract. This is complementary counting, and the words "at least one" are its calling card.

The idea

How many three-digit numbers have at least one repeated digit? Counting directly means cases: exactly two digits equal (in which positions?), or all three equal. Instead, count the opposite.

  • All three-digit numbers: 900900 (from 100100 to 999999).
  • Three-digit numbers with no repeated digit: 9⋅9⋅8=6489 \cdot 9 \cdot 8 = 648.

So 900−648=252900 - 648 = 252 have at least one repeated digit.

Complementary counting

#(what you want)=#(everything)−#(what you don’t want)\#(\text{what you want}) = \#(\text{everything}) - \#(\text{what you don't want})

Use it when the complement is simpler, especially for "at least one," "not," and "at least two" questions.

The opposite of "at least one" is "none." The opposite of "at least two" is "zero or one." The opposite of "not all the same" is "all the same."

Worked example: At least one 7

How many four-digit numbers contain at least one digit 77?

All four-digit numbers: 90009000. Four-digit numbers with no 77: the first digit has 88 choices (not 00, not 77) and each other digit has 99 choices (not 77): 8⋅9⋅9⋅9=58328 \cdot 9 \cdot 9 \cdot 9 = 5832.

So 9000−5832=31689000 - 5832 = 3168 contain at least one 77.

Worked example: At least one girl

A committee of 33 is chosen from 55 boys and 44 girls. How many committees include at least one girl?

All committees: (93)=84\dbinom{9}{3} = 84. Committees with no girls (all boys): (53)=10\dbinom{5}{3} = 10. So 84−10=7484 - 10 = 74 include at least one girl.

Counting directly would take three cases (exactly 11, 22 or 33 girls): (41)(52)+(42)(51)+(43)=40+30+4=74\binom{4}{1}\binom{5}{2} + \binom{4}{2}\binom{5}{1} + \binom{4}{3} = 40 + 30 + 4 = 74. Same answer, more work.

Worked example: Avoiding a point

How many shortest paths go from (0,0)(0, 0) to (4,4)(4, 4), moving right or up one unit at a time, and avoid the point (2,2)(2, 2)?

All paths: (84)=70\dbinom{8}{4} = 70. Paths through (2,2)(2, 2): (42)⋅(42)=6⋅6=36\dbinom{4}{2} \cdot \dbinom{4}{2} = 6 \cdot 6 = 36. Paths that avoid it: 70−36=3470 - 36 = 34.

Common mistake

Make sure the "everything" count and the "unwanted" count use exactly the same rules. If the problem is about four-digit numbers, the complement must also be four-digit numbers (leading digit not 00). Mixing "four-digit numbers" with "four-digit strings" is the classic slip.

Tip

When you can, check a complementary answer by counting directly on a smaller version of the problem. For example, with two-digit numbers: 9090 total, 8⋅9=728 \cdot 9 = 72 with no 77, so 1818 contain a 77. Listing them (17,27,…,9717, 27, \dots, 97 and 70,…,7970, \dots, 79, with 7777 counted once) gives 9+10−1=189 + 10 - 1 = 18.

Practice

Practice 1

How many integers from 11 to 100100 are not multiples of 33?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

How many three-digit numbers have at least one even digit?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

A coin is flipped 55 times, and the sequence of heads and tails is recorded. In how many sequences are there at least two heads?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 4

How many four-digit numbers have at least one repeated digit?

Practice 5

Five students line up in a row. In how many arrangements is Mia not at either end?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 6

How many integers from 11 to 999999 contain at least one digit 33?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 7

A bag holds 66 red, 44 blue and 22 green marbles, all different. In how many ways can you choose 33 marbles that are not all the same color?

Practice 8

Four people sit in a row of 77 chairs. In how many ways can they be seated so that at least two of them sit in neighboring chairs?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Real contest practice

  • 2020 AMC 8, Problem 23: count all ways to hand out awards, then remove those that leave a student empty-handed.
  • 2024 AMC 8, Problem 25: a probability that is easiest through the complement (no two adjacent empty seats).