Generating Functions - Examples and Constructions
Generating functions excel at solving counting problems involving combinations with restrictions. These examples demonstrate systematic approaches to constructing and manipulating generating functions for complex enumeration scenarios.
A partition of a positive integer is a way of writing as a sum of positive integers, where order doesn't matter. For example, partitions of 4 are: .
The generating function for partitions is:
The coefficient of in is , the number of partitions of .
Explanation: The factor represents using 0, 1, 2, ... parts of size . The product over all gives all partitions.
How many ways can we distribute identical balls into 3 distinct boxes, where the first box gets an even number, the second gets at most 4, and the third gets at least 2?
Generating function for each box:
- Box 1 (even):
- Box 2 (at most 4):
- Box 3 (at least 2):
Combined generating function:
The coefficient of gives the answer for balls.
Solve with and using generating functions.
Let . Multiply the recurrence by and sum:
Therefore: .
The exponential generating function for derangements is:
This follows from the formula :
Using series manipulation and the fact that and :
Generating functions are particularly powerful for partition problems. Besides ordinary partitions, we can count partitions with distinct parts (using ), partitions into odd parts, partitions with bounded part size, and many other variants. Euler's partition theorem states that the number of partitions into odd parts equals the number of partitions into distinct parts, proven elegantly by showing their generating functions are equal: . The pentagonal number theorem and Rogers-Ramanujan identities represent deep results in this area, connecting partition theory to number theory and modular forms.
These examples illustrate how generating functions transform counting problems into algebraic manipulations, often revealing surprising patterns and connections.