12. Advanced Counting (SLASH) Generating Functions Overview

More Combinatorial Techniques

More Combinatorial Techniques in Advanced Counting

Welcome, students! In this lesson, you will explore more combinatorial techniques—powerful counting tools that help solve problems when simple methods like direct listing or basic multiplication are not enough. Counting is a major part of discrete mathematics because many real-world situations involve selecting, arranging, or organizing objects in careful ways 📚✨. By the end of this lesson, you will be able to explain the main ideas behind advanced counting techniques, apply them to example problems, and see how they connect to the larger topic of Advanced Counting / Generating Functions Overview.

What you will learn

  • How to use counting ideas like the addition rule, multiplication rule, and complement counting in stronger ways
  • How to use casework, bijections, inclusion-exclusion, and pigeonhole reasoning to count efficiently
  • How these techniques support more advanced topics such as generating functions
  • How to recognize which counting method fits a given problem

Building on the Basic Counting Rules

Before jumping into advanced techniques, students, it helps to remember the two most important counting ideas:

  • The addition rule says that if a task can be done in one of several non-overlapping ways, the total number of ways is the sum of the counts.
  • The multiplication rule says that if a task happens in stages, and each stage has a certain number of choices, the total number of outcomes is the product of the choices.

These ideas sound simple, but they become very powerful when combined with careful thinking. For example, suppose a student can choose one of $3$ clubs and one of $4$ sports teams. If every club choice can be paired with every sports choice, then the total number of combinations is $3 \cdot 4 = 12$.

Advanced counting is what happens when the situation is not that straightforward. Maybe some choices are forbidden, some are repeated, or the objects can be grouped in different ways. Then we need stronger tools to avoid mistakes and double counting.

A key skill in discrete mathematics is deciding how to describe the objects you are counting. Often the best solution is not to list every object one by one, but to build a counting argument that matches the structure of the problem.


Casework and Counting by Categories

One of the most useful techniques is casework. Casework means splitting a problem into separate categories that are easier to count individually. Then you add the answers together.

This technique is useful when a problem depends on a condition such as whether an object is even or odd, whether a number is positive or negative, or whether a selection includes a certain item.

Example: Counting integers with a property

How many integers from $1$ to $20$ are divisible by $2$ or $5$?

Instead of checking every number, split into cases:

  • Multiples of $2$: $\{2,4,6,8,10,12,14,16,18,20\}$ gives $10$ numbers.
  • Multiples of $5$: $\{5,10,15,20\}$ gives $4$ numbers.

But some numbers, like $10$ and $20$, are counted twice. That means casework alone is not enough unless the cases do not overlap. This leads directly to a more advanced technique: inclusion-exclusion.

Casework is often the first step in solving a counting problem. If the cases are disjoint, the method is clean and fast. If they overlap, you need extra care.


Inclusion-Exclusion: Fixing Double Counting

The inclusion-exclusion principle is a core advanced counting technique. It helps when objects belong to multiple groups and get counted more than once.

For two sets $A$ and $B$, the number of objects in at least one of the sets is

$$

|A \cup B| = |A| + |B| - |A $\cap$ B|.

$$

This formula subtracts the overlap so that each object is counted exactly once.

Example: Students in activities

Suppose $18$ students are in drama, $12$ are in debate, and $5$ are in both. Then the number in drama or debate is

$$

18 + 12 - 5 = 25.

$$

Without subtracting the $5$ students in both groups, they would be counted twice.

Inclusion-exclusion can also be extended to three or more sets. The idea stays the same: add the single groups, subtract pairwise overlaps, add triple overlaps, and continue alternating signs. This can look complicated, but it is a very reliable way to count when overlap matters.

This principle appears in many areas of discrete mathematics, including probability, graph theory, and generating functions.


Bijections: Counting by Matching Objects One-to-One

A bijection is a one-to-one and onto matching between two sets. In counting, a bijection is powerful because if two sets can be matched perfectly, then they have the same number of objects.

This technique is especially useful when one set is hard to count directly, but another set with the same size is easier to count.

Example: Binary strings and subsets

How many subsets does a set with $n$ elements have?

Instead of listing all subsets, match each subset with a binary string of length $n$:

  • Write $1$ if the element is included.
  • Write $0$ if the element is excluded.

For example, if a set is $\{a,b,c\}$, then the subset $\{a,c\}$ corresponds to the binary string $101$.

Because every subset gives exactly one binary string, and every binary string gives exactly one subset, this is a bijection. Since there are $2^n$ binary strings of length $n$, there are also $2^n$ subsets.

Bijections are important because they often turn a counting problem into a familiar one. They also help prove identities by showing that two expressions count the same set in different ways.


The Pigeonhole Principle: Guaranteed Overlap

The pigeonhole principle says that if more objects are placed into fewer boxes, then at least one box must contain more than one object. In its simplest form, if $n+1$ objects are placed into $n$ boxes, then some box contains at least two objects.

This idea may seem obvious, but it is surprisingly powerful. It proves that certain outcomes must happen, even when we do not know exactly where they happen.

Example: Socks in a drawer

If students has $13$ socks but only $12$ possible color categories, then at least one color category must contain at least two socks. This is a direct pigeonhole argument.

The principle is often used in discrete mathematics to show existence rather than to count exact numbers. Still, it is part of advanced counting because it helps solve problems that are about organizing objects and finding unavoidable patterns.

A common stronger version says that if $N$ objects are placed into $k$ boxes, then some box contains at least $\lceil N/k \rceil$ objects. This can be used in scheduling, graph theory, and number theory.


Counting with Complementary Counting

Sometimes the easiest way to count a set is to count everything and subtract the unwanted cases. This is called complementary counting.

If $U$ is the universal set of all possibilities and $A$ is the set of desired outcomes, then

$$

$|A| = |U| - |A^c|,$

$$

where $A^c$ is the complement of $A$.

Example: Passwords without a repeated character

Suppose a password has $4$ characters chosen from $10$ digits, and repetition is not allowed. One method is to count directly using the multiplication rule:

$$

$10 \cdot 9$ $\cdot 8$ $\cdot 7$.

$$

But if the problem were “How many $4$-digit passwords have at least one repeated digit?”, it may be easier to count all passwords and subtract the passwords with no repeated digits.

The total number of $4$-digit passwords allowing repetition is

$$

$10^4.$

$$

The number with no repeated digits is

$$

$10 \cdot 9$ $\cdot 8$ $\cdot 7$.

$$

So the number with at least one repeated digit is

$$

10^4 - $10 \cdot 9$ $\cdot 8$ $\cdot 7$.

$$

Complementary counting is especially helpful when the “bad” cases are simpler than the “good” cases, which is very common in advanced counting problems.


Where Generating Functions Begin

Advanced counting often leads naturally to generating functions. A generating function is a formal power series whose coefficients encode counting information. In simple terms, it is a clever way to pack a counting sequence into an algebraic expression.

For a sequence $a_0, a_1, a_2, \dots$, the generating function is often written as

$$

A(x) = a_0 + a_1x + a_2x^2 + $\cdots.$

$$

The coefficient of $x^n$ tells us something about the number of ways to make $n$.

Why does this matter for more combinatorial techniques? Because many advanced counting problems involve combining choices from different categories. Generating functions turn those categories into algebraic factors, and then multiplication and expansion can reveal the answer.

For example, if one type of object can be chosen $0$, $1$, or $2$ times, its generating factor might be

$$

$1 + x + x^2.$

$$

If another type can be chosen independently, the combined choices may be represented by multiplying factors. This connects counting rules directly to algebra.

Even if you do not fully use generating functions yet, it is important to see how they grow out of the same logic as casework, products, and complements.


How to Choose the Right Technique

When faced with an advanced counting problem, students, ask yourself a few questions:

  1. Can I split the problem into disjoint cases?
  2. Is there overlap that requires inclusion-exclusion?
  3. Can I count the complement instead?
  4. Is there a one-to-one match to a simpler set?
  5. Is a guaranteed existence argument enough, as in the pigeonhole principle?

These questions help you decide which tool is most natural. In many problems, more than one technique can work, but one will usually be cleaner.

For example, counting arrangements of letters in a word may involve repeated objects, which often suggests casework, complementary counting, or inclusion-exclusion. Counting subsets often suggests bijections. Proving that some pattern must occur often suggests the pigeonhole principle.

The main goal is not just to get an answer, but to understand why the answer is correct.


Conclusion

More combinatorial techniques are the bridge between basic counting rules and more powerful methods in advanced discrete mathematics. Techniques such as casework, inclusion-exclusion, bijections, pigeonhole reasoning, and complementary counting help solve problems that are too complex for direct listing alone. These methods also connect naturally to generating functions, where counting problems are translated into algebraic expressions.

As you continue in discrete mathematics, students, focus on the structure of each problem. Ask what is being counted, whether the cases overlap, and whether a simpler equivalent problem exists. That habit will help you choose the right technique and build strong counting reasoning 📘✅

Study Notes

  • The addition rule adds counts from disjoint cases, while the multiplication rule multiplies choices from successive stages.
  • Casework splits a problem into easier parts, but the cases should be disjoint or carefully corrected.
  • Inclusion-exclusion corrects double counting using formulas such as $|A \cup B| = |A| + |B| - |A \cap B|$.
  • A bijection proves two sets have the same size by matching objects one-to-one.
  • The pigeonhole principle guarantees that if there are more objects than boxes, some box contains multiple objects.
  • Complementary counting uses $|A| = |U| - |A^c|$ to count the desired outcomes by subtracting unwanted ones.
  • These techniques help solve difficult counting problems and prepare you for generating functions.
  • Generating functions encode counting data in coefficients of power series like $A(x) = a_0 + a_1x + a_2x^2 + \cdots$.
  • Good counting work depends on recognizing structure, avoiding double counting, and choosing the most efficient method.

Practice Quiz

5 questions to test your understanding