Full Text 01
Full Text 01
Christoffer Rydén
LiTH-MAT-EX–2023/04–SE
Credits: 16 hp
Level: G2
Supervisor: Milagros Izquierdo,
Department of Mathematics, Linköping University
Examiner: Göran Bergqvist,
Department of Mathematics, Linköping University
Linköping: June 2023
Abstract
In this report we will plunge down in the fascinating world of the generating
functions. Generating functions showcase the "power of power series", giving
more depth to the word "power" in power series. We start off small to get
a good understanding of the generating function and what it does. Also, off
course, explaining why it works and why we can do some of the things we do
with them. We will see alot of examples throughout the text that helps the
reader to grasp the mathematical object that is the generating function.
We will look at several kinds of generating functions, the main focus when
we establish our understanding of these will be the "ordinary power series"
generating function ("ops") that we discuss before moving on to the "exponential
generating function" ("egf"). During our discussion on ops we will see a "first
time in literature" derivation of the generating function for a recurrence relation
regarding "branched coverings". After finishing the discussion regarding egf we
move on the Hermite polynomials and show how we derive their generating
function. Which is a generating function that generates functions. Lastly we
will have a quick look at the "moment generating function".
Keywords:
Ordinary power series generating function, Exponential generating func-
tion, Moment generating function, Hermite polynomials.
Rydén, 2023. v
Nomenclature
G(x) Ordinary power series, or exponential, generating function
MX (s) Moment generating function
[xn ]G(x) The coefficient in front of xn in the power series expansion of G(x)
xn
[xn /n!]G(x) The coefficient in front of n! in the power series expansion of G(x)
D Differentiation operator
xD Differentiate first, then multiply by x operator
(1 + D) Differentiate then add the identity operator
{an }n=0 ∞ A sequence of real numbers
Fn The n:th Fibonacci number
S(n, k) Stirling numbers of the second kind
Cn The n:th Catalan number
Qn Number of branched coverings with dihedral monodromy of degree 2n
Hn (x) Hermite polynomial of degree n
H2n Hermite numbers
X Random variable/probabilistic distribution
E(X) Expectation or mean of random variable X
V (X) Variance of random variable X
X ∼ Ber(p) Random variable X is Bernoulli distributed
r.h.s. Right hand side
l.h.s. Left hand side
1 Introduction 1
2 Generating functions 3
2.1 Generating functions and power series . . . . . . . . . . . . . . . 3
2.2 Recurrence relations . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 The method of generating functions . . . . . . . . . . . . 9
7 Conclusions 45
Rydén, 2023. ix
Chapter 1
Introduction
Generating functions have been around for quite some time. In 1718 Abraham
DeMoivre solved the Fibonacci recurrence relation using the generating function.
Leonhard Euler extended the technique in his study of partitions of integers in
1748. Later the generating functions developed further when they were used
together with probability theory and the moment generating function arose and
were presented by Pierre-Simon de Laplace in 1812. These historical examples
are taken from [6].
Generating functions are sort of an infinitely long measuring tape that, in-
stead of keeping track of units of length, it keeps track of numbers in a sequence.
They bookkeep this information by coding the terms of a sequence as coefficients
in a formal power series, this is a very efficient way to represent a sequence. They
are also useful when solving many types of counting problems[16], for instance,
how many integer solutions are there to the equation
x1 + x2 + · · · + xn = C, for some C ∈ N,
with various constrains on xi [6]. This is often what we first learn when read-
ing literature that introduces generating functions [6] [16]. Apart from solving
counting problems generating functions can be used to solve recurrence rela-
tions, which is something that we focus a lot on in this work.
Some generating functions generates functions instead of a sequence. These
generating functions are often more interesting in a physical point of view since
physicists are often interested in solving differential equations, and such solu-
tions comes in the form of functions.
A different kind of generating function is the "Moment generating function",
they are used in probability and statistics where they offer a good way to rep-
resent probabilistic distributions. As the name implies the moment generating
Rydén, 2023. 1
2 Chapter 1. Introduction
Generating functions
Rydén, 2023. 3
4 Chapter 2. Generating functions
∞
x2 x3 X xn
G(x) = a0 + a1 x + a2 + a3 + ··· = an (2.3)
2! 3! n=0
n!
is called the exponential generating function ("egf") to the given sequence {an }∞
n=0 .
In addition since
∞
x2 x3 X xn
ex = 1 + x + + + ··· = (2.6)
2! 3! n=0
n!
for every real number x we have that ex is the exponential generating function
for the same sequence {1}∞
n=0 , instead denoted by
egf
ex ←→ {1}∞
n=0 . (2.7)
algebraic objects, meaning we do not have to worry about their radius of con-
vergence [16]. An introduction to the theory of formal power series as algebraic
objects can be found in [13].
We started this chapter with a metaphor, describing a generating function
as
P∞ measuring
a tape, in the sense that for a fixed n the xn in the power series
n=0 an x just acts as a way of keeping track of an . Clearly the value of x
n
does not effect the sequence {an }∞n=0 meaning we can consider any x such that
the power series converge and when a series converge we know that the series in
fact represent an analytic function [2], and analytic functions are easy to work
with. So all we need is that the series at least converge somewhere and then
just assume that x is within that radius.
For example, for z ∈ C such that |z| < 1
∞
X 1
zn = (2.8)
n=0
1−z
is analytic for |z| < 1/a. But since we are considering formal power series that
converge somewhere we are free to "forget" about |z| and we can just focus
on the result instead of when these results are legit. In this manner we can,
for instance, take the derivative of a power series. Consider 2.8 and take the
derivative on both sides, we get
∞ ∞
X X 1
nz n−1
= (n + 1)z n = . (2.10)
n=1 n=0
(1 − z)2
This "freedom" gives us many useful identities for our generating functions.
Some of them are listed here [19] [6].
∞
1 X
= xn = 1 + x + x2 + x3 +· · · (2.11)
1 − x n=0
∞
1 X
= (n + 1)xn = 1 + 2x + 3x2 + 4x3 +· · · (2.12)
(1 − x)2 n=0
∞
1 X n+k n 1+k 2+k 2 3+k 3
= x =1+ x+ x + x +· · ·
(1 − x)k+1 n=0
n 1 2 3
(2.13)
6 Chapter 2. Generating functions
∞
1 X
= an xn = 1 + ax + a2 x2 + a3 x3 +· · · (2.14)
1 − ax n=0
∞
1 X n+k−1 k k n n+1 2 n+2 3
= a x = 1+ x+ x + x +· · ·
(1 − ax)n k 1 2 3
k=0
(2.15)
∞ n 2 3
X x x x
ex = =1+x+ + +· · · . (2.16)
n=0
n! 2! 3!
Adding, and also subtracting, power series as well as multiply with a con-
stant c ∈ C is quite trivial [2]:
∞
X ∞
X ∞
X ∞
X ∞
X
n
an z ± n
bn z = (an ± bn )z n
and c n
an z = (can )z n .
n=0 n=0 n=0 n=0 n=0
Multiplying two power series also behaves as expected, it follows the Cauchy
product rule [2]:
∞
X ∞
X ∞
X n
X
an z n bn z n = cn z n where cn = ak bn−k .
n=0 n=0 n=0 k=0
So far, so good, we can breath out knowing that as long as we keep a formal
view on our power series we can manipulate them without thinking twice if the
series converge. However that does not mean we never have to take into account
if a series converge. If we need to draw some analytical conclusions we will have
to have convergence. When we have convergence our formal power series is just
as any convergent power series and we can use known results regarding such
series to draw our conclusions.
We will run into a situation like that later when we need to consider the
limit of a generating function. When doing that we must respect the radius of
convergence and not let z −→ a if a is not contained within that radius.
an = an−1 (2.17)
2.2. Recurrence relations 7
defines the constant sequence {a0 }∞ n=0 . But here a0 could be any number,
meaning we also need some initial condition for the recurrence to be meaning-
ful. Initial conditions are values of the startup terms, satisfying the recurrence
relation, before the relation takes effect [16]. So if we want to describe {1}∞n=0
with a recurrence relation we would write
an = an−1 , n ≥ 1, a0 = 1. (2.18)
Recurrence relations are central in the field of combinatorics where they arise
naturally when counting "stuff". For instance, consider the following problem:
You have 3 vertical rods on a table and n discs with different diameters and
with holes in the center so that they can "slide" down on the rods. The n discs
are placed on rod nr.1 in order of their diameter, the largest one being at the
bottom and the smallest one being on top. Now you have to move all these
discs from rod nr.1 to one of the other rods. You may only move one disc at
the time and you may never place a larger disc on top of a smaller one.
The question that seeks answer is: What is the fewest amount of moves
needed to achive this?
This problem is called "The towers of Hanoi" and it was made famous by E.
Lucas, a french mathematician of the nineteenth century [3]. Here a recurrence
relation is obtained by the following way of reasoning.
Let an denote the smallest number of moves needed to move n discs from one
rod to another. It is easy to see that a0 = 0 and a1 = 1, also a2 = 3 is not very
hard to see. But what about an for any n ≥ 3 ?
In order to move disc nr. n (the largest disc) clearly it must be that we have all
the other n − 1 discs stacked on one of the rods, say rod nr.2, leaving rod nr.3
empty.
Now the smallest possible moves required to move those n − 1 discs to rod
nr.2 is, by definition, an−1 . Since rod nr.3 is empty we can move disc nr.n there,
yielding one extra move. After moving that disc we will never touch it again,
and now all that is left is to move the n − 1 discs from rod nr.2 to rod nr.3, this
we know can be done in an−1 moves.
Adding all the moves together we get
an = 2an−1 + 1, n ≥ 1, a0 = 0. (2.19)
has the solution an = rn . Note that the coefficients ci are just constant’s.
This is quite easy to see since if we plug in rn in 2.20 we get
And, with the condition r ̸= 0, we can divide 2.21 by rn−k which yields
Of course 2.22 is true if and only if r ̸= 0 and r is a root in 2.22. Also 2.22
is called the "characteristic equation" of 2.20 and r is called a "characteristic
root".
In addition, a linear combination of two, or more, solutions to a linear and
homogeneous recurrence relation is also a solution [16]. Lets keep this in mind
while looking at a more general recurrence relation
an − 2an−1 = 1, n ≥ 1, a0 = 0. (2.25)
This form agrees very well with 2.23 with k = 1, c1 = −2 and f (n) = 1.
(h)
First we get an by solving the characteristic equation, in this case it is
trivial to see that r = 2 and the homogeneous solution falls out as
a(h) n
n = A(2) , A ∈ R. (2.26)
(p)
Next we search for a particular solution an . Since the r.h.s. in 2.25 is a
constant, then it is reasonable to believe that a particular solution here also will
be a constant, say C. If we plug in C as the solution in 2.25 we get
C − 2C = 1. (2.27)
an = a(p) (h) n
n + an = A(2) − 1. (2.28)
Using our initial condition a0 = 0 we find that A = 1 and the solution to 2.19
is
an = 2n − 1. (2.29)
So, we have glanced at the method of homogeneous and particular solutions and
as we saw in the example above it does the job to find an explicit formula very
well. We now leave this topic and will instead look at an alternative way to solve
2.19. One that focus on the essence of this paper, the generating functions.
ourselves with questions about convergence when doing all this, we will just
assume x is sufficiently small. Expanding our generating functions in a power
series can be done in several ways, partial fraction expansion or Maclaurin
expansion for instance[19].
To illustrate this consider a recurrence relation
an = can−1 , n ≥ 1, a0 = a, a, c ∈ R. (2.30)
Now this is a simple equation, actually it is the equation for exponential growth
and has the solution an = (c)n a but nevertheless, it works fine to demonstrate
the method on.
For each n ≥ 1 we just have an equation, if we multiply each of those
equations with xn we get
a1 x = ca0 x (n = 1)
a2 x2 = ca1 x2 (n = 2)
3 3
a3 x = ca2 x (n = 3)
.. ..
. .
Now add all these equations and we get
∞
X ∞
X
an xn = c an−1 xn . (2.31)
n=1 n=1
Here we clearly see something that resembles 2.2 though it is not the P
same, but it
∞
is easy to rewrite in terms of a generating function since, let G(x) = n=0 an xn .
Then 2.31 can be expressed as
P∞
Example 3 First of all let G(x) = n=0 an xn and multiply both sides of 2.19
by xn and sum over the n : s for which the recurrence relation is defined. In
this case n ≥ 1. This yields
∞
X ∞
X ∞
X
an xn = 2 an−1 xn + xn . (2.34)
n=1 n=1 n=1
since ao = 0.
Now look at the r.h.s. of 2.34.
∞ ∞
X X x
2 an−1 xn + xn = 2xG(x) + , (2.36)
n=1 n=1
1−x
since
∞
X
2 an−1 xn = 2(a0 x + a1 x2 + a2 x3 +· · ·) = 2x(a0 + a1 x + a2 x2 +· · ·) = 2xG(x)
n=1
(2.37)
and
∞
X x
xn = x + x2 + x3 +· · · = x(1 + x + x2 +· · ·) = (2.38)
n=1
1−x
This is our analytic form of G(x) and the solution we seek is [xn ]G(x). To
find this expression we expand G(x) in a power series using partial fraction
12 Chapter 2. Generating functions
expansion.
x 2 1
= x( − )
(1 − x)(1 − 2x) 1 − 2x 1 − x
= x(2 + 22 x + 23 x2 +· · ·) − x(1 + x + x2 +· · ·)
∞
X
= (2n − 1)xn .
n=0
From 2.40 it is easy to see that [xn ]G(x) = 2n − 1 which is the explicit formula
for an that we were looking for.
With this example we finish this section. We will, throughout the text, consider
many important sequences of different kinds. Both homogeneous, linear, non-
linear and of more then one variable. All of these will be solved using this
method and by doing so we illustrate the power of the generating functions
when it comes to solving recurrence relations.
We will treat the different generating functions separately, in Chapter 3 we
focus on the ordinary power series generating function and in Chapter 4 we will
instead look at the exponential generating function.
Chapter 3
In this chapter we will look at some recursively defined sequences of great impor-
tance and solve their recurrence relations with the method described in Chapter
2, also, along the way we will establish some "rules of computation" that will
come in handy as we progress through the examples.
One of the most famous sequences we have is the Fibonacci numbers. This
sequence has been around for 800 years or so and it was first discovered by
Fibonacci when he presented a counting-problem involving the population of
rabbits [16]. However, to say that the Fibonacci numbers model the population
of rabbits may be to exaggerate a bit, since in Fibonacci´s problem no rabbits
ever die but just keep on breeding. The sequence do however model things
that can be interesting in a combinatorial point of view. For example, let Fn
denote the n:th Fibonacci number and let S = {1, 2, 3, . . . , n} then the number
of subsets of S containing no consecutive integers is given by Fn+2 . Or in how
many ways can one tile a 2 × n units path using tiles of dimension 2 × 1 and
1 × 2 units? The answer is Fn+1 ways [6].
The Fibonacci sequence is recursively defined as
Rydén, 2023. 13
14 Chapter 3. Ordinary Power Series Generating Function
⇔ F (x)(1 − x − x2 ) = x.
We have now illustrated how the method of generating functions can be used
to solve the Fibonacci recurrence relation. Was it any better then the method
of homogeneous and particular solutions? In this case perhaps not, but at the
same time it did not make the computations harder, just a little bit different and
it shows that generating functions have what it takes to solve such equations.
Later we will show how generating functions possess the power to solve other
kinds of recurrence relations, quite easy, that would be hard to solve otherwise
[19].
But first let us establish a few rules that will make computations faster. The
rules that we formulate here can also be found in [19] without proof. Here we
also provide proofs for them.
ops
Recall that G ←→ {an }∞ n=0 means that G(x) is the ordinary
P∞ power series
generating function for the sequence {an }∞ n=0 i.e. G(x) = n=0 n x .
a n
ops
Theorem 1 (Rules of computation (ops)) Let G ←→ {an }∞
n=0 and
ops
T ←→ {bn }∞
n=0 Then
ops
2. (xD)k G(x) ←→ {nk an }∞
n=0
ops Pn ∞
3. GT ←→ { r=0 ar bn−r }n=0
Proof.
ops ops
1. Let G ←→ {an }∞
n=0 and let H ←→ {an+k }n=0 . This implies
∞
∞
X
G(x) = an xn = a0 + a1 x − a2 x2 +· · · (3.9)
n=0
and
∞
X
H(x) = an+k xn = ak + ak+1 x + ak+2 x2 +· · · (3.10)
n=0
That is
G(x) − a0 − a1 x −· · · − ak−1 xk−1
H(x) = (3.11)
xk
16 Chapter 3. Ordinary Power Series Generating Function
ops ops
2. Let G ←→ {an }∞
n=0 and let H ←→ {n an }n=0 then for H(x) we have
k ∞
∞
X
nk an xn = a1 x + 2k a2 x2 + 3k a3 x3 +· · ·
n=0
= xD(a0 + a1 x + 2k−1 a2 x2 + 3k−1 a3 x3 +· · ·)
= (xD)(xD)(a0 + a1 x + 2k−2 a2 x2 + 3k−2 a3 x3 +· · ·)
= (xD)2 (a0 + a1 x + 2k−2 a2 x2 + 3k−2 a3 x3 +· · ·) (3.12)
..
.
= (xD)k (a0 + a1 x + 2k−k a2 x2 + 3k−k a3 x3 +· · ·)
= (xD)k (a0 + a1 x + a2 x2 + a3 x3 +· · ·)
= (xD)k G(x).
ops ops
3. Let G ←→ {an }∞ n=0 and T ←→ {bn }n=0 . Assume that both of them
∞
Soon we are ready to look at a bit more complicated sequence and we will
do so in the example to follow, this will involve a sequence depending on two
independent variables. But before we do that we should point at some properties
of this notation (see [19]). Recall that [xn ]G(x) denotes the coefficient in front
of xn in the power series G(x). Its follows that
The answer to that question is the Stirling numbers of the second kind (see
[3]), we denote this number S(n, k). It is quite clear that for all n ≥ 1 it holds
that
S(n, 1) = S(n, n) = 1. (3.16)
Since there is only one way to partition A in one part, namely A itself. Likewise,
since no part of the partition can be empty there is only one way to partition
A into n parts.
Also it is not possible to partition A into zero parts, nor is it possible to
partition A into k parts if n < k since no parts can be empty. From this we get
S(n, 0) = 0, ∀n ≥ 1 (3.17)
S(n, k) = 0, if n < k. (3.18)
Note as well the special case S(0, 0). This number is a bit strange when thinking
of partitioning an empty set into zero parts, but similar to the convention to
put 0! = 1 it is a useful convention to define S(0, 0) = 1 [3].
The Stirling numbers of the second kind is then defined, recursively, through
S(n, k) = S(n − 1, k − 1) + kS(n − 1, k), 1 ≤ k < n (3.19)
For a derivation of the formula one can read [3] or [19]. Now let us solve this
with the help of generating functions.
Example 5 Consider, for every k ≥ 0 the sum
∞
X
Ak (x) = S(n, k)xn . (3.20)
n=0
Let this be our unknown generating function. Note that 3.20 is the l.h.s. of 3.19
multiplied by xn and summed over n ≥ 0. For k = 0 we get
A0 = S(0, 0) + S(1, 0)x + S(2, 0)x2 +· · · = S(0, 0) + 0 + 0 +· · · = 1. (3.21)
If we now express 3.19 in terms of Ak (x) we get, for k ≥ 1,
∞
X ∞
X
Ak (x) = n
S(n − 1, k − 1)x + k S(n − 1, k)xn , A0 = 1. (3.22)
n=1 n=1
∞
X
k S(n − 1, k)xn = k(S(0, k)x + S(1, k)x2 + S(2, k)x3 +· · ·)
n=1
∞
(3.24)
X
n
= kx S(n, k)x = kxAk (x).
n=0
Which yields
x
Ak (x) = Ak−1 (x) . (3.26)
1 − kx
Iterating 3.26 from k ≥ 1 our previously unknown generating function falls out
xk
Ak (x) = k ≥ 0. (3.27)
(1 − x)(1 − 2x)· · · (1 − kx)
Note that 3.27 works for k = 0 as well if we in that case take the denominator
to be 1 − 0x. Again we use partial fraction decomposition to find an explicit
formula for S(n, k).
k
1 X αi
= , αi ∈ R. (3.28)
(1 − x)(1 − 2x)· · · (1 − kx) i=1
1 − ix
Here we can find each αi simply by multiplying both sides of 3.28 with 1 − rx
and simultaneously letting x = 1r for every 1 ≤ r ≤ k. Computing this we get
rk−1
αr = (−1)k−r , 1 ≤ r ≤ k. (3.29)
(r − 1)!(k − r)!
Now we will take advantage of the notation we use, remember we are looking for
xk
1
S(n, k) = [xn ] = [xn ]xk . (3.30)
(1 − x)· · · (1 − kx) (1 − x)· · · (1 − kx)
k
X rk−1
= (−1)k−r rn−k (3.32)
r=1
(r − 1)!(k − r)!
k
X rn
= (−1)k−r
r=1
r!(k − r)!
To convince yourself that 3.32 truly is an explicit formula one could take a look
at S(n, 2) for every n ≥ 2. According to [3] S(n, 2) = 2n−1 − 1 for every n ≥ 2.
Lets evaluate S(n, 2) using our formula to see that it gives us the correct answer.
1n 2n
S(n, 2) = (−1) + (1) = 2n−1 − 1. (3.33)
1! 1! 2! 0!
d (3.34)
= xBn−1 (x) + (x )Bn−1 (x)
dx
= [x(1 + D)]Bn−1 (x), n > 0, B0 (x) = 1
Here we used Theorem1. From 3.34 we see that we get Bn (x) by doing the
operation x(1 + D) on Bn−1 (x). This yields
B1 (x) = x(1 + D)1 = x
B2 (x) = x(1 + D)x = x2 + x
B3 (x) = x(1 + D)(x2 + x) = x3 + 3x2 + x
.. .. ..
. . .
20 Chapter 3. Ordinary Power Series Generating Function
1 2 1 2
4 3 4 3
Figure 3.1:
Now consider the circle with 2n dots, see Figure 3.2, for simplicity start in
dot nr. 1 and pick a dot to pair with. It is clear we cannot pick an odd numbered
dot since that will result in an odd number of dots remaining on both sides of
the line, meaning we will be forced to intersect that line to pair up all dots.
Instead pick an even numbered dot, say dot nr. 2r for some 1 ≤ r ≤ n.
This results in a line, splitting the circle in two, on one side of the line we have
2r − 2 = 2(r − 1) dots and on the other side we have 2n − 2r = 2(n − r) dots.
Meaning we can view these two halves as two separate circles with 2(r − 1) and
2(n − r) dots respectively (see Figure 3.3).
3.2. Catalan numbers 21
2
1 3
4
2n ..
.
2r
2r + 1
...
Figure 3.2:
2 2
1 3 1 3
4 4
2(r − 1) .. 2(n − r) ..
. .
Figure 3.3:
So for this choice of r there is, by the multiplication principle, Cr−1 Cn−r
different ways to pair up the dots and we can pick any r such that 1 ≤ r ≤ n.
Hence the addition principle yields
n
X n−1
X
Cn = Cr−1 Cn−r = Cr Cn−r−1 , n ≥ 1, C0 = 1. (3.35)
r=1 r=0
It is hard to argue that the Catalan numbers is the solution to many counting
problems. But their recurrence formula is nonlinear, meaning it seems hard to
solve for an explicit formula for Cn . No need to worry, generating functions will
take on this task with a breeze.
P∞
Example 6 Let G(x) = n=0 Cn xn . Without loss of generality we can rewrite
3.35 as
n
X
Cn+1 = Cr Cn−r , n ≥ 0, C0 = 1. (3.36)
r=0
Multiply 3.36 by xn and sum over n ≥ 0 and use Theorem 1 we get, without
hardly any effort at all,
G(x) − 1
= G2 (x). (3.37)
x
We see that G(x) is a solution to the quadratic equation
only one of the solutions work and that is G1 (x). To see this consider the limits
of G1 (x) and G2 (x) respectively as x → 0. For G1 (x) we have, with the help of
"L´Hospital´s Rule" [1]
√
1 − 1 − 4x
lim = 1 = C0 . (3.39)
x→0 2x
While for G2 (x) we clearly have
√
1+ 1 − 4x
lim = ∞. (3.40)
x→0 2x
So we pick G(x) = G1 (x) as our generating function.√ To find an explicit formula
for Cn , first consider the Maclaurin expansion of 1 − 4x.
∞
1/2
X 1/2
(1 − 4x) = (−4)k xk
k
k=0 (3.41)
1 1 1 42 x2 1 1 3 43 x3
= 1 − · 4x − · · − · · · −· · · .
2 2 2 2 2 2 2 3!
Hence
1 1 42 x2 1 1 3 43 x3
1 1
G(x) = 1 − 1 − · 4x − · · − · · · −· · ·
2x 2 2 2 2 2 2 2 3!
1 1 42 x2 1 1 3 43 x3
1 1
= · 4x + · · + · · · +· · · (3.42)
2x 2 2 2 2 2 2 2 3!
1 4x 1 3 42 x2 1 3 5 43 x3
=1+ · + · · + · · · +· · ·
2 2 2 2 3! 2 2 2 4!
1·3·5 ···(2n−1) n
Here we see [xn ]G(x) = 2n (n+1)! 4 . Now, to rewrite this more compact
1 · 3 · 5 · · · (2n − 1) n 2n
4 = 1 · 3 · 5 · · · (2n − 1)
2n (n + 1)! (n + 1)!
2n 1 · 3 · 5 · · · (2n − 1) · 2 · 4 · 6 · · · 2n
=
(n + 1)! 2 · 4 · 6 · · · 2n
(3.43)
2n (2n)!
=
(n + 1)! 2n n!
1 (2n)! 1 2n
= = .
n + 1 n!n! n+1 n
Which is a neat formula for Cn .
24 Chapter 3. Ordinary Power Series Generating Function
Before closing this chapter I would like to just give one more example, this
is a rather special one. It is a recurrence relation used by M. Izquierdo in
her article On Klein Surfaces and Dihedral Groups [8]. The following goes far
beyond the scope of this work and include things like complex geometry.
How many non-biconformally equivalent Klein-surfaces are coverings of the
hyperbolic quotient space, whose fundamental group admits the dihedral group
Dn as a group of automorphisms?
The interested reader finds very good account on Klein-surfaces, branched
coverings and complex geometry in Jones and Singerman [10], Stillwell [18],
Lages Lima [12] and Fulton [5].
What is special about it is that no one has ever yielded the generating
function for it in literature, until now, thus, in literature, no one has solved it
using the method of generating functions. So let us do just that.
The recurrence relation is as follows [8]:
is
p − xp(p − 2)
G(x) =
1 − (p − 2)x − (p − 1)x2
Proof. Equation 3.44 can, equivalently, be rewritten as
From this we can derive values for Qi , 0 ≤ i ≤ 2 so that we can start the
sequence from Q0 instead of Q3 . Compute these and we find Q0 = p, Q1 = 0
and Q2 = p(p − 1). Also we rewrite the indices in 3.44 so that we can use
Theorem 1. This yields
P∞
Now let G(x) = n=0 Qn xn and execute the method. Then by Theorem 1 we
get
G(x) − p (p − 2)(G(x) − p)
= + (p − 1)G(x), (3.48)
x2 x
from which we get
p − xp(p − 2)
G(x) = . (3.49)
1 − (p − 2)x − (p − 1)x2
Note that we can see some resemblance to the generating function of the Fi-
bonacci sequence, at least in the sense that it is a first degree polynomial divided
by a second degree polynomial. If we rewrite a little bit we can actually take a
shortcut and use a result from the Fibonacci example when we are determining
the explicit formula for Qn . First consider this second degree polynomial
√ √
a + 4b + a2 a − 4b + a2
1 − ax − bx = (1 − αx)(1 − βx) where α =
2
, β= .
2 2
(3.50)
If we plug in a = (p − 2) and b = (p − 1) we get the denominator of 3.49, hence
we can rewrite 3.49 as
p − xp(p − 2) p x
G(x) = = − p(p − 2)
(1 − αx)(1 − βx) (1 − αx)(1 − βx) (1 − αx)(1 − βx)
(3.51)
From Example 4 we know that
x 1 1 1
= − . (3.52)
(1 − αx)(1 − βx) α − β 1 − αx 1 − βx
Partial fraction decomposition yields
p 1 p α β
=p = − .
(1 − αx)(1 − βx) (1 − αx)(1 − βx) α − β 1 − αx 1 − βx
(3.53)
Hence
p α β p(p − 2) 1 1
G(x) = − − −
α − β 1 − αx 1 − βx α−β 1 − αx 1 − βx
pα 1 p(p − 2) 1 p(p − 2) 1 pβ 1
= − + −
α − β 1 − αx α−β 1 − αx α−β 1 − βx α − β 1 − βx
pα − p(p − 2) 1 p(p − 2) − pβ 1
= + .
α−β 1 − αx α−β 1 − βx
(3.54)
26 Chapter 3. Ordinary Power Series Generating Function
where
p p
(p − 2) + 4(p − 1) + (p − 2)2 (p − 2) − 4(p − 1) + (p − 2)2
α= and β =
2 2
(3.56)
Chapter 4
Exponential Generating
Functions
P∞ n
Define our unknown generating function G(x) = n=0 an xn! , multiply 4.1 with
xn /n! and sum over n ≥ 0 yields
∞ ∞ ∞
X xn X xn X xn
an+2 =2 an+1 − an . (4.2)
n=0
n! n=0
n! n=0 n!
Rydén, 2023. 27
28 Chapter 4. Exponential Generating Functions
Note that
∞
X xn x2 x3
an+1 = a1 + a2 x + a3 + a4 +· · ·
n=0
n! 2 3!
(4.3)
d x2 x3 d
= (a0 + a1 x + a2 + a3 +· · ·) = G(x).
dx 2 3! dx
In addition
∞
X xn x2 x3
an+2 = a2 + a3 x + a4 + a5 +· · ·
n=0
n! 2 3!
(4.4)
2 3 2
d x x d
= (a1 + a2 x + a3 + a4 +· · ·) = 2 G(x).
dx 2 3! dx
So 4.1 expressed in terms of its generating function G(x) turns out to be
We get the initial conditions we need from the initial conditions of 4.1. Since
G(0) = a0 = 0 and G′ (0) = a1 = 1, it follows that
Using the Maclaurin expansion for xex we find an explicit formula for an :
∞ ∞
x3 x4 X xn X xn
xex = x + x2 + + +· · · = = n . (4.8)
2 3! n=1
(n − 1)! n=0 n!
egf
Theorem 3 (Rules of computation (egf )) Let G ←→ {an }∞
n=0 and
egf
n=0 . Then
T ←→ {bn }∞
egf
1. Dk G(x) ←→ {an+k }∞
n=0 (where D is the differentiation operator)
egf
2. (xD)k G(x) ←→ {nk an }∞
n=0
egf Pn
3. GT ←→ { n
ak bn−k }∞
k=0 k n=0
Proof.
egf
1. Let G ←→ {an }∞
n=0 and for 1 ≤ r ≤ k calculate D G(x)
r
x2 x3 x2 x3
DG(x) = D(a0 + a1 x + a2 + a3 +· · ·) = a1 + a2 x + a3 + a4 +· · ·
2 3! 2 3!
x2 x3
D2 G(x) = a2 + a3 x + a4 + a5 +· · ·
2 3!
..
.
∞
k x2 x3 X xn
D G(x) = ak + ak+1 x + ak+2 + ak+3 +· · · = an+k
2 3! n=0
n!
(4.9)
egf egf
n=0 and T ←→ {bn }n=0 , then their product
3. Let G ←→ {an }∞ ∞
∞ n
X X ak bn−k
GT = cn xn where cn = . (4.10)
n=0
k!(n − k)!
k=0
So
∞ n
!
X X ak bn−k
GT = xn (4.11)
n=0
k!(n − k)!
k=0
30 Chapter 4. Exponential Generating Functions
and
n
!
n
X ak bn−k
[x /n!]GT = n!
k!(n − k)!
k=0
(4.12)
n n
X n! X n
= ak bn−k = ak bn−k .
k!(n − k)! k
k=0 k=0
egf Pn
n=0 .
n
ak bn−k }∞
∵ GT ←→ { k=0 k
When we discussed the ordinary power series generating function one of the
first recurrence relations we solved was the one of Fibonacci. Lets solve it again,
this time using the exponential generating function and then look at how the
two examples differ from each other.
Example 9 We previously stated that the Fibonacci sequence was defined through
3.1. But it is also possible to change the indices to make it a better fit for us to
use Theorem 3. Equivalent to 3.1 we have the following equation:
From 4.13 and with the use of Theorem 3 we immediately get the homogeneous
differential equation
It has solutions
√ √
1+ 5 1− 5
G(x) = c1 e αx
+ c2 e βx
where α = , β= and c1 , c2 ∈ C. (4.15)
2 2
The initial conditions G(0) = 0 and G′ (0) = 1 gives us the unique solution
1 1 1
G(x) = √ eαx − √ eβx = √ (eαx − eβx ). (4.16)
5 5 5
From which it is easy to get the formula for Fn :
1 1
[xn /n!] √ (eαx − eβx ) = √ (αn − β n ), (4.17)
5 5
√ √
where , α = 2 ,
1+ 5
β= 2 .
1− 5
31
So after solving the same problem twice, using two different kinds of generating
functions, what conclusions can we make? Well first of all, they both work
and yields the same solution. That is what is most important here. Another
thing we can notice is that in Example 4 we only needed to solve a ordinary,
algebraic equation, while in Example 9 we were forced to solve a differential
equation. So it seems that the ops version is somewhat easier, in this case, to
obtain the generating function. At the same time, in Example 4, we had to
do some partial fraction decomposition to obtain the explicit formula while in
Example 9 we just applied [xn /n!]G(x) and we were done. So the egf version
seems, in this case, to have an easier way of obtaining the explicit formula once
the generating function is known [19].
Chapter 5
Rydén, 2023. 33
34 Chapter 5. Generating Function for Hermite Polynomials
Actually there are other ways of writing these polynomials, one may multiply
the exponent in 5.6 with some constant in order to make them more suitable for
what ever purpose the user has. The ones that we consider here are sometimes
called the physicists Hermite polynomials and they have their leading coefficient
x2
equal to 2n , another version of the polynomials uses e− 2 instead and therefor
have their leading coefficient equal to one, these are usually referred to as the
probabilists Hermite polynomials [17].
Before we take on the challenge to derive the generating function for Hn (x)
we will look at some of the properties of these polynomials. For instance, what
happens if we take the derivative of Hn (x)? With the product rule we get
n n+1
2 d
−x2 x2 d −x2
Hn′ (x) = (−1)n 2xex e + e e (5.7)
dxn dxn+1
Note how the r.h.s. of 5.7 almost looks like the sum of two Hermite polynomials.
In fact n
2 d 2 2 2
2x(−1)n ex e−x = 2x(−1)n ex Dn e−x = 2xHn (x) (5.8)
dxn
and
2 dn+1 −x2 2 2
(−1)n ex n+1
e = (−1)(−1)n+1 ex Dn+1 e−x = −Hn+1 (x) (5.9)
dx
Thus 5.7 can be rewritten as
2
2 2 2
= (−1)n ex (−2) n0 x(ex )(n) + n1 (1)(ex )(n−1) + n2 (0)(ex )(n−2) + 0 + 0 +· · ·
n
2
d −x2 dn−1 −x2
= (−1)n ex (−2) x dx ne + n dx n−1 e
2
dn −x2 d n−1
−x 2
= (−2x)(−1)n ex dxn e − 2n(−1)n dx n−1 e
(5.13)
Plug this expression back in 5.7 and we get
n n n−1
′ n x2 d −x2 x2 d −x2 x2 d −x2
Hn (x) = (−1) 2xe e − 2xe e − 2ne e
dxn dxn dxn−1
n−1
2 d
−x2
= (−1)n −2nex e
dxn−1 (5.14)
2 dn−1 −x2
= 2n(−1)n−1 ex e
dxn−1
2 2
= 2n(−1)n−1 ex Dn−1 e−x = 2nHn−1 (x).
Equations 5.10 and 5.14 gives us the very nice recurrence relation for n ≥ 1
2 d2n −x2
D2n e−x = e
x=0 dx2n x=0
d2n−1 2
= (−2xe−x )
dx2n−1 x=0
2n−1
X
2n − 1 (k) −x2 (2n−1−k)
= (−2) x (e )
k
k=0 x=0
(5.24)
d2n−1 d2(n−1)
2 2
= (−2) x 2n−1 e−x + (2n − 1) 2(n−1) e−x
dx dx x=0
d2(n−1) −x2
= (−2)(2n − 1) e
dx2(n−1) x=0
d2(n−1) −x2
= (2 − 4n) e = (2 − 4n)H2(n−1) (0).
dx2(n−1) x=0
Here using the notation for the Hermite Numbers. From this we get
H2 = (2 − 4)H0 = (2 − 4)
H4 = (2 − 8)H2 = (2 − 8)(2 − 4)
H6 = (2 − 12)H4 = (2 − 12)(2 − 8)(2 − 4)
..
.
(5.26)
H2n = (2 − 4n)(2 − 4(n − 1))(2 − 4(n − 2)) · · · (2 − 8)(2 − 4)
= 2n (1 − 2n)(1 − 2(n − 1))(1 − 2(n − 2)) · · · (1 − 4)(1 − 2)
= 2n (1 − 2n)(3 − 2n)(5 − 2n) · · · (−3)(−1)
= (−2)n (2n − 1)(2n − 3)(2n − 5) · · · 3 · 1.
38 Chapter 5. Generating Function for Hermite Polynomials
Now, since H0′ (x) = 0 we can instead choose to let n start from 1, this together
with 5.14 yields
∞ ∞
X tn X tn
Hn′ (x) = 2nHn−1 (x) . (5.31)
n=0
n! n=1
n!
With the following change of variables: m = n − 1 we get
∞ ∞
X tm+1 X tm+1
2(m + 1)Hm (x) = 2Hm (x) = 2tG(x, t) (5.32)
m=0
(m + 1)! m=0 m!
39
And since we know from before what Hn (0) is, we can just plug the results from
5.22 and 5.28 into 5.36 and we get
∞
X t2n
f (t) = H2n (0)
n=0
(2n)!
∞
X (2n)! t2n
= (−1)n (5.37)
n=0
n! (2n)!
∞
X (−t2 )n 2
= = e−t .
n=0
n!
you instead define the Hermite polynomials by the generating function 5.38 and
instead derive identities from the generating function instead [11]. For instance,
when we were interested in Hn (0), if we had known the generating function we
could have written
∞
2t0−t2
X tn
e = Hn (0) . (5.39)
n=0
n!
Expand the l.h.s. in a power series and get
∞ ∞
X (−t2 )k X tn
= Hn (0) . (5.40)
k! n=0
n!
k=0
At once realising that H2n+1 (0) = 0 since the l.h.s. of 5.40 do only contain even
powers of t. To find H2n (0) we make the change of variables: n = 2k and get
∞ ∞
X (−1)k t2k X t2k
= H2k (0) , (5.41)
k! (2k)!
k=0 k=0
Moment Generating
Functions
Rydén, 2023. 41
42 Chapter 6. Moment Generating Functions
Look at what happens when we take the derivative, with respect to s and eval-
uate it at s = 0:
d s2 s3
(1 + sE(X) + E(X 2 ) + E(X 3 ) +· · ·) = E(X). (6.6)
ds 2 3! s=0
So we obtain the mean (first moment) of X by just taking the first derivative of
MX (s) and evaluate at s = 0. If we wanted to know the second moment E(X 2 )
we would just take the second derivative of MX (s) and evaluate at s = 0. It is
not to hard to see that the moment generating function "generates" the moment
E(X k ) if we apply the operator Dk to it and evaluate at s = 0 [15]:
s2 s3
Dk MX (s) s=0
= Dk (1 + sE(X) + E(X 2 ) + E(X 3 ) +· · ·)
2 3! s=0
s2
= Dk−1 (0 + E(X) + sE(X 2 ) + E(X 3 ) +· · ·)
2 s=0
s2
= Dk−2 (0 + 0 + E(X 2 ) + sE(X 3 ) + E(X 4 ) +· · ·)
2 s=0
..
.
This is a very useful property when it comes to calculating things like the
variance of a random variable. Remember that the variance of a random variable
X is defined as
d2 d s
E(X 2 ) = MX (s) pe = pes |s=0 = p. (6.10)
dss s=0 ds s=0
So we get
V (X) = p − p2 = p(1 − p) (6.11)
44 Chapter 6. Moment Generating Functions
We began this chapter with a little talk regarding the first four moments of a
distribution and how powerful these moments are when it comes to character-
ising a distribution. Now we have illustrated that calculations with moment
generating functions is very efficient. It is not hard to imagine this having a
lot of applications. For instance in Artificial Intelligence (A.I.), or any type of
data-analysis, we analyse a lot of data and this data can be viewed as a ran-
dom variable, with the moment generating function we can then calculate the
moments of that variable and characterize the data and see what distribution
it follows.
Chapter 7
Conclusions
Rydén, 2023. 45
46 Chapter 7. Conclusions
common in literature that we already know the generating function for the Her-
mite polynomials and use it for calculations since those calculations are simpler.
Lastly I would like to mention another type of generating function that is
a generalization of the moment generating function. It is called the Universal
Generating Function (ugf). It is a powerful tool when working with random
distributions. When we looked at moment generating functions we looked at
discrete random variables, the ugf sort of "translates" this to a non-discrete
case. This makes the ugf a powerful tool when it comes to simulations for
instance, the interested reader should read Universal Generating Function Based
Probabilistic Production Simulation for Wind Power Integrated Power Systems
[9]. In this article they present a model that simulates the electricity demand and
output in a power-system along with costs. Power-systems are quite complex
and persists of multiple kinds of generators with varying outputs and capacities.
Their model makes very accurate simulations using ugf which require far less
expensive computations then other methods.
Bibliography
Rydén, 2023. 47
48 Bibliography
[17] D. Rule, Lecture Notes for Partial Differential Equations, Linköping uni-
versity, spring 2019.
[18] J.Stillwell, Geometry of Surfaces, Springer-Verlag, New York, 1992.
[19] H. S. Wilf, Generatingfunctionology, Academic Press Inc. 1994.
Copyright
The publishers will keep this document online on the Internet – or its possible
replacement – from the date of publication barring exceptional circumstances.
The online availability of the document implies permanent permission for
anyone to read, to download, or to print out single copies for his/her own use
and to use it unchanged for non-commercial research and educational purpose.
Subsequent transfers of copyright cannot revoke this permission. All other uses
of the document are conditional upon the consent of the copyright owner. The
publisher has taken technical and administrative measures to assure authentic-
ity, security and accessibility.
According to intellectual property law the author has the right to be men-
tioned when his/her work is accessed as described above and to be protected
against infringement.
For additional information about the Linköping University Electronic Press
and its procedures for publication and for assurance of document integrity,
please refer to its www home page: http://www.ep.liu.se/.
Upphovsrätt
Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare –
från publiceringsdatum under förutsättning att inga extraordinära omständig-
heter uppstår.
Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda
ner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för
ickekommersiell forskning och för undervisning. Överföring av upphovsrätten vid
en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av
dokumentet kräver upphovsmannens medgivande. För att garantera äktheten,
säkerheten och tillgängligheten finns lösningar av teknisk och administrativ art.
Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman
i den omfattning som god sed kräver vid användning av dokumentet på ovan
beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan
form eller i sådant sammanhang som är kränkande för upphovsmannens litterära
eller konstnärliga anseende eller egenart.
För ytterligare information om Linköping University Electronic Press se för-
lagets hemsida http://www.ep.liu.se/.