Generating functions

Comprehensive study notes, diagrams, and exam preparation for Generating functions.

Generating Functions

Definition

A generating function for a sequence is a formal power series of the form

where:

  • is the coefficient of
  • the sequence is encoded inside the coefficients
  • the variable is usually treated as a formal symbol rather than a number in many combinatorial applications

For example, the sequence has generating function

This means the coefficients of the expansion of are all 1.

A generating function is most commonly used as a counting device: the coefficient of tells us how many objects of size exist in the combinatorial problem.


Main Content

1. Ordinary Generating Functions

Definition and meaning

  • An ordinary generating function (OGF) for a sequence is . It is the standard form used in combinatorics when the order of objects matters only through the index , not through extra labeling.

Examples and interpretation

  • The sequence has OGF .
  • The sequence has OGF .
  • The sequence has OGF .

These examples show how familiar sequences can be encoded compactly.

Why it is useful

Ordinary generating functions help in:

  • counting combinations and selections,
  • solving recurrence relations,
  • finding closed forms for sequences,
  • analyzing partitions and compositions.

Example

Suppose we want the number of ways to choose any number of objects from a set where each choice contributes a weight . The generating function for “choose 0 or 1 of an object” is: If we have 3 independent objects, the total generating function becomes: The coefficient of gives the number of ways to choose objects.

2. Operations on Generating Functions

Addition and subtraction

If and , then This means generating functions can combine sequences term by term.

Multiplication and convolution

If then The coefficient of becomes a convolution of the two sequences.

Shift property

Multiplying by shifts the sequence: This is useful for expressing recurrences.

Example

Let . Then has coefficient of equal to . This counts the number of ways to write as a sum of two nonnegative integers: where .
For example, for , the pairs are: giving 4 ways.

3. Applications in Combinatorics and Recurrences

Counting combinatorial objects

Generating functions are used to count:

  • binary strings,
  • partitions of integers,
  • paths in graphs and grids,
  • ways to distribute objects with restrictions.

Solving recurrence relations

Many recurrences become algebraic equations after translating them into generating functions. For example, if then the generating function can be used to derive the Fibonacci sequence formula.

Example: Fibonacci sequence

Let where , and .
Then: Solving gives: This compact expression encodes all Fibonacci numbers.

Counting with restrictions

Suppose we want the number of ways to make using coins of values 1, 2, and 5 with unlimited supply. The generating function is: The coefficient of gives the number of ways to make .


Working / Process

1. Write the sequence or counting problem as a power series

  • Identify what the coefficient of should represent.
  • Choose ordinary generating functions for ordinary counting problems.
  • Example: if there are objects of size , write .

2. Use algebraic manipulation to express the problem

  • Convert restrictions into factors.
  • Use addition for alternative choices and multiplication for independent choices.
  • Translate recurrences into equations involving the generating function.
  • Example: a choice of 0, 1, 2, or more of an item can be written as

3. Extract coefficients and interpret the result

  • Expand the function or simplify it into a known form.
  • Find the coefficient of the required power of .
  • Interpret that coefficient as the answer to the counting problem or recurrence.
  • Example: so the coefficient of is .

Advantages / Applications

  • Generating functions convert difficult counting problems into algebraic problems, making them easier to solve.
  • They provide closed-form expressions for sequences and recurrence relations, including classical sequences like Fibonacci numbers.
  • They are widely used in combinatorics, number theory, probability, computer science, and discrete structures.
  • They help count partitions, compositions, lattice paths, and distributions with constraints.
  • They reveal hidden patterns in sequences and support systematic problem-solving in discrete mathematics.

Summary

  • Generating functions encode sequences as power series.
  • Coefficients of powers of represent counted values.
  • They are especially useful for combinatorial counting and recurrence solving.
  • Important terms to remember: ordinary generating function, coefficient, power series, recurrence relation, convolution, sequence.