Overview
Intermediate counting problems demand structure. Learn to avoid overcounting by using systematic cases and complementary counting.
This module adds high-yield techniques: stars and bars with constraints, inclusion-exclusion, derangements, and bijective counting.
Key Ideas
- Stars and bars counts nonnegative solutions to .
- Inclusion-exclusion fixes overlaps: .
- Symmetry reduces cases by grouping equivalent configurations.
- Word rearrangements with repeats use .
- Derangements: .
Core Skills
Translate to Stars and Bars
Turn constraints into and adjust for lower bounds.
Use Inclusion-Exclusion
When constraints overlap, compute total minus overlaps instead of case-by-case.
Build Bijections
Match objects to a known set (binomial coefficients, lattice paths) to avoid overcounting.
Worked Example
How many nonnegative solutions to with ?
Let . Then with nonnegative variables. The answer is .
Word Rearrangements
If a word has letters with repeats , the number of distinct arrangements is . Example: BANANA has arrangements.
Stars and Bars with Constraints
To solve with , pre-allocate the minimum: let , then count nonnegative solutions to .
If you also have upper bounds, use inclusion-exclusion on the violated boxes.
Inclusion-Exclusion (PIE)
For sets :
PIE is essential for derangements and multi-constraint counting.
Derangements
A derangement is a permutation with no fixed points. The count is
The probability of a derangement approaches as grows.
Bijections
If you can map objects in set to objects in set one-to-one and onto, then . Bijections often turn hard counting into binomial coefficients.
Pigeonhole Principle
If objects are placed into boxes, some box has at least objects. Use it to force collisions or equal sums.
Strategy Checklist
- Decide if order matters and if repetition is allowed.
- Use stars and bars for integer solutions.
- Apply inclusion-exclusion for overlapping cases.
- Check for symmetry or bijections to reduce work.
Common Pitfalls
- Overcounting when cases overlap.
- Forgetting to enforce lower or upper bounds.
- Using permutations when combinations are needed.
Example: PIE with Divisibility
How many integers from 1 to 100 are divisible by 2, 3, or 5?
, , , , , , . So the answer is .
Practice Problems
| Status | Source | Problem Name | Difficulty | Tags | ||
|---|---|---|---|---|---|---|
| AMC 12 | Hard | Show TagsCasework, Combinatorics | ||||
| AIME | Hard | Show TagsInclusion-Exclusion | ||||
Module Progress:
Join the AoPS Community!
Stuck on a problem, or don't understand a module? Join the AoPS community and get help from other math contest students.
