Section 2: Generating Functions

2.1, 2.2: Power Series Review, Intro to Ordinary Generating Functions

A formal power series is an infinite sum

whose coefficients represent a sequence .

The function is the ordinary generating function of , sometimes denoted the OGF.

These functions are quite interesting! Oftentimes, we can manipulate these functions into something else that we can recognize.

Example: Ordinary Generating Functions of Sequences

Let be given by

What is ?

We can find as

Example: Sequences of Ordinary Generating Functions

Find if the OGF is

Note that our denominator looks like the output of a geometric series, but as a product! So, we apply partial fractions to get separate geometric series.

So, we get

So we find our sequence to be

Given a recurrence, say (the fibonacci recurrence) where we are given a term in terms of the previous ones, we can obtain the closed form OGF, and then use a series expansion to get an explicit closed form formula for our sequence .

Lemma

We have

Moreover, if , , then .

--- End of Exam 1 Content ---

2.3: Ordinary Generating Functions and Counting

What if is a combinatorial value, like ? Well, using our techniques, we can actually find the closed form solution of (at least in some cases)!

We describe various combinatorial objects that can be used to solve counting problems.

Weak Compostions with Contraints

We have

Differentiating this, we get

Generalizing this, we find that at the derivative,

Letting , we find

Now observe that

We can find that the coefficient of any is ! And in fact, our disgusting product can actually just be seen as all possible ways we can choose in group 1, in group 2, … in group where

Which is in fact weak compositions! With this relation, we can actually solve any weak composition problem (with any constraints)!

Each exponent represents one “dollar” we can give, and each series represents one entity we could give dollars to, where the series depends on the constraints we have!

Example: Model for Solving Weak Compositions

Find the ordinary generating function and state the coefficient that would count the total ways to distribute $100 to 4 kids so that kid 1 gets at most 5 dollars, kid 2 gets at least 3 dollars, kid 3 gets an even number of dollars, and kid 4 gets any amount.

We want the coefficient of such that

Each series is given in terms of the ways we can give dollars to each of the kids. For example because kid 2 gets at least 3 dollars, the series is as when we make a “choice” in our product, the exponent (dollars) we wantt to select for kid 2 must be 3 or more.

Its hard to solve this by hand, but we could easily solve this by a computer!

Stirling Numbers

Theorem: OGF for Stirling Numbers

Let be a fixed positive integer. Then the OGF for is

Integer Partitions

Theorem:

The OGF for the total integer partitions of , , is

Example: Integer Partitions

How many ways can you make $1 using any number of pennies, nickels, dimes, quarters, and half dollars?

We can formulate this as the following OGF, where we are looking for the coefficient of .

By computer, we get 292.

Same as in weak compositions, with such a model, we can now manipulate this expression for any constraints! Say, if we wanted to use at least 5 pennies, we could replace the first group with !

Theorem: Distinct Integer Partitions

The total ways to partition integer into parts where every number is distinct equals the total ways to partition integer where each part is an odd number.

Example: Distinct Integer Partitions

. The distinct integer partitions vs. the odd integer partitions are given as

Both have 4 cases!

Integer Partitions into Parts

Theorem: Integer Partitions into Parts

The OGF for , the ways to partition into exactly parts, is given as

2.4: Exponential Generating Functions

The exponential generating function for sequence is

Lemma: Product of OGFs

Let , . Then,

Where .

Lemma: Product of EGFs

Let

Then,

Where

What’s important about this is that gives us the total ways to separate into two blocks, such that we do a task in ways to block 1, and a task in ways to block 2! This can be used to solve more problems.

Theorem: EGFs for Stirling Numbers

The egf for the Stirling Number (for fixed ) is given as

From this theorem, we can find that the egf for the bell number is

But why are egfs useful? Well, let’s consider the product

Then, we can find the contribution to as

Thus, the term is

This actually is permutations with repetition using any number of A’s, B’s, and C’s ()! In fact, this makes a lot of sense, because

Like with OGFs, EGFs give us a much more versatile way to do these types of problems! See the below example.

Example: Closed Form Sequences (1)

How many rearrangements of length use an odd number of A’s, even number of B’s, and any number of C’s?

If denotes the value, find the closed form for .

We’ve found a closed form egf. We can now use this to find our closed form sequence!

Section 2.5: The Catalan Numbers

Given an lattice, how many up-right paths go from to ?

Note that regardless of the path we take, we always do steps. Out of them, choose positions to be “right”, the rest being “up.

Now consider an lattice. How many of the up-right paths never cross over the diagonal?

Let denote the total paths satisfying this. We partition these paths into classes, where they last touched the diagonal , for .

Say we last touched . Then,

  • To get from to , we have ways.
  • To get to to , we must go right once, then take any paths. Finally, we go up once to .

Therefore, we find

We can use generating functions to find an explicit closed form solution for this recurrence!

Here, the closed form ogf is

We must define .

Theorem

If denotes the total up-right paths that don’t cross over the diagonal,

And the ogf for is

Lastly, we can find the closed-form solution for as

Called the catalan number.

Example: Using the Catalan Numbers (1, Stanley Combinatorics)

What are the total ways to order “n” pairs of parentheses.

Let’s consider an opening parenthes as a “RIGHT”, and closing as an “UP”. We can’t, at any point, have too many closing parentheses than opening parentheses. In other words, we cannot cross the diagonal!

This gives us

ways.