Discrete Mathematics: Department of Mathematical Sciences
Discrete Mathematics: Department of Mathematical Sciences
Discrete Mathematics
Only study guide for
MAT3707
K. J. Swanepoel
Contents
I GRAPH THEORY 1
1 Introduction to graphs 3
2 Planar graphs 12
4 Graph Colouring 29
5 Trees 34
II ENUMERATIVE COMBINATORICS 40
7 Basic counting 42
8 Binomial identities 47
9 Generating functions 50
11 Recurrence relations 57
Throughout this study guide we repeatedly refer to the prescribed book, which we abbreviate as Tucker:
Tucker, Alan. 2012. Applied Combinatorics. 6th edition. New York: John Wiley & Sons.
Note that only some terminology, definitions, theorems and corollaries of Tucker are, where deemed neces-
sary, repeated in the study guide. For each study unit you should read the indicated sections of Tucker,
using the “What to look out for” section in the study unit as guide. Once you have mastered the material in
a study unit, you should immediately start doing the relevant problems in the assignments given in Tutorial
Letter 101. The amount of time that should be spent on each study unit differs from individual to indi-
vidual. However, you should organize your studies around the closing dates for sending in the assignments.
These dates are also indicated in Tutorial Letter 101.
Only after you have done the exercises in the assignments and you feel that you need to do more exercises,
should you look at the exercises found in Tucker.
v MAT3707/1
Students of mathematics are usually rushed into learning calculus as fast and as soon as they can. This
is due to the applications of this field in the physical sciences. It is almost impossible to understand
physics and some parts of chemistry without knowing differentiation and integration. Calculus and the
fields building on it such as mathematical analysis, differential equations, dynamical systems, etc, deal with
various continuous quantities (which are derived from the physical world, such as length, mass and volume).
On the other hand, in the world of computers, including communication networks such as cellular networks
and the internet, quantities such as network configurations and large data sets are usually discontinuous or
discrete, and continuous information such as sound and visual images are quickly discretised by CDs and
digital cameras. Discrete mathematics (or combinatorics) traditionally deals with mathematical problems
arising from the sciences in which this discrete (manufactured) world is studied:
Usually, calculus on its own is useless in dealing with discrete problems. As can be guessed, discrete
mathematics has undergone most of its development in the 20th century, although there are some precursors
going back to the 16th century (mostly dealing with recreational mathematics and gambling!).
Discrete mathematics is a large field. The two subfields introduced in this module are
Graph theory deals with simple mathematical models of networks. Nodes are modelled as vertices and
connections as edges, and the mathematical object is called a graph. The name “graph” has its roots in
linguistics and history. (The first graph theory book was published in German, by a Hungarian1 , almost
70 years ago—long before the internet).
Enumerative combinatorics involves the counting of large collections of mathematical objects. This subject
is older than graph theory and has its origin in the calculation of probabilities in gambling as far back as
the 16th century. Nowadays there are of course more noble applications as well, such as computational
complexity and statistical physics.
1
Denes König, Theorie der endlichen und unendlichen Graphen, 1936
Part I
GRAPH THEORY
1
3 MAT3707/1
Study unit 1
Introduction to graphs
In this study unit you’ll encounter the basic definitions and properties of graphs, which are simple mathe-
matical models of networks. You’ll see how various real-life problems can be modelled in terms of graphs.
Various basic concepts around graphs will be introduced, in particular the important concept of isomor-
phism, as well as special types of graphs, such as connected graphs and bipartite graphs.
1.1 Source
– graph
– vertex
– edge
– adjacent vertices
– directed graph (also called digraph)
– directed edge
– the degree of a vertex
– the in-degree and out-degree of a vertex in a directed graph
– path
– circuit
– the length of a path or circuit
– connected graph / disconnected graph
– components of a graph
– complete graph
– isomorphic graphs
– isomorphism between graphs
– isolated vertex
– bipartite graph
– complete bipartite graph
– the complement of a graph
– subgraph
4
• you should know the following theorems (and the proofs only where indicated):
– the edge counting theorem (theorem 1 and its corollary, in section 1.3 of Tucker) and its proof
– the characterization of bipartite graphs (theorem 2, in section 1.3 of Tucker) (no proof)
Definitions in Tucker are printed in boldface. Study the definitions as you find them and learn them.
After the first few definitions and discussion, read examples 1 to 5. Do not spend too much time on
the detail of these examples. The important thing here is to understand which types of problems can be
modelled with graphs, and how to model them. When doing such modelling, always look out for the
• things or objects; they will become the vertices in the graph (or directed graph)
• relations between pairs of objects; these will become the edges of the graph (if this relation is sym-
metric), or the directed edges of the directed graph (if the relation is not symmetric)
G1 G2
and
(A multigraph, which will be introduced in study unit 3, may have loops and parallel edges.) A directed
graph has arrows.
5 MAT3707/1
The number of vertices of a graph G is called the order of G and the number of edges in G is called its
size. We sometimes denote the order of G by n(G) or simply n and the size of G by e(G) or just e.
G1 G2 g h
b
and
f c i
i
d l
e k j
We say that two vertices are adjacent if there is an edge between them. So b and c are adjacent vertices
while b and d are nonadjacent.
We say that an edge is incident with a vertex if the vertex is one of the two endpoints of the edge. So the
edge bc is incident with b and bc is also incident with c.
A path P is a sequence of distinct vertices and edges. For example f cba is a path in G1 :
a
G1
b
f c
Note that b and d can never be consecutive vertices on a path since there is no edge between them.
A path containing all the vertices of the graph is called a Hamilton path. The path abcf de is a Hamilton
path in G1 :
a
G1
b
f c
e
6
The number of vertices of a path P is called the order of P . If a path of order at least 3, say v1 v2 . . . vk
is followed by the edge vk v1 we call v1 v2 . . . vk v1 a circuit. In G1 there are three circuits: bcdf b, bcf b and
f cdf .
A graph G is connected if there is a path between every pair of vertices of G. Note that the first graph
G1 is connected while the second graph G2 is not connected. The removal of either vertex b or the edge ab
in G1 will disconnect the graph:
a a
G 1-{b} G 1-{ab}
b
f c f c
d d
e
e
Note that when we remove a vertex from a graph, we also remove all the edges incident with that vertex,
but if we remove an edge of a graph we don’t remove the vertices it is incident with.
If two vertices are adjacent we call them neighbours. In G1 , vertex b is the only neighbour of a, while b
has three neighbours, namely a, c and f . The degree of a vertex v is the number of neigbhours of v and
is denoted by d(v). Hence d(b) = 3. (Sometimes we also use the notation deg(v) for the degree of v.)
If a set of vertices has no edge between any two of its vertices, we call such a set and independent set of
vertices. In G1 , {a, f, e} is an independent set of vertices.
• how to prove that graphs are isomorphic (example 2), by indicating an isomorphism
• how to prove that graphs are not isomorphic (example 1), by indicating a property that the one graph
possesses, but the other does not
• how to do the above for directed graphs
It is important to note that there are no quick or easy ways known to find out whether two graphs are
isomorphic or not, not even for a computer (unless the graphs are small). So you’ll always need some
ingenuity for this type of problem (think!).
A subgraph of a graph G is a graph formed by a subset of vertices and edges of G. If two graphs are
isomorphic, then so are subgraphs induced by corresponding vertices and edges.
A graph in which every vertex is adjacent with every other vertex in the graph is called a complete graph.
A complete graph on n vertices is denoted by Kn .
7 MAT3707/1
K3:
K5:
K4:
Two graphs G and H are isomorphic if and only if there is a one-to-one correspondence between the vertex
sets of G and H such that adjacency is preserved. This means that if u and v are vertices of G which
correspond with x and y in H respectively, then uv is an edge in G if and only if xy is an edge in H.
To think of it in another way: If G and H are isomorphic graphs, we should be able to draw them so that
they look exactly the same.
Here is an example:
a b 1 2
G: H:
d c 4 3
a b
G:
c d
1 2 3 4
a b d c
8
In this example the vertex correspondence given above is obviously not unique.
So how does one go about determining whether two graphs are isomorphic?
It depends on the graphs you are given. Sometimes it is easy. By simply looking at the degrees of the
vertices, one can see that the graphs are non-isomorphic:
a 1
b 2
f c 6 3
e d 5 4
In the example above, the second graph has a vertex of degree four (vertex 2), while the first graph does
not have such a vertex. The two graphs are therefore not isomorphic.
4 5 6 d e f
7 g
They have the same degree sequence, namely 1,2,2,3,3,3,4. So we need to take a closer look. Something
does not look right. But we need to find a way to explain why the two graphs are not the same.
Consider the subgraphs induced by vertices of the same degree. Obviously if these subgraphs are non-
isomorphic, the two original graphs will also be non-isomorphic.
Looking at vertices of degree three does not help because in both graphs we get the subgraph:
So what about vertices of degree 2? In the first graph the two vertices of degree 2 are adjacent, i.e. 36 is
an edge, but in the second graph the two vertices of degree 2, namely a and c, are nonadjacent:
3 6 a c
Since these subgraphs are non-isomorphic, the two original graphs are also non-isomorphic.
Now consider the graphs: 1 a
6 2 f b
5 3 e c
4 d
9 MAT3707/1
Again the two graphs have the same degree sequence. And looking at the subgraphs induced by vertices of
the same degree does not help either, since the subgraphs of vertices of degree two are given by
for both graphs and for vertices of degree three we get a circuit on four vertices in both cases:
So we need another approach. Let us look at the circuit structure of the two graphs. Immediately we notice
that the second graph has 3-circuits (or simply called triangles), for example abf a and cdec, while the first
graph does not have any triangles! So this means that the two graphs are non-isomorphic.
Note that you could also have observed that the first graph has five 4-circuits, while the second graph only
has one 4-circuit. Or that the second graph has 5-circuits, while the first graph has none. So in this case
there are in fact many reasons why the two graphs are non-isomorphic.
h c
6 5 4
g d
7 8 9
f e
In this case both graphs have the same degree sequence as well as the same circuit structure, and the
subgraphs induced by vertices of the same degree are also isomorphic. So we begin to suspect that the two
graphs might be isomorphic. Now all we need to do is to find a vertex correspondence between the vertices
of the two graphs.
If the two graphs are isomorphic, we would have to match vertex 5 with vertex e since they are the only
vertices of degree four:
1 2 3 4 5 6 7 8 9
e
The four neighbours of vertex 5 each has degree three. They have to be matched somehow with the four
neighbours of e. We notice that the neighbours 2 and 4 of vertex 5, have another common neighbour,
namely vertex 3 (of degree two). Also, the other two neighbours, 6 and 8, also have another common
neighbour, namely vertex 7 (of degree two). So we need to find two pairs of neighbours of e such that each
pair also have another common neighbour (of degree two). This is easy, neighbours b and d of e share the
neighbour c (of degree two), and neighbours h and f of e share the neighbour g (of degree two).
So we try to match 2 and 4 with b and d respectively. (If this does not work, we have to try another option.)
Then their common neighbours have to be matched, i.e. we match 3 with c. Thus far we have
10
1 2 3 4 5 6 7 8 9
b c d e
Since 7 and g are the only remaining vertices of degree two, they have to be matched. Now {6, 8} somehow
has to be matched with {f, h}. We notice that in the first graph, 6 and 2 share a common neighbour, 1.
Vertex 2 corresponds with vertex b in the second graph. While b and h do not have an unmatched neighbour
in common, b and f have the neighbour a in common. So we are forced to match vertex 6 with vertex f .
Then 8 has to be matched with h:
1 2 3 4 5 6 7 8 9
b c d e f g h
Finally we look at the remaining vertices 1 and 9 in the first graph. We have to match them with a and
i. We notice that the matched neighbours of 1 are vertices 2 and 6 which correspond to vertices b and f
in the second graph. The only unmatched neighbour of b and f in the second graph is vertex a, so we are
forced to match 1 with vertex a. Then vertex 9 has to be matched with vertex i which is fine since the
neighbours of i correspond with the neighbours of 9:
1 2 3 4 5 6 7 8 9
a b c d e f g h i
We have found a vertex correspondence between the vertices of the two graphs in such a way that two
vertices are adjacent in the first graph if and only if they are adjacent in the second graph.
Here, at last, is the first theorem: theorem 1. This theorem is very important, and should always be kept
in mind. Make sure that you also understand its proof, and that of its corollary (which can be found just
before the corollary). Study examples 1 to 3 to see how to apply theorem 1 and its corollary.
You may skip example 4.
Next you’ll find the definition of a bipartite graph, and theorem 2, which characterizes bipartite graphs.
This theorem is also important. However, you don’t have to know its proof. Study example 5, to see how
this theorem is applied to determine whether a graph is bipartite or not.
Note: Another definition you should learn is that of a complete bipartite graph Km,n . This is a
bipartite graph with m + n vertices with m vertices in the independent vertex set V1 and n vertices in the
independent vertex set V2 , where each vertex in V1 is adjacent to each vertex in V2 . (We say that V is an
independent vertex set if no two vertices of V are adjacent.) The following figure shows some examples of
complete bipartite graphs.
11 MAT3707/1
K1,4
K1,1 K1,2
K2,2 K3,5
Note: A complete bipartite graph is not a complete graph (with the single exception of K1,1 = K2 ). It is
a complete bipartite graph: there are still no edges between any two vertices of partite set V1 , and no edges
between any two vertices of partite set V2 .
1.4.2 “These graphs are not isomorphic, because the isomorphism I tried to construct
doesn’t work.”
If you try to demonstrate a one-to-one correspondence between two graphs and it turns out not to be an
isomorphism, then you cannot conclude that the graphs are non-isomorphic. Some other way could still
work!
As a general rule, if you want to show that graphs are not isomorphic, it is a bad idea to try to show
directly that there is no isomorphism. Since there are n! ways of matching up the vertices between two
graphs, each having n vertices, and you have to check that each of these matchings is not an isomorphism,
you’ll be busy for quite a while (months, years)! For example, if both graphs have 10 vertices, there are
10! = 3628800 ways of matching up the vertices.
The simplest way to show that graphs are not isomorphic, is to find a graph property that
the one graph has, that the other graph lacks (as illustrated by the examples in section 1.2).
12
Study unit 2
Planar graphs
Planar graphs are graphs that can be drawn in the plane in such a way that no two edges cross. For
example, the complete graph K4 is planar, but K5 is not (try both). If a graph is planar, one can prove it
by making a planar drawing. To prove that a graph is not planar, however, you cannot check all possible
drawings; instead you have to show that it violates some property of planar graphs. For small graphs we
also introduce the circle-chord method, which can often prove that a graph is non-planar.
There are many different ways to draw the same planar graph. However, all of these ways share a common
property, expressed by Euler’s formula.
2.1 Source
– planar graph
– plane graph
– K3,3 configuration and K5 configuration
– the regions of a plane graph
– the degree of a region of a plane graph
• you should know the following theorems (and the proofs only where indicated):
– apply the corollaries to Euler’s theorem (including the extensions above in this study guide) to
show that a graph is non-planar
You must understand the definitions of planar graph and plane graph. Study example 1 (and keep it in
mind for study unit 4).
A graph is planar when we can draw it in the plane without crossing edges.
G:
d c
is a planar graph since we can redraw the edge ac of G outside the circuit abcda:
a b
G:
d c
a b c
5 2
d e f
4 3
K5 K3,3
The graph on the left is the complete graph on 5 vertices, K5 , and the graph on the right is the complete
bipartite graph K3,3 .
It is easy to see that these graphs are nonplanar. The circle-chord method is used in example 3 of Tucker
to prove that K3,3 is nonplanar. Now let us use the circle-chord method to prove that K5 is also nonplanar.
14
We start by considering a Hamilton circuit of K5 , for example the circuit 123451. There are of course more
than one Hamilton circuit in a K5 , choose any one:
1
5 2
4 3
We are going to prove that K5 is nonplanar by adding chords to the Hamilton circuit and showing that we
are forced to get crossing edges. (An edge is called a chord of a circuit C if both endpoints of the edge are
vertices on C.)
Pick any chord, say 13. We can add this chord either inside the circuit or outside. It does not matter where
we start. So let’s say we choose to draw 13 inside:
1
5 2
4 3
5 2
4 3
5 2
4 3
5 2
4 3
15 MAT3707/1
5 2
4 3
or outside:
1
5 2
4 3
Hence K5 is nonplanar.
a b c
5 2
d e f
4 3
A K 5 configuration A K 3,3 configuration
Notice that they almost look like a K5 and a K3,3 . They were in fact obtained by subdividing some of
the edges of the original K5 and K3,3 . This means that extra vertices were added in the middle of some of
its edges.
Of course (repeated) subdivision of edges of a nonplanar graph will give a new graph that is also nonplanar!
Kuratowski’s theorem
Kazimierz Kuratowski was a 20th century Polish mathematician. His well-known characterization of planar
graphs are give by Theorem 1 in Section 1.4 of Tucker and repeated below:
Theorem 1 (Kuratowski, 1930) A graph is planar if and only if it does not contain a subgraph that is a
K5 or a K3,3 configuration.
We know that the complete bipartite graph K3,3 and the complete graph K5 are not planar. What can you
say about the planarity of K2,3 and K4 ?
16
Study the definition of a K3,3 configuration and that of a K5 configuration: these graphs are still not planar;
if there did exist a planar drawing for them, one would also have been able to make a planar drawing of
K3,3 or K5 .
When the circle-chord method shows that a graph is not planar, it is usually easy to find a K3,3 or K5
configuration in the graph, as demonstrated in example 4. We also illustrate this in our next example where
we use the circle-chord method to determine whether the graph
1 2
4 3
5 6
8 7
is planar or not. If it turns out to be nonplanar, we will try to identify a K3,3 or K5 configuration of the
graph above.
4 2
3 6
5 7
Then we add the chords step-by-step. We try to find chords in such a way that our previous choices force
the next chord to be drawn in only one possible way, that is outside (or inside) the Hamilton circuit. If the
chords can be drawn either inside or outside, this would give us two choices, and we would have to consider
both cases.
Obviously it does not matter where we draw our first chord. It can be inside or outside. Let’s say we pick
the chord 37 to be drawn inside the Hamilton circuit.
1
4 2
3 6
5 7
4 2
3 6
5 7
But now the edge 48 cannot be drawn inside (or outside) without crossing edges:
1
4 2
3 6
5 7
Now let’s see if we can find a K3,3 configuration of the graph. (I suspect we won’t find a K5 configuration
because we only added three edges to the Hamilton circuit.) Keep in mind that a K3,3 can be drawn in
many ways:
Knowing this it is easy to draw a K3,3 configuration showing the partite sets (that is the two sets of
independent vertices of K3,3 such that all the edges are added between these two sets).
First we find the two independent sets of vertices indicated below as triangles and squares (a vertex of
degree two can be ignored for this since such a vertex only subdivides some edge):
1
4 2
3 6
5 7
Then we redraw the graph to show the bipartition of the vertex set, and we indicate where the edge 17 was
subdivided by adding the vertices 2 and 6:
Euler’s formula
Leonhard Euler was an 18th century Swiss mathematician who also lived in St. Petersburg and in Berlin.
His name is pronounced “oiler”.
18
1 3 8
6
5 7 4
Study theorem 2 (Euler’s formula) which is also given below (but skip its proof), and example 5 to see how
it is applied.
Theorem 2 (Euler’s formula, 1752) If G is a connected planar graph, then any plane graph depiction of G
has r = e − v + 2 regions.
The following three plane depictions of the same graph illustrates Euler’s theorem:
a
e b
3
5 a
e b 2
1 3
f g f g
2 1 4 1
e b
d c
3 4
d c 5
2 4
5 f g a
d c
Each of the three plane depictions has the same number of regions. (A region of a graph is sometimes also
referred to as a face of a graph, and it is just an area of a graph which is surrounded by edges.) The graph
above has a total of five regions (four inner regions) and the outer region as indicated in the sketch above.
Study the corollary of Euler’s formula (with its proof). Note that the hypothesis in this corollary requires
that the graph has to be connected, planar, and with at least two edges. We repeat the corollary below:
This Corollary implies that if G is a graph with more than 3v − 6 edges, then G is nonplanar.
We’ll show below that the requirement of connectedness is not necessary. However, note that the corollary
does not hold for a graph with only one edge, such as K2 (check this!). Note where in the proof the
assumption that the graph has more than one edge is used: Where it is claimed that each region has degree
≥ 3.
We now present two extensions to this corollary. We still call them corollaries of Euler’s formula, since they
are also simple consequences of Euler’s formula. The first one shows that it is not necessary to assume that
the graph is connected.
Proof. If G is connected, we may simply apply the first corollary of Euler’s formula. Otherwise, let the
connected components of G be G1 , G2 , . . . , Gk , with k ≥ 2 the number of connected components of G.
Consider a drawing of G in the plane. It is possible to join one of the vertices of G1 to one of the vertices
of G2 without having the edges cross. Similarly, join G2 and G3 with an edge, as well as G3 and G4 , . . . ,
Gk−1 and Gk . Denote the new graph obtained in this way by G′ . The number of its vertices is the same as
that of G, namely v. The number of its edges is k − 1 more than that of G: e + k − 1. Since G′ is connected
and still planar, and it definitely has more than one edge, we may apply the first corollary to it to obtain
e + k − 1 ≤ 3v − 6.
e < 3v − 6
Corollary. If G is a triangle-free planar graph (ie it does not contain K3 as a subgraph), with e > 1, then
e ≤ 2v − 4.
When G is connected, the proof is almost identical to the proof of the corollary in Tucker. The difference
is that it now follows from the facts that there is more than one edge, and that there are no triangles, that
each region has degree ≥ 4. Then it follows that 2e ≥ 4r, hence 12 e ≥ r. Combining this with Euler’s
formula, we obtain
1
e ≥ r = e − v + 2,
2
and solving for e we obtain e ≤ 2v − 4.
When G is disconnected we complete the proof as before (by joining the different components with edges
in a plane drawing).
It follows from this corollary that for planar bipartite graphs we have e ≤ 2v − 4, since bipartite graphs are
triangle-free:
Corollary If G is a planar bipartite graph with e > 1, then e ≤ 2v − 4.
The converse is false: if e ≤ 3v − 6 for a given graph, then you cannot conclude that the graph is planar.
Take as example K3,3 —it satisfies the inequality (check this!), but it is not planar, as shown in example 3
of section 1.3 in Tucker. (However, it does not contain any triangles, since a triangle is a circuit of odd
length, and it does not satisfy e ≤ 2v − 4, so from the corollary above for triangle-free planar graphs, we
again deduce that K3,3 is not planar.)
20
2.4.3 Confusing the graphs K3,3 and K5 with K3,3 and K5 configurations
Kuratowski’s theorem refers to K3,3 and K5 configurations. These are graphs obtained by adding vertices
in the middle of edges of K3,3 and K5 —see Tucker, section 1.4.
It is possible for a non-planar graph not to contain K3,3 or K5 as a subgraph. However, Kuratowski’s
theorem says that a non-planar graph will contain a K3,3 or K5 configuration.
21 MAT3707/1
Study unit 3
Euler discovered the theory of Euler cycles and Euler trails in 1736 while studying a recreational problem
(walking through town in such a way that you cross each bridge exactly once). This theory also solves the
problem of drawing a figure without lifting your pen, and without retracing the same line.
William Hamilton was a 19th century Irish mathematician who is most famous for his discovery of the
number system called the quaternions, which is an extension of the complex number system. He also
studied Hamilton circuits and paths, although he was not the first to do so.
3.1 Source
– multigraph
– trail
– cycle
– Euler cycle
– Euler trail
– Hamilton circuit
– Hamilton path
– n-dimensional cube (or hypercube)
• you should know the following theorems (and the proofs only where indicated):
are allowed. (This is not the case for graphs.) Note that a loop in a multigraph contributes 2 to the degree
of a vertex, since both its end points are incident to the vertex.
A path P is a sequence of distinct vertices where each pair of consecutive vertices is joined by an edge. If
a path, say v1 v2 . . . vk is followed by the edge vk v1 we call v1 v2 . . . vk v1 a circuit.
A trail T is a sequence of vertices, not necessarily distinct, where each pair of consecutive vertices is joined
by an edge. If a trail, say v1 v2 . . . vk is followed by the edge vk v1 we call the trail v1 v2 . . . vk v1 a cycle.
Although we allow vertices to be repeated on a trail and a cycle, edges are not allowed to repeat.
An Euler cycle is a cycle that contains all the edges in a graph and visits every vertex at least once.
An Euler trail is a trail that contains all the edges in a graph and visits every vertex at least once.
Theorem 1 (Euler, 1736) A multigraph G has an Euler cycle if and only if it is connected and all its
vertices are of even degree.
Since the vertices on a trail may be repeat, a graph will have an Euler trail if it has an Euler cycle. So
Theorem 1 above also imply that if G is connected and all its vertices are of even degree, then G also has
an Euler trail.
The following corollary of Theorem 1 shows however that there are graphs that have Euler trails but no
Euler cycles.
Corollary A multigraph G has an Euler trail, but not an Euler cycle, if and only if it is connected and has
exactly two vertices of odd degree.
Example 3 gives a practical application.
23 MAT3707/1
6 5 4
7 9
8
All its vertices are of even degree so it should have an Euler cycle and an Euler trail. See if you can find
them.
1 2 3
6 5 4
7 9
8
It has exactly two vertices of odd degree. So it should have an Euler trail but not an Euler cycle. Try to
convince yourself of this.
These rules are common sense and are based on the following two properties that follow directly from the
definition of a Hamilton circuit:
A: a Hamilton circuit uses exactly two edges incident with each vertex and
B: it uses all the vertices in the graph.
A implies rules 1 and 3 while B implies rule 2.
6 5 4
7 9
8
Using the fact that vertices 1, 3, 9 and 7 are all of degree 2, we are forced to use the two edges incident with
each of these vertices (rule 1). But then we get the proper subcircuit 123498761 indicated in grey below.
1 2 3
6 5 4
7 9
8
This violates rule 2. The graph therefore does not have a Hamilton circuit.
Now consider this graph:
a
m
j e
k f
d b
i
g
h
n
c
25 MAT3707/1
It follows from rule 2 that we have to use the edges incident with m, k and n:
a
m
j e
k f
d b
i
g
h
n
Now consider vertex j. Due to the symmetry of the graph as well as the symmetry of the edges already
chosen, it does not matter which one of the edges je and ji we use. These two cases will be similar. So we
choose to use je and then we delete ji (rule 2):
a
m
j e
k f
d b
i
g
h
n
m
j e
k f
d b
i
g
h
n
Applying rule 3 at vertex d we delete da and then applying rule 1 to a we use the edge ae:
a
m
j e
k f
d b
i
g
h
n
c
26
We notice that we cannot use the edge hc since we would get a proper subcircuit hcndih. Therefore by
rule 2, we delete the edge hc. Since c now has degree 2, we are forced to use the edge cb from rule 1 and
similarly at h we are forced to use the edge hg:
a
m
j e
k f
d b
i
g
h
n
We have therefore proved that this graph does not have a Hamilton circuit.
Theorem 1 (Dirac’s theorem) can be used to prove that a graph has a Hamilton circuit.
Theorem 1 (Dirac, 1952) A graph with n vertices, n > 2, has a Hamilton circuit if the degree of each
vertex is at least n/2.
If the degree of each vertex is ≥ n/2, then the graph has a Hamilton circuit, guaranteed by Dirac’s theorem.
On the other hand, if there is at least one vertex with degree < n/2, then you cannot use the theorem to
conclude that there is no Hamilton circuit (see one of the Common Mistakes below).
Skip Theorem 2.
Theorem 3 (Grinberg, 1968) Suppose a planar graph G has a Hamilton circuit H and consider a planar
depiction of G. Let ri denote the number of regions inside the Hamilton circuit bounded by i edges and let
ri′ be the number of regions outside the circuit bounded by i edges. Then the numbers ri and ri′ satisfy the
equation
∑
(i − 2)(ri − ri′ ) = 0. (∗)
i
Theorem 3 (Grinberg’s theorem) can be used to prove that a planar graph does not have a Hamilton circuit,
as illustrated in example 4. (And it cannot be used to prove that a Hamilton circuit exists.)
Since the graph in the previous example is planar, we can also apply Grinberg instead of the three rules of
Tucker to try and show that it does not have a Hamilton circuit.
We notice that this graph has 7 regions (remember to count the outer region). Six of these regions are
bounded by 5 edges and one region (the outer region) is bounded by 6 edges.
We also have
r5 + r5′ = 6 and r6 + r6′ = 1,
since there are six regions bounded by 5 edges and one region bounded by 6 edges.
27 MAT3707/1
Since ri and ri′ are nonnegative integers it follows from r6 + r6′ = 1 that there are two possibilities:
r6 = 1 and r6′ = 0
or
r6 = 0 and r6′ = 1
Thus graphs are also multigraphs (just like a square is a rectangle, but not all rectangles are squares).
3.4.2 Confusing Euler cycles and trails with Hamilton circuits and paths
In an Euler trail or cycle, you pass through each of the edges of the graph exactly once. In a Hamilton
circuit or path, you pass through each of the vertices of the graph exactly once.
It is easy to find out if a graph has an Euler circuit or Euler trail, and to find them. It is in general difficult
(even for a computer) to find out if a graph has a Hamilton circuit or path. You will have to use some
ingenuity when trying to find one or to prove that none exists.
28
if the degree of each vertex is ≥ n/2 (where n is the number of vertices), then there is a Hamilton
circuit.
It can, however, not be applied to prove that a Hamilton circuit does not exist, because the converse of
Dirac’s theorem is false. For example, there are graphs with a Hamilton circuit, and with all degrees < n/2.
The simplest example is a circuit with five edges:
29 MAT3707/1
Study unit 4
Graph Colouring
Graph colouring has important applications in scheduling, and is an example of a problem that is computa-
tionally difficult. In this study unit we shall discuss the basic definitions and a few basic colouring theorems.
Note that because of the practical applications and the difficulty of colouring, there is an enormous number
of theorems on graph colouring, and we only scratch the surface.
4.1 Source
– colouring of a graph
– independent set
– the chromatic number of a graph
• you should know the following theorems (and the proofs only where indicated):
– χ(G) ≤ 2 if and only if G does not have any odd circuits, if and only if G is bipartite (without
proof)
– Brooks’ theorem (without proof)
– the famous 4-colour theorem (without proof!)
– find an upper bound for the chromatic number of a graph either by finding a colouring, or by
using one of the colouring theorems
– find a lower bound for the chromatic number of a graph by finding a large complete subgraph,
or by using the techniques of forcing colours and symmetry
– determine the chromatic number of a graph by finding equal upper and lower bounds
30
Colour or color? “Colour” is the British spelling (as indicated in the Oxford dictionary), which is used in
South Africa and most English-speaking countries. “Color” is the American spelling (as indicated in the
Webster dictionary, as well as the Oxford dictionary), which is used in the USA and Canada.
Let us first consider the complete graphs (the first five are given below).
4
4 3 5 3
3
1 1 2
1 2 1 2 1 2
K1 K2 K3 K4 K5
Since every vertex in a complete graph Kn of order n is adjacent to all the other n − 1 vertices in the graph,
we will need at least n colours to colour the vertices of Kn . (We need one colour for the vertex itself, plus
n − 1 other colours to colour its n − 1 neighbours.) Hence χ(Kn ) ≥ n.
Since there are only n vertices in the graph, we are not going to need more than n colours, so χ(Kn ) ≤ n.
This proves that χ(Kn ) = n.
Consider the graph G below. We observe that the largest complete subgraph of G is a K2 (or simply called
an edge), so we will need at least two colours to colour its vertices. Hence χ(G) ≥ 2:
1 2
31 MAT3707/1
If the largest complete subgraph is a K3 (also called a triangle), we will need at least three colours, so
χ(G) ≥ 3:
1 2
If the largest complete subgraph is a K4 , we will need at least four colours, so χ(G) ≥ 4:
3 4
1 2
So if G contains a Ki then χ(G) ≥ i. The next step would then be to attempt to colour the vertices of G
with i colours. If you succeed, then your colouring of G in i colours would imply that χ(G) ≤ i. Hence
χ(G) = i.
If your attempt proves that it is impossible to colour your graph in i colours, and you show that you need
at least, say j > i colours, then χ(G) ≥ j. Furthermore, if you obtain a j colouring of G, then χ(G) ≤ j.
Hence χ(G) = j.
a b c d
2 1 2 1
1 2 1 2 1 2
e f g h
We attempt a 2-colouring of the vertices. We have already coloured e with colour 1 and f with colour 2.
Then a is forced to be 2, b is forced to be 1, c is forced to 2. Then d is forced to be 1, h has to be 2 and
finally g is forced to be 1. Two colours are therefore enough to colour the graph. Thus the vertex colouring
colour 1 colour 2
b, d, e, g a, c, f, h
shows that χ(G) ≤ 2 and so χ(G) = 2. (In this case the result also follows from the fact that G is bipartite,
i.e. contains no odd circuits.)
a b c d
3 3 1 2 4
1 2 3 1
1 2 e f g h
32
we have already shown that the vertices of the triangle ef ae has to have colours 1, 2 and 3 respectively.
Hence b is forced to be 1. Then g is forced to be 3 and c is forced to be 2. Vertex h is forced to be 1. Now
d is adjacent to a vertices coloured by colours 1, 2 and 3 and so we need another colour to colour d. Hence
three colours are not enough to colour the vertices of the graph, so χ(G) ≥ 4. But colouring g with colour
4 gives us the colouring
colour 1 colour 2 colour 3 colour 4
b, e, h c, f a, g d
which shows that χ(G) ≤ 4. Hence χ(G) = 4.
Finally for the graph
a b c d
3 4
3 4 2 4
1 2 3 1
1 2 e f g h
we show that four colours is enough to colour the graph as follows: We have already shown that due to the
K4 induced by the vertices e, f , a and b we need at least four colours to colour the graph. So χ(G) ≥ 4.
But the colouring below
colour 1 colour 2 colour 3 colour 4
e, h c, f a, g b, d
shows that χ(G) ≤ 4. Hence χ(G) = 4.
Theorem 2 in section 1.3. χ(G) ≤ 2 if and only if G does not contain any circuit of odd length.
(Reason: A graph is bipartite if and only if it has a 2-colouring.)
Brooks’ theorem (theorem 2 in Tucker). If G is not an odd circuit or a Kn , then χ(G) ≤ d, where d is
the maximum degree in G.
Note that if G is an odd circuit, then χ(G) = 3, and also χ(Kn ) = n, in both cases one more than
the maximum degree.
4.4.1 “The graph needs at least k colours, because I used k colours in a colouring”
When you have found a k-colouring, the only thing you may conclude is that χ(G) ≤ k, that is, the
chromatic number is k or less, in other words, at most k colours are needed.
If you want to find a lower bound, that is χ(G) ≥ k, by using the technique of forced colours, as in example 2
in section 2.3 in Tucker, you have to make sure that in each step of your k-colouring you are forced to do
only one thing (otherwise you will have to consider separate cases, which will quickly turn into a huge job).
Study unit 5
Trees
Trees are important special graphs, and are used extensively in computer science. Again we only consider
their basic properties and a few applications.
5.1 Source
– tree
– root
– rooted tree
– the level number of a vertex in a rooted tree
– the parent of a vertex in a rooted tree
– the children of a vertex in a rooted tree
– the leaves of a rooted tree
– the internal vertices of a rooted tree
– binary tree, ternary tree, m-ary tree
– the height of a rooted tree
– a balanced rooted tree
– spanning tree
– breadth-first spanning tree
– depth-first spanning tree
– breadth-first search
– depth-first search
– preorder traversal
– postorder traversal
– inorder traversal
• you should know the following theorems (and the proofs only where indicated):
Note the definitions of level number, parent, children and siblings (all applying to rooted trees).
Study Theorem 1 and its proof.
Study the basic Theorem 2 and its proof.
Note the definitions of leaves and internal vertices (applying to rooted trees), and of m-ary trees (also called
a binary tree if m = 2 and a ternary tree if m = 3).
Study theorem 3 and its corollary and their proofs. Note that in the corollary it is really not necessary
to learn all those formulas. Any one of them can be calculated from the two formulas n = mi + 1 (of
theorem 3) and n = l + i.
Study examples 1 and 2 which provide non-serious applications, but are useful to make sure you understand
the theory you have learnt so far.
Note the definitions of the height of a rooted tree, and of a balanced rooted tree. Study theorem 4. Note the
notation ⌈·⌉ used there. In general ⌈x⌉ is the ceiling of x, that is, x rounded up1 , for example ⌈5/2⌉ = 3,
⌈2⌉ = 2, and ⌈−1/2⌉ = 0.
Similarly, ⌊x⌋ is the floor of x, i.e. x rounded down, e.g. ⌊5/2⌋ = 2, ⌊2⌋ = 2, and ⌊−1/2⌋ = −1. This notation is used very
1
not 5.
37 MAT3707/1
Study unit 6
You will recall that, according to Cayley’s theorem (study unit 5), a complete graph on n vertices has nn−2
spanning trees. Suppose that we label each edge of Kn with a number, indicating the cost of connecting
the two vertices. If we attempted to find a spanning tree with minimum total cost by checking each of the
nn−2 spanning trees, this could take a very long time, even for a computer. For example,
2020−2 = 262144000000000000000000.
Fortunately, there are two very efficient ways to find a spanning tree of minimum total cost: Kruskal’s
algorithm and Prim’s algorithm. Such as spanning tree is called a minimal spanning tree.
6.1 Source
– network
– minimal spanning tree
• you should know the following theorems (and the proofs only where indicated):
The definition of a network is in Section 4.1, so we repeat it here. A network (also called a weighted
graph) is a graph with a positive number assigned to each edge. In Tucker these numbers are assumed to
be integers, which is important in Section 4.1, but in the context of minimal spanning trees they may be
any positive real numbers.
38
Study the definition of a minimal spanning tree. Study both Kruskal’s algorithm and Prim’s algorithm for
finding a minimal spanning tree in a network; they are extremely easy to apply. In fact, both algorithms
are examples of greedy algorithms, which seek short-term gain. This is one of the rare instances where
greedy algorithms really work.
Example 1 illustrates both algorithms.
Since this is one of the rare instances where a greedy algorithm solves the problem, it is worth looking at
its proof of correctness. Therefore study theorem 1 and its proof carefully.
6.4.2 Not realizing that a problem asks for a minimal spanning tree
Sometimes the following type of problem is given:
The towns A to L, shown in the map below, have to be joined by a fibre optic cable network.
A B C D
8 1 2
2 3 1 4
E F G H
2 5 4
2 6 1 1
5 5 5
I J K L
You may only install lines along the roads shown on the map. Assume that the cost of installing
a line between two adjacent towns is as shown on the map. Find a cheapest network intercon-
necting all the towns (ie every town must be connected to every other town, possibly via some
other towns).
Students often incorrectly think that they have to find a path connecting the towns in some order. Since
“every town must be connected to every other town, possibly via some other towns,” any two vertices must
be joined with some path. You therefore have to find a connected subgraph of the given graph. Secondly,
since you have to find a cheapest one, there should not be any circuits in your solution. If there is a circuit,
you may remove one of the edges, whereby the subgraph will stay connected and become cheaper. You
therefore have to find a connected, circuit-free subgraph (thus a tree) connecting all vertices, that is, a
spanning tree. Since it has to minimize cost, it must be a minimal spanning tree. (You may now solve the
given problem as an exercise.)
39 MAT3707/1
Part II
ENUMERATIVE COMBINATORICS
40
42
Study unit 7
Basic counting
In this study unit we consider various ways of calculating the number of elements in some given set.
Ironically, mathematicians still refer to this as counting, although the whole point of this theory is to find
ways to count, without really counting. For example, as you probably know already, the number of ways
that 10 people can sit in a row is
10! = 10 · 9 · 8 · 7 · 6 · 5 · 4 · 3 · 2 · 1 = 3628800,
something that you would not want to discover by actually listing all possible ways and then counting them!
The techniques that we shall consider do not really form a nice theory as calculus does. Later (in study
unit 9) we’ll consider a more systematic method (that will also require more effort). The golden rule for
this study unit is:
7.1 Source
• you should know the following theorems (and the proofs only where indicated):
– solve simple counting problems using the multiplication and addition principles
– determine the number of r-permutations and r-combinations of a set of n distinct objects
– solve counting problems involving permutations and combinations
– determine the number of arrangements of n objects (with repetition), where ri is of type i
(i = 1, . . . , m), n = r1 + r2 + · · · + rm
– determine the number of selections with repetition of r objects chosen from n types of objects
– solve counting problems involving arrangements and selections with repetition
– solve counting problems involving distributions of r distinct objects in n different containers
– solve counting problems involving distributions of r identical objects in n different containers
– determine the number of integer solutions to a linear equation in several variables with constraints
|2 × 2 ×
{z· · · × 2} = 2 = 1024.
10
10 times
The important thing to remember here is that at each stage, the number of possibilities must not depend
on what has happened in the previous stages.
Study examples 1 and 2.
Example 3 is important. Pay special attention to (d), which demonstrates how one can make a mistake
with the multiplication principle.
Finally, look at example 4.
Let us count the number of binary sequences of length n. A binary sequence (also called a binary string)
is a sequence of length n, with each value a 0 or a 1. For example, 10010 is a binary sequence of length
5 (it is not necessary to write commas as with sequences of real numbers). When counting the number of
binary sequences of length n, we have to think of how to construct such a sequence step by step. There
are n positions. In each one of them we place a 0 or a 1. We do this for the first position (2 ways), for the
44
second position (2 ways), . . . , for the nth position (2 ways). According to the multiplication principle, the
number of ways is
2| × 2 ×
{z· · · × 2} = 2 .
n
n times
and ( )
n n!
= ,
r r!(n − r)!
and how these formulas are derived. (In fact, if you make sure you understand how these formulas are
calculated, then you can always recalculate them if you have forgotten them.)
Study examples 1 to 5. Look closely at the example of a mistake in example 5(d) (overcounting).
As far as example 4 is concerned, we don’t expect you to know how to play the game of poker, but we do
expect you to know the different cards in a pack of cards. Each card has one of 13 values:
Study example 1. The important thing to remember is that when you calculate the number of arrangements
of n objects, yet not all of them are different, then you do this by choosing the positions for each type of
( )
object. Thus the answer is a product of terms of the form ab ; see theorem 1. Study the first proof, which
is the clearest one. Make sure that you know why
( )( ) ( )
n n − r1 n − r1 − r2 − · · · − rm−1 n!
... = .
r1 r2 rm r1 !r2 ! . . . rm !
( )
(Write out the left-hand side using the formula ab = b!(a−b)!
a!
, and cancel out some of the terms.)
45 MAT3707/1
An important special case to remember is the number of binary strings of length n which have r 0’s. To
( )
count them, you first choose the positions of the r 0’s: nr ways. Then you choose the positions of the n − r
( ) (n ) ( )
1’s out of the remaining n − r positions: n−r
n−r = 1 way. Thus the number of ways is r ( · 1 = nr .
)
(Note: By first choosing the n − r positions of the 1’s out of the n positions, we obtain n−r n
. These two
(n) ( n )
expressions must therefore be equal: r = n−r .)
Study example 2. This is just like arrangements with repetition, except that we disregard the order. Study
theorem 2 and its proof. Note that in the proof each selection of r objects from n types is modelled as a
sequence of n − 1 slashes and r x’es. You may just as easily think of a binary string: n − 1 1’s and r 0’s,
( )
thus of length r + n − 1. The number of such binary strings is n+r−1r , as we have already noted above.
Study the following examples, examples 3 to 8. Note that although Tucker just refers to theorem 1 or
theorem 2 whenever he needs a formula, it is good exercise to rederive the formula in each problem you do.
For example, when determining the number of arrangements of 2 A’s, 4 B’s and 6 C’s, you choose the 2
( )
positions of the A’s among 2 + 4 + 6 = 12 possible positions: 12 2 ways; then you choose the 4 positions of
(10)
the B’s from 12 − 2 = 10 remaining positions: 4 ways; and finally you choose the positions of the 6 C’s
()
from the 6 remaining positions in just 66 = 1 way. According to the multiplication principle, the number
of ways is
( )( )( )
12 10 6
2 4 6
12! 10! 6!
=
2!10! 4!6! 6!0!
12!
= ,
2!4!6!
and it was not necessary to recall the complicated formula in theorem 1.
The multiplication principle is used when you are constructing the objects you are counting step-by-step.
Consider the following example.
In a video shop there are 9 comedies and 9 thrillers to choose from. You want to rent one
comedy and one thriller. In how many ways can you do this?
The answer is not 9 + 9. This would be the number of ways you may choose a single video (since there
are 18 of them, according to the addition principle, and we are assuming a movie cannot be both a comedy
and a thriller).
The question asks for the number of ways of choosing a pair of videos. If we label the comedies by
A, B, C, . . . , I and the thrillers 1, 2, 3, . . . , 9, then we may write down a selection in the form of A3 or G8,
etc. Thus we have to determine the number of such pairs. We do this by constructing such a pair. There are
two positions. There are 9 choices for the first position. Then we choose the value for the second position
which also has 9 choices. Because this is a successive construction, we use the multiplication principle, and
the correct answer is 9 × 9 = 92 .
You can double-check this answer by making a list of all such pairs:
A1, A2, A3, A4, A5, A6, A7, A8, A9
B1, B2, B3, B4, B5, B6, B7, B8, B9
C1, C2, C3, C4, C5, C6, C7, C8, C9
D1, D2, D3, D4, D5, D6, D7, D8, D9
E1, E2, E3, E4, E5, E6, E7, E8, E9
F 1, F 2, F 3, F 4, F 5, F 6, F 7, F 8, F9
G1, G2, G3, G4, G5, G6, G7, G8, G9
H1, H2, H3, H4, H5, H6, H7, H8, H9
I1, I2, I3, I4, I5, I6, I7, I8, I9,
which is clearly 9 × 9, and not 9 + 9. Of course, making such a list goes against common sense and against
the principle of this study unit, which is to count without really counting. This list is presented only to
make it clear to you that the answer is not 9 + 9.
7.4.2 Using the multiplication principle when the number of outcomes in some stage
depends on what has happened previously
See example 4(d) in section 5.1 in Tucker.
7.4.4 Overcounting
See example 5(d) in section 5.2 in Tucker.
47 MAT3707/1
Study unit 8
Binomial identities
A large part of combinatorics is concerned with identities involving expressions coming from counting
problems. Sometimes such identities can be proved algebraically, but a more insightful proof is given when
one can present a counting argument. This is best demonstrated by a simple example:
(n) ( n
)
Prove that r = n−r .
( )
Solution I, using algebra: We use the formula for nr . The left-hand side is
( )
n n!
= ,
r r!(n − r)!
and, similarly, the right-hand side is
( )
n n! n!
= = .
n−r (n − r)!(n − (n − r))! (n − r)!r!
Thus the left-hand and right-hand sides are equal.
Solution, II using combinatorial reasoning: The left-hand side is the number of r-combinations of a
set of n distinct objects. The right-hand side is the number of (n − r)-combinations of a set of n distinct
objects. However, choosing the r objects in an r-combination is the same as choosing the n − r objects not
in the combination. Thus there are an equal number of each.
This second solution therefore follows the principle of counting without counting—we have proved that two
things are equal, without making a calculation.
8.1 Source
– binomial coefficient
– binomial theorem
– Pascal’s triangle
48
• you should know the following theorems (and the proofs only where indicated):
– prove identities such as identities (2) to (12) in Tucker using the block walking model and the
committee selection model
– prove identities such as (6), (13) and (13′ ) in Tucker using the binomial theorem
– prove identities such as (13) and (14′ ) in Tucker using a combination of the binomial theorem
and differentiation
– prove further identities by manipulating them so that they become identities involving binomial
coefficients
The first identity deduced in this section is an algebraic identity called the binomial theorem. The proof
works by counting the number of terms of the form an−k xk when
(a + x)n = (a + x)(a + x) . . . (a + x)
is expanded. This number is the number of sequences of a and x of length n, with k x’s. We already know
( )
that this is nk . Thus
( ) ( ) ( ) ( )
n n n n−1 n n−2 2 n n
(a + x)n = a + a x+ a x + ··· + x
0 1 2 n
∑n ( )
n n−k k
= a x .
k
k=0
Although Tucker calls this identity where a = 1 the binomial theorem, it is in fact the above expansion of
(a + x)n which is usually considered to be the binomial theorem. The expression a + x in parentheses has
two terms, and is therefore called a binomial. This is why the identity is called the binomial theorem, and
( )
why the coefficients nk occurring in the theorem are called binomial coefficients.
The proof of the binomial theorem is important. This idea of counting terms will be extremely important
later, when we do generating functions (study unit 9).
You can now already write down many identities just by plugging in various values for a and x; for example
identities (6) and (13) of this section.
The next two identities in this section are the two most important ones involving binomial coefficients—
identities (2) (already proved above in two ways) and (3). You can also, as an exercise, prove identity (3)
algebraically. Tucker gives a combinatorial proof of (3) in terms of choosing committees.
Also look at the combinatorial proof of identity (4) (and work out the algebraic proof as well).
Identity (5) is just a special case of (4), written in a different way.
( ) ( ) ( ) ( )
The next thing proved in the section is that for a fixed n, the sequence of binomial coefficients n0 , n1 , n2 , . . . , nn
increases as long as k ≤ n/2, and decreases as long as k ≥ 1 + n/2. When you look at the table of binomial
coefficients (also called Pascal’s triangle), you’ll see in each row how the values go up, and then down. Also
49 MAT3707/1
(n)
observe that when n is even, there is a single maximum n/2 , whereas if n is odd, there are two places
( n ) ( n )
where the maximum occurs—at (n−1)/2 and (n+1)/2 .
Make sure you understand how identity (3) is proved with the block-walking model of binomial coefficients.
Then some more identities are listed, namely identities (6) to (12). Proofs are then given for identities (6),
(8) (example 2) and (9) (example 3). Make sure that you can follow this type of reasoning, and that you
can prove all the identities (6)–(12) with the block walking model, and with the committee selection model.
In examples 4 and 5 some more (non-binomial) identities are proved, using binomial identities. The idea is
to rewrite the terms of the sum in each case in terms of binomial coefficients. Once that is done, one tries
to use the binomial identities.
Finally, you are shown how to use the binomial theorem to obtain some more identities—identities (6),
(13) and (13′ ). Note that (13′ ) follows from (13), using only algebra. Identity (13′ ) has a combinatorial
interpretation. The left-hand side is the sum of all r-combinations of n objects where r is even, and the
middle expression is the sum of all r-combinations where r is odd. Thus this identity says that in a set of
n objects the number of subsets of even size equals the number of subsets of odd size. (It is also possible
to prove this combinatorially—can you do it?)
Identities (14) and (14′ ) are obtained in a completely different way—not algebraically, and not combina-
torially, but by differentiation. Because the binomial theorem is an identity, if we consider both sides as
functions of x (defined on R), we have identical functions on both sides. So if we differentiate both sides,
we still have identical functions. Thus we differentiate both sides of
( ) ( ) ( ) ( )
n n n 2 n n
n
(1 + x) = + x+ x + ··· + x
0 1 2 n
to obtain ( ) ( ) ( )
n n n
n(1 + x) n−1
= + 2x + · · · + nxn−1 ,
1 2 n
and then substitute x = 1 to obtain
( ) ( ) ( )
n n n
n2 n−1
= +2 + ··· + n .
1 2 n
(You do not have to stop here—you can find more identities by differentiating twice, or three times, or by
integrating, etc.)
The most common mistake is making a mistake in counting (study unit 7). You should therefore make sure
that you understand the techniques explained in study unit 7 before attempting a combinatorial proof of a
binomial identity.
50
Study unit 9
Generating functions
Generating functions provide a unified way of solving various combinatorial problems by reducing them to
algebraic problems in terms of polynomials or power series. This is a very powerful and general method.
However, you’ll see that this is not a cure-all—very often the algebraic problem turns out to be extremely
difficult.
Besides solving counting problems, generating functions are also used to evaluate sums (section 6.5 in
Tucker), and for solving recurrence relations (in study unit 11).
9.1 Source
• you should know the following theorems (and the proofs only where indicated):
• The generating functions in this study unit are more properly called ordinary generating functions,
to distinguish them from exponential generating functions (study unit 10).
• Ordinary generating functions can be used to model the following problems:
– first of all, the number of integer solutions to a linear equation in several variables with constraints
– secondly, the two problems that we have previously (in study unit 7) see are equivalent to this—
selections with repetition, and the distribution of identical objects in distinct containers
– thirdly, the distribution of identical objects in identical containers (section 6.3).
If you want to model arrangements with repetition or the distribution of distinct objects in distinct
containers, you have to use exponential generating functions (study unit 10).
• If you want to solve a specific combinatorial problem with generating functions, you first have to
generalise it. For example, if you want to determine the number of selections with repetition of 10
objects from 20 types, you first have to set up the generating function for the number of selections
with repetition of r objects from 20 types, then find the coefficient ar , and finally substitute r = 10
into your answer.
e1 + e2 + e3 + · · · + en = r, ei ≥ 0,
52
( ) ( )
which we already know is r+n−1 r . Thus the coefficient is ar = r+n−1
r . (Note that in Tucker the constraints
are given incorrectly as ei ≤ 0.)
Finally, identity (6) is obtained by expanding
Study examples 1 to 5. They show how these identities are used to find coefficients.
Note that Tucker stops at the term rer , but there is no need to stop there, since the equation itself forces
er+1 = er+2 = · · · = 0. The generating function of this equation with an infinite sum on the left-hand side
is then an infinite product.
One can similarly find the generating functions of variations of this problem. Study examples 1 to 3.
You may skip the discussion of Ferrers diagrams, including example 4.
You may have observed that up to now no real formula has been given for the number of partitions of an
integer r, or for any of the related problems in examples 1 to 3. This is because there is no nice and simple
formula. There are approximate formulas, but they are very difficult to prove. In fact, partitions are still an
active area of research in number theory, with many unsolved problems. However, the generating functions
can be found and can be used to prove certain identities involving partitions (without knowing any exact
formula). Consider the following example:
Problem. Prove that the number of partitions of an integer into distinct parts equals the
number of partitions of an integer into odd parts.
8 = 1 + 7 = 2 + 6 = 3 + 5 = 1 + 2 + 5 = 1 + 3 + 4;
there are 6 of them (8 is a partition of itself into one part). Also, the partitions of 8 into odd parts are
1+7=3+5=1+1+3+3=1+1+1+5
= 1 + 1 + 1 + 1 + 1 + 3 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1,
also 6.
Solution. Let g(x) be the generating function of the number of partitions into distinct parts, and h(x)
the generating function of the number of partitions into odd parts. In example 1 g(x) has already been
determined:
g(x) = (1 + x)(1 + x2 )(1 + x3 )(1 + x4 ) · · · .
The generating function h(x) is easy to find:
1
h(x) =
(1 − x)(1 − x3 )(1 − x5 ) · · ·
53 MAT3707/1
(compare this with the generating function for the number of ordinary partitions, determined before exam-
ple 1 in Tucker). To solve the problem, it is sufficient to prove that g(x) = h(x). (Thus we have reduced the
combinatorial problem to an algebraic one.) In general, it can be tricky to prove that two infinite products
are equal. In this case, one way that will work is to prove that g(x)/h(x) = 1. We start calculating:
g(x)
= (1 + x)(1 + x2 )(1 + x3 )(1 + x4 ) · · ·
h(x)
·(1 − x)(1 − x3 )(1 − x5 ) · · ·
= (1 + x)(1 − x)(1 + x2 )(1 + x3 )(1 − x3 )(1 + x4 ) ·
·(1 + x5 )(1 − x5 ) · · · (rearrange terms)
= (1 − x2 )(1 + x2 )(1 − x6 )(1 + x4 )(1 − x10 )(1 + x6 ) ·
·(1 − x14 )(1 + x8 )(1 − x18 ) · · ·
= (1 − x2 )(1 + x2 )(1 + x4 )(1 + x6 )(1 − x6 )(1 + x8 ) ·
·(1 − x10 )(1 + x10 )(1 + x12 )(1 + x14 )(1 − x14 ) · · · (rearrange terms)
= (1 − x4 )(1 + x4 )(1 − x12 )(1 + x8 )(1 − x20 )(1 + x12 ) ·
·(1 − x28 )(1 + x16 )(1 − x36 )(1 + x20 ) · · ·
= (1 − x4 )(1 + x4 )(1 + x8 )(1 − x12 )(1 + x12 )(1 + x16 ) ·
·(1 − x20 )(1 + x20 )(1 + x24 )(1 − x28 )(1 + x28 ) · · · (rearrange terms)
= (1 − x )(1 + x )(1 − x )(1 + x )(1 − x )(1 + x ) ·
8 8 24 16 40 24
·(1 − x56 ) · · ·
.
= ..
and as you can see, the non-zero powers of x become larger and larger, or put differently, each non-zero
power of x eventually vanish. Thus the only term that remains eventually is 1.
In other words, g(x)/h(x) = 1, which solves the problem without us knowing the values of the coefficients.
In this section (ordinary) generating functions are used to calculate the values of certain sums. First note
the four rules given for constructing new generating functions from old ones. Then a fifth rule is given: the
generating function of rar is the derivative of the generating function of ar .
In examples 1 and 2 these rules are used to find the generating functions if ar is known. Then theorem 1
shows us how to construct the generating function of a1 + a2 + · · · + ar from the generating function of ar .
Thereafter examples 1 and 2 are continued, explaining how to use this theorem to evaluate two sums.
One usually has to do a lot of algebraic manipulation when working with generating functions. You should
not forget the simple algebraic rules. Now is the time to revise the exponent rules.
54
Study unit 10
They are called exponential generating functions, because the function ex frequently occurs (where e =
2.718281828459 . . . is the basis of the natural logarithms).
The same principle holds as for ordinary generating functions: first model the problem with a generating
function; then determine the coefficients of the generating function.
10.1 Source
Study the explanation of how exponential generating functions work. The important thing to remember is
that the combinatorial quantity ar is now the coefficient of xr /r!, not of xr .
56
Study examples 1 to 6. It is also important to learn the power series for ex (equation (3) in this section),
and to take note of equations (4), (5) and (6), which are easy to deduce from (3). (If you are familiar with
the hyperbolic trigonometric functions, note that (5) is the function cosh x and (6) the function sinh x;
however it is not necessary to know the hyperbolic trigonometric functions for this module.)
r! = r(r − 1)(r − 2) · · · 3 · 2 · 1.
Study unit 11
Recurrence relations
Recurrence relations are special forms of difference equations, which are the discrete analogues of differential
equations. (Recurrence relations are analogous to initial value problems in differential equations.) In this
study unit we first consider how to model certain problems with recurrence relations, and then how to solve
certain types of recurrence relations.
11.1 Source
– recurrence relation
– initial condition (of a recurrence relation)
– Fibonacci relation
– Fibonacci numbers
– linear recurrence relation
– first-order linear recurrence relation
– second-order linear recurrence relation
– linear recurrence relation of order r
– characteristic equation (of a linear recurrence relation)
– homogeneous recurrence relation
– inhomogeneous recurrence relation
– Catalan numbers
– the generalized binomial theorem
where r ≥ 1 and where c1 , c2 , . . . , cr are constants (ie they do not depend on n). The above recurrence
relation is of the order r. For example,
an = 4an−1
and
an = 2an−1 + 1
Theorem. Suppose that f (n) and g(n) are two solutions of the linear recurrence relation
Then, for any constants A and B the linear combination Af (n) + Bg(n) will again be a solution of (∗).
59 MAT3707/1
Proof. We are given that f (n) and g(n) are both solutions to (∗). This means that if we substitute an = f (n)
and an = g(n) then (∗) will be satisfied in each case:
f (n) = c1 f (n − 1) + c2 f (n − 2) + · · · + cr f (n − r) (11.1)
and
g(n) = c1 g(n − 1) + c2 g(n − 2) + · · · + cr g(n − r). (11.2)
Af (n) = c1 Af (n − 1) + c2 Af (n − 2) + · · · + cr Af (n − r)
and
Bg(n) = c1 Bg(n − 1) + c2 Bg(n − 2) + · · · + cr Bg(n − r).
Af (n) + Bg(n)
= c1 Af (n − 1) + c2 Af (n − 2) + · · · + cr Af (n − r)
+c1 Bg(n − 1) + c2 Bg(n − 2) + · · · + cr Bg(n − r)
= c1 (Af (n − 1) + Bg(n − 1))
+c2 (Af (n − 2) + Bg(n − 2)) + · · ·
+cr (Af (n − r) + Bg(n − r)),
Study the derivation of the characteristic equation in this section. Note that if the recurrence relation is
of order r, then the left-hand side of the characteristic equation will be a polynomial of degree r. If this
polynomial has roots α1 , α2 , . . . , αr , then, as explained in Tucker, each of α1n , α2n , . . . , αrn will be a solution
to the recurrence relation. From the above theorem on linear combinations, it follows that equation (5) in
section 7.3 also provides a solution to the linear recurrence relation. The constants A1 , . . . , Ar can then be
determined from the initial conditions of the recurrence relation. For a recurrence relation of order r there
must be r initial conditions, which gives r linear equations in r variables A1 , . . . , Ar which you can solve,
for example by Gaussian elimination.
Note that this will only work if all r solutions of the characteristic equation are distinct. If there is a
repeated root α, say α1 = α2 = · · · = αm = α, then you have to replace each of the terms Ai αn with
Ai ni−1 αn , that is, instead of having A1 αn + A2 αn + · · · + Am αn + Am+1 αm+1 + · · · in equation (5), you
must have
A1 αn + A2 nαn + A3 n2 αn + · · · + Am nm−1 αn + Am+1 αm+1 + · · · .
Study examples 1 to 4, all of which illustrate how to solve linear recurrence relations. In example 3 a
formula is found for the Fibonacci numbers. In example 4 we see what happens if there are multiple roots.
It goes without saying that in this section you should be able to find the roots of polynomials of low degree,
especially quadratic polynomials ax2 + bx + c:
√
−b ± b2 − 4ac
x= .
2a
60
• find the general solution of the associated linear recurrence relation (i.e. without the term depending
only on n)
• find any particular solution to the original inhomogeneous relation (this is usually done using gener-
ating functions; see the next section)
• then add these two solutions together, to find a general solution to the inhomogeneous relation
Secondly, in the special case of equation (2) in section 7.4 in Tucker, you can find a solution using iteration,
as explained there.
Study examples 1 to 3.
g(x) = a1 x + a2 x2 + a3 x3 + . . .
= (a0 x1 + 1x1 ) + (a1 x2 + 2x2 ) + (a2 x3 + 3x3 ) + . . . (2)
0 1 2 1 2 3
= x(a0 x + a1 x + a2 x + . . . ) + (1x + 2x + 3x + . . . ) (3)
= x(a0 x0 + a1 x1 + a2 x2 + . . . )
() () () ()
+ ( 01 x0 + 11 x1 + 21 x2 + 31 x3 + . . . ) (4)
x
= xg(x) + . (5)
(1 − x)2
If you get confused when using Σ notation, it is always a good idea to write the calculation out as above.
62
Study unit 12
The inclusion-exclusion formula is used to determine the number of elements in the union of sets, when
these sets are not disjoint (and thus when the addition principle cannot be used). This study unit considers
various combinatorial problems that can be solved using this formula.
12.1 Source
– derangement
• you should know the following theorems (and the proofs only where indicated):
– explain how the inclusion-exclusion formula is derived for two and three sets
– use the inclusion-exclusion formula to solve certain counting problems
A∪B∪C =A∩B∩C
A∩B∩C =A∪B∪C
The inclusion-exclusion formula has two equivalent forms. The second form counts the complement of the
first. For two sets these forms are
N (A ∪ B) = N (A) + N (B) − N (A ∩ B)
and
N (A ∩ B) = N − N (A) − N (B) + N (A ∩ B).
Also see equations (1) and (2) and the discussion preceding them in section 7.1. For three sets the two
forms are
∑
3 ∑
N (A1 ∪ A2 ∪ A3 ) = N (Ai ) − N (Ai ∩ Aj ) + N (A1 ∩ A2 ∩ A3 )
i=1 1≤i<j≤3
and
∑
3 ∑
N (A1 ∩ A2 ∩ A3 ) = N − N (Ai ) + N (Ai ∩ Aj ) − N (A1 ∩ A2 ∩ A3 ).
i=1 1≤i<j≤3
Also see equations (4) and (5) and the discussion preceding them in section 7.1. Make sure you understand
how these formulas are derived.
Study examples 1 to 5 to see how some standard problems are solved using inclusion-exclusion. Example 5
is especially important.
Also study example 6 that shows how to use a Venn diagram to solve a problem that doesn’t fit neatly into
the inclusion-exclusion formula.
In this section the general inclusion-exclusion formula is given in two forms: theorem 1 and its corollary. It
is not required of you to know their proofs. (However, if you are interested in studying the proof, note that
the binomial theorem must be applied.) You should, however, know how the inclusion-exclusion formula is
derived in the cases of two and three sets (section 8.1).
Study examples 1 to 5 carefully. Note the definition of derangement that is given after example 4.
Example 4 is a famous combinatorial problem. (In example 5 it is not necessary for you to know that this
is a chromatic polynomial.)
Skip theorem 2 and example 6.
64