lecture_40_generating_functions
lecture_40_generating_functions
Daniel Myers
Transformations
Generating functions are an important tool in combinatorics, probability, and modeling applications. In
general, a generating function is a transformation of some mathematical object, such as a sequence, into
an alternate form. By changing the form, we may be able to learn things about an object that would be
impossible to discover by working with the original form.
The z-Transform
Consider a sequence
f0 , f1 , f2 , f3 , . . .
More technically, we may think of f as function of discrete time that can only take non-zero values at
non-negative time steps.
F (z) = f0 + f1 z + f2 z 2 + f3 z 3 + . . .
X∞
= fk z k
k=0
The transformation “compresses” the sequence into a single function of the argument, z. Technically, it’s
possible to evaluate the function for particular values of z – provided that the infinite sum converges – but
in practice this is rarely necessary. For the most part, we’ll treat z as a placeholder and obtain our results
by algebraically manipulating the transform.
When the term “generating function” is used without further qualification, it refers to the z-transform.
Examples
Let’s start with a sequence with a single non-zero value.
0, 0, 1, 0, 0, . . .
F (z) = 0 · z 0 + 0 · z 1 + 1 · z 2 + 0 · z 3 + . . . = z 2
Having a zero in any position in the sequence eliminates that term from the transform polynomial.
0, 0, a, 0, 0, . . .
1
F (z) = 0 · z 0 + 0 · z 1 + a · z 2 + 0 · z 3 + . . . = az 2
1, 1, 1, 1, 1, . . .
Since we’ll encounter lots of infinite sums, it’s important to say a word about convergence. Technically, the
1
geometric series only converges to 1−z for z < 1. Because we’re only using z as a placeholder, though, we
won’t worry about convergence issues. Instead, we’ll just treat the summation as if it converges, without
ever specifying a valid range of values for z. It turns out all of the manipulations we need to solve problems
with generating functions can be justified using other concepts (i.e. formal power series), so we don’t need
to obsess over convergence issues.
This result will be the key to inverting transforms, which we’ll apply in the next lecture.
Adding Transforms
The transform of the sum of two sequences is the sum of their individual transforms. For example,
Inverting
Given the z-transform of a sequence, we can invert the transform to recover the original generating sequence.
At this point, this may not seem helpful, since we’ve only seen the generating functions of trivial sequences.
Inversion becomes powerful when we don’t know how to calculate the terms of a sequence, but we know how
to get its generating function by some other method. Inverting the generating function then gives a way of
calculating the terms of the unknown sequence.
2
There are multiple ways to invert a generating function, but the simplest method (and only one we’ll use in
this course) is inspection. Just manipulate the generating function into a combination of simpler functions
of known form, then invert the simpler functions individually. The power series is by far the most commonly
used form for this type of inversion. For example,
1 1
F (z) = +
1 − 3z 1 − 2z
This has the form of the summed series from the previous section. Rewriting,
∞
X
F (z) = (3k + 2k )z k
k=0
Therefore, the individual terms of the original sequence can be calculated using fk = 3k + 2k .
The general technique for simplifying rational functions is partial fractions. In these examples, we’ll use
a simplified technique that works when the denominator is a second-degree polynomial. First, factor the
A B
polynomial, which we’ve already done. Next, imagine combining 1−z and 1−2z over a common denominator.
The numerator of that combined fraction must equal the original numerator.
(1 − 2z)A + (1 − z)B = 1
Setting z = 1 and solving, we obtain A = −1. Setting z = 12 , we obtain B = 2. The factored generating
function is
−1 2
F (z) = +
1−z 1 − 2z
Using the power series formula to simplify,
∞
X ∞
X
k
F (z) = (−1)z + 2 2k z k
k=0 k=0