Definition
The generating function for the sequence of real numbers is the infinite series
If the sequence is finite, such as , then we could let . Here the generating function becomes a finite series.
Power Series
If and . Then
and
See also: Power Series
Extended Binomial Theorem
Extended Binomial Coefficient
Let be a real number and a non-negative integer. Then the extended binomial coefficient is defined by
When the top parameter is a negative integer, the extended binomial coefficient can be expressed in terms of an ordinary binomial coefficient:
The Extended Binomial Theorem
Let be a real number with and let be a real number. Then
Using this, we can find the generating function of , which is
Useful Generating Functions
if ; 0 otherwise | |
1 if ; 0 otherwise | |
1 | |
1 if ; 0 otherwise | |
Counting Problems and Generating Functions
Number of Solutions for Linear Equation
Find the number of solutions of
where and are non-negative integers with and .
The number of solutions with the indicated constraints is the coefficient of in the expansion of
This follows because we obtain a term equal to in the product by picking a term in the first sum , a term in the second sum , and a term in the third sum . It is not hard to see that the coefficient of in this product is .
Ways to Insert Tokens into a Vending Machine
Determine the number of ways to insert tokens worth $1, $2 and $5 into a vending machine to pay for an item that costs dollars in both cases
- when the order in which the tokens are inserted does not matter
- when the order does matter
First we consider the case when the order in which the tokens are inserted does not matter. The answer is the coefficient of in the generating function
When the order does matter, the number of ways to insert exactly tokens to procure a total of dollars is the coefficient of in
So the total number is the coefficient of in
Using Generating Functions to Solve Recurrence Relations
Solve the recurrence relation for and initial condition . Let be the generating function for the sequence , that is, . First note that
Using the recurrence relations, we see that
because and . Thus
Using the identity , therefore As another example, to solve the recurrence relation
We still have
Therefore
This leads to
Proving Identities via Generating Function
To show
First we note that by the binomial theorem is the coefficient of in
The coefficient of in this expression is
This equals , because .
Exponential Generating Function
For sequence , its exponential generating function (e.g.f.) is defined as
E.g.f.s are particularly useful for sequences where the order of elements is significant, such as permutations or labeled structures, and allow for operations like addition and multiplication similar to ordinary generating functions
To find an exponential generating function for the number of permutations with repetition of length of the set , in which there are an odd number of s, an even number of s, and any number of s, we consider the following function
We already know if we have 3 s, 4 s, and 2 s, there are such permutations. Let us consider the coefficient of of the product above. One way to get an term is
That is, this one term counts the number of permutations in which there are 3 s, 4 s, and 2 s. The ultimate coefficient of will be the sum of many such terms, counting the contributions of all possible choices of an odd number of s, and even number of s, and any number of s.
Notice that
And similarly
Thus, the generating function we seek is