Complementary Counting is the habit of counting everything except the bad cases when direct counting is harder. In contest math, that habit turns a crowded setup into a relation the student can test, bound, count, or compute. MathGrit teaches it as a recognizable signal, a deliberate move, and a final translation back to the original question.
When the cases you want are messy, count everything and subtract the cases you do not want.
Why It Works
1
Let $S$ be all outcomes and $A \subseteq S$ the outcomes you want; its complement $A^c$ is the rest.
2
Every outcome is either in $A$ or in $A^c$ and never both, so $|S| = |A| + |A^c|$.
3
Rearranging gives $|A| = |S| - |A^c|$.
4
This wins whenever 'at least one' or 'not all distinct' is awkward directly but its opposite ('none' or 'all distinct') is easy.
Worked Examples
Example 1
How many $5$-digit strings using digits $0$–$9$ (leading zeros allowed) have at least one repeated digit?
1
Total strings: each of the $5$ positions is any of $10$ digits, so $10^5 = 100000$.
2
The bad case (no repeats) means all $5$ digits are distinct: $10 \cdot 9 \cdot 8 \cdot 7 \cdot 6 = 30240$.
3
Subtract: $100000 - 30240 = 69760$.
Answer:
$69760$
Warm-up
Two fair dice are rolled. What is the probability that the two numbers are different?
1
The total number of ordered outcomes is $6 \cdot 6 = 36$.
2
The complement of 'different' is 'the same' (a double): the outcomes $(1,1), (2,2), \ldots, (6,6)$, which number $6$.
3
So $P(\text{same}) = \dfrac{6}{36} = \dfrac{1}{6}$, and $P(\text{different}) = 1 - \dfrac{1}{6} = \dfrac{5}{6}$.
Answer:
$\dfrac{5}{6}$
Contest level
How many subsets of $\{1, 2, \ldots, 8\}$ contain at least one even number?
1
Total subsets of an $8$-element set: $2^8 = 256$.
2
The complement is 'no even number,' i.e. subsets of the odd elements $\{1, 3, 5, 7\}$.
3
There are $2^4 = 16$ such subsets (including the empty set).
4
Subtract: $256 - 16 = 240$.
Answer:
$240$
Olympiad / Challenge
Five distinct books are placed in a row. In how many arrangements is no book in its original (sorted) position? (A derangement count.)
1
Total arrangements: $5! = 120$. We want those with zero fixed points, so subtract the arrangements with at least one fixed point.
2
By inclusion-exclusion, the count of arrangements fixing at least one position is $\binom{5}{1}4! - \binom{5}{2}3! + \binom{5}{3}2! - \binom{5}{4}1! + \binom{5}{5}0!$.
Subtract from the total: $120 - 76 = 44$. (Equivalently $D_5 = 5!\sum_{k=0}^{5}\frac{(-1)^k}{k!} = 44$.)
Answer:
$44$
Going Deeper
The general principle is $|A| = |S| - |A^c|$; it pays off precisely when the complement has more structure than the event. 'At least one,' 'not all the same,' and 'contains some' are the trigger phrases — their negations ('none,' 'all distinct,' 'avoids') usually collapse to a clean product or smaller universe.
It is the workhorse behind 'at least one' probability problems (the birthday problem, at-least-one-success in repeated trials) and underlies derangements via inclusion-exclusion. Spotting it early often turns a five-case bash into a one-line subtraction.
Pitfall: define the universe $S$ precisely and make sure the complement is taken within that same universe. A common error is computing the complement over a different sample space (e.g. forgetting that 'leading zeros allowed' changes the total from $9 \cdot 10^4$ to $10^5$), so the subtraction mixes incompatible counts.
Spot the Signal
Look for problems where the key step is counting everything except the bad cases when direct counting is harder.
You can describe the hard part as counting everything except the bad cases when direct counting is harder, but a direct attack starts producing clutter.
The problem rewards preserving structure instead of expanding, listing, or guessing too early.
Learn the Move
Start by identify the counting object that calls for complementary counting, then rewrite the givens around it.
Name the relation that makes Complementary Counting legal before doing computation.
Use the new relation to replace the messiest part of the problem with a cleaner one.
Translate the result back to the quantity the problem actually asks for.
Avoid These Traps
Do not use Complementary Counting just because the surface looks familiar; verify the required condition first.
Applying Complementary Counting because it sounds relevant, without checking the trigger first.
Stopping after spotting the technique instead of finishing the calculation or proof.
MathGrit Coach Note
Let complementary counting reveal the counting structure; then compute only what remains.
Try it on:
Practice a contest problem where the key step is counting everything except the bad cases when direct counting is harder.