Advanced Counting
Explore powerful counting techniques including inclusion-exclusion, generating functions, and special sequences like Catalan and Stirling numbers.
- Apply inclusion-exclusion principle
- Count derangements
- Understand generating functions
- Solve linear recurrence relations
- Calculate Catalan numbers
- Use Stirling numbers
1. Inclusion-Exclusion Principle
How many integers from 1 to 1000 are divisible by neither 2, 3, nor 5?
Let A = div by 2, B = div by 3, C = div by 5.
Answer:
2. Derangements
A derangement is a permutation where no element appears in its original position. The number of derangements of n elements is denoted .
3. Generating Functions
The generating function for sequence is:
- (sequence 1, 1, 1, ...)
- (sequence 1, 2, 3, ...)
- (binomial coefficients)
4. Solving Recurrence Relations
For , solve the characteristic equation:
If roots are distinct:
5. Catalan Numbers
First values:
- Ways to correctly match n pairs of parentheses
- Full binary trees with n+1 leaves
- Ways to triangulate a convex (n+2)-gon
- Monotonic lattice paths that don't cross the diagonal
Practice Quiz
Frequently Asked Questions
When do I use inclusion-exclusion?
Use it when counting objects that DON'T have certain properties is easier than counting those that DO.
What are generating functions good for?
They transform counting problems into algebraic manipulation—useful for solving recurrences and proving identities.
How do I recognize a Catalan number problem?
Look for: matching parentheses, binary trees, non-crossing partitions, paths below diagonals.