Math222 Problems Solutions
Math222 Problems Solutions
Contributors:
Elise Marchessault
Ashna Wright
This work is licensed under the Creative Commons Attribution 4.0 International
License. To view a copy of this license, visit
http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons,
PO Box 1866, Mountain View, CA 94042, USA.
Acknowledgements
This work was made possible by an Open Educational Resource grant from the Divi-
sion of Learning and Teaching Support and Innovation at the University of Victoria.
Ideas for questions were taken from:
2 Graph Theory 15
2.1 Graphing Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2 Definitions and Basic Properties . . . . . . . . . . . . . . . . . . . . . 15
2.3 Isomorphisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.4 Eulerian Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.5 Hamiltonian Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.6 Trees and Their Properties . . . . . . . . . . . . . . . . . . . . . . . . 71
2.7 Planar Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
2.8 Colouring Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
2
6 Recurrence Relations 247
6.1 First-Order Linear Recurrence Relations . . . . . . . . . . . . . . . . 247
6.2 Second Order Linear Homogeneous Recurrence Relations with Con-
stant Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
3
1 Preliminaries
1.1 Sets
Questions:
2. Consider the sets A = {1, 2, 3}, B = {x, y}, and C = {u, v}. Let P(A) denote
the powerset of A. Find each of the following:
(a) P(A ∪ B)
(b) P(B × C)
(c) P(P(C))
(d) A × (B ∩ C)
(e) (A × B) × C
4. Prove or disprove: For the arbitrary sets A, B, and C, knowing that A ⊆ B and
A ⊆ C implies that A ⊆ B ∩ C.
1
5. Prove the following identity:
A × (B ∪ C) = (A × B) ∪ (A × C)
A ∩ B = A ∪ B.
2
Solutions:
2. The powerset of any set is the collection of all possible subsets of that set. With
∅ representing the empty set.
3
(d) B ∩ C = ∅.
A × (B ∩ C) = A × ∅ = ∅.
Note: The Cartesian product of any set with the empty set is always the
empty set.
(e) A × B = {(1, x), (1, y), (2, x), (2, y), (3, x), (3, y)}.
(A × B) × C = {((1, x), u), ((1, y), u), ((2, x), u), ((2, y), u), ((3, x), u), ((3,
y), u), ((1, x), v), ((1, y), v), ((2, x), v), ((2, y), v), ((3, x), v), ((3, y), v)}.
3. Suppose for contradiction that the empty set, ∅, is not a subset of some ar-
bitrary set, S. Then there exists some element in ∅ that is not in S, but by
definition there are no elements in ∅, a contradiction. Therefore ∅ is a subset of
every set.
4
(x, y) ∈ A × C.
Case 1: Suppose (x, y) ∈ A × B. Then x ∈ A and y ∈ B. Certainly y ∈ B ∪ C,
thus (x, y) ∈ A × (B ∪ C).
Case 2: Suppose (x, y) ∈ A × C. Then x ∈ A and y ∈ C. Certainly y ∈ C ∪ B,
thus (x, y) ∈ A × (C ∪ B).
Since we have proved that both sets are subsets of each other, we may conclude
equality.
7. (a) False. Consider this counterexample: Let A = {1, 2} and B = {a, b}.
A ∪ B = {1, 2, a, b}. Certainly {1, 2, a, b} ∈ P(A ∪ B), but {1, 2, a, b} ∈
/
P(A) ∪ P(B).
(b) True. We will show that P(A∩B) ⊆ P(A)∩P(B) and then P(A)∩P(B) ⊆
P(A ∩ B).
5
Suppose that x ∈ A ∩ B. This means x ∈
/ A ∩ B, so either x ∈ A and x ∈/ B,
x∈/ A and x ∈ B, or x ∈
/ A and x ∈
/ B. In symbols this precisely means that
x ∈ A ∪ B (draw a Venn-Diagram for yourself to clearly see this).
We may now conclude equality of the sets and the identity has been proved.
6
1.2 Relations and Graphs
Questions:
1. Given the relations, R, that are defined on the sets S, determine if R is reflexive,
symmetric, transitive, and/or antisymmetric. Explain your reasoning.
(a) Let S denote the set of all nonempty subsets of {a, b, c, d, e} and define
A R B to mean that A ∩ B = ∅, for A, B ⊆ S.
(b) Let S be the set of all residents in Victoria, B.C., and x R y means that x
is a friend of y.
Note: Assume that friendship goes both ways (i.e. if x is a friend of y,
then y is a friend of x).
(c) Let S be the set of ordered pairs of real numbers with (x1 , x2 ) R (y1 , y2 ) if
and only if x1 = y1 and x2 ≤ y2 .
(d) Let Q be any nonempty set with S = P(Q). For all
X, Y ∈ S, X R Y if and only if X ⊆ Y .
2. Prove that the following relations, R, defined on the sets S are equivalence
relations. Describe the equivalence class of z ∈ S, and determine the number
of total equivalence classes of R.
(a) Let S be the set of all positive integers. Let x R y if and only if x and
y have the same largest prime divisor. Describe the equivalence class of
z = 11.
(b) Let S be the set of ordered pairs of real numbers and define (x1 , x2 ) R
(y1 , y2 ) if and only if x21 + x22 = y12 + y22 . Describe the equivalence class of
z = (2, 5).
3. Draw a directed graph corresponding to the relation, R, on the set S = {1, 2, 3, 4, 5, 6}.
7
(b) R = {(1, 2), (2, 3), (5, 4), (1, 1), (6, 1), (2, 5), (5, 2), (3, 3)}
4. Write an equivalence relation on the set S = {1, 2, 3, 4, 5, 6} that has the subsets
{1, 3, 6}, {2, 5}, and {4} as the partition of its equivalence classes.
5. Given the set S = {{1}, {2}, {3}, {4}, {1, 2}, {1, 5}, {3, 6}, {4, 6}, {0, 3, 6},
{1, 5, 8}, {0, 3, 4, 6}} and the relation, R, being the is a subset of relation. Draw
a Hasse Diagram for this partial order.
6. Let S be the set of all integers and x R y if and only if x ≡ y (mod 5). Is R a
partial order? Explain why or why not. If R is a partial order, draw its Hasse
diagram.
(a) symmetric?
(b) antisymmetric?
Hint: Consider the k × k matrix, M . 1 in the ith row and j th column means
mi R mj , while 0 in the ith row and j th column denotes mi R mj . Count the
possibilities that will result in the matrix which represents the given relation.
b
8. Let S = N. If we define a R b to mean that a
∈ Z, is R antisymmetric?
8
Solutions:
Symmetric: Yes.
If A ∩ B = ∅, then B ∩ A = ∅ since A ∩ B = B ∩ A.
Transitive: No.
{a} ∩ {b, c} = ∅ and {b, c} ∩ {a, d} = ∅, but {a} ∩ {a, d} = {a} =
6 ∅.
Antisymmetric: No.
{a, b} ∩ {c, d} = ∅, but {c, d} ∩ {a, b} = ∅.
Symmetric: Yes.
If x is a friend of y, then y is a friend of x.
Transitive: No.
Suppose that x is a friend of y and y is a friend of z, this does not guarantee
that x and z are friends.
Antisymmetric: No.
Symmetric: No.
(1, 2) R (1, 3) since 2 ≤ 3, but (1, 3) R (1, 2) as 3 2.
Transitive: Yes.
Suppose (x1 , x2 ) R (y1 , y2 ) and (y1 , y2 ) R (z1 , z2 ). This means that x1 = y1
9
and y1 = z1 , so x1 = z1 . Also, x2 ≤ y2 and y2 ≤ z2 , so x2 ≤ z2 hence
(x1 , x2 ) R (z1 , z2 ).
Antisymmetric: Yes.
If (x1 , x2 ) R (y1 , y2 ) and (y1 , y2 ) R (x1 , x2 ), x2 ≤ y2 and y2 ≤ x2 , thus
x2 = y2 , hence (x1 , x2 ) = (y1 , y2 ) .
Symmetric: No.
If X ⊆ Y , then Y 6⊆ X unless X = Y (not necessarily the case).
Transitive: Yes.
Suppose that X ⊆ Y and Y ⊆ Z, then certainly X ⊆ Z.
Antisymmetric: Yes.
Suppose that X ⊆ Y and Y ⊆ X, then X = Y .
Symmetric: Yes.
If x has the same largest prime divisor as y, then y has the same largest
prime divisor as x.
Transitive: Yes.
Suppose that x and y share the same largest prime divisor, as well as y
and z. Then x and z share that largest prime divisor.
10
The equivalence class of z = 11 is [11] since 11 is prime. The other positive
integers in [11] are the positive integers whose largest prime divisor is 11.
Symmetric: Yes.
Suppose that x21 + x22 = y12 + y22 , then of course y12 + y22 = x21 + x22 .
Transitive: Yes.
Suppose x21 + x22 = y12 + y22 and y12 + y22 = z12 + z22 , then certainly x21 + x22 =
z12 + z22 .
There are infinitely many equivalence classes of R, one for each positive
real number that can be written as the sum of the squares of two real
numbers.
11
3. Hint: We put an arrow from x to y if x R y.
(a)
3 2
4 1
5 6
(b)
3 2
4 1
5 6
12
4. When determining this relation we must ensure that it is reflexive, symmetric
and transitive. Specifically every element in the same equivalence class must
have these properties with every other element in its equivalence class and with
no other elements.
R = {(1, 1), (3, 3), (6, 6), (1, 3), (3, 1), (1, 6), (6, 1), (3, 6), (6, 3), (2, 2), (5, 5), (2, 5),
(5, 2), (4, 4)}.
5.
Reflexive: Yes.
x ≡ x (mod 5).
Transitive: Yes.
Suppose x ≡ y (mod 5) and y ≡ z (mod 5), certainly x ≡ z (mod 5).
13
Antisymmetric: No.
0 ≡ 5 (mod 5) and 5 ≡ 0 (mod 5), but 0 6= 5.
k2 −k k(k+1)
7. (a) 2k · 2 2 =2 2 .
|M | = k 2 . There are k entries along the diagonal, which can have entry 0
or 1, 2k choices. For any entry in the lower triangle of M , it must match
in the corresponding upper triangle, therefore there are two choices, 1 or
2
0, for these k 2−k entries.
k(k−1)
(b) 2k · 3 2 .
There are 2k choices along the main diagonal. There are exactly three
disjoint possibilities for any entry, (mi , mj ), for i 6= j. Either (mi , mj ) is in
R, (mj , mi ) is in R, or neither of (mj , mi ), (mi , mj ) is in R. Once the lower
2
half triangle, k 2−k entires, has been assigned values the upper half will
be designated accordingly. Thus there are three options for these entries
k2 −k
which gives us 3 2 choices.
14
2 Graph Theory
2.1 Graphing Preliminaries
1. Draw the following graphs and determine how many edges each has.
(a) K4
(b) K3,2
(c) K1,5
(a) Kn ?
(b) Km,n ?
3. If a graph has five vertices of degree 4 and four vertices of degree 3, how many
edges does it have?
15
6. Let G be the following graph:
8. A graph has 26 vertices and 58 edges. There are five vertices of degree 4, six
vertices of degree 5, and seven vertices of degree 6. If the remaining vertices all
have the same degree, what is this degree?
9. A graph has 24 vertices and 30 edges. It has five vertices of degree 4, seven
pendant vertices, and seven vertices of degree 2. All other vertices have degree
3 or 4. How many vertices of degree 4 are there?
10. Use graph theory to explain why at any party an even number of people speak
to an odd number of people.
16
11. Can there exist a graph on 13 vertices and 31 edges, with three vertices of de-
gree 1, and seven vertices of degree 4? Explain.
12. Is the subgraph of a bipartite graph also bipartite? Would that change if bi-
partite graphs required edge sets to be non-empty? Explain.
13. If a graph G has 15 edges and all vertices of the same degree d, what are the
possible values of d? Describe briefly each graph.
14. Given the following degree sequences either construct a graph with such a degree
sequence, or explain why this would be impossible.
(a) 1, 1, 1, 1, 1, 1
(b) 5, 4, 3, 2, 1
(c) 6, 6, 4, 2, 2, 2, 2, 1
15. How many (simple) graphs are there with exactly n vertices?
16. What is the maximum number of vertices on a graph that has 35 edges and
every vertex has degree ≥ 3?
17. Suppose all vertices in a graph, G, have odd degree, k. Prove k divides |E(G)|.
18. The compliment of a graph, G, of order n, denoted G, has the same vertex set
as G with E(G) = E(Kn ) − E(G). If every vertex of G has an odd degree,
except for one, how many vertices have odd degree in G?
17
19. Construct a graph on five vertices with six edges such that there are no three
pairwise adjacent vertices (i.e. no triangles).
20. Using graph theory, explain whether or not it is possible for each person, in a
group of 15 individuals, to have exactly three friends. (Assume that friendship
is a symmetric relation, i.e. friendship goes both ways.)
21. Does there exist a graph where the degree of each vertex is even? Explain
22. Prove that it is impossible for every vertex of a graph to have a different degree.
23. Prove that if G is a graph with n vertices and n edges with no vertices of degree
0 or 1, then the degree of every vertex is 2.
18
Solutions:
1. (a)
K4 has 6 edges.
(b)
(c)
(n−1)(n)
2. (a) 2
edges.
This can be seen using the Euler’s Theorem. Each vertex in a Kn graph
19
has degree (n − 1). And so we have that:
n
X
(deg(vi )) = n · (n − 1) = 2 · |E|
i=1
n·(n−1)
Therefore, |E| = 2
.
(b) m · n edges.
2n · m = 2|E|,
hence
n · m = |E|.
|E| = 16.
4. (a) Impossible.
(b) Impossible.
20
By a corollary to Euler’s Theorem we know there must be an even number
of odd degree vertices.
(c) Impossible.
The only way to partition 5 vertices would either be with partite sets of
size 1 and 4, or partite sets of size 2 and 3. K1,4 has 1 · 4 = 4 edges, while
K2,3 has 2 · 3 = 6 edges. Neither complete bipartite graphs on 5 vertices
can have more than 6 edges, so 7 edges is not possible.
(d) There are several graphs with these properties, here is one:
6. (a) No.
21
7. Many such graphs exist, such as K4 itself. One possible graph is:
5 · 4 + 6 · 5 + 7 · 6 + 8 · x = 2 · 58,
5 + 7 + 7 + x + y = 24
5 · 4 + 7 · 1 + 7 · 2 + 3 · x + 4 · y = 3 · 30
22
We now have two equations with two unknowns and can solve this system of
equations. Isolating for x in the first equation, x = 5 − y, and substituting
it into the second equation, with some arithmetic we obtain y = 4. Therefore
there are exactly four vertices of degree 4.
10. This follows from Euler’s Theorem. Let us create a graph where each person is
represented by a vertex. We can represent two people ‘speaking’ by connecting
their respective vertices with an edge. Euler’s Theorem shows us that there
must be an even number of odd degree vertices in any graph (don’t forget that
zero is an even number). Thus, it follows that there must be an even number
of people at any party who speak to an odd number of people.
11. No.
By Euler’s Theorem, since this graph has 31 edges, the sum of its degrees must
be 62. There are 13 − 3 − 7 = 3 vertices with currently undetermined degree,
but we know that the sum of the degrees of these three vertices must equal
62 − 3 · 1 − 7 · 4 = 31. We are now left to determine three positive integers,
x1 , x2 , x3 , who sum to 31, which represent the degrees of the undetermined
vertices.
We know that in any graph there must be an even number of odd vertices
(currently there is an odd number of odd degree vertices), thus either one or
three of these vertices will have an odd degree.
Case 1: Suppose that only one of the three remaining vertices has odd degree,
say x1 , implying there are two vertices with even degree. We know that the
vertex of odd degree cannot be degree one or seven by the set up of the problem.
23
Case 1b: Suppose deg(x1 ) = 5, then 31 = 5 + x2 + x3 which implies that
one of the vertices of even degree will have degree ≥ 13. This is impossible
given the order of the graph.
Case 2: Suppose that all three of the remaining vertices have odd degree. One
of these vertices will have degree at least b 31
3
c = 11. Certainly no vertex of this
graph may be degree 13 since |V (G)| = 13. Thus one vertex must be degree 11,
say x1 . We know that:
31 = 11 + x2 + x3 ,
20 = x2 + x3 .
By this set up, x2 , x3 ≤ 10, thus their only possible degrees are three, five and
nine. Neither combination of two of these numbers adds up to 20.
Therefore there is no possible way for a graph with these parameters to exist.
12. Yes the subgraph of any bipartite graph is also bipartite, just keep the same
partite sets, or some subset of them, in the subgraph. This answer does not
change if we require non-empty edges sets since then there is just limited vari-
ation on the possible partite sets.
13. This graph G has 15 edges, so the sum of the degrees of the vertices must be
30.
24
If d = 3, the graph has order 10.
If d = 5, the graph has order 6 (K6 ).
These are the only possible cases. Remember that we are looking at simple
graphs so multiple edges exist nor can vertices be self-adjacent.
(b) Impossible.
There are an odd number of vertices with even degree (there are other
valid arguments).
(c) Impossible.
Notice that this graph has seven vertices, two of which have degree 6. This
graph would have two universal vertices, which means that the minimum
degree of any vertex must be 2, which is not the case.
n n(n−1)
15. 2( 2 ) = 2 2 .
25
We know a complete graph has n2 edges, so we can consider counting the num-
16. n = 23.
The number of vertices will be maximized by minimizing the degree of the ver-
tices.
2 · 35 = 3n.
We next try a graph where every vertex, but one, is degree 3. We see:
70 = 3(n − 1) + 4,
Which rearranges to give us n = 23 ∈ Z+ . Note that this means that there are
22 (an even number of) vertices of (odd) degree 3.
Pn
17. Suppose there are n vertices. By Euler’s Theorem, i=1 deg(vi ) = n · k =
2|E(G)|
2|E(G)|. We know n ∈ Z and k ∈ Z, therefore k divides |E(G)|.
18. n − 1.
All vertices of G, except one, have odd degree. To guarantee there are an even
number of odd degree vertices, n must be odd.
26
If the degree of a vertex in G is k, the degree of that same vertex in G is n−1−k.
n − 1 is certainly even as n is odd, therefore if k is odd, n − 1 − k is odd as well.
The vertex in G of even degree will still have an even degree in G by the same
argument. Thus, there are also n − 1 vertices of odd degree in G.
20. Impossible.
Let each person represent a vertex where an edge between two vertices denotes
friendship. Suppose each person has exactly three friends, meaning that the
degree of every vertex is 3. Euler’s Theorem tells us that there must always be
an even number of odd degree vertices, this set up has an odd number of odd
vertices which is not possible.
Kn , where n is odd, or any cycle are two such examples. (More exist, try to
find some more!)
27
22. Suppose our graph has n vertices. First we must notice that if a graph has a
vertex of degree 0, an isolated vertex, then there is no vertex of degree n − 1, an
universal vertex. Similarly a graph with a vertex of degree n − 1 cannot have a
vertex of degree 0. Therefore the degrees of the vertices of the given graph will
be a subset of either V1 = {0, 1, 2, ..., n − 2} or V2 = {1, 2, 3, ..., n − 1}. We can
see that |V1 | = |V2 | = n − 1, but there are n vertices we need to assign degrees
to, thus at least two of the vertices must share the same degree meaning it is
impossible for every vertex to have a different degree.
23. Let G be a graph with n vertices and n edges. By Euler’s Theorem we know,
n
X
deg(vi ) = 2 · |E(G)| = 2n.
i=1
Suppose for contradiction that there is at least one vertex with degree more
than 2. By Euler’s Theorem we see:
n
X
deg(vi ) ≥ 2(n − 1) + 3 > 2n,
i=1
a contradiction. Therefore we can conclude that the degree of every vertex must
be exactly 2.
28
2.3 Isomorphisms
Questions:
1. In your own words, what does it mean for two graphs to be isomorphic?
2. If G1 and G2 are isomorphic graphs then they have the same number of ver-
tices, the same number of edges, and the same degree sequence. What is the
converse of this statement, and is it true or false? If true, prove it. If false, find
a counterexample.
(a) n = 3
Hint: there are four such graphs.
(b) n = 4
Hint: there are 11 such graphs.
(c) n = 5 and connected
Hint: There are 21 such graphs
4. Show that every graph is isomorphic to the subgraph of some complete graph.
What is a necessary lower bound for the order of these complete graphs?
5. Prove that if two graphs are isomorphic, they must contain the same number
of triangles.
29
6. Given the following two graphs, write an explicit isomorphism between them.
f g u t
b c s r
a d p n
e h m q
7. Let the vertex set of a graph be the set of binary strings of length three. Edges
occur between vertices whose binary strings differ by exactly one digit. Show
that this graph is isomorphic to the graph formed by the corners and edges of
a cube.
(a) If two graph have the same number of vertices with the same quantity and
of order cycles, then they are isomorphic.
(b) Two isomorphic graphs must have the same number of edges and vertices.
(c) Two isomorphic graphs always look exactly the same.
(d) Isomorphism is an equivalence relation on all graphs.
(e) The degree sequence of two isomorphic graphs must be the same.
(f) K3,2 is isomorphic to C5 .
(g) K4,2 is isomorphic to K2,4 .
(h) If G contains no cycles, all graphs isomorphic to G also have no cycles.
30
9. Determine whether the following pairs of graphs are isomorphic. If they are
redraw one to look like the other, if not determine why.
(a)
3 2
c d f
4 1
a b e 5 6
(b)
a b c 2 3
d e 4 5
(c)
d 1 2
a b 3
c 4
31
(d)
a 1
b e 2 5
c d 3 4
(e)
c 3
d b 4 2
e a 5 1
f i 6 9
g h 7 8
32
Solutions:
More formally, two graphs, G and H, are isomorphic if there exists a bijection
between V (G) and V (H), f : V (G) −→ V (H), where uv ∈ E(G) if and only if
f (u)f (v) ∈ E(H). Isomorphism is denoted: G ∼
= H.
2. The converse of this statement is: ”If two graphs G1 and G2 have the same
number of vertices, same number of edges, and the same degree sequence, then
they are isomorphic”.
The above two graphs have the same number of vertices, edges and identical
degree sequences, but are not isomorphic since the leftmost graph has no five
cycles, while the rightmost graph has two.
33
3. (a)
(b)
34
(c)
35
36
4. Consider a graph, G, with n vertices. G is certainly isomorphic to some span-
ning subgraph of Kn since E(G) ⊆ E(Kn ), and V (G) = V (Kn ). G is also a
subgraph, although not spanning, of Kk for k > n. Therefore G is isomorphic
to some subgraph of every complete graph on least n vertices.
5. We prove this using the definition of isomorphism; if two graphs G and H are
isomorphic, there exists a bijection, f : V (G) −→ V (H), between them that
maintains adjacencies.
Suppose that G has a triangle with vertices a, b, c. The mapping of these ver-
tices to H maintain that they are all pairwise adjacent, that is f (a), f (b), f (c)
forms a triangle in H. Thus, each triangle in G corresponds to a triangle in H.
37
6. The following is a bijection between the vertices that maintains adjacencies:
a −→ m
b −→ n
c −→ p
d −→ q
e −→ r
f −→ s
g −→ t
h −→ u
Note: There are multiple correct solutions. Verify yours is correct by following
the isomorphism and attempting to draw this graph in the same form as the
other.
110 100
111 101
010 000
011 001
Since we have been able to draw the graph representing the length three binary
strings, as outlined by the question, as a cube we may conclude that it is indeed
isomorphic to the corners and edges of a cube.
38
8. (a) False.
(b) True.
(c) False.
(d) True.
Reflexive: Yes.
39
Any graph is certainly isomorphic to itself, just let the isomorphism be the
identity function.
Symmetric: Yes.
Suppose G ∼ = H, then there exists a mapping f : V (G) −→ V (H). By def-
inition, f is a bijection so there exists an inverse mapping, f −1 : V (H) −→
V (G), that maintains adjacencies, telling us that H ∼ = G.
Transitive: Yes.
Let us consider three graphs G, H, I with G ∼
= H and H ∼= I. We know
there exists a mapping from V (G) −→ V (H) that maintains adjacencies,
and similarly a mapping from V (H) −→ V (I). Composing these func-
tions we obtain the mapping: V (G) −→ V (H) −→ V (I) which maintains
adjacencies, hence G ∼
= I.
(e) True.
If this were not true, then it would not be possible to create a bijection
that maintains every adjacency.
(f) False.
The degree sequences of these two graphs are different! Two vertices in
K3,2 have degree 3, while all vertices in C5 have degree 2.
(g) True.
(h) True.
Let G ∼
= H. If H contains a cycle, in order to maintain all adjacencies in
40
G, G would contain a cycle too.
9. (a) Non-isomorphic.
The degree sequences differ. The graph on the left has two vertices of
degree 3, while the graph on the right has four vertices of degree 3.
(b) Non-isomorphic.
The graph on the right contains a vertex of degree 4, while the graph on
the left does not.
(c) Isomorphic.
Here is the rightmost graph drawn in the form of the leftmost graph:
2 3
(d) Isomorphic.
41
Here is the rightmost graph drawn in the form of the leftmost graph:
4 3
2 5
(e) Non-isomorphic.
The graph on the left has a triangle formed by vertices c, g, h while the
graph on the right is triangle-free.
42
10. There are exactly ten self-complementary graphs of order 8. Below is one such
example (verify for yourself that these two graphs are indeed isomorphic):
G:
c
d b
e a
f h
g
G:
d
g a
b f
e c
h
43
2.4 Eulerian Circuits
Questions:
2. Are the following graphs Eulerian? Does there exist an Eulerian trail?
Hint: Use the parity of the vertex degrees.
(a)
(b)
44
(c)
(d)
(e)
45
(f)
4. Explain how the Königsberg Bridge problem is directly related to the study of
Eulerian graphs.
5. Prove that there is a walk from vertex u to vertex v if and only if there is a uv
path.
Hint: Induction in one direction.
6. Find a graph of order 7 such that both G and G contain Eulerian circuits.
Hint: For every v ∈ V (G), degG (v) + degG (v) = 6.
(a) Any graph in which all vertices have even degree contains an Eulerian
circuit.
(b) A closed walk contains a cycle.
(c) A graph with multiple components can contain a Eulerian cycle.
46
(d) If a connected graph has n = 2k vertices, for some positive integer k, all
with odd degree, then there are k disjoint trails containing every edge.
11. If the following statement is true, prove it. If false, provide a counterexample.
All circuits of order n contain a cycle and any circuit that is not isomorphic to
Cn contains at least two cycles.
12. Define the relation, R, on the set of vertices of a graph, to be u R v if and only
if there exists a uv walk, where u, v ∈ V (G). Prove that R is an equivalence
relation on V (G).
14. Prove that if for a graph, G, of order 9 every pair of distinct vertices u, v ∈ V (G)
deg(v) + deg(u) ≥ 8 then G is connected.
15. If G is a connected graph on n vertices, what is the lower bound for the number
of edges G?
47
16. Show if vertices u and v belong to a circuit of G that after the removal of any
arbitrary edge of this circuit a uv trail will remain in the graph.
48
Solutions:
1. An Eulerian circuit is a trail that uses every edge exactly once and ends where
it began. A Eulerian trail is a trail that goes through every edge, but does not
necessarily end where it began.
2. (a) Neither an Eulerian circuit nor an Eulerian trail exist as there are more
than two vertices with odd degree.
(b) No Eulerian circuit exists but there exists an Eulerian trail as there are
exactly two odd degree vertices.
(c) Yes, there exists both a Eulerian circuit and a Eulerian trail as all vertices
are of degree 4, meaning all vertices are of even degree.
(d) Neither an Eulerian circuit nor an Eulerian trail exists as there are more
than two vertices with odd degree.
(e) Neither an Eulerian circuit nor an Eulerian trail exists as there are more
than two odd degree vertices.
(f) Neither an Eulerian circuit nor an Eulerian trail exists as there is only one
vertex with odd degree.
Both G and H are Eulerian so all of their vertices have even degree. Making
vertices from G and H adjacent will result in two odd degree vertices. There
will, however, exist a Eulerian trail.
4. Recall the Königsberg Bridge Problem: The city of Königsberg, Prussia, was
set on both sides of a river and included two large islands, all connected by
49
seven bridges. Is there a way to walk through the city crossing every bridge
exactly once while finishing where you started?
Let the land masses represent the vertices of a graph and bridges the edges.
Solving the problem boils down to finding an Eulerian Circuit in the graph.
5. Assume there exists a path from u to v. By definition, every path is also a walk,
hence we have identified a uv walk.
50
6. We must find a connected graph with all even vertices such that its complement
also has even degree and is connected.
7. (a) False.
This graph also must be connected with all vertices a non-zero, even degree.
(b) True.
(c) False.
51
An Eulerian circuit requires crossing every edge exactly once, but if there
are no edges between the components of the graph, there is no way to
reach every edge.
(d) True.
Consider pairing off the vertices of the graph (which we can do since there
are an even number of them), and add an edge between each pair of ver-
tices. Now the degree of every vertex is even and there exists an Eulerian
circuit. Removing the edges between the vertex pairs leaves us with k
disjoint trails that contain all the edges.
The m vertices in the first partite set have degree n, while the n vertices in the
second partite set all have degree m. Requiring both m, n to be even ensures
that all the vertices of the graph have even degree.
52
(b) For all odd values of n there will be a closed Eulerian trail (i.e. an Eulerian
circuit). The only open Eulerian trail occurs when n = 2.
11. True.
Suppose that C has a repeated vertex, say vi , for some i = 1, ..., n. We use a
similar strategy as the induction step from the proof of question 5 and identify
the v0 v0 path which is certainly a cycle. Now consider the part of our circuit
which starts and ends at the repeated vertex, vi (the part we ignored to form
the v0 v0 path). If this sub-circuit contains a repeated vertex, repeat the same
process as above, if not then it is a cycle and we are done.
Reflexive: Yes.
Consider the trivial walk from a vertex to itself.
Symmetric: Yes.
Suppose there exists a uv walk, then follow it in the opposite direction to find
a vu walk.
Transitive: Yes.
Suppose there is a uv walk and a vz walk. Consider first following the uv walk
and then continuing to z by the vz walk. This is a uz walk, as desired.
53
13. If G is connected then we are done.
Therefore our additional hypothesis that G was disconnected was false, hence
G is connected.
15. |E(G)| ≥ n − 1.
54
We can now remove n − 3 edges from the next vertex, n − 4 from the next,
and so on. Hence the maximum number of edges that can be removed without
disconnecting the graph is:
(n − 2)(n − 1)
(n − 2) + (n − 3) + ... + 2 + 1 =
2
Therefore the minimum number of edges required for the graph to be connected
is exactly:
(n)(n − 1) (n − 2)(n − 1)
− = n − 1.
2 2
16. Recall that in any given circuit, there must exist two trails between any given
pair of vertices. This is because there are two distinct ways of going around the
circuit.
u v
Thus, removing any single edge cannot destroy both trails, as there is no com-
mon edge between them, hence there still exists a uv trail.
55
2.5 Hamiltonian Cycles
Questions:
2. Which of the following graphs are Hamiltonian? If they are Hamiltonian identify
a Hamiltonian cycle. If they are not, explain briefly why.
(a)
56
(b)
(c)
57
(d)
(e)
58
(f)
(g)
3. Recall that Dirac’s Theorem states: if a graph G has at least 3 vertices such
that every vertex has degree at least n2 , then G is Hamiltonian. Show that
Dirac’s Theorem does not hold if the minimum degree requirement is reduced
to n−1
2
.
59
4. Does there exist a graph that is both Eulerian and Hamiltonian? If so, find one.
If not, explain why this is impossible.
n−1
6. Let G be a graph with at least 3 vertices and 2
+ 2 edges. Prove that G is
Hamiltonian.
10. Prove that if a cycle that begins and ends at vertex v goes through the vertex
w, then there exists a cycle that begins and ends with the vertex w.
60
11. Prove that if G is a connected bipartite graph, with a Hamiltonian path, the
orders of the partite sets differ by at most one.
13. Show that any cubic graph of order 6 is Hamiltonian. Try to do this without
using Ore’s or Dirac’s Theorem.
Hint: There are only two cubic graphs of order six.
14. Consider a cube. Identify a Hamiltonian cycle in the graph formed by its edges
and vertices.
61
Solutions:
1. (a) A Eulerian circuit is a circuit that uses every edge and vertex in the graph.
A Hamiltonian cycle is a cycle that uses every vertex. In a Eulerian circuit
it is possible to pass through some vertices multiple times while that is not
possible in a Hamiltonian cycle. Also, a Hamiltonian cycle may not visit
every edge while that is a requirement of a Eulerian circuit.
(b) A Eulerian trail is a trail that uses every edge and vertex. A Hamiltonian
path is a path that uses every vertex.
A Eulerian trail may visit the same vertex multiple times while a Hamil-
tonian path will not. A Hamiltonian path may not visit every edge in the
graph, while that is a requirement of Eulerian trail.
2. (a) This graph is not Hamiltonian. This is because removing either of the
vertices of degree 3 in the graph will disconnect it into two components.
In a Hamiltonian graph, the graph obtained by removing any non-
empty, proper subset of U of the vertices of the graph will have no more
than |U | components. This means removing a single vertex cannot
disconnect a Hamiltonian graph.
62
(c) Yes, many Hamiltonian cycles exist. One example is highlighted in red.
(d) Similar to part (a), removing any vertex of degree 3 will disconnect
the graph. This means the graph is not Hamiltonian.
(f) Similar to parts (a) and (d), it is possible to remove two vertices and
disconnect the graph into more than two parts, as shown below.
−→
63
3. The following graph is a sufficient counterexample.
64
4. Yes, many Hamiltonian and Eulerian graphs exist. The following is a simple
example:
5. We can use a graph to represent the relationships of the group, where represent
each person is represented with a vertex and each friendship with an edge.
By Dirac’s Theorem, this graph is Hamiltonian as every vertex will have degree
at least n2 . We can use a Hamiltonian cycle of the graph as the seating plan,
which will seat each person next to two friends.
65
This can be rearranged to find a lower limit on deg(u) + deg(v):
n−1 n−2
deg(v) + deg(u) ≥ +2−
2 2
(n − 1)(n − 2) − (n − 2)(n − 3)
deg(v) + deg(u) ≥ +2
2
deg(v) + deg(u) ≥ n
7. (a) False.
Consider the complete graph K4 . This graph contains many triangles but,
as with all complete graphs, is Hamiltonian.
(b) True.
This can be seen by simply deleting one edge from a Hamiltonian cycle of
the graph. This will leave a path that goes through every vertex, but is
not a cycle.
(c) True.
If there is a Hamiltonian path between any two vertices then graph is con-
nected. Take two adjacent vertices u and v. Add the edge connecting them
to the Hamiltonian path between them, which will create a Hamiltonian
cycle.
8. Notice that G has exactly two fewer edges than K13 , as the size of K13 is
13
2
= 78. This means the minimum possible degree of a vertex in G is 10, as
at most two edges from one vertex in K13 could be removed to obtain G.
66
G is Hamiltonian.
The graph is not necessarily Eulerian as G can be obtained from K13 by deleting
two edges in such a way that G has four vertices of degree 11.
Proof :
K1,1 cannot contain a Hamiltonian cycle as it is acyclic. So we consider when
m, n ≥ 2.
10. If a cycle beginning and ending at v contains w then the cycle will have a vertex
sequence {v, v1 , v2 , ..., vk−1 , w, vk , vk+1 , ...v}.
Thus, there exists edge-disjoint paths from v − w and w − v. We can put these
path together w − v + v − w. This will form a cycle that begins and ends with
w with a vertex sequence {w, vk , vk+1 , ...v, v1 , v2 , ..., vk−1 , w}.
11. Let us assume for a contradiction that there exists a Hamiltonian path in a
bipartite graph, G, where one partite set contains at least two vertices more
67
than the other. Let us call the partite sets A and B and assume without loss
of generality that |A| + 2 ≤ |B|.
68
13. Notice that there are only two unique cubic graphs of order 6. A Hamiltonian
cycle has been highlighted for each in red.
Thus, since both graphs are Hamiltonian it follows that all cubic graphs of order
6 are Hamiltonian.
14. Consider the cube below where the vertices are the corners of the cube and the
edges are the edges of the cube.
69
Highlighted below is one of several Hamiltonian cycles in red:
70
2.6 Trees and Their Properties
Questions:
1. Provide an example of a degree sequence of a tree with at least 3 vertices. Ex-
plain why this is a possible degree sequence.
(a) n = 4
Hint: There are exactly two.
(b) n = 5
Hint: There are exactly three.
(c) n = 6.
Hint: There are exactly six.
5. Does there exist a tree with a Hamiltonian trail? If yes, provide an example.
6. True or false: The subgraph of a tree is always a tree. Justify your answer.
7. A tree has 100 leaves, 20 vertices of degree 6, and half of the remaining vertices
have degree 4. The left over vertices are degree 2, how many vertices are of
degree 2?
71
8. A tree, T , with 35 vertices has 25 leaves, two vertices of degree 2, three vertices
of degree 4, two vertices of degree 6 and three vertices of degree x. Solve for x.
10. Let T be a tree. Suppose deg(v) ∈ {1, 5} for all vertices of T . If T has 25
vertices of degree 5, how many vertices does T have?
11. Let T be a tree with 21 vertices such that deg(v) ∈ {1, 3, 5, 6} for every vertex
of T . If T has 15 leaves and one vertex of degree 6, how many vertices with
degree 5 are in T ?
12. Prove that the deletion of any edge of a tree results in a disconnected graph.
What can we say about the components of this new graph?
13. Prove that any tree with more than two vertices is bipartite.
14. Explain why any tree with two vertices of degree 3 has at least four leaves.
15. What is a necessary and sufficient condition for a tree to be a complete bipartite
graph? Explain.
16. Determine a formula for the number of edges in a forest with order n and c
components.
72
17. Find a graph with five vertices and four edges that is not a tree. What specific
property of a tree fails?
18. Construct a tree with the following properties or explain why such a tree cannot
exist.
a c h
f g i
b e j
m k l
73
(a) Draw a spanning tree, T , of G that has two vertices of degree 6, or explain
why such a spanning subgraph does not exist.
(b) Find an induced 4-cycle of G, or explain why such a subgraph does not
exist.
74
Solutions:
1. Infinitely many possible degree sequences exist. If you can draw a tree with
your degree sequence then it is correct.
The sum of your degree sequence must be 2(n − 1), and there must be at least
two vertices of degree 1.
4. (a) n = 4 :
75
(b) n = 5 :
(c) n = 6 :
76
5. Yes.
6. False.
Consider the tree, P2 . Removing the only edge produces a disconnected sub-
graph which is clearly not a tree.
Let n denote the number of vertices of this tree and x the number of vertices
with degree 2 or 4. Thus, n = 100 + 20 + x. Applying Euler’s formula knowing
that our graph is a tree (|E| = n − 1), we obtain the equality:
1 1
100 + 20(6) + · 4x + · 2x = 2(n − 1)
2 2
Substituting n we get,
x
With basic arithmetic we get x = 18. There are 2
= 9 vertices of degree 2.
8. x = 5.
77
9. We proceed by induction on the order of the graph.
Base case: The graph with one vertex and no edges is the trivial tree.
which is a contradiction. Thus there must exist some vertex of degree 1, say u.
Now consider G − u, which is a connected graph with order k and size k − 1,
so by the induction hypothesis G − u is a tree. Readding the vertex u and its
single adjacency cannot form a new cycle, so G is a connected, acyclic graph
with k + 1 vertices and k edges and hence a tree.
78
11. There are two vertices of degree 5.
Let x represent the number of degree 5 vertices. Using Euler’s Theorem we see:
12. Suppose T is a tree on n vertices. Then we know that T has n − 1 edges and
is simultaneously connected and acyclic. Consider removing one edge of T , T
is no longer a tree since it has n − 2 edges and n vertices. The removal of this
edge certainly did not add a cycle, so the graph must be disconnected.
13. Consider a tree with at least three vertices. We know that a graph is bipartite
if and only if it contains no odd cycles, and that every tree is acyclic. Certainly
there are no odd cycles in a tree, so every such tree is bipartite.
14. Let T be a tree of order n with two vertices of degree 3. Let x be the number
of leaves of T . We know that there are n − x − 2 vertices that are not degree
1 or 3, these vertices will have degree at least 2. Applying Euler’s Theorem we
see:
2(n − 1) ≥ 2(3) + x + (n − x − 2)(2) = 2n − x + 2
15. A tree, T , is a complete bipartite graph if and only if T = K1,n for some positive
integer n.
We know that every tree has at least one leaf. The only way for a complete
79
bipartite graph to have vertices of degree 1 is if one of the partite sets has only
one vertex.
16. |E(G)| = n − c.
Let ci represent the number of vertices in the ith component of the forest, for
i = 1, ..., c. Certainly n = c1 + ... + cc , with each component is a tree, thus each
component has ci − 1 edges. The total number of edges in the forest is
c1 − 1 + c2 − 1 + ... + cc − 1 = n − c
17. There are many possible graphs satisfying these properties. If your graph is
disconnected or has a cycle then it is not a tree.
Consider the following disconnected cyclic graph on five vertices with four edges
that is not a tree:
In any tree,
n
X
(deg(vi )) = 2(n − 1)
i=1
80
(b) Impossible.
Here is one:
(d) Impossible.
Vertices f and g are the only vertices of G with degree 6. The appropriate
T would require all vertices adjacent to f and g. f and g share the neigh-
bour, m, hence the graph induced by vertices f, g and their neighbours
will create a triangle, meaning T was not a tree.
81
2.7 Planar Graphs
Questions:
Throughout this section we will use V to denote the number of vertices of the graph,
E the number of edges of the graph, and R the number of regions.
2. In your own words, define what it means for two graphs to be ‘homeomorphic’ ?
(a)
82
(b)
(c)
83
(d)
(e)
84
5. Let G be a connected, planar graph with at least 4 vertices. Prove that the
number of regions is bounded above by 2V − 4.
10. Let G be a planar graph where δ(G) ≥ 5. Show that G has at least 12 vertices.
11. Show that a connected, planar graph with order 22 has no more than 60 edges.
12. Determine if each statement is true or false. If true, provide a brief proof. If
false, find an explicit counterexample.
13. For each of the following values, determine whether there exists a corresponding
planar graph. If it exists, draw it. If not, explain why briefly.
85
(a) 7 vertices and 13 edges.
(b) 6 regions and 5 vertices.
(c) 8 vertices and 20 edges.
(d) 10 regions and 5 edges.
14. Does there exist a plane graph with 5 regions such that every region is bounded
by exactly four edges. Explain.
15. Prove if there exists a circuit in a planar graph that contains two regions, both
with an even number of boundary edges, then the circuit is of even length.
86
Solutions:
1. A graph is ‘planar’ if it can be drawn in the plane so that edges only intersect
at vertices. Any graph that is not planar is called ‘nonplanar’.
87
(c) This graph is planar, as shown in the redrawing below.
88
(e) This graph is nonplanar as it is homeomorphic to K3,3 , as shown below.
89
If follows then that:
V + R − 2 ≤ 3V − 6
R ≤ 2V − 4
If any region were bounded by more than 3 edges, then 2E > 3R. As this is
not true, it follows that every region is bounded by three edges. That is, each
region is a triangle.
For Kn where n = 1, 2, 3, 4 one can verify by hand that each graph is indeed
planar, as shown below.
K1 : K2 : K3 :
90
K4 :
If both m and n are greater than or equal to 3, then K3,3 will be a subgraph of
Km,n and so by Kuratowski’s theorem the graph will be nonplanar.
10. As the minimum degree of any vertex in G is 5, it follows from Euler’s Theorem
that: 5V ≤ 2E.
11. If G is a planar graph with V = 22, then we can apply Euler’s Planar Graph
Theorem. It follows that, E ≤ 3V − 6 = 3(22) − 6 = 60, as desired.
91
12. (a) False.
(b) True.
(c) True.
92
(d) True.
Notice that 2(11) − 6 = 27. Thus, if G has 28 or more edges we are done.
Let us suppose instead that G has no more than 27 edges. Then G at least
55 − 27 = 28 edges, and so is nonplanar.
13. (a) Such a graph does exist and has exactly 8 regions.
(b) Such a graph does exist and, using Euler’s Planar Graph Theorem, will
have exactly 9 edges.
93
(c) There is no such planar graph. We know that any planar graph with more
than 3 vertices will have an upper bound on size: E ≤ 3V − 6. This graph
however has 20 > 3(8) − 6 = 18 and so cannot be planar.
(d) There is no such planar graph. Suppose that there is such a plane graph,
then by Euler’s Planar Graph Theorem V − E + R = 2. It follows that
V = 2 − R + E = 2 − 10 + 5 < 0, which is impossible.
14. A graph that has 5 regions all bounded by 4 edges then we can sum the total
number of edges in the graph to see that 2E = 4R.
Since the graph is planar, we can use the upper bound on the number of edges:
E ≤ 3V − 6
E
≤ 3(2 + ) − 6
2
3E
≤
2
3E
≤
2
15. Suppose C is a circuit in a planar graph enclosing exactly two regions that each
have an even number of boundary edges. As G is planar, these two regions
must share exactly one edge. Therefore, C includes every edge of each region,
except the one that is shared. So, C includes an odd number of edges from the
both regions. The sum of two odd numbers is even hence the length of C is even.
94
2.8 Colouring Graphs
Questions:
1. Describe what is meant by “colouring a graph”.
3. Determine the chromatic number for the following graphs. Provide a brief
explanation.
(a) Kn .
(b) Km,n .
(e)
95
(f)
(g)
(h)
96
(i)
4. If the following is true, prove it. If false, provide a counterexample. Any graph
with n or n+1 vertices and exactly n edges has chromatic number at most three.
97
(h) If χ(G) = n, then G contains a subgraph isomorphic to Kn .
(a)
98
(b)
(a) A zoo plans to remodel by removing all cages and instead placing animals
in large, open, enclosed areas. Any animals that cannot live together in
harmony (i.e. a lion and a elk) must be put in different enclosures. The
zoo would like to determine the minimum number of enclosures needed so
that each animal can live peacefully.
(b) The English department is scheduling courses for the upcoming year. Each
student has made a list of the courses they would like to enrol in. The de-
partment would like to make a schedule so that every student can enrol in
all of their desired courses without conflict.
8. Explain why a graph with 8 vertices and 17 edges has chromatic number more
than two.
99
9. Use induction to prove that χ(G) + χ(G) ≤ n + 1, where n is the number of
vertices of G.
10. If the following is true, prove it. If false, provide an explicit counterexample.
If every region of a planar graph is bounded by an even number of edges, then
there exists a 2-colouring of the graph.
11. Prove that if a graph has at most two cycles of odd length then it can be
coloured with 3 colours.
12. Consider a colouring of a graph. What can you say about all vertices assigned
the same colour?
100
Solutions:
1. Colouring a graph refers to assigning every vertex of a graph colours such that
no adjacent vertices have the same colour.
2. If a graph can be coloured with exactly one colour then it follows that there are
no adjacent vertices in the graph. Hence, the graph is edge-less/empty.
3. (a) χ(Kn ) = n.
(b) χ(Km,n ) = 2.
Vertices are only adjacent to vertices in the opposite partite set. We can
colour every vertex in one partite set one colour, and a different colour for
every vertex in the other partite set.
See explanation for (b), the fact the graph was complete bipartite was ir-
relevant.
101
(e) χ(G) = 3.
This graph has a triangle, three mutually adjacent vertices, hence χ(G) ≥
3. Consider the following assignment of colours:
(f) χ(G) = 2.
102
(g) χ(G) = 4.
(h) χ(G) = 2.
103
(i) χ(G) = 4.
The graph has a 5-cycle and triangles hence χ(G) ≥ 3. We know colour-
ing the outer cycle will require three colours since 5 is odd. However, the
central vertex is adjacent to every vertex in the cycle so, χ(G) > 3.
4. False.
It has a K4 subgraph and so requires at least four colours, but it has 6 vertices
and 6 edges.
104
5. (a) False.
Every odd cycle with length n ≥ 3 has chromatic number 3 and no trian-
gles.
(b) False.
(c) True.
(d) False.
(e) False.
(f) True.
105
(g) False.
Consider K3,3 . This graph has chromatic number 2 ≥ 4, but is not planar.
(h) False.
(i) False.
All graphs with χ(G) ≤ 3 and order at least four can be coloured using
four colours, this colouring just may not be a minimum colouring.
(j) True.
(k) False.
K5 does not have a 3-colouring, but it also does not have a 4-colouring,
hence χ(G) 6= 4.
106
6. (a) Here is one such minimum edge colouring:
107
7. (a) Every animal represents a vertex. Two vertices are adjacent (i.e. there
is an edge) if these animals cannot live together peacefully. The vertices
assigned the same colour represent the animals that can live in the same
enclosure. The zoo is attempting to find the chromatic number of such a
graph.
(b) Let each course be a vertex, with two vertices adjacent if a student in-
dicates that they would like to enroll in both courses. Vertices assigned
the same colour represent courses that can run at the same time. Any
colouring of this graph will give the department such a schedule, however
the most efficient schedule would be indicated by the chromatic number of
the graph.
8. We know χ(G) > 1 since there is an edge. We also know a graph is bipartite if
and only if χ(G) = 2, so it will suffice to prove that G is not bipartite.
Suppose for contradiction that G is a bipartite graph with partite sets V and
U . Let |V | = x and |W | = 8 − x, with 1 ≤ x ≤ 7.
If x = 1 then K1,7 has 7 edges.
If x = 2 then K2,6 has 12 edges.
If x = 3 then K3,5 has 15 edges.
If x = 4 then K4,4 has 16 edges.
The graph we are considering has 17 edges and certainly is not bipartite since it
has more edges than any possible complete bipartite graph on 8 vertices. Hence
χ(G) > 2, as desired.
108
Base Case: n = 1. Certainly G = G with χ(G) = 1, therefore χ(G) + χ(G) =
2 ≤ 1 + 1.
Case 2: Suppose that G contains exactly one odd cycle, C. Then certainly
χ(G) > 2 as this graph is not bipartite. Consider removing an arbitrary ver-
tex u ∈ C from G, this would create a graph with no odd cycles. So, G − u
2-colourable. Adding u back to G would only require one additional colour, so
109
G is 3-colourable.
Case 3: Suppose G contains exactly two odd cycles, C1 and C2 , we now con-
sider two subcases:
We have now shown that all graphs with no more than two odd cycles are 3-
colourable.
12. There are no adjacent vertices within a set of vertices of the same colour.
110
3 Counting: Fundamental Topics
3.1 Basic Counting Principles
For each of your solutions, when appropriate, explicitly identify if you are using the
rule of sum, the rule of product, or both.
2. In which counting scenarios will you need to apply both the rule of sum and
product?
3. How many different licence plates with exactly 6 characters (numbers and low-
ercase letters) can be made given the following specifications?
(a) No restrictions. This plate can have any arrangement of digits and letters
and repetition is allowed.
(b) The first two characters are digits and the last four are letters. Repetition
is not allowed.
(c) The characters alternate between letters and digits and no digit may be
repeated.
(d) The license plate includes no more than one digit.
Hint: Consider all possible cases.
(e) The first character must be either “T” or 0 and the last character must be
either “J” or “Q”.
111
4. A university student is looking to take out a book on either frogs or fireflies
from their campus library. There are 45 books available covering frogs, and 13
discussing fireflies. How many books does this student have to choose from?
5. Joselyn stops by a sandwich shop on her way home from class. The shop sells
4 types of potato chips, 3 types of cookies, 7 different drinks and 10 different
sandwiches. She is interested in determining how many different ways there are
to order if she’d either like a drink and a cookie, or a meal which includes a
sandwich, a drink, and chips.
6. Two 6-sided dice, each of a different colour, are rolled. Determine how many
outcomes are possible.
7. How many nonempty sets of letters can be formed from 3 X’s and 5 Y’s?
Hint: As these are sets, the order of the letters is irrelevant.
(a) x is even?
(b) x contains exactly one digit 0?
(c) x has at least one repeated digit?
9. How many ternary sequences (sequences using only the digits 0,1, and 2) of
length 10 exist such that no consecutive digits are the same?
10. How many integers, x, between 100 and 999 are divisible by 5?
112
11. A palindrome is a word that has the same spelling when read forwards or back-
wards. Find the number of 7-letter palindromes.
12. Let A = {a1 , a2 , ..., am } and B = {b1 , b2 , ...bn }. How many functions
f : A → B are there such that:
13. How many functions are there from a set with 5 elements to a set with 3 ele-
ments?
14. How many different ways are there to answer a true or false test with 25 ques-
tions, assuming every question is answered?
15. The math department is hosting an event. They are randomly inviting one
professor and one student to give a speech together. If there are 1500 students
and 50 professors, how many different pairs could give a speech? What about
if only one person gives a speech and it could be a student or a professor?
16. If A = {1, 2, 3}, B = {a, b, c, d}, C = {α, β, γ, χ, λ}, how many distinct 3-tuples
are there in the set A × B × C?
17. Jamie is buying a combination lock to lock up her work-out gear at the gym.
Jamie would like to pick the most secure lock to protect her valuables. Lock
113
1 advertises that its combination is an ordered sequence of numbers between 1
and 35 such that the first number cannot be the third number. Lock 2 adver-
tises that its combination is an ordered sequence of 4 numbers between 1 and
25 where the first three numbers are all distinct and the fourth number must
be the same as one of the previous three numbers. Which lock should Jamie
purchase?
18. How many words (strings of letters) exist that are length 1, 2 or 3?
114
Solutions:
1. (a) The sum rule for multiple events is for events that are independent (i.e.
events/situations that cannot occur at the same time). If one event can
occur m ways, and the other event can occur in n ways, where both events
are independent, then the two events together can occur in m + n ways.
(b) The product rule for multiple events is for events that are happening in
sequence of one another, thus are not independent. For example, if one
event can occur in m ways and then another event follows and can occur
in n ways, then the sequence of these two events can occur in mn ways.
2. The product and sum rule are used together when a set of sequences of events
are occurring independently.
115
together to see there is a total of 26 · 10 · 26 · 9 · 26 · 8 = 12 654 720 licence
plates with this specification.
Now we consider the case when the plate begins with a digit and then
alternates. The counting is the same as multiplication is commutative.
Since these cases are disjoint there are 12 654 720+12 654 720 = 25 309 440
possible licence plates with this restriction.
The number of possible licence plates with exactly one digit is slightly more
complex. There are six possible places that the single digit can appear.
We can account for this by applying the six possible places the digit can go
to the choice of the digit. So for the digit there will be 6 · 10 possibilities.
The remaining five spots will all have a letter and so, in total, there are
6 · 10 · 265 possible licence plates with this restriction.
Thus, the total number of licence plates with at most one digit is 266 + 6 ·
10 · 265 = 1 021 798 336.
The plate can begin with “T” and end with “J”. There are no further
restrictions therefore for each of the four middle characters there are 36
options so there are 364 possible plates with this restriction.
116
Similarly, the plate can begin with “T” and end in “Q” and so there are
364 possible plates.
The number of possible plates in the other two remaining cases is the same:
the plate begins with 0 and ends with “J” or the plate begins with 0 and
ends with “Q”.
Therefore there are 364 +364 +364 +364 = 6 718 464 possible licence places
with these restrictions.
4. Rule of sum.
Since the student would like either a book on frogs or on fireflies there are
45 + 13 = 58 books to choose from.
There are 3 types of cookies and 7 drinks to choose from, so there are 3 · 7 = 21
possible combinations of a cookie and a drink.
In total Joselyn can order 21 + 210 = 231 possible combinations at the shop.
6. Rule of product.
As each die is a different colour, they are distinct. Let us assume the dice are
blue and red. This means rolling a 1 on the blue die and a 2 on the red die is
distinct from rolling a 2 on the blue die and a 1 on the red die.
117
On each die there are 6 options therefore there are 6×6 = 36 possible outcomes.
7. Rule of product.
Consider an ordered pair, (X, Y ) where 0 ≤ X ≤ 3 and 0 ≤ Y ≤ 5. Let the
ordered pair represent the number of X’s and Y ’s in the given non-empty set.
There are 4 possibilities for the value of X’s and 6 possibilities for the value
of Y ’s in the pair. In total there are 6 × 4 − 1 = 23 possible pairs. We must
subtract 1 because one of our pairs represents the empty set, (0, 0). Thus, there
are 22 possible non-empty sets.
The number of five digit numbers is 9 · 104 = 90 000. The number of five
digit numbers with no repeated digits is 9 · 9 · 8 · 7 · 6 = 27 216. Thus,
there are 90 000 − 27 216 = 62 784 five digit numbers that have at least
118
one repeated digit.
9. Rule of product.
The first digit in the sequence can be any of 0,1, or 2. Thus there are 3 pos-
sibilities. The second digit cannot be the same as the first digit. This means
there are 2 possibilities for it. Similarly, for each following digit they cannot be
the digit that proceeds them, meaning there are 2 possibilities. Therefore there
are 3 · 29 = 1 536 ternary strings with the required restriction.
The first digit of x can be any digit except 0. Thus there are 9 possibilities. The
second digit of x is any digit, thus there are 10 possibilities. Using the product
rule, there are 5 · 9 · 10 possible values of x.
(a) nm−1 · 1
This is because all elements in A have n possible possibilities, except f (a2 )
which has only one possibility – whatever was assigned to f (a1 ).
119
(b) 1 · nm−2 · n − 1
This is because all elements in A except f (a1 ), f (a2 ) are unrestricted. f (a1 )
must be b1 and so has only one possible value, while f (a2 ) can be any
element in B except b1 and so has n − 1 possible values.
(c) 3 · nm−1
This is because all elements in A, except f (a1 ), can be assigned to any
element in B and so have n options while f (a1 ) can only be one of three
possibilities.
(d) n · n − 1m−1
This is because whatever element is assigned to f (a1 ) cannot be assigned
to any other element. This means all elements but f (a1 ) have only n − 1
possible values in B.
(e) nm−1 · n − 1
This is similar to part b except f (a1 ) is not restricted.
120
16. Rule of product.
Each tuple will be of the form (a, b, c) where a ∈ A, b ∈ B and c ∈ C. The
number of possible options in the first position is 3, the number of possible
options in the second position is 4, and the number of possible options in the
last position is 5. Using the rule of product it follows that there are 3 · 4 · 5 = 60
distinct elements in A · B · C.
121
length 3. There are exactly 26 words of length 1, 262 words of length 2, and 263
words of length 3 as there are no restrictions on these words. Therefore there
are 26 + 262 + 263 = 18 278 words of length 1, 2 and 3.
122
3.3 Permutations
Questions:
2. Explain why the permute function requires distinct objects when counting.
3. How many different permutations of the word MATHS are there of length,
(a) 5?
(b) 3?
(c) If repetitions are allowed, how many different 10 letter ’words’ can we make
using the letters from MATHS?
4. How many different 6 letter permutations of the word COFFEE are there?
Hint: Be aware of repeated letters.
5. (a) You and seven friends dine at a circular table at a fancy restaurant. How
many different ways can the eight of you seat yourselves around this table?
6. There are 25 people competing in the school swim race including Nia, Andre,
and Katie.
(a) At the race, the first, second, third, fourth, and fifth fastest swimmers
receive medals. How many possible ways can these medals be distributed?
123
(b) How many possible ways can these medals be distributed if Nia, Andre,
and Katie always place in the top three positions?
7. A group of eight would sit in a row at the movie theater, how many ways can
arrange themselves if Andrew and Asiya refuse to sit beside each other?
9. Leora has 20 books in her room. Her three friends each want to borrow two
books from her. Tomorrow they’re all coming over to pick them up, in how
many different ways can Leora loan out the books such that the order she gives
each friend their books is the order in which they read them?
10. José lost the last two digits of his friend’s phone number. How many different
phone numbers will José potentially have to call before calling his friend?
11. How many 7-letter words, with no repeated letters, are there such that:
12. In a group of teenagers m of them are naturally brunette and n of them were
not born with brown hair. How many different ways can these teenagers be
arranged in a line such that the m brunette’s are all together?
124
13. Using the definition of a permutation, show that P (n, n) = n!.
14. Explain when you would use a permutation instead of the Rule of Product.
P (n + 1, 2) − P (n, 2) = 2 · P (n, 1)
17. A K-pop fan has 10 different posters to arrange (in a line) on their wall. Three
posters are from one band, four from a different group, and three from a third
group. How many ways can the posters be lined up such that posters from the
same group are together?
19. What if the functions from question 12, section 3.2, had to be one-to-one? What
must first be said about the cardinality of A and B?
20. (a) How many ways can the letters in BOOKKEEPER be rearranged?
(b) What if the E’s cannot be consecutive?
(c) What if the E’s had to be consecutive?
(d) What if the vowels had to occur consecutively?
125
Solutions:
1. A permutation is a linearly ordered arrangement of distinct objects.
3. (a) 120.
(b) 60.
(c) 510 .
There are ten letter positions available, with 5 options for each letter, so
there are 510 such words.
4. 20.
There are six letters and two pairs of two repeating letters (double E’s and
6!
double O’s), hence there are 2!2! = 20 possible permutations.
5. (a) 5 040.
126
We avoid having potentially the same arrangement in different spots around
the table by fixing one person and then arranging those around them, which
gives 7! = 5 040 choices.
(b) 1 440.
If two people insist on sitting together, we begin by fixing their seats to-
gether then arrange the remaining six friends, 6! = 720. For the two
individuals sitting together, we are unsure who will be on the left versus
right, so we multiply by two to account for the two possibilities of their
positions. All together there are 6! · 2 = 1 440 ways to seat everyone.
(b) 2 772
There are P (3, 3) = 3! ways to place Nia, Andre, and Katie in the top
three positions. The remaining 2 positions can be filled in P (22, 2) ways.
Thus, using the rule of product there are P (3, 3) · P (22, 2) = 2772 ways for
the medals to be given out.
7. 30 240.
We begin by sitting the six individuals who are not Andrew or Asiya, there are
P (6, 6) ways to do this. To guarantee Andrew and Asiya are not beside each
other, they will either sit on an end or between two other friends. There are
five seats between friends and two on the ends, which gives seven possible seats
127
for Andrew and Asiya thus P (7, 2) choices. By applying the Rule of Product it
follows that there are P (7, 2) · P (6, 6) = 30 240 ways to seat the group.
8. 1 440.
We only consider numbers less than 6 000 000, thus the only possible first digits
are ≤ 5. There are four options for the first digit, and the remaining digits can
go in any order, 6! = 720 options. We must divide by 2 to account for the two
identical 4’s in the set. Hence there are 4·6!
2!
= 2 · 6! = 1 440 possible numbers
possible.
9. 27 907 200.
10. 100.
José has ten possibilities for one of the lost digits and another ten for the second
lost digit. By the Rule of Product there are 102 = 100 possible phone numbers
he will have to call before calling his friend.
128
We begin by placing the T in one of the 7 spots and arranging the other
six letters around it. There are P (25, 6) ways to assign the six letters that
aren’t T , and seven positions the T can be placed. By the Rule of Product
there are 7 · P (25, 6) = 892 584 000 such words.
There is only one option in the assignment of the first letter, A, only in
the ordered arrangement of the remaining six letters selected from the re-
maining 25 from the alphabet, which makes P (25, 6) = 127 512 000 words.
We first pick whether the word has X or Y , two choices, and then place
it in one of the seven spots, seven options. Now we arrange the remaining
six letters which are picked from the 24 possible letters (since exactly one
of X and Y is used), P (24, 6) possibilities. By the Rule of Product there
are 7 · 2 · P (24, 6) = 1 356 727 680 such words.
Let us consider the m brunette’s to be one distinct object. We now must ar-
range n+1 individuals into a line which yields P (n+1, n+1) = (n+1)! possible
arrangements. Within the single ‘object’ of brunettes, there are P (m, m) = m!
ways to arrange the brunette individuals. By the Rule of Product there are are
m!(n + 1)! such arrangements.
n! n! n!
P (n, n) = = = = n!
(n − n)! 0! 1
129
14. The permutation function is one specific application of the product rule if you
are trying to determine the number of possible arrangements of k out of n dis-
tinct objects (k ≤ n). If this is not the specific case, count using the Rule of
Product.
16. We will use the definition of the permutation function to show this result:
Subtracting,
We see that,
n! n(n − 1)!
P (n, 1) = = = n,
(n − 1)! (n − 1)!
therefore 2P (n, 1) = 2n, as desired.
17. 5 184.
To start, we consider the posters for the same K-pop group to be a distinct
object, which reduces the problem to arranging three distinct objects in a line,
P (3, 3) = 3! possibilites. Now within each group of posters there are 3! ways to
arrange the first group’s posters within the line, 4! the second, an 3! the third.
130
By the Rule of Product there are (3!)3 · 4! = 5 184 ways to line up these posters.
18. 34 650.
For any arrangement with repeated objects, we know that we must divide by
the factorial of the number of repeated objects. In the word MISSISSIPPI there
11!
are four I’s, four S’s and two P’s, therefore in total there are 4!·4!·2! = 34 650
distinct permutations of this word.
19. |A| = m ≤ n = |B|, otherwise no one-to-one functions can exist between the
sets.
(a) 0.
(b) P (n − 1, m − 1).
3(n−1)!
(c) (n−m)!
.
There are three choices for f (a1 ), and the remaining m − 1 ai ’s must be
uniquely assigned to the n − 1 remaining bj ’s, P (n − 1, m − 1) options. The
3(n−1)!
Rule of Product yields, 3 · P (n − 1, m − 1) = (n−1−(m−1))! such one-to-one
functions.
131
(d) P (n, m).
We are permuting 10 letters, P (10, 10) = 10!, but O and K repeat twice
10!
and E thrice, so we must divide by 2!, 2, !, 3!. All together there are 2!2!3! =
151 200 distinct arrangements.
(b) 70 560.
We begin by placing the letters that are not E, there are seven of them
7!
so 2!2! , still accounting for the repeated letters, possible arrangements. We
now place the three E’s between (or on the outside) of the placed letters
to guarantee no E’s are consecutive. There are eight possible gaps to place
the E’s so there are P (8,3)
3!
ways to put the E’s in accounting for the fact that
they are identical. By the Rule of Product there are 2!2! 7!
· P (8,3)
3!
= 70 560
such arrangements.
(c) 10 080.
We can consider the E’s to be one letter since their arrangement is irrele-
vant as they are identical. Now we arrange the eight objects, dividing by
8!
2! · 2! since there are two O’s and K’s, hence 2!2! = 10 080 possibilities.
132
(d) 3 600.
We will group all the vowels together and consider them to be one distinct
5!
object. Within this object of vowels there are 2!·3! possible arrangements
since some vowels are repeated. We now arrange this block within the five
consonants, so there are P (6, 6) = 6! arrangements, but we must divide
by 2! to account for the identical K’s. By the Rule of Product there are
5!
· 6! = 3 600 such arrangements.
3!2! 2!
133
3.4 Combinations and the Binomial Theorem
Questions:
1. In your own words, explain the differences and similarities between a permuta-
tion and a combination and describe when each one is used.
3. The local college’s intramural basketball team accepts 21 players. This year 80
students tried out. They want to arbitrarily decide who to let on the team. In
each scenario, determine how many different possible teams there are.
134
forward, and 15 play power forward. The coach wants to ensure the team
has 5 people who play shooting guard and 4 people of every other position.
(f) There are 5 students who are graduating this year. The coach wants to
ensure at least 3 of them get to play.
6. (a) If there are 12 students in a class and the teacher would like to create
groups of 6, how many ways can the groups be arranged?
(b) What if two students refuse to work together?
7. Eli wakes up every morning and makes himself a smoothie with frozen fruit. He
picks 3 fruits everyday to make his smoothie with out of the 10 options types
of fruit in his freezer. He likes any combination of fruit in his smoothie except
banana with apple. How many ways are there for Eli to make his smoothie?
8. UVic is picking what first year math courses they should offer next year. They
can only offer both ‘Logic and Foundations’ and ‘Linear Algebra’ if they are
also offering ’Calculus 1‘. If there are 15 possible first year math courses and
they will offer 7 courses, how many different ways can they offer courses?
135
9. Robert is picking the group from his dance class to perform the opening act
at the upcoming show. The opening act will have 8 students out of a class of
20, how many possible groups of dancers are there given each of the following
scenarios:
Recall : A combinatorial proof is an arbitrary scenario where the same thing can
be counted two different ways.
136
13. Use the binomial theorem to efficiently expand the binomial:
(a) (x + y)n
(b) (3 − x)6
(c) (2x − 3y)7
(d) (4x + 7y)15
(a) (x + y)13
(b) (2x + y)13
(c) (4x − 3y)13
17. Using the binomial theorem, prove (1 + i)n + (1 − i)n is an integer for all n ≥ 0,
where i2 = −1.
137
18. Evaluate the following for all positive integers n:
Pn n
(a) k=0 6k k
Pn n n
(b) k=0 4 k
Pn k n−k n
(c) k=0 (−3) (2) k
Pn n
(d) k=0 6 k
Pn n−k n
(e) k=0 (−1) k
n!
n1 !n2 !···nm !
,
19. When is the multinomial theorem used instead of the binomial theorem?
(a) x2 yz in (x + y + z)4
(b) w2 x2 y 2 z 2 in (2w − x + 3y − 3z)8
(c) xyz in (3x − y − z)10
138
Solutions:
n!
The formula for permutation, P (n, r), is (n−r)! while the formula for combina-
n! P (n,r)
tion, C(n, r) is (n−r)!r! . Clearly, C(n, r) = r! which highlights that order is
irrelevant in a combination.
2. There are 69
26
5 1
= 292 201 338 possible tickets. Thus, the cost of buying all
the tickets is higher than the prize money and so it is not worth it to buy all
the tickets to ensure a win.
80
3. (a) 21
The coaches must form a team of 21 from 80 players. The order in which
the team is selected is irrelevant. So, there are exactly 80
21
possible teams.
40 40
(b) 10 11
First we choose the 10 first year students that make the team, then we
choose the remaining 11 spots from the remaining 40 students. Using the
product rule, multiply these together to see that there are 40
40
10 11
possible
teams.
78
(c) 19
The two highest scoring players are already guaranteed a position on the
team, so the remaining 18 players from the 78 other students who tried
out need to be selected. So, there are 78
19
poossible teams.
65 15
(d) 10 11
First, select the 11 returning students for the team and then 10 new stu-
dents. There are 65
15
10 11
possible teams with this structure.
139
20 15 10 20 15
(e) 4 5 4 4 4
First select the player who play centre position, then shooting guard, point
guard, small forward and finally power forward. Using the product rule, it
follows that there are 20
15 10 20 15
4 5 4 4 4
possible teams with this struc-
ture.
(f) 75
5
+ 75
5
+ 75
5
16 5 17 4 18 3
The cases we must consider are whether there are 3, 4 or, 5 graduating
students on the team. First, we select the number of graduating students
and then, using the product rule, we select the appropriate number of
remaining players.
Using the rule of sum, in total there are 75
5
+ 75
5
+ 75
5
16 5 17 4 18 3
possible
teams with this structure.
4. n = 91
n
= 2 672 670
4
n!
= 2 672 670
4!(n − 4)!
n(n − 1)(n − 2)(n − 3)
2 672 670 =
4!
2 672 670(4!) = n(n − 1)(n − 2)(n − 3)
2 672 670(4!) = n4 − 6n3 + 11n2 − 6n
0 = n4 − 6n3 + 11n2 − 6n − 2 672 670(4!)
140
13
5. 3
12
6. (a) 6
The order in which the students are chosen is irrelevant thus this is a
standard combination. So, there are 12
6
possible groups of six.
10 2
(b) 5 1
First, assign the two students who refuse to work together each to one of
the two groups. Then choose the remaining five students in each group
from the other ten students in the class. Applying the rule of product,
there are 10
2
5 1
possible groups of six, given this restriction.
10 8 9 9 8
7. 3
− 1
= 2
+ 2
+ 3
Case 2: Apple is chosen for the smoothie. The total number of smoothies
in this case is: 82 , since banana cannot be chosen.
Case 3: Neither banana nor apple is chosen for the smoothie. The total
number of smoothies in this case is: 83 .
Thus, the total smoothies is the sum of all these cases which is: 92 + 92 + 83 .
141
15 12 2 13 13 12
8. 7
− 5
= 1 6
+ 7
+ 4
20
9. (a) 8
10 10
(b) 4 4
20 18 18 2 18
(c) 8
− 6
= 8
+ 1 7
20 8 20 19
(d) 8 1
= 1 7
. Robert can either choose the group of dancers for the
opening act and then select a soloist or he can select a soloist from the
class and then select the other 7 dancers.
142
10. Algebraic:
n n−1
m =n
m m−1
m(n!) n(n − 1)!
=
(n − m)!m! (n − 1 − (m − 1))!(m − 1)!
n! n!
=
(n − m)!(m − 1)! (n − m)!(m − 1)!
Alternatively, we can pick from the leader from the larger group of n people
first, and then from the remaining n − 1 select the remaining m − 1 non-leader
n−1
committee members. This is n m−1 .
Since we counted the same scenario in two different ways, these expressions are
equivalent.
11. We can look at this problem as counting the number of subsets given a set. We
know that 2n counts the total number of subsets from a set of cardinality n.
This is because for each element in the set we are given two ’choices’: whether
or not to include it in the set. Since there are n elements in a set, we can use
the product rule to see there are a total of 2n possible subsets.
set of size n. And so, the left side is the sum of all possible subsets of n of size
0 to n. This is all possible sizes of subsets and so this is all possible subsets of
143
a set of size n.
Since we counted the same scenario in two different ways, these expressions are
equivalent.
We can also look at this problem in two cases. Suppose there is a student
Chan Ming in the class. We can look at two cases relating to Chan Ming either
attending the conference or not. If Chan Ming does not attend the conference
there are n−1
k
ways of picking students to go to the conference. If Chan
Ming does attend the conference there are n−1
k−1
ways of selecting the remaining
students to attend the conference. Thus, by the Rule of Sum, the total number
of possible groups of students to attend the conference is n−1 n−1
k
+ k−1
.
Since we counted the same scenario in two different ways, these expressions are
equivalent.
Pn n
13. (a) k=0 xk y n−k k
P6 k 6−k 6
(b) k=0 (3) (−x) k
= x6 − 18x5 + 135x4 − 549x3 + 1215x2 − 1458x + 729
P7 k 7−k 7
(c) k=0 (2x) (−3y) = 128x7 −1344x6 y+6048x5 y 2 −15120x4 y 3 +22680x3 y 4 −
k
20412x y + 10206xy − 2187y 7
2 5 6
P15 k 15
(d) k=0 (4x) (7y)n−k k
144
13
14. (a) 9
P13 13
Notice first: (x + y)13 = k=0 (x)
k
(y)13−k k
.
Thus, the coefficient we are looking for occurs when k = 9. This is equal
to 13
9
.
13
(b) 29 9
P13 13
Notice first: (2x + y)13 = k
k=0 (2x) (y)
13−k
k
.
Thus, the coefficient we are looking for occurs when k = 9. This is equal
to 29 13
9
.
13
(c) 9
· 49 (−3)4
P13 13
Notice first: (4x − 3y)13 = k=0 (4x)
k
(−3y)13−k k
.
Thus, the coefficient we are looking for occurs when k = 9. This is equal
to 13
9
9
· 4 (−3)4 .
11
15. (a) 27 · 34 · 7
We can first expand our binomial using the binomial theorem, that is:
(2x − 3y)11 = 11 11−k 11
P k
k=0 (2x) (−3y) k
.
11
The term x7 y 4 will occur when k = 7, so the coefficient of x7 y 4 is 27 ·34 · 7
.
9
(b) 27 · 52 · 7
P9 9
Notice first: (2x + 5y)9 = k=0 (2x)
k
(5y)9−k k
.
Thus, the coefficient we are looking for occurs when k = 7. This is equal
to 27 · 52 · 97 .
(c) 35
P5 5−k 5
Notice first: (3x − y)9 = k
k=0 (3x) (−y) k
.
Thus, the coefficient we are looking for occurs when k = 5. This is equal
to 35 .
145
12
(d) (−2)3 · (2)9 · 3
P12 12−k 12
Notice first: (−2x + 2y)12 = k
k=0 (−2x) (2y) k
.
Thus, the coefficient we are looking for occurs when k = 3. This is equal
to (−2)3 · (2)9 · 12
3
.
(e) 2 · 46 · 7
P7 7
Notice first: (2x − 4y)7 = k=0 (2x)
k
(−4y)7−k k
.
Thus, the coefficient we are looking for occurs when k = 1. This is equal
to 2 · 46 · 7.
Pn n
16. (a) Notice: 3n = k=0 2k 1n−k k
and so:
n 1
X n k n
X
k n
2 =3 − 2 = 3n − 1 − 2n
k=2
k k=0
k
(b)
n n
X (−1)k 1 X (−1)k (1)!n!
=
k=0
k!(n − k)! n! k=0 k!(n − k)!
n
1 X k n−k n
= (−1) (1)
n! k=0 k
1
= (1 − 1)n
n!
= 0, as n ≥ 0
146
We know that nk ∈ Z and so we can focus on ((i)k + (−i)k ). Let us proceed
Pn k n
18. (a) k=0 6 k
= (6 + 1)n = 7n
(b)
n n
X
nn n
X n
4 =4
k=0
k k=0
k
= 4n (1 + 1)n
= 4n · 2n
= 23n
Pn k n−k
(c) k=0 (−3) (2) = (−3 + 2)n = (−1)n
(d)
n n
X n X n
6 =6
k=0
k k=0
k
= 6(1 + 1)n
= 6 · 2n
147
Pn n−k n
(e) k=0 (−1) k
= (−1 + 1)n = 0
19. When evaluating a polynomial with more than two terms to some integer power
the multinomial theorem is used to determine the coefficients of the terms. The
binomial theorem is a version of the multinomial theorem that can be used for
binomials.
4!
20. (a) Using the theorem, the coefficient is 2!1!1!
= 12.
8!
(b) Using the theorem, the coefficient is clearly 2!2!2!2!
· 22 · (−1)2 · 32 · (−3)2 =
816480.
(c) There is no term with xyz since the sum of the exponents of the variables
must add up to the exponent, 10.
148
3.5 Combinations with Repetitions
Questions:
1. Find two statements equivalent to: “The number of combinations of n objects
taken r at a time, where repetition is allowed.”
n+r−1 n+r−1
r
= n−1
,
3. Seven teammates go to a fast food joint between tournament games. The menu
offers: cheeseburgers, hamburgers, hot dogs, fries, and onion rings. If each in-
dividual orders only one thing, how many different ways can the group order?
4. A tea shop offers twenty varieties of teas. Assuming they will not run out of
tea, how many combinations of tea, with repetition allowed, can 12 teas be
purchased?
5. A store has a sale on basic T-shirts, offering 50% off any purchase of exactly
12 shirts. They have 40 different colours to pick from. In how many ways can
someone purchase 12 shirts such that,
149
6. How many ways are there to distribute 20 toy cars to m children if:
7. Parents are distributing the last of the Halloween candies between their four
children. There are seven packs of Skittles and six chocolate bars, in how many
ways can these parents distribute the candy such that each child gets at least
one pack of Skittles.
8. Create a situation that results in counting the number of integer solutions to:
x1 + x2 + x3 = 10,
where xi ≥ 0 for i = 1, 2, 3.
x1 + x2 + x3 + x4 + x5 < 20,
where xi ≥ 0 for 1 ≤ i ≤ 5?
x1 + x2 + x3 + x4 = 8,
150
11. How many integer solutions are there to:
x1 + x2 + x3 + x4 = 30,
x1 + x2 + x3 + x4 + x5 ≤ 21,
13. How many ways can we arrange ten identical towels in a house with five bath-
rooms where each bathroom needs one towel?
y1 + y2 + y3 + ... + y51 = n,
15. Hannah is buying two dozen loaves of bread at a bakery out of n options. The
bakery has more than three dozen of each type and Hannah is okay with repe-
tition. If she can select the bread in 593 775 different ways, how many different
types of bread does the bakery have?
Note: one dozen = 12.
151
17. Which formula would you use to count:
18. How many integer solutions exist to x1 + x2 + x3 = 0 with the restriction that
xi ≥ −5 for all i = 1, 2, 3?
19. Write the following problems as an equivalent problem of counting the number
of integer solutions of an equation. (You do not need to count the number of
solutions).
Hint: Refer to question 1 from this section.
(a) The selection of seven marbles from a group of 3 red, 4 blue and 2 green
marbles.
(b) Distributing 30 identical poker chips to 5 different players.
(c) Picking 12 apples from 4 different varieties of apples, where at least two of
each type is selected.
(d) The distribution of 15 identical markers into 4 distinct boxes such that the
number of markers in the first and second boxes are equal.
20. How many ways can someone distribute x identical marbles into n distinct boxes
such that there are m boxes empty, m ≤ n?
152
21. How many ways are there to distribute r identical shoes into n distinct shoe
boxes with the first m boxes collectively holding at least s shoes, where m ≤ n
and s ≤ r?
153
Solutions:
x1 + x2 + ... + xn = r.
3. 330.
We are interested in selecting seven items from the menu, potentially with rep-
etition, from five distinct options, hence there are 5+7−1 = 11
7 7
= 330 ways
these teammates can order.
4. 41 120 525.
We are interested in selecting 12 teas out of 20 possible teas with potential repe-
tition, hence there are 20+12−1 31
12
= 12
= 141 120 525 ways to select twelve teas.
40
5. (a) 12
.
40
This is just a combinations problem, picking 12 shirts from 40 gives 12
ways to select them.
154
51
(b) 12
.
20+m−1
6. (a) 20
.
(b) m20 .
7. 1680.
After giving each child one Skittle, we count how to distribute the 3 remaining
Skittles and 6 chocolate bars. First we count the ways to distribute the remain-
ing Skittles, then the chocolate, and then we’ll apply the Rule of Product.
Skittles: We are arranging three identical objects, potentially with repetition,
between four distinct individuals, so there are 4+3−1 = 63 ways to distribute
3
the Skittles.
Chocolate: Arranging six identical chocolate bars between four distinct chil-
dren gives 4+6−1 9
6
= 6
ways to distribute the chocolate.
6 9
In total there are 3
· 6
= 1 680 ways to distribute this candy.
155
8. There are many possible correct answers, one example is, in how many can you
distribute ten treats between three dogs?
9. 42 504.
We can re-express this problem as how many solutions are there to the equation
x1 + x2 + x3 + x4 + x5 + x6 = 19,
x1 + x2 + x3 + x4 + x5 = 19 − x6 < 20
10. 56.
First we must rewrite the problem accounting for the xi ’s with restrictions larger
than one. We first distribute one into x1 which means our problem is equivalent
to asking how many solutions there are to,
x1 + x2 + x3 + x4 = 7
156
4+5−1 8
distinct containers, so there are 5
= 5
= 56 unique integral solutions.
11. 2 925.
We begin by distributing one into x1 , one into x2 , and four into x4 , therefore
this problem is equivalent to the number of integer solutions of,
x1 + x2 + x3 + x4 = 24,
12. 26 334.
We first put one into x4 and three into x5 which makes the problem equivalent
to the number of integer solutions to:
x1 + x2 + x3 + x4 + x5 ≤ 17,
157
13. 126.
First we will put a towel in each bathroom. Now we are left to distribute the
five remaining identical towels into the five bathrooms, with potential repeti-
tion. Using the combination with repetition formula there are exactly 5+5−1
5
= 95 = 126 ways to distribute these towels.
14. n = 7.
Notice that positive integer solutions implies that each xi , yi ≥ 1 for all i. So
we can start by giving one to each xi , yi , reducing the equations to:
where xi , yi ≥ 0.
n−1 n−1
If we want the same solutions to the two equations then we need n−22
= n−55
.
n n n−1
= n−1 n−1
Recall that m = n−m , so we know n−22 21
. Now we have 21
=
n−1
n−55
. This tells us that 21 = n − 55, which gives n = 76.
158
15. n = 7.
If we know Hannah has 593 775 different ways of choosing two dozen loaves
with repetition from n distinct bread varieties, then we know that,
n + 24 − 1 n + 23
= = 593 775
24 24
n+r−1
(n+r−1)!
r
= r!(n−1)!
,
and that,
n+r−1 (n+r−1)!
n−1
= (n−1)!r!
.
It is easy to see that these expansions are equal since multiplication is commu-
tative, so we’re done.
159
then have the balls fill the remaining positions, n+r−1
n−1
, or we can choose where
to place the balls first and have the dividers fill the remaining positions, n+r−1
r
.
The two options are equivalent and are equal to the right and left sides of the
equation, respectively.
18. 136.
x1 + x2 + x3 = 15,
3+15−1 17
for each xi ≥ 0. This gives precisely 15
= 15
= 136 possible solutions.
(a)
x1 + x2 + x3 = 7,
160
(b)
x1 + x2 + x3 + x4 + x5 = 30,
(c)
x1 + x2 + x3 + x4 = 12,
n−m+x−1 n
20. x
· m
.
m+s−1 n+r−s−1
21. s
· r−s
.
We begin by distributing s shoes into the first m boxes. These s shoes are
identical and the m boxes distinct. There are m+s−1
s
ways to do this. Next,
we must distribute the remaining r − s identical shoes into the n boxes. There
are n+r−s−1 m+s−1
r−s
ways to do this. So by the Rule of Product, there are s
·
n+r−s−1
r−s
ways to distribute these shoes.
161
3.6 The Pigeonhole Principle
Questions:
1. In your own words, describe the Pigeonhole Principle.
3. What can you say about the number of pigeons occupying each pigeonhole if
there are n pigeons and m pigeonholes, where m ≥ n?
5. Apply the pigeonhole principle to solve the following problems. Describe the
‘pigeons’ and the ‘pigeonholes’.
6. Prove that any subset of A = {1, 2, ..., 9} with 6 or more elements contains two
elements whose sum is 10.
162
7. An ice cream parlour sells 15 different ice cream flavours. A parent brings 8
children to the parlour and lets them each get a double-scoop of ice cream with
the requirement that each scoop must be different flavor. Is it possible for no
flavour to be ordered more than once?
8. Prove that if more than 1001 integers are selected from {1, ..., 2000} then:
(a) there are two integers with the property that one number divides the other.
(b) there are two integers that are relatively prime (i.e. there exist two inte-
gers, say m and n, such that gcd(m, n) = 1).
Hint: Every pair of consecutive integers are relatively prime.
9. How many people must attend a conference to ensure that at least two atten-
dees share the same first and last initial?
10. While trying to apply for scholarships to pay for college, Brynn spends six weeks
sending out applications. She sends out at least one application daily, but less
than 60 were sent out over the course of these six weeks. Prove that there was
a period of consecutive days where Brynn applied for 23 scholarships.
11. Show that any subset of the positive integers with more than three elements,
will contain two distinct elements whose sum is even.
12. The local library has 12 computers available. There are 42 people who signed up
to use them today. Each person may only use one computer, and to minimize
the strain on the computers, the library does not allow more than six people
to use a single computer in a day. Show that there are at least five computers
used by three or more individuals.
163
13. At a party there are n people, where n ≥ 2. Prove that it is guaranteed that
two people will speak to the exact same number of people.
14. Prove that in any set of exactly 13 integers 12 divides the difference of two
numbers from that set.
16. How many integers must you pick in A = {1, 2, ..., 200} to ensure that there is
at least one number divisible by 5?
17. How many integers in X = {0, .., 60} must be chosen to ensure that an odd
integer is selected?
164
Solutions:
1. If there are k pigeons that are flying into n pigeonholes where n < k, then there
must be at least one box with at least two pigeons.
2. A function from one finite set to a smaller finite set cannot be one-to-one. There
will be at least two elements from the domain that map to the same image in
the co-domain/range. The pigeons represent the domain and the pigeonholes
the co-domain. The function is the assignment of pigeons to pigeonholes.
3. There is nothing specific that can be said, unless m > n. If m > n we know that
at least one pigeonhole will be empty. Beyond that, there are many possible
arrangements of the pigeons.
Consider when k > 1. Suppose for contradiction that each pigeonhole houses at
most k pigeons. Then there are, at most, k × n = kn pigeons, which is a con-
tradiction as there are kn + 1. Thus, at least one pigeonhole hosts k + 1 pigeons.
5. (a) There are 366 possible birthdays, including February 29. As 367 > 365,
there will be at least two people who have the same birthday.
The pigeons are the people and the pigeonholes are the birthdays.
(b) Every integer can be written in the form 28k + m, where k ∈ Z and
m ∈ {0, 1, ..., 27}. So, m represents the remainder of the integer when
divided by 28. There are 28 possible values of m. Therefore, there must
be at least two integers in the set of 29 integers with the same remainder.
165
The pigeons are the different integers and the pigeonholes represent the
possible remainders upon division by 28.
(c) You must take out at least 10 shoes before you are guaranteed to obtain a
pair. Any less and it is possible that each shoe is from a different pair.
The pigeons are the shows and the pigeonholes are the pairs of shoes.
(d) To determine this, we must first count the number of distinct three letter
words. For each position in the word there are 26 possible letters. There-
fore, in total there are 263 = 17 576 distinct three letter words. This means
that it is possible, but not definitive, that all words on this list are distinct
as there are more three-letter words possible than there are words on the
list.
The pigeons are the number of three-letter words and the pigeonholes are
the words on the list.
6. If we prove the statement about subsets of size 6, the result will follow for all
larger subsets.
Let the pigeonholes be: {1, 9}, {2, 8}, {3, 7}, {4, 6}, {5}. Let the pigeons be the
integers in the subset. As there are at least 6 distinct integers chosen and only
5 pigeonholes, two pigeons must be in the same pigeonhole. Notice there is only
one box whose sum does not add to 10, but this box can only contain at most
one pigeon, the number 5. Thus, a box with two pigeons indicates there must
be a pair of integers whose sum is 10.
7. Let each flavour a child orders be a pigeon and each flavour option be a pigeon-
hole. There are eight children who each order two flavours of ice cream and
15 flavour options. This means there are 15 pigeonholes and 16 pigeons. This
166
means that at least one flavour must be ordered twice.
8. (a) Any even positive integer can be written as x = 2k y (essentially just fac-
toring out the two’s), where k ∈ N, and y is odd. There are exactly 1000
odd numbers in A = {1, ..., 2000}.
Select any 1001 numbers from A, these are the pigeons. Then, by the
pigeonhole principle, there exists a pigeonhole, P Hy , that contains two
selected numbers: a and b. Say a = 2k y and b = 2p y for some distinct,
nonnegative integers k and p. If k > p, then b divides a and if k < p, then
a divides b.
(b) We can partition the numbers into sets of size two, where the second
digit is one less than the first: {1, 2}, {3, 4}, ..., {1997, 1998}, {1999, 2000}.
Then, there are exactly 1000 of these disjoint subsets, which represent our
‘pigeonholes’.
Choose any 1001 integers and let them represent our ‘pigeons’. Then by
PHP, we will have two integers from the same disjoint subset. Hence, two
integers are relatively prime.
9. First determine the number of possible, distinct initials. There are 26 options
for each one’s first and last initial. Therefore, there are 262 = 676 different
possible initials.
Let the attendees represent the ‘pigeons’ and the possible initials represent the
‘pigeonholes’. To guarantee there are at least two attendees with the same
initials, it follows from the Pigeonhole Principle that we need more than 676
167
attendees. So, we require at least 677 attendees.
10. Notice that Brynn spent 6 · 7 = 42 days sending out scholarship applications.
For 1 ≤ i ≤ 42, let xi represent the number of scholarships Brynn has sent out
in total as of day i. Since Brynn sends out at least one application per day and
no more than 60 total, we know that 1 ≤ x1 < x2 < ... < x42 < 60.
Note: Recognizing that you need to do this is the heart of the proof. We add
23 because we are trying to prove that there are 23 consecutive days where
scholarship applications were sent out, which allows us to conclude this by the
PHP.
Now we have 84 distinct numbers, {x1 , x2 , ..., x42 , x1 + 23, x2 + 23, ..., x42 + 23}.
Let these numbers represent out ‘pigeons’. These 84 numbers must all lie be-
tween 1 and 83, where the range of integers from 1 to 83 represent out pigeon-
holes. Thus by the PHP there exists an xi = xj +23 for some i > j ∈ {1, ..., 42}.
This means that from the beginning of day j + 1 to the end of day i, Brynn
applied for 23 scholarships.
11. It suffices to prove the result for subsets of exactly size three, since that will
imply the result for subsets of size larger than three.
The only way for the sum of two integers to be even is if both of the integers
have the same parity, that is both are even or both are odd. Any given integer
can be classified as either even or odd, hence any subset of 3 integers will con-
tain at least two with the same parity by the PHP. Thus, there are two integers
168
in the subset with an even sum.
12. There are 12 pigeonholes (computers) and 42 pigeons. In this problem there is
a restriction that no pigeonhole can hold more than 6 pigeons.
We wish to show that there are five computers which are used by three or more
people.
Let us assume for a contradiction that this is not true. This would mean that
8 computers are used by at most 2 people. This would mean that these 8
computers are used by at most 16 people all together.
There are 42 people who use a computer at the library and so that means the
remaining 26 people use 4 computers.
This means that there are 26 pigeons and 5 pigeon holes where the maximum
capacity of each pigeonhole is 6. This however gives that the maximum capacity
for the remaining computers is 24, which is a contradiction.
13. Let us assume that if one person speaks to another, the person will respond.
That is, assume speaking to someone is a reflective relation.
If there are n people at the party, each person can speak to between 0 and
n − 1 people, as no person can speak to themselves and speaking to someone is
reflective.
169
If a person at the party spoke to 0 people, then it is impossible for someone to
have spoken to everyone. In this case every person will have spoken to between
0 and n − 2 people. That means there are n − 1 potential number of people a
person could have spoken to.
In both of the above cases, there are n − 1 potential amounts of people a person
could have spoken to but n people. Thus, by the PHP two people will have
spoken to the same amount of people at the party.
14. For 12 to divide the difference of two numbers, they must have the same re-
mainder upon division by 12. Observe that 12k + m − (12j + m) = 12(k − j),
where k, j, m ∈ Z and m represents the remainder of the arbitrary integer when
divided by 12.
Certainly the only possible remainders are {0, ..., 11}, of which there are 12 pos-
sibilities. Thus by the PHP, as 12 integers have been selected at least two must
have the same remainder when divided by 12. Thus, their difference is divisible
by 12, as desired.
15. Notice that a rectangle with width of 3 metres and height of 4 metres has a
diagonal length of 5 metres. If we divide the field into rectangles of this size,
we are able to split the field into 30 rectangles. Let the cows represent ‘pigeons’
and the rectangles represent ‘pigeonholes’. Then, by the PHP, at least two cows
must be in the same rectangle. The farthest two cows are apart in a rectangle
in 5 metres and so the result follows.
16. In A, there are exactly 40 integers divisible by 5. Therefore one must select
200 − 40 + 1 = 161 integers to guarantee that at least one of them is divisible
by 5.
170
17. There are exactly 30 odd numbers bin X, and 61 numbers to choose from.
Therefore at least 61 − 30 + 1 = 32 numbers must be selected to guarantee that
at least one is odd.
171
4 Inclusion and Exclusion
4.1 The Principle of Inclusion-Exclusion
Questions:
Where appropriate, indicate the set and the conditions you will be working with.
N (c1 c2 ) = N (c1 c2 ).
3. A kindergarten class with 30 students was surveyed about which activities they
enjoy. 20 students enjoy nap time, and 14 students enjoy colouring. Determine
4. There are 500 families that live in the neighbourhood of South Brambleton. 100
of these families have no children and no pets. 300 families have pets, and 400
have children. How many homes in South Brambleton have both of children
and pets living in them?
172
5. Suppose there are 100 different cookies at the bake-sale. There are 40 cookies
with chocolate chips and 25 with raisins.
(a) If 11 cookies have both chocolate chips and raisins, how many cookies have
neither chocolate chips nor raisins?
(b) Suppose there are also 30 cookies with oatmeal, 10 of which also have
chocolate, and 15 of which have raisins. If there are only 6 cookies with all
three ingredients in them, how many cookies do not contain any oatmeal,
raisins, and chocolate chips?
7. At a local twin convention, the attendees are seated at circular tables. Each
table can sit 12 people so 6 sets of twins. In how many ways can they be ar-
ranged so that no individual sits beside their twin?
Note: two seating arrangements are the same if one is simply a rotation of the
other.
(a) divisible by 7 or 2.
(b) divisible by 7 and not 2.
173
(c) not divisible by 3 or 5.
(d) divisible by 2, 3 and 7, but not divisible by 11.
9. How many nine-digit sequences contain all of the digits 1,2, and 3 appearing at
least once?
10. How many 10-digit permutations of the digits 0, 1, ..., 9 exist such that the first
digit is at least 2 and the last digit is less than or equal to 7?
11. How many sequences of 10 distinct letters do not contain any of the words:
GAINS, BUG, SNAP?
12. How many sequences of 12 distinct letters do not contain any of the words:
DOG, SPUN, or DREAM?
13. How many ways can the letters of MISSISSIPPI be arranged such that none of
the following are true: all of the I’s are consecutive, all the P’s are consecutive,
and all the S’s are consecutive?
(a) 0 ≤ xi for i = 1, 2, 3, 4?
(b) 0 ≤ xi ≤ 9 for i = 1, 2, 3, 4?
(c) 0 ≤ x1 ≤ 5, 0 ≤ x2 ≤ 3, 2 ≤ x3 ≤ 7, 3 ≤ x4 ≤ 11?
15. How many ways are there to distribute 25 identical marbles into 6 distinct boxes
so that each of the first three boxes have no more than six balls?
174
16. Consider a finite set, S, with |S| = k. Let c1 , c2 , c3 , c4 be four conditions, each of
which may be satisfied by one or more elements of the set S. Use the Principle
of Inclusion-Exclusion to prove that
175
Solutions:
1. The Principle of Inclusion-Exclusion is a counting method that ensures ev-
ery possible event is counted, while also taking into account events that can
co-occur. This method is a way of ensuring events are not counted twice or
“double counted”.
The left side, N (c1 c2 ), represents the number of elements where c1 and c2 are
not simultaneously satisfied. These elements include elements where one of c1
or c2 is satisfied.
The right side, N (c1 c2 ), represents the elements where neither c1 nor c2 are
satisfied.
An example of this situation follows. Suppose you are looking for a movie to
watch. You are choosing between action movies, movies that are at least two
hours long, and movies in Spanish. Let c1 , c2 , and c3 represent action movies,
movies that are at least two hours long, and movies that are in Spanish.
If you are looking for pick a movie that satisfies the condition c1 c2 . This means
you are choosing a movie that is not both an action movies and two hours or
longer. So, you may still pick a shorter action movie or a two hour long movie
of a different genre.
If on the other hand you are looking to pick a movie that satisfies the condition
c1 c2 . This means you are looking for a movie that is neither an action movie
nor longer than two hours. This condition excludes movies that are both action
and two hours or longer, movies that are only actions movies, and movies that
are just two hours or longer.
176
3. Let S be the set of kindergarten students, thus |S| = 30. Let c1 be the condition
that students enjoy nap time, and c2 be the condition that the students enjoy
colouring. So, N (c1 ) = 20 and N (c2 ) = 14.
(a) 16 students
This is the total number of students in the class subtracted by those who
enjoy colouring: 30 − 14 = 16 students do not enjoy colouring.
(b) 27 students
(c) 20 students
We are looking for the number of students who only enjoy colouring and
the number of students who only enjoy nap time.
The number of students who only enjoy naptime is equal to the number
of students who like nap time, subtracted by the number of students who
enjoy both colouring and nap time: N (c1 c2 ) = N (c1 ) − N (c1 c2 ) = 20 − 7 =
13.
Thus, the total of students who only enjoy one activity is: N (c1 c2 ) +
N (c1 c2 ) = 13 + 7 = 20.
177
4. 300 homes.
Let P be the set of families with pets and C the set of families with children.
The question asks for |P ∩ C|. In the question they tell us that |P ∪ C| =
500 − 100 = 400. By Inclusion-Exclusion,
|P ∪ C = |P | + |C| − |P ∩ C|.
Rearranging, we get
5. (a) 46 cookies.
Let c1 represent cookies with chocolate chips and c2 represent cookies with
raisins. From the question we know that N = 100, N (c1 ) = 40, N (c2 ) = 25,
and N (c1 c2 ) = 11.
178
(b) 35 cookies.
We can introduce an additional variable c3 to represent cookies with oat-
meal. We are given additional information: N (c3 ) = 30, N (c1 c3 ) = 10,
N (c2 c3 ) = 15, and N (c1 c2 c3 ) = 6.
N (c1 c2 c3 ) = N −N (c1 )−N (c2 )−N (c3 )+N (c1 c2 )+N (c1 c3 )+N (c2 c3 )−N (c1 c2 c3 )
N (c1 c2 c3 ) = N − N (c1 c2 c3 )
= N − (N (c2 ) − N (c1 c2 ) − N (c2 c3 ) + N (c1 c2 c3 ))
= 150 − (50 − 25 − 30 + 20)
= 135
P6 i 6
7. 11! − i=1 (−2) i
(11 − i)!
179
represent the condition where twins i sit next to each other for i = 1, 2, 3, 4, 5, 6.
To find N (c1 ), we can first seat the twins next to each other at the table. We can
seat the twins next to each other and then place the other ten people around
the table. Since this is a round table, where we seat the twins is irrelevant.
There are 10! ways to arrange everyone in this manner. We must also consider
which twin is in which seat. There are 2 ways to arrange the twins themselves.
Thus, using the product rule, we can see that N (c1 ) = 2 · 10! is the total seating
arrangements where two twins sit next to each other.
This follows similarly for each N (ci ) for i = 2, 3, 4, 5, 6. Thus, we collect these
terms together, let T1 = 61 2 · 10! where T1 is the total seating arrangements
To find N (cp cq ) for 1 ≤ p < q ≤ 6, we can treat the seating as the arrangement
of 10 distinct objects, where each pair of twins is one object. Since this is a
round table, there are 9! ways of seating everyone. We then must account for
the arrangement of each twin. There are 2 ways to arrange each twin, and so
in total we have N (cp cq ) = 22 · 9!.
We can again collect all seatings where two pairs of twins are seating together.
Let us use T2 to represent this total. Then T2 = 62 22 · 9!.
The total number of possible seatings is simply N = 11!, as there are 12 people
to seat at a circular table.
We are looking for N (c1 c2 c3 c4 c5 c6 ), and so we can use PIE and our above
180
values to find this.
N (c1 c2 c3 c4 c5 c6 ) = N − T1 + T2 − T3 + T4 − T5 + T6
6
i 6
X
= 11! − (−2) (11 − i)!
i=1
i
First, let us count how many numbers are divisible by each of 7 and 2. Let
us call S2 the set of numbers in A that divisible by 2, and S7 the set of
numbers in A that are divisible by 7.
The numbers in A that are divisible by 2 are:
3000
|S2 | = = 1500
2
181
Thus, by PIE, the total numbers in A divisible by either 2 or 7 is:
182
Thus, by PIE:
(d) 63 numbers.
3000
|S2 ∩ S3 ∩ S7 | =
lcm(2, 3, 7)
3000
=
42
= 71
3000
|S2 ∩ S3 ∩ S7 ∩ S11 | =
lcm(2, 3, 7, 11)
3000
=
462
=8
Thus, there are 63 numbers in A that are divisible by 2,3, and 7 but not 11.
183
9. 109 − 3(99 ) + 3(89 ) − 79 sequences.
Let c1 , c2 , and c3 be the condition that a 9 digit sequences does not include 1,
2, and 3, respectively.
To find N (c1 ) we can find the number of sequences we can make with the the
other 9 digits, excluding 1. This is 99 as there are 9 options for each of of the
9 digits where order does matter. Similarly, N (c2 ) = N (c3 ) = 99 .
To find N (c1 c2 ), we can find the number of sequences we can make with the
other 8 digits. This is 89 , as there are 8 options for each of the 9 digits. Similarly,
N (c1 c3 ) = N (c2 c3 ) = 89 .
To find N (c1 c2 c3 ), we can find the number of sequences we can make with the
other 7 digits. This is 79 , as there are 7 options for each of the 9 digits.
Thus, by PIE, the number of sequences that include 1, 2, and 3 at least once is
equal to N (c1 c2 c3 ):
10. 10! − 2 · 9! − 2 · 9! + 22 · 8!
Let c1 be the condition that the first digit is less than 2 and c2 be the condition
that the last digit is greater than 7.
184
The total number of sequences without restrictions is N = 10!, as there are 10
digits to permute. In order to use PIE, we will find N (c1 ), N (c2 ), and N (c1 c2 ).
Let N (c1 ), N (c2 ), and N (c3 ) represent the number of words containing GAINS,
BUG, and SNAP, respectively. Let N represent the total number of letter
sequences of length 10. Thus, N = P (26, 10) = 26! 16!
To form a sequence that contains GAINS, we need to arrange 5 letters from the
remaining 20 letters of the alphabet. This can be done in P (21, 5) = 21!
16!
ways.
Then, choose the position for the word GAINS within this sequence. This can
be done in 6 ways. Thus, using the product rule N (c1 ) = 6 · P (21, 5) = 6(21!)
16!
.
8(23!)
Similarly for BUG and SNAP, there are N (c2 ) = 8 · P (23, 7) = 16!
and
N (c3 ) = 7 · P (22, 6) = 7(22!)
16!
.
A sequence containing both BUG and SNAP requires 3 other letters. There are
185
P (19, 3) ways to arrange these letters. There are then 3 ways to place BUG in
between these letters and 4 ways to then place SNAP. Thus, using the product
rule there are N (c2 c3 ) = 4 · 3 · P (19, 3) = 4·3·(19!)
16!
.
A sequence that contains both BUG and GAINS must include the sequence
BUGAINS, as the sequence does not allow for any repeated letters. Thus, there
are N (c1 c2 ) = 4 · P (19, 3) = 4(19!)
16!
.
A sequence that contains both GAINS and SNAP must contain the sequence
the sequence GAINSNAP. Thus, N (c1 c3 ) = 3 · P (18, 2) = 3(18!)
16!
.
A sequence containing GAINS, SNAP, and BUG must contain the sequence
BUGAINSNAP. This sequence is of length 10 and so there is only one sequence
containing all three words. Thus, N (c1 c2 c3 ) = 1
We are looking for the number of sequences not containing any of these words,
N (c1 c2 c3 ). By PIE, we know that:
Let N (c1 ), N (c2 ), N (c3 ) represent the number of words containing DOG, SPUN,
and DREAM, respectively.
To count the number of sequences that contain DOG, we can first permute
the other 9 letters in the sequence from the remaining 23 letters. There are
186
23!
P (23, 9) = 14! ways to do this. We can then place the word DOG somewhere
in the sequence. There are 10 different ways to place DOG. Thus, using the
product rule we can see that N (c1 ) = 10·23!
14!
. Similarly, N (c2 ) = 9·22!
14!
and
8·21!
N (c3 ) = 14! .
To count the number of sequences containing both DOG and SPUN, we can first
permute the other 5 letters from the remaining 19 letters. There are P (19, 5) =
19!
14!
ways to do this. We can then place DOG and SPUN somewhere in the
sequence. There are 6 · 7 ways to place these words. Thus, using the product
rule we can see that N (c1 c2 ) = 6·7·19!
14!
. Similarly, N (c2 c3 ) = 4·5·17!
14!
.
There can be no sequences containing both DOG and DREAM as these se-
quences of letters are not disjoint. Thus N (c1 c3 ) = 0. Similarly, there can be
no sequences containing all three of the words DOG, SPUN, and DREAM.
26!
The total sequences with 12 letters is N = P (26, 12) = 14!
We are interested in
N (c1 c2 c3 ). Using PIE, we can see that:
11! 8! 10! 8! 7! 5! 7!
13. 4!4!2!
− 4!2!
− 4!4!
− 4!2!
+ 4!
+ 2!
+ 4!
− 4!
Let c1 , c2 , and c3 be the conditions that all I’s consecutive, all P’s are consecu-
tive, and all S’s are consecutive, respectively.
First, let us focus on N (c1 ). This is the number of sequences in which all I’s are
consecutive. We can treat the the 4 I’s as a single block and arrange the other
187
7 letters with it. The order of the I’s is irrelevant so there is only one way to
arrange them. Thus, there are 8! ways to arrange these 8 blocks, but we must
account for repetition. The word contains 2 P’s and 4 S’s, this means we must
divide the number of ways to rearrange these letters within our sequence. This
8! 10! 8!
gives us N (c1 ) = 4!2! . Similarly, N (c2 ) = 4!4! and N (c3 ) = 4!2! .
Next, we can look at N (c1 c2 ). This is the number of sequences where all the I’s
are consecutive and all the P’s are consecutive. Similar to above, we can look
at the I’s and P’s as blocks where the order is irrelevant. We can arrange these
blocks with the remaining 5 letters, giving us a total of 7 elements. Again, as
there are 4 S’s, we must divide by the number of ways to arrange the S’s to
7!
account for repetition. This gives us that N (c1 c2 ) = 4! . Similarly, N (c1 c3 ) = 5!
2!
7!
and N (c2 c3 ) = 4! .
Next, we can look at the number of sequences that satisfy c1 , c2 and c3 . We can
look at these consecutive sequences as blocks to arrange where, again, the order
within them does not matter. With the remaining letter, there are 4 blocks.
That means that N (c1 c2 c3 ) = 4!.
11!
The total number of permutations without restrictions is N = 4!4!2!
We can now
solve for our desired result using PIE, which is N (c1 c2 c3 ).
188
14. Any question that specifies an upper bound on the value of xi will require the
use of the Principle of Inclusion-Exclusion.
(a) 3 276.
This is simply the same sort of problem seen in 3.5 (notice that there is
no upper bound on xi ’s). Thus, there are 4+25−1
25
= 3 276 solutions.
The value of N (c1 ) is the same as the number of integer solutions to the
equation x1 + x2 + x3 + x4 = 15 where xi ≥ 0 for i = 1, 2, 3, 4. So using the
combination with repetition formula we see: N (c1 ) = N (ci ) = 4+15−1
15
=
816.
189
x1 + x2 + x3 + x4 = 20 where 0 ≤ x1 ≤ 5, 0 ≤ x2 ≤ 3, 0 ≤ x3 ≤ 5, and
0 ≤ x4 ≤ 8.
Let N (c1 ) denote the number of integer solutions that satisfy the given
equation with x1 ≥ 6.
Let N (c2 ) denote the number of integer solutions where x2 ≥ 4.
Let N (c3 ) denote the number of integer solutions where x3 ≥ 6.
Let N (c4 ) denote the number of integer solutions where x4 ≥ 9.
190
N (c3 c4 ) is the number of integer solutions to x1 + x2 + x3 + x4 = 5 where
xi ≥ 0 for i = 1, 2, 3, 4. Therefore N (c3 c4 ) = 4+5−1
5
= 56.
30 3 23 3 16 9
15. 5
− 1
· 17
+ 2
· 10
− 3
.
Let ci represent the arrangements where box i has more than 6 marbles for
i = 1, 2, 3.
191
To find N (c1 ), we can give the first box 7 marbles and then arrange the other
18 marbles without restrictions. This is an arrangement where order does not
matter and repetition is allowed which implies that N (c1 ) = 6+18−1 = 23
18 18
.
23
Similarly, N (c2 ) = N (c3 ) = 18 .
In order to count the number of cases where both the first and second box
have more than 6 marbles, we can give the first two boxes 7 marbles each and
then arrange the remaining 11 marbles. This is an arrangement of 11 marbles
into 6 boxes without restrictions. This implies that N (c1 c2 ) = 6+11−1 16
11
= 11
.
16
Similarly, N (c1 c3 ) = N (c2 c3 ) = 11 .
In order to count the number of cases where all three of the first three boxes
contain more than 6 marbles, we can give each box 7 marbles and then distribute
the other 4 marbles. This is simply an arrangement of 4 objects into 6 boxes,
without restrictions. This implies N (c1 c2 c3 ) = 6+4−1 9
4
= 4
.
16. Let x ∈ S and let n be the number of conditions, out of c1 , c2 , c3 , c4 , that are
satisfied by the element x (i.e. 0 ≤ n ≤ 4). We will consider the various
possibilities for n and see which of the three terms in the equation x satisfies.
192
not satisfy ci for i = 2, 3, 4. Then x will be included in N (c2 c3 c4 ) and in N (c1
c2 c3 c4 ).
For n = 2, 3, 4 then x is not counted in any of the three terms of the equation.
Thus, all cases have been considered and hence the two sides of our equation
are equal.
193
4.2 Derangements: Nothing in its Right Place
Questions:
1. Explain, in your own words, what a derangement is. Give a simple example.
3. How many ways can we permute the alphabet such that no letter is in its usual
place?
4. A high school decides to host a gift exchange for their students. If 150 students
participate in the exchange, how many different ways can gift-givers be assigned
such that,
5. Kalil is interviewing for jobs at 5 different companies where each job has a two-
part interview. He has 5 interview-appropriate outfits. Kalil wants to wear each
outfit once for each round of interviews, but does not want to wear the same
outfit to the second-part of an interview as he wore to the first. How many
ways can he do this?
6. How many different ways can you arrange the numbers {1, 2, 3, ..., 9, 10} such
that no even number is in its original position?
194
7. For the set of positive integers {1, 2, 3, 4, ..., n − 1, n}, we know that the first 6
digits appear in the first 6 positions. If there are 2 385 derangement of this set,
what is the value of n?
8. A waiter (who is not particularly good at their job) has 8 customers at lunch.
Every person order a different meal. How many different ways can the waiter
bring people their food such that:
9. Twelve friends host a potluck (a party where everyone brings a dish), six of
them are vegetarians while the other six are not. Every individual bring both
a drink and a main dish (suppose that the vegetarians only bring vegetarian
main dishes). How many ways can these friends bring home leftovers such that
each friend brings home one drink and one main dish and
(a) no friend brings home either of the things they brought to the potluck?
(b) the vegetarians all bring home the meal they brought but not their drink,
while the non-vegetarians bring home the drink they brought but not a
different main dish?
(c) No one brings home both of the items they brought.
Hint: Use PIE instead of trying to adapt the derangement formula.
195
10. Give a combinatorial proof of:
Pn n
n! = k=0 k
·d(k)
196
Solutions:
1. Simply, a derangement is a permutation where no element appears is in its orig-
inal position. Formally, a derangement is a function, f , on a set X such that
for all x ∈ X, f (x) 6= x.
2. Derangements are one specific application of the PIE. In order to find the num-
ber of ways to arrange items such that nothing is in its original place, we could
use the PIE to exclude all the cases where things are in their right place. (Re-
member that PIE is defined by satisfying none of the conditions.)
3. d(26).
We are interested in permuting 26 elements such that none are in their original
position; this is simply a derangement of 26 elements. Thus there are,
26
X (−1)k
d(26) = 26! ,
k=0
k!
4. (a) d(150).
Every student must give one gift, but they will not be assigned themselves,
this is simply a derangement of 150 elements. Thus the number of possible
ways to draw names is,
150
X (−1)k
d(150) = 150!
k=0
k!
197
(b) d(50) · d(30)2 · d(40).
50 30 40
2
X (−1)k X (−1)k 2
X (−1)k
d(50) · d(30) · d(40) = (50! )(30! ) (40! ),
k=0
k! k=0
k! k=0
k!
5. 5! · d(5).
For the first round of interviews, Kalil can simply assign one outfit to each in-
terview, giving 5! possible distributions of these outfits. For the second round of
interviews, the outfit must be different at that job than worn in the first round.
Hence, we would like to derange the five outfits, d(5), from the first round. By
the Rule of Product there are 5! · d(5) ways for Kalil dress for these interviews.
We solve this problem using cases depending on how many odd numbers re-
mained in their original position.
Case 1: No odd numbers are in their place. Then every number is not in its
original place and there are d(10) such permutations.
Case 2: One odd number is in its original place. First we must determine
198
which of the five odd numbers stayed, there are 51 = 5 options. The remaining
9 digits will be deranged, d(9). By the Rule of Product there are 5 · d(9) such
permutations.
Case 3: Two odd numbers are not deranged. There are 52 = 10 choices of
which odd numbers remained in their initial position. The remaining 8 digits
will be deranged, d(8). By the Rule of Product there are 10 · d(8) such permu-
tations.
5
Case 5: 4
·d(6) = 5 · d(6).
5
Case 6: 5
·d(5) = d(5).
ways to permute the integers one through ten such that no even number is in
its original position.
7. n = 10.
We begin by deranging the first 6 elements, which will be deranged but remain
in the first 6 positions in the list, d(6) ways to do this. We now derange the
remaining n − 6 digits amongst the last n − 6 positions, which gives d(n − 6)
ways to do this. By the Rule of Product, d(6) · d(n − 6) = 2385. Rearranging
199
to solve for n, we obtain,
2385 2385
d(n − 6) = = =9
d(6) 265
By trial and error we see that d(n − 6) = d(4) = 9, hence n − 6 = 4 which gives
n = 10.
8. (a) d(8).
(b) 8! − d(8).
Any permutation that is not a derangement will result in at least one per-
son receiving the food they ordered. This can be calculated by taking the
total number of possible ways the waiter could have delivered the food,
8!, subtracted by the number of ways that no one gets the right meal, so
8! − d(8).
(c) 28 · d(6).
We are unsure which two people will get the food they ordered, so we
must multiply the derangement of the 6 plates, d(6), by 82 = 28. There-
fore there are d(6) · 28 ways exactly two people receive what they ordered.
(d) This is impossible. Assuming that the kitchen send out the correct orders,
if one person gets the wrong meal in the group then someone else must
have received a wrong meal as well.
200
9. (a) [d(12)]2 .
There are d(12) ways the drinks can be redistributed and d(12) ways the
meals can be redistributed, so by the Rule of Product there are [d(12)]2
ways to take home the leftovers.
(b) [d(6)]2 .
There is only one way for vegetarians to take home there own dishes and
there are d(6) ways to redistribute their drinks. There is only one way for
non-vegetarians to take home their own drinks and there are d(6) ways the
leftovers can be given out. So, by the Rule of Product there are [d(6)]2
possible distributions.
P12 k 12
(c) k=0 (−1) [(12 − k)!]2 k
.
Let ci be the case where i people bring home both their own drink and
main dish for 1 ≤ i ≤ 12.
If at least one person brings home their own main dish and drink, there
are 12
1
different ways this person could be chosen. There (11!)2 ways to
permute the remaining drinks and main dishes. This gives that N (c1 ) =
12
1
· (11!)2 .
Similarly, if at least two people bring home their own main dish and drink,
201
there 12
2
different pairs of people who could take home their own things
2
and (10!) ways to permute the remaining drinks and main dishes. Thus,
N (c2 ) = 12
2
(10!)2
10. We will count the number of permutations of the numbers 1, 2, 3, ..., n, which
is certainly n!. Alternatively, for every possible permutation we can consider
how there are k elements that have been deranged, and hence n − k elements
in their original positions for 0 ≤ k ≤ n. The n − k fixed elements can be
n
= nk ways, with d(k) ways that the k remaining elements
selected in n−k
can be deranged. We sum these cases from k = 0 to k = n to account for all
possible permutations, and the proof is complete since we’ve counted the same
situation in two different ways.
202
4.3 Onto Functions and Stirling Numbers of the Second Kind
Questions:
1. In your own words, explain what an onto function is.
2. Using the language of “objects” and “containers”, what is counting the number
of surjective functions equivalent to?
4. Let f : A → B be a surjective function, what can you say about |A| compared
to |B|?
8. A middle school social studies teacher wants the students to learn about the
seven different continents of the world. Between the 27 students they must split
into groups such that every continent has at least one student studying it. How
many different ways can the students group themselves?
Note: You may leave your solution in terms of a summation without evaluating
it.
203
9. At an engineering firm there are 4 professional engineers. Currently they have
7 different clients, one of which is by far the most profitable. In how many ways
can each engineer work on at least one account with the condition that Billi,
the most senior engineer, is always given the most valuable client.
10. In your own words, define what a Stirling number of the Second Kind is.
11. Express the number of onto functions from a set of size k to a set of size j where
k ≥ j using Stirling numbers.
12. You have been asked to distribute 10 different stuffed animals between 5 labelled
bins.
(a) How many ways can the stuffed animals be distributed so that every bin
has at least one stuffed animal in it?
(b) One of the stuffed animals is a collectable. In how many ways can we
distribute the stuffed animals such that the collectable is in the first bin,
and no bins are left empty?
(c) Suppose the bins are identical. How many ways can the stuffed animals
be distributed amongst the bins, with any number bins left empty?
(a) In how many ways can 55 335 be written as the product of two factors,
where each factor must be greater than 1?
(b) In how many ways can 55 335 be written as the product of two or more
factors, with every factor greater than 1?
204
14. Using the definition of Stirling numbers, algebraically prove:
(a) S(n, 1) = 1.
(b) S(n, 2) = 2n−1 − 1.
(c) S(n, n − 1) = n2 .
205
Solutions:
Note: There are two equivalent formulas for Stirling numbers:
n−1 n
1 X k n m 1 X k n
S(m, n) = (−1) (n−k) = (−1) (n−k)m
n! k=0 k n! k=0 k
n n−1
1 X k n m 1 X k n m n n
(−1) (n − k) = (−1) (n − k) + (−1) (n − n)m
n! k=0 k n! k=0 k n
n−1
1 X k n
= (−1) (n − k)m + 0
n! k=0 k
n−1
1 X k n
= (−1) (n − k)m
n! k=0 k
3. There are many possible examples, one example is the function y = x where
x ∈ Z.
206
5. There exists no surjective functions from C to D. As noted in question 3, the
size of the domain no smaller than the codomain/range. In this case, |D| > |C|
and so no possible onto functions exist.
P8 k 9
6. k=0 (−1) k
(9 − k)13
P8 k 9
For f : A → B, |A| = 13 and |B| = 9. Therefore, there are k=0 (−1) k (9 −
k)13 such onto functions.
P1 k 2
7. 24 − k=0 (−1) 2−k (2 − k)4 = 2.
There are 24 = 16 possible functions. Applying the formula for onto functions,
P1 k 2
we see that there are k=0 (−1) 2−k
(2 − k)4 possible surjective functions.
Hence there are only 16 − 14 = 2 non-surjective functions from X to Y .
P6 k 7
8. k=0 (−1) 7−k
(7 − k)27
This is essentially counting the number of onto functions from a set of size 27
to a set of size 7. Therefore, there are 6k=0 (−1)k 7−k
7
(7 − k)27 possible ways
P
P2 k 3
P3 4
9. k=0 (−1) 3−k
(3 − k)6 + k=0 (−1)
k
4−k
(4 − k)6 = 2 100
To solve this problem, we must consider two distinct cases and then apply the
sum rule.
Case 1: Suppose Billi is assigned only the most expensive client. Then we are
considering how to assign the remaining 6 accounts to the other 3 engineers
207
such that they each get at least one client. This is precisely the number of onto
functions from a set of size 6 to size 3, so there are 2k=0 (−1)k 3−k
3
(3−k)6 = 540
P
Case 2: Suppose instead that Billi is assigned the most expensive client as well
as other clients. Then we are left to assign the remaining 6 clients between the
4 engineers where each gets at least one client. This is the same as counting
the number of onto functions from a set of size 6 to a set of size 4. Therefore
there are exactly 3k=0 (−1)k 4−k4
(4 − k)6 = 1 560 ways to do this.
P
Adding these cases together using the sum rule, we see that there are 540 +
1 560 = 2 100 ways to assign the engineers to their clients so that Billi is always
assigned the most expensive client.
10. A Stirling number of the second kind, denoted S(m, n), is the number of ways
to distribute m distinct objects into n identical containers with no container
left empty.
11. We know the formula for the the number of onto functions from a set of size k
to a set of size j is: j−1 j
n
(j − n)k .
P
n=0 (−1) j−n
1
Pj n j
By definition of Stirling numbers, we know S(k, j) = j! n=0 (−1) j−n
(j −
n)k .
It is clear from the formulas that we can express the number of onto functions
in terms of Stirling numbers as: j! · S(k, j).
208
P4 k 5
12. (a) k=0 (−1) 5−k
(5 − k)10 = 5 103 000
This is simply the number of onto functions from a set of size 10 to a set
of size 5. Thus, there are 4k=0 (−1)k 5−k
5
(5 − k)10 = 5 103 000 way of
P
P3 k 4
P4 5
(b) k=0 (−1) 4−k
(4 − k)9 + k=0 (−1)
k
5−k
(5 − k)9 = 1 020 600
First, put the collectable in the first bin. Now we must consider two cases
depending on if we will put any other stuffed animals in the first bin.
Case 1: Suppose the collectable is the only stuffed animal in the first bin.
Then we distribute the remaining 9 stuffed animals between the 4 distinct
bins. This is the number of onto functions from a set of size 9 to a set of
size 4. Thus, there are exactly 3k=0 (−1)k 4−k
4
(4 − k)9 = 186 480 ways to
P
Case 2: Suppose the first bin has more stuffed animals than just the
collectable. Then we distribute other 9 stuffed animals between the 5 con-
tainers such that no container is left empty. There are 4k=0 (−1)k 5−k
5
P
(5−
9
k) = 834 120 ways to distribute the stuffed animals in this case.
Now apply the rule of sum to see that there are 186 480 + 834 120 =
1 020 600 ways to distribute the stuffed animals such that no bin is left
empty and the collectable is put into the first bin.
P5
(c) n=1 S(10, n) = 86 472
Since the bins are identical we will use Stirling numbers. We must consider
multiple cases to account for how many containers are left empty.
Case 1: Suppose no containers are left empty. We can use part a and
divide it by 5!, to account for the identical containers. In this case, there
are 5 1035! 000 = 42 525 = S(10, 5) ways to distribute the stuffed animals.
209
Case 2: Suppose 1 container is left empty. Now we are interested in how
many ways we can assign 10 distinct stuffed animals into the 4 remaining
identical containers so that none are left empty. There are S(10, 4) =
34 105 ways to do this.
Case 3: Suppose 2 containers are left empty. Now we are interested in how
many ways we can assign 10 distinct stuffed animals into the 3 remaining
identical containers so that none are left empty. In this case there are
S(10, 3) = 9 330 ways to distribute the stuffed animals.
Case 4: Suppose 3 containers are left empty. In this case, there are
S(10, 2) = 511 ways to distribute the stuffed animals.
Case 5: Suppose 4 containers are left empty. Then, there are S(10, 1) = 1
way to distribute the stuffed animals.
We now apply the Rule of Sum and see that there are 5n=1 S(10, n) =
P
13. We recall from number theory that any factor of 55 335 will be the product of
some subset of the factors of 55 335. For example. 3 · 5 and 31 · 3 · 17 are both
factors of 55 335.
(a) S(5, 2) = 15
210
S(5, 2) = 15 2-factor factorizations of 55 335.
P5
(b) n=2 S(5, n) = 15 + 25 + 10 + 1 = 51
We can add these cases together using the Rule of Sum to see that there
are 5n=2 S(5, n) = 15 + 25 + 10 + 1 = 51 possible factorizations where no
P
factor is 1.
1
1 X k 1
14. (a) S(n, 1) = (−1) (1 − k)n
1! k=0 1−k
1 n 1
= (1 − 0) + (1 − 1)n
1−0 0
=1·1+0·0
=1
211
2
1 X k 2
(b) S(n, 2) = (−1) (2 − k)n
2! k=0 2−k
1 0 2 n 1 2 n 2 2 n
= (−1) (2 − 0) + (−1) (1) + (−1) (0)
2! 2 1 0
= 2n−1 − 1
n−1
1 X
k n−1
(c) a S(n, n − 1) = (−1) (n − 1 − k)n
(n − 1)! k=0 n−1−k
1 0 n−1 n 1 n−1
= [(−1) (n − 1) + (−1) (n − 2)n + ...
(n − 1)! n−1 n−2
n−2 n − 1 n n−1 n − 1
+ (−1) (1) + (−1) (0)n ]
1 0
1 n!(n − 1)!
=
(n − 1)! (n − 2)!2!
n!
=
(n − 2)!2!
n
=
2
212
5 Generating Functions
5.1 Introductory Examples
(a) 1, 2, 3, 4, ...
(b) 5, 4, 3, 0, 0, ....
(c) 1, −1, 1, −1, 1, −1, ...
(d) 10
11 12 13
10
, 10 , 10 , 10 ...
(e) 10 11
12 13
10
, − 10
, 10
, − 10
...
(f) 1, 0, 1, 0, 1, ...
(g) 1, −2, 4, −8, 16, −32, 0, 0, 0, 0, ...
2. Given the following generating functions, determine the sequence that repre-
sents it.
(a) f (x) = 0
(b) f (x) = x
(c) f (x) = 4 + 3x − 10x2 + 55x3
(d) f (x) = (3x − 4)3
3x
(e) f (x) = 1−x
1
(f) f (x) = (1−3x)2
213
3. Determine the coefficient of the specified term in the expansion of the given the
function.
1
(a) x3 in 1−x
.
1
(b) x2 in (1−2x)3
.
(1−x8 )
(c) x5 in 1−x
.
1
(d) x4 in (1+3x)10
.
4. In how many ways can 1000 identical pamphlets be distributed to five different
counselling centers, where pamphlets are put in stacks of 50, such that each
center receives at least 50 but no more than 500 pamphlets?
5. In how many ways can 20 identical balls be distributed between 3 distinct boxes
such that,
6. Determine the number of ways that $12 in loonies can be distributed between
a father’s three children so that the eldest gets at least four dollars, the middle
and youngest child are both guaranteed at least two dollars, but the youngest
cannot receive any more than $5 since he will spend it all on candy and rot his
teeth.
7. In how many ways can n balls be selected from a supply of pink, orange and
black balls such that the number of black balls selected must be even?
Hint: Partial fractions may come in handy.
214
8. A restaurant just closed for the night and they had an extra 12 orders of fries
and 16 mini-desserts left over. The restaurant manger decides to split this left
over food between the four employees closing that night. How can the manager
do this so that the head chef receives at least one order of fries and exactly
three mini-desserts, while the three other closing-staff are guaranteed at least
two orders of fries but less than 5 desserts?
10. A student is picking out a handful of gummy bears from a large container.
There are red, yellow, and green gummy bears in the container. The student
wishes to pick out an even number of red gummy bears, an odd number that is
at least 3 of yellow gummy bears, and either 4 or 6 green gummy bears.
(a) Determine the appropriate generating function that models this situation.
(b) How many ways can the student pick out gummy bears if they pick out:
i. 15?
ii. 22?
11. Determine the generating function for the following equations, where no xi < 0:
215
12. Someone buys a chocolate bar and receives 50 cents in change. Create a gen-
erating function that could determine the number of ways they could receive
their change in any combination of pennies, nickles, dimes, and quarters? The
coefficient of which term will give the desired solution?
Note: You are not being asked to determine how many ways this is possible.
13. A deck of cards has 52 cards in total. Half of the deck is red and half is black. A
quarter of the deck has the symbol hearts, a quarter has the symbol diamonds,
a quarter has the symbol spades, and a quarter has the symbol clubs. How
many ways are there to pick 15 cards if:
(a) You wish to pick an even number of black cards and an odd number of red
cards?
(b) You wish to pick at least two of each symbol, but no more than 5 hearts
and 6 spades?
14. Three students are running for student body president: Krishna, and Jamar,
and Bonnie. Find the generating function used to determine the possible dis-
tribution of n students’ votes
15. How many ways are there to obtain a sum of 7 if 2 distinct 6-sided dice, num-
bered 1, 2, 3, 4, 5, 6, are thrown?
216
Solutions:
1. The pattern for both this question and the one below it is, starting from 0, the
ith term in the sequence is the coefficient of xi .
P∞ k+1
k 1
(a) 1 + 2x + 3x2 + 4x3 + ... + nxn+1 + ... = k=0 1
x = (1−x)2
P2 5−k
(b) 5 + 4x + 3x2 = k=0 1
xk .
P∞ 1
(c) 1 − x + x2 − x3 + x4 − x5 + ... + (−1)n xn + ... = k=0 (−x)
k
= 1+x
.
10 11 12
x + ... = ∞ 10+k 1
2 P k
(d) 10
+ 10
x+ 10 k=0 x 10
= (1−x)11
10 11 12 13
... = ∞ 10+k 1
x2 − k
P
(e) 10
− 10
x+ 10 10 k=0 (−x) 10
= (1+x)11
P∞ 1
(f) 1 + x2 + x4 + ... = k=0 x2k = 1−x2
P5 1−(−2x)6 1−64x6
(g) 1 − 2x + 4x2 − 8x3 + 16x4 − 32x5 = k=0 (−2x)
k
= 1−(−2x)
= 1+2x
2. (a) 0, 0, 0, ....
(b) 0, 1, 0, 0, 0...
Since,
(3x − 4)3 = 27x3 − 108x2 + 144x − 64
217
(e) 0, 3, 3, 3, 3, ....
Since,
∞
3x X
= 3x · xk = 3x(1) + 3x(x) + 3x(x2 ) + ..
1−x k=0
Since,
∞ ∞
1 X k+1 k
X
2
= (3x) = (k + 1)(3x)k
(1 − 3x) k=0
1 k=0
.
3. (a) 1.
We know,
∞
1 X
= xr
1−x r=0
(b) 24.
We know,
∞
1 X r+n−1 r
= x
(1 − x)n r=0
n−1
218
(c) 1.
We know,
n
1 − xn+1 X r
= x
1−x r=0
(d) 57 915.
We know,
∞
1 r r+n−1
X
n
= (−1) xr
(1 + x) r=0
n−1
Therefore,
∞
1 r r + 10 − 1
X
= (−1) (3x)r
(1 + 3x)10 r=0
10 − 1
4. 3 246.
219
can identify the coefficient of x15 in,
g 0 (x) = (1 + x + ... + x9 )5 ,
1 − x10 5
g 0 (x) = ( )
1−x
1
= (−x50 + 5x40 − 10x30 + 10x20 − 5x10 + 1)
(1 − x)5
∞
50 40 30 20 10
X r+5−1 r
= (−x + 5x − 10x + 10x − 5x + 1) · x.
r=0
5 − 1
5. (a) 120.
220
factoring out some x’s, we can consider finding the coefficient of x14 in,
g 0 (x) = (1 + x + x2 + ...)3 .
g 0 (x) = (1 + x + x2 + ...)3
1 3
=[ ]
1−x
1
=
(1 − x)3
∞
X r+3−1 r
= x.
r=0
3 − 1
The coefficient of x14 occurs precisely when r = 14, which gives the coeffi-
cient 14+3−1
3−1
= 120.
(b) 48.
This problem boils down to finding the coefficient of x20 in the the gener-
ating function,
g(x) = (x3 + x4 + x5 + ... + x10 )3
Alternatively, we can factor out some x’s and find the coefficient of x11 in,
g 0 (x) = (1 + x + x2 + .. + x7 )3 .
221
Rewriting g 0 (x),
g 0 (x) = (1 + x + x2 + .. + x7 )3
1 − x8 3
=[ ]
1−x
1
= (1 − x8 )3
(1 − x)3
1
= (−x24 + 3x16 − 3x8 + 1)
(1 − x)3
∞
X r+3−1
= (−x24 + 3x16 − 3x8 + 1) xr .
r=0
3−1
The coefficient of x11 will occur in the expansion twice, when r = 11, 3.
For r = 11, 11+3−1 3+3−1
3−1
= 78, and r = 3, 3−1
= 10. Therefore putting it
11
all together, the coefficient of x is (1)(78) + (−3)(10) = 48.
(c) 21.
As we have already found our generating function for this condition and
number of boxes, we are simply looking for the coefficient of x25 in g(x),
or x16 in g 0 (x).
From (b),
∞
0 24 16 8
X r+3−1
g (x) = (−x + 3x − 3x + 1) xr
r=0
3−1
The coefficient of x16 will occur thrice when r = 16, 8, 0. When r = 16,
16+3−1 8+3−1 0+3−1
3−1
= 153, when r = 8, 3−1
= 45, and when r = 0, 3−1
= 1.
16
Putting it all together, the coefficient of x , and hence the number of
ways to distribute these 25 identical balls into three distinct boxes while
satisfying the conditions is 1(153) + (−3)(45) + 3(1) = 21.
222
6. 14.
To determine the number of ways the loonies can be distributed, we are looking
for the coefficient of x12 in the product,
g 0 (x) = (1 + x + x2 + ...)2 (1 + x + x2 + x3 )
g 0 (x) = (1 + x + x2 + ...)2 (1 + x + x2 + x3 )
1 1 − x4
= ·
(1 − x)2 1 − x
(1 − x4 )
=
(1 − x)3
∞
4
X r+3−1 r
= (1 − x ) x.
r=0
3−1
223
The coefficient of x4 will occur when r = 0, 4. When r = 0, 0+3−1
3−1
= 1, when
4+3−1
r = 4, 3−1 = 15. Putting this together, there are, 15(1) − 1 = 14 ways to
distribute the loonies.
1 1 n+1 1 n+2
+ 18 (−1)n .
7. 8
+ 4 1
+ 2 2
The expression, (1 + x + x2 + ...), will help keep track of the pink and orange
balls, while the expression, (1 + x2 + x4 + ...), will keep track of the even black
balls. We are interested in determining the coefficient of xn in the product,
1 2 1
g(x) = [ ] ·
1−x 1 − x2
1 1
= ·
(1 − x) 1 − x2
2
1
=
(1 − x) (1 − x2 )
2
1
= .
−(x − 1)3 (x + 1)
−1
g(x) =
(x − 1)3 (x + 1)
A B C D
= + + + .
x − 1 (x − 1)2 (x − 1)3 x + 1
Multiplying both the left and right hand sides by the common denominator,
(x − 1)3 · (x + 1), we obtain,
224
Expanding and applying the binomial theorem where necessary we see that,
A+D =0
−A + B − 3D = 0
−A + C + 3D = 0
A − B + C − D = −1.
We must now solve this system of equations. Clearly from the first equation,
D = −A. Plugging this into the second equation,
−A + B − 3(−A) = −A + B + 3A = B + 2A = 0,
which implies that B = −2A. Plugging these into the fourth equation we
obtain,
which implies that C = −1 − 4A. Finally we can plug everything into the third
equation and solve for A,
225
Hence,
−1 1 −1 1
g(x) = + 2
+ 3
+
8(x − 1) 4((x − 1) ) 2((x − 1) ) 8(x + 1)
1 1 1 1
= + 2
+ 3
+ .
8(1 − x) 4(1 − x) 2(x − 1) 8(1 + x)
8. 336.
We first note that we will need to apply the Rule of Product here, and use
generating functions for the distribution of the fries and then the mini-desserts.
In each of the generating functions, the first term in the product will represent
the share of the head chef, and the other terms the other employees.
g(x) = (x + x2 + x3 + ...)(x2 + x3 + x4 )3
= x7 (1 + x + x2 + ...)4 ,
226
the coefficient of x5 in,
g 0 (x) = (1 + x + x2 + ...)4 .
Rewriting,
1 4
g 0 (x) = [ ]
1−x
1
=
(1 − x)4
∞
X r+4−1 r
= x.
r=0
4 − 1
5+4−1
The term x5 occurs when r = 5, hence there are, 3
= 56 ways to distribute
the fries.
g(x) = x3 (1 + x + ... + x5 )3 ,
227
Rewriting,
1 − x6 3
g 0 (x) = [ ]
1−x
(1 − x6 )3
=
(1 − x)3
1
= (1 − x6 )3 ·
(1 − x)3
∞
X r+3−1
= (1 − x6 )3 · xr
r=0
3−1
∞
18 12
X r+3−1 r
6
= (−x + 3x − 3x + 1) x.
r=0
3−1
Certainly the term x13 occurs when r = 13, 7, 1. When r = 13, 13+3−1
2
= 105,
7+3−1 1+3−1
when r = 7, 2
= 36, and when r = 1, 2
= 3. Therefore there are
exactly, 1(105) + (−3)(36) + 3(3) = 6 ways to distribute the mini-desserts.
Now applying the Rule of Product, 56·6 = 336 ways the manager can distribute
the leftovers as outlines by the constraints.
9. First we consider one subset which satisfies our condition, say {2, 5, 9, 14}. Cer-
tainly 1 ≤ 2 < 5 < 9 < 14 ≤ 15. Now consider the differences between adjacent
values in this chain of inequalities,
2 − 1 = 1,
5 − 2 = 3,
9 − 5 = 4,
14 − 9 = 5,
15 − 14 = 1.
228
Notice how the sum of these differences is 14. Consider any other subset that
also satisfies the required conditions and you will see that upon doing the same
calculation, the sum of the differences will be 14 too. In other words, the non-
negative integers that are the differences that arise from the inequality, are a
set of five non-negative integers that sum to 14. This means that there is a
1 − 1 correspondence between these four-element subsets of our set, and the
non-negative integer solutions to,
c1 + c2 + c3 + c4 + c5 = 14,
g 0 (x) = (1 + x + x2 + ...)5 .
Rewriting,
g 0 (x) = (1 + x + x2 + ...)5
1 5
=[ ]
1−x
1
=
(1 − x)5
∞
X r+5−1 r
= x.
r=0
5−1
8+5−1
The term, x8 occurs when r = 8 and has a coefficient of 5−1
= 495. There-
229
fore there are 495 four-element subsets that contain no consecutive integers.
10. (a)
g(x) = (1 + x2 + x4 + ...)(x3 + x5 + x7 + ...)(x4 + x6 ).
(b) i. 9.
.
Rewriting,
g 0 (x) = (1 + x2 + x4 + ...)2 (1 + x2 )
1 2
=[ 2
] · (1 + x2 )
1−x
1
= · (1 + x2 )
(1 − x2 )2
1 + x2
= .
(1 − x2 )2
1 1
g 0 (x) = 2
+ .
2(x + 1) 2(x − 1)2
1 1
g 0 (x) = 2
+
2(x + 1) 2(1 − x)2
∞ ∞
1X r r+2−1 r 1X r+2−1 r
= (−1) x + x.
2 r=0 2−1 2 r=0 2−1
1
The coefficient of x8 occurs when r = 8, hence there are 2
· (−1)8 ·
230
8+1 1 8+1
1
+ 2 1
= 9.
ii. 0.
We can use the generating function from part (i) and this time solve
for the coefficient of x22−7 = x15 . This occurs when r = 15. The
coefficient is, 21 · (−1)8 · 15+1
1 15+1
1
+ 2 1 = 0.
Logically this makes sense since there is no way to sum to 22 from two
even numbers and one odd number.
11. In each of these questions, the solution would be the coefficient of the term xk .
Recall : You were not asked to solve these problems, only determine the gener-
ating function that could solve them.
(a) The first two terms in the product will represent the possibilities for x1 and
x2 . The third term in the product will stand in for x3 , and the final term x4 .
231
(b) g(x) = (1 + x2 + x4 + ...)(1 + x2 + x4 + ...)(1 + x + ... + x5 )(1 + x + x2 )
= (1 + x2 + x4 + ...)2 (1 + x + ... + x5 )(1 + x + x2 )
1 2 1 − x6 1 − x3
=[ ] · ·
1 − x2 1−x 1−x
(1 − x6 )(1 − x3 )
= .
(1 − x)2 (1 − x2 )2
(1 + x + x2 + ...)(1 + x5 + x10 + x15 + ...)(1 + x10 + x20 + ...)(1 + x25 + x50 + ...).
The first term of the product represents the pennies used, the second term the
nickels used, third the dimes used, and the last term stands in for the quarters.
1 1 1 1
· 5
· 10
· ,
1−x 1−x 1−x 1 − x25
232
which is our desired generating function.
13. (a) 8.
We will first set up the generating function. The first term of the prod-
uct represents the even black cards, and the second term the odd red cards.
1 1
g(x) = 2
−
4(x − 1) 4(x + 1)2
1 1
g(x) = 2
−
4(x − 1) 4(x + 1)2
∞ ∞
1X r+2−1 r 1X r r+2−1 r
= x − (−1) · x.
4 r=0 2−1 4 r=0 2−1
The coefficient of x15 occurs when r = 15. Therefore there are exactly 41 ·
16
− 4 · (−1)15 · 16
1
1 1
= 8 ways to pick 15 cards such that an even number
of black cards and an odd number of red cards from a standard deck.
(b) 90.
233
more than 13 of each symbol in the 15 cards.
The first term of the function will represent the clubs, the second the
diamonds, the third the hearts and the fourth the spades. Our generating
function is,
g(x) = (x2 + x3 + ... + x15 )(x2 + x3 + ... + x15 )(x2 + x3 + x4 + x5 )(x2 + x3 + ...x6 )
= (x2 + x3 + ... + x15 )2 (x2 + x3 + x4 + x5 )(x2 + x3 + ...x6 )
= x8 (1 + x + x2 + ... + x13 )(1 + x + x2 + x3 )(1 + x + x2 + x3 + x4 ).
1 − x12 2 1 − x4 1 − x5
g(x) = [ ] · ·
1−x 1−x 1−x
1
= · (x33 − x29 − x28 + x24 − 2x21 + 2x17 + 2x16 − 2x12 + x9
(1 − x)4
− x5 − x4 + 1)
∞
X r+4−1 r
= x · (x33 − x29 − x28 + x24 − 2x21 + 2x17 + 2x16
r=0
4 − 1
− 2x12 + x9 − x5 − x4 + 1)
234
14. (a) Each student can receive any number of votes, so the generating function
would be as follows.
g(x) = (1 + x + x2 + x3 + ...)3
15. If two distinct dice are rolled, then we can form the following generating func-
tion:
g(x) = (x + x2 + x3 + x4 + x5 + x6 )2
If we are looking to obtain a sum of 7, then we are looking to find the coefficient
of x7 in g(x).
g(x) = (x + x2 + x3 + x4 + x5 + x6 )2
= x12 + 2x11 + 3x10 + 4x9 + 5x8 + 6x7 + 5x6 + 4x5 + 3x4 + 2x3 + x2
The coefficient of x7 is 6 and thus there are 6 possible ways to throw two dice
in order to obtain a sum of 7.
235
5.3 Partitions of Integers
Questions:
1. In your own words, define a partition on a positive integer n.
2. Explain why generating functions are helpful in determining the number of pos-
sible partitions of integers.
5. Find all partitions of 5. Which of these partitions use only distinct summands?
6. Find the generating function that represents the number of ways of distributing
an unlimited supply of of balls into 5 identical boxes. What method would be
used to find the ways of distributing 10 balls?
7. Find the generating function for each of the following partitions of the integer
r such that:
236
(h) no summand can exceed 12, and summands cannot occur more than five
times?
8. Prove that the number of odd partitions of a natural number, n, is the same as
the number of distinct partitions of n.
10. Use a Ferrers diagram to show that the number of partitions of n is equal to
the number of ways to partition 2n into n parts.
11. Use a Ferrers diagram to prove that the number of partitions of n is equal to
the number of ways to partition (n + m) into m parts, where n ≤ m.
237
Solutions:
1. A partition on a positive integer n is a collection of unordered positive integers
that all sum to n.
54 = 1 + 10 + 20 + 5 + 8 + 7 + 3
5=1+1+1+1+1
5=1+1+1+2
5=1+2+2
5=1+1+3
5=1+4
5=2+3
5=5
238
g(x) = (1 + x + x2 + ...)5 .
To solve this problem when 10 balls are distributed, we would determine the
coefficient of x10 .
k
k
Y 1
=x
i=1
(1 − xi )
239
(e) g(x) = (1 + x + x2 + ...)(1 + x2 )(1 + x3 + x6 + ...)(1 + x4 )...
1 (1 − x4 ) 1 (1 − x8 ) 1 (1 − x12 )
= · · · · ...
(1 − x) (1 − x ) (1 − x ) (1 − x ) (1 − x5 )
2 3 4 (1 − x6 )
4 8 12
1 (1−x ) 1 (1−x ) 1 (1−x )
= · 2
· 3
·
4 ·
...
(1 − x) (1 − x ) (1 − x ) (1− x ) (1 − x5 ) 6
(1 − x )
∞
Y 1
= , where i 6≡ 0 mod 4
i=1
1 − xi
(h) g(x) = (1 + x + x2 + x3 + x4 + x5 )(1 + x2 + x4 + ... + x10 )...(1 + x12 + x24 + ... + x60 )
12
Y
= (1 + xi + x2i + x3i + x4i + x5i )
i=1
8. A distinct partition is one in which all the summands are distinct. For example,
the summands of 3 = 1 + 1 + 1 are not distinct, but the summands of 3 = 1 + 2
are.
We begin by finding the generating function for the partitioning of n into distinct
partitions. Let us denote this generating function by Pd .
(1 − x2 ) (1 − x4 ) (1 − x6 ) (1 − x8 )
Pd (x) = · · · ..
(1 − x) (1 − x2 ) (1 − x3 ) (1 − x4 )
240
We can then cancel common factors:
(1 − x2 ) (1 − x4 ) (1 − x6 ) (1 − x8 )
Pd (x) = · · · · ...
(1 − x) (1 − x2 ) (1 − x3 ) (1 − x4 )
2 4 6 8
(1−x ) (1−x ) (1−x ) (1−x )
= · 2 · 3
· 4 · ...
(1 − x) (1−x ) (1 − x ) (1−x )
1 1 1
= · · ...
(1 − x) (1 − x ) (1 − x5 )
3
Next we will find the generating function corresponding to the number of odd
partitions of n. Let us denote this generating function by Po .
1 1 1
Po (n) = · · · ....
1 − x 1 − x 1 − x5
3
Certainly, we see that Po (n) = Pd (n). Thus, since the generating functions are
equal, the coefficient of xn will be equal as well implying our desired result.
1 1 − x4 1 1 − x8
Pe (n) = · · · · ....
1 − x 1 − x2 1 − x3 1 − x4
241
We can now cancel out some terms to simplify the formula:
4 8 12
(1−x (1−x (1−x
1 ) 1 ) 1 )
Pe = · 2
· 3
·
4 5
·
6
...
(1 − x) (1 − x ) (1 − x ) (1− x ) (1 − x ) (1 − x )
∞
Y 1
= , where i 6≡ 0 mod 4
i=1
1 − xi
(1 − x4 ) (1 − x8 ) (1 − x12 ) (1 − x16 )
P3 (n) = · · · · ....
(1 − x) (1 − x2 ) (1 − x3 ) (1 − x4 )
10. This can be done by creating a one-to-one correspondence between any parti-
tioning of n and any partitioning of 2n into n parts.
242
Let us take some partition of 2n, where (arbitrarily) n = 3.
Notice that the top row in this Ferrers diagram has exactly n dots:
Deleting this row would create a Ferrers diagram for a partition of n. Each
unique partition of 2n manipulated in this way will create a unique partition of
n, as there is no way to remove only the top row and have two equivalent dia-
grams as then the top row would have to be what distinguishes two partitions
of 2n. The top row must always be n dots by the way the partitioning of 2n is
defined so this is not possible.
243
We can add a row to the top. This will add n dots and ensure there are eaxactly
n partitions. This converts this diagram into a partition of 2n with exactly n
partitions.
Thus, a one-to-one corresdence exists between the two sets of diagrams and so
the two set sizes are equal.
11. Similar to in question 11, we can prove these two numbers are equal by finding
a one-to-one correspondence between the two sets. Also, notice this is simply a
generalization of question 11.
244
We can simply add a row to the top of the diagram with m dots. This will
transform this Ferrers diagram into a partition of n + m with exactly m parti-
tions. Let us suppose m = 4.
245
Notice that the top row has exactly m dots.
If we remove these dots we are left with a partition of n. Thus we have a relation
between any m + n Ferrers diagram and a unique Ferrers diagram for n. The n
diagram must be unique as if two Ferrers diagrams of partitions of m + n create
two identical partitions of n by removing the top row it must mean that the
top row is what is distinct between them. That is not possible as these Ferrers
diagrams have exactly m summands and so must have the same top row.
246
6 Recurrence Relations
6.1 First-Order Linear Recurrence Relations
Questions:
1. In your own words, describe what a recurrence relation is.
Why is it better to solve a recurrence relation rather than just find the desired
terms as necessary?
8. Leora puts money in a high interest savings account to help save for university.
The interest is 8% annually and compounds monthly. If she deposits $1500.00
on the day she opens the account, how much money will she have after 16
months? Use recurrence relations to solve this problem.
247
9. By making a substitution, transform the following non-linear recurrence relation
into a linear recurrence relation and then solve it.
10. Given the following geometric progressions, find a recurrence relation with an
initial condition that satisfies the progression.
11. Given the following recurrence relation and initial conditions, solve for d:
−8 −32
an+1 − d · an = 0, where a3 = and a5 =
343 16807
12. Suppose the amount of bacteria in a container triples every hour. If initially
there are only 5 bacteria, how many bacteria are in the container after a day
and a half?
248
Solutions:
1. A recurrence relation is an expression for a function f (n) that is defined in
terms of previous terms, such as f (n − 1), with one or more initial values for
f (k) stated.
As we are not solving the recurrence relation, we will use the provided recurrence
formula to find the terms for n = 2, 3, 4, 5 to then find the value for n = 6.
a0 = 2
a1 = 7
a2 = −7 + 5(2) = 3
a3 = −3 + 5(7) = 32
a4 = −32 + 5(3) = −17
a5 = −(−17) + 5(32) = 177
a6 = −(177) + 5(−17) = −262
Solving a recurrence relation is better as you do not need to first find all the
preceding terms in order to find the nth term. As n gets large, computing each
term by hand will become extremely difficult and tedious.
249
4. an = 5 · (−2)n
a1 = −2(5)
a2 = −2[−2(5)] = (−2)2 · 5
a3 = −2[(−2)2 · 5] = (−2)3 · 5.
5. an = 909( 13 )n
We can reindex the function such that an+1 = 13 an for n ≥ 0 and a2 = 101. Since
this recurrence relation is a geometric progression we know that the solution to
this is an = a0 ( 31 )n so we have to determine is a0 .
6. an = k · ( −6
5
)n
1296 7 n
7. an = ( )
2401 2
250
As a4 = 81 = a0 ( 72 )4 = a0 ·2401
16
, it follows that a0 = 81 · 16
2401
= 1296
2401
. Therefore
1296 7 n
the solution is an = 2401 ( 2 ) .
8. bn = 25 · 3n
9. Make the substitution bn = a2n . The recurrence relation now becomes bn+1 = 3bn
where n > 0 and b0 = a20 = 52 = 25.
This is now a first order linear homogeneous recurrence relation. Thus, the
solved recurrence relation is bn = 25 · 3n for n ≥ 0.
2
11. d = 7
251
We can solve for a0 in both equations:
−8
a3 = a0 d 5 =
343
−8
a0 =
343 · d
−32
a5 = a0 d 5 =
16807
−32
a0 =
16807 · d
−8 −32
3
=
343 · d 16807 · d5
−8 · 16807 · d5 = −32 · 343 · d3
134456 · d2 = 10976
10976
d2 =
134456
4
=
49
r
4
d=
49
2
=
7
2
Thus, d = 7
and so our recurrence relation is an = a0 · 27 .
12. 5 · (336 )
Let n represent the number of hours the bacteria has been in the container, so
a0 = 5. Thus, we can use the recurrence relation an+1 = 3an where n ≥ 1 to
represent the bacteria growth. The unique solution to this relation is an = 5 · 3n
where n ≥ 0.
252
One and a half days is equal to 36 hours, so we compute an for n = 36. Hence,
there are a36 = 5 · (336 ) bacteria after a day and a half.
a0 = 1
a1 = −5
a2 = 25
a3 = −125
a1 = 1
a2 = 4
a3 = 16
253
6.2 Second Order Linear Homogeneous Recurrence Relations
with Constant Coefficients
Questions:
1. When solving a second order linear homogeneous recurrence relation with con-
stant coefficients, how many initial terms must be known to find its unique
solution? Explain.
for n ≥ 2?
254
Note: Do not be concerned if you are not getting nice results!
3r2 − 5r + 11 = 0
7. Find a recurrence relation for the number of binary sequences of length n that
have no consecutive 0’s.
Note: A binary sequence is sequence made up of only the digits “0” and “1”.
9. Determine and then solve a recurrence relation that determines the value of a
stock market indicator where the change in value in any given year, from the
previous, is twice the change noticed in the previous year.
10. Find the recurrence relation on for the number of n-letter words made from the
letters O, W, N that contain at least one O using generating functions. Check
your answer using a straightforward counting argument.
255
11. Solve the recurrence equation an = 3an−1 + n, n ≥ 1, a0 = 1 using generating
functions.
(a) un , the number of n-letter words using the letters B,A,R that contain no
consecutive A’s, n ≥ 0
(b) vn , the number of n-letter words using the letters B,A,R such that each B
and each A can only be followed directly by an R.
256
Solutions:
1. The solution will be in the form:
an = c1 (r1 )n + c2 (r2 )n ,
for n ≥ 0 and r1 , r2 come from factoring the initial function. Since the unique
solution requires knowing c1 and c2 , two unknowns, we will need at least two
initial values to solve for these two unknowns. Thus, two initial values are
needed.
C0 an + C1 an−1 − C2 an−2 = 0
r2 − 9r + 20 = 0
257
Thus our general solution is:
an = c1 (4n ) + c2 (5n )
where c1 and c2 are arbitrary constants. We now use our initial conditions
to solve for these constants.
a0 = c1 (40 ) + c2 (50 ) = c1 + c2 = 5
c1 = 5 − (−14) = 19
r2 + 1 = 0,
with roots r1 = i, r2 = −i
Since the characteristic roots are complex conjugates, we know the general
258
solution of this recurrence relation is given by,
an = c1 (i)n + c2 (−i)n ,
for n ≥ 0
We now use our initial conditions to solve for constants c1 and c2 .
a0 = 0 = c 1 + c 2 ,
a1 = −2 = c1 i − c2 i = i(c1 − c2 ).
From equation one, c1 = −c2 , and plugging this into the second equation
we obtain:
−2 = i(−c2 − c2 ) = −2c2
1
Therefore c2 = i
= −i and c1 = i. Thus:
r2 + 6r + 9 = 0.
Factoring this we find that r = −3. Thus, there is only one repeated root
and so the general solution to this recurrence relation is:
259
Using the initial conditions we see that:
a0 = 7 = c 1 + 0
a1 = 20 = 7(−3) + c2 (−3),
41
It follows that c2 = −3
. Thus our unique solution for n ≥ 0 is:
41n
an = 7(−3)n + (−3)n = 7(−3)n + 41n(−3)n−1 .
−3
r2 − 2r + 2 = 0
Using the quadratic formula we identify that the characteristic roots are
complex conjugates, specifically, r1 = 1 − i, r2 = 1 + i.
an = c1 (1 + i)n + c2 (1 − i)n
260
Using our two initial conditions we can solve for c1 , c2 :
a0 = 2 = c 1 + c 2
c2 = 2 − c1
a1 = 2 = c1 (1 + i) + c2 (1 − i)
a1 = 2 = c1 (1 + i) + (2 − c1 )(1 − i)2 = c1 + ic1 + 2 − 2i − c1 + ic1
2 = 2ic1 + 2 − 2i1 = c1 c2 = 1
√
Therefore the characteristic roots are r1 = r2 = 3. So our function has
repeated real roots. Thus, the general solution is:
√ √
an = c1 ( 3)n + c2 n( 3)n for n ≥
We can solve for our two unknowns by using the given initial conditions:
261
a0 = −1 = c1
r2 − 7r + 12 = r
(r − 3)(r − 4) = 0
an = c1 (3n ) + c2 (4n )
where c1 and c2 are constants. We can solve for c1 and c2 using our initial
262
values:
a0 = 2 = c 1 + c 2
a1 = 6 = 3c1 + 4c2
4 = c2
−2 = c1
−3i 3i
(g) an = 2
(3 + i)n + 2
(3 − i)n for n ≥ 0
r2 − 6r + 10 = 0
Thus, we can solve for the characteristic roots using the quadratic equation:
r1 = 3 + i and r2 = 3 − i
Thus the roots are distinct and complex. The general solution then is:
an = c1 (3 + i)n + c2 (3 − i)n
where c1 and c2 are constants. Using the initial values we can solve for c1
263
and c2 :
a1 = 0 = c 1 + c 2
= −c1 = c2
a2 = 3 = c1 (3 + i) − c1 (3 − i)
−3i
c1 =
2
3i
c2 =
2
−3i 3i
an = (3 + i)n + (3 − i)n for n ≥ 0.
2 2
r2 − 4r + 4r = 0
(r − 2)2 = 0
And so, r1 = r2 = 2. Thus, we have two repeated roots. This gives that
our general solution is:
an = c1 (2n ) + c2 n(2n )
264
We can find the particular solution using the initial values given:
a0 = −3 = c1
a1 = 1 = −6 + 2c2
c2 = 7
r2 − 4 = 0
Thus, solving for the characteristic roots we can see that we have two
distinct roots r1 = 2 and r2 = −2. Thus, the general solution is: an =
c1 (2n ) + c2 (−2)n We can solve for the particular solution using our initial
values:
a0 = 3 = c1 + c2
a1 = 4 = 2c1 − 2c2
2 = c1 − c2
5 = 2c1
5 1
= c1 = c2
2 2
265
Thus, the recurrence relation is equal to:
5 1
an = (2n ) + (−2)n for n ≥ 0.
2 2
√ √
4. an = (−1 − √412 )( 74− 5423 )n + ( 2√413 − 1)( 74+535423 )n for n ≥ 0
2 5423 53 5423
We start by using the 4 initial conditions to solve for b, c. We obtain the system
of equations:
14 + b(5) + c(−2) = 0
39 + b(14) + c(5) = 0
−148
Thus: b = 53
and c = 153.
−148 1
an + an−1 + an−2 = 0 for n ≥ 2
53 53
148 1
r2 − r+ =0
53 53
Using the quadratic equation we find that the characteristic roots are, x1 =
√ √
74− 5423 74+ 5423
53
and x 2 = 53
.
These are two distinct real roots, hence the general solution to this recurrence
relation is:
√ √
74 − 5423 n 74 + 5423 n
an = c 1 ( ) + c2 ( ) for n ≥ 0
53 53
266
We solve for the constants by using our initial values:
a0 = −2 = c1 + c2
c2 = −2 − c1
√ √ √
5 1+ 5 n
6. an = 5
[( 2
) − ( 1−2 5 )n ] for n ≥ 0
First, we must determine the recurrence relation. We can do so by trial and error
and examining the sequence. We find that this sequence can be represented by:
r2 − r − 1 = 0
√ √
1+ 5 1− 5
The characteristic roots are r1 = 2
and r2 = 2
, which can be seen using
267
the quadratic equation. These roots are real and distinct, so the general solution
to this relation is,
√ √
1+ 5 n 1− 5 n
an = c 1 ( ) + c2 ( ) , for n ≥ 0
2 2
a0 = 0 = c 1 + c 2
c1 = −c2
√ √
1+ 5 1− 5
a1 = 1 = c 1 ( ) + c2 ( )
2 2
√ √
2 = c1 + 5c1 + c2 − 5c2
√ √ √
2 = −c2 − 5c2 + c2 − 5c2 = −2 5c2
√
− 5
c2 =
5
√ √
− 5 5
Thus, c2 = 5
and c1 = 5
.
Therefore the unique solution that describes the Fibonacci sequence is:
√ √ √
5 1+ 5 n 1− 5 n
an = [( ) −( ) ]forn ≥ 0
5 2 2
First, we notice that a1 = 2, as the only possible sequences are “0” and “1”.
We can build each sequence of length n+1 from sequences of length n by adding
268
one addition term at the end as since the sequences of length n already satisfy
that there are no consecutive 0’s. Thus, we can see that
an = 2 · a1n−1 + 1 · a0n−1
This is because for any sequence of length n − 1 that ends in “1”, either “1” or
“0” can be added to the end to form a sequence of length n while a sequence
of length n − 1 that ends in “0” can only have “1” added to the end to form a
sequence of length n, else there would be consecutive “0”’s.
Now consider some sequences that belong to an−2 . If the sequence y ∈ an−2 then
y1 ∈ a1n−1 , and vice versa. Thus, there is a one-to-one correspondence between
the sets and so it follows that an−2 = a1n−1 .
We can now find our recurrence relation by putting all of this together:
an = 2 · a1n−1 + a0n−1
= a1n−1 + a1n−1 + a0n−1
= a1n−1 + an−1
= an−1 + an−2
8. c1 = 9 and c2 = −18
We know from the general solution that the characteristic roots of the charac-
teristic equation must be r1 = 3, r2 = 6.
269
r1 : 32 − 3c1 − c2 = 0,
r2 : 62 − 6c1 − c2 = 0.
The first equation implies that c2 = 9 − 3c1 , so we can substitute this into the
second equation: 36 − 6c1 − 9 + 3c1 = 27 − 3c1 = 0.
9. an = c1 + c2 2n , for n ≥ 0
an = 3an−1 − 2an−2
r2 − 3r + 2 = 0
Note: we are not able to find the particular/unique solution since we were not
provided with initial conditions.
10. on = 3n − 2n
For n = 0, there are no possible words as there is no way to include the letter
‘O’ in a word of length 0. Thus o0 = 0.
270
For n = 1, the only possible word is the letter ‘O’ itself. Thus, o1 = 1.
For n = 2, the possible words are: OO, OW, ON, NO, WO. Thus, o2 = 5.
To create a word of length n with with at least one O there are two cases:
(i) The first letter of the word is ‘O’. Then the following n − 1 letters can be
any other letters. Thus, there are 3n−1 words in this case.
(ii) The first letter is either ‘N’ or ‘W’. So, the following n − 1 letters must
include the letter ‘O’. This means the following n − 1 letters must be a
valid word of length n − 1. Thus, there are 2 · on−1 words in this case.
As these cases are disjoint, the recurrence equation is: on = 3n−1 + 2wn−1 ,
o0 = 0.
And so:
∞
X ∞
X
n
g(x) − w0 = g(x) = 2x on x + x 3n xn
n=0 n=0
x
= 2xg(x) +
1 − 3x
271
And so:
x
g(x) =
1 − 3x
x
g(x) =
(1 − 3x)(1 − 2x)
x
g(x) =
(1 − 3x)(1 − 2x)
1 1
= −
(1 − 3x) (1 − 2x)
X∞ ∞
X
= 3n xn − 2n xn
n=0 n=0
We can also solve this problem using a simple counting argument. All possible
words of length n, without restrictions, made with the letter ‘O, W, N’ is 3n .
All words with n letters that do not include ‘O’ are 2n . Thus, the total words
that do contain ‘O’ using PIE is: 3n − 2n , which is the same result we found
using generating functions.
11. an = 47 3n − 34 − n
2
.
Let us multiply the equation for an by xn :
272
an xn = 3xn an−1 + xn n
We can now sum this equation from n = 1, as this is when the equation given
begins:
∞
X ∞
X ∞
X
n n
an x = 3x an−1 + xn n
n=1 n=1 n=1
X∞ ∞
X
n−1
=x 3x an−1 + xn n
n=1 n=1
X∞ ∞
X
= 3x x n an + xn n
n=0 n=1
∞
X
= 3xg(x) + xn n
n=1
P∞
We can refer to the table of generating functions to rewrite n=1 xn n:
∞ ∞ ∞
X
n
X n+2−1 n 1 X
(n + 1)x = x = 2
= xn−1 n
n=0 n=0
1 (1 − x) n=1
Thus:
∞
X ∞
X
n
x ·n=x· xn−1 n
n=1 n=1
x
=
(1 − x)2
273
Thus, we can substitute our values into our summation equation:
∞
X ∞
X ∞
X
n n
an x = 3x an−1 + xn n
n=1 n=1 n=1
x
g(x) − g(0) = 3x · g(x) +
(1 − x)2
x
g(x) − 1 = 3x · g(x) +
(1 − x)2
x
g(x) − 3x · g(x) = 1 +
(1 − x)2
x
g(x)(1 − 3x) = 1 +
(1 − x)2
1 x
g(x) = + 2
(1 − 3x) (1 − x) (1 − 3x)
x
Now we can rewrite (1−x)2 (1−3x)
using partial fractions:
x A B C
= + +
(1 − x)2 (1 − 3x) (1 − 3x) (1 − x) (1 − x)2
And so:
Thus:
0 = A + 3B
1 = −2A − 4B − 3C
0=A+B+C
274
x 3 1 1
= − −
(1 − x)2 (1 − 3x) 4(1 − 3x) 4(1 − x) 2(1 − x)2
Thus:
1 3 1 1
g(x) = + − −
(1 − 3x) 4(1 − 3x) 4(1 − x) 2(1 − x)2
7 1 1
= − −
4(1 − 3x) 4(1 − x) 2(1 − x)2
∞ ∞ ∞
7X n n 1X n 1X
= 3 x − x − (n + 1)xn
4 n=0 4 n=0 2 n=0
7 1 1
an = 3n − − (n − 1)
4 4 2
7 n 1 n 1
= 3 − − −
4 4 2 2
7 n 3 n
= 3 − −
4 4 2
For n = 1, any single letter is a valid word (ie ‘B’, ‘A’, ‘R’). So u1 = 3.
275
(ii) The word begins with ‘A’. Then the following letter must be ‘B’ or
‘R’. The remaining n − 2 letters are any valid word of that length.
Thus, there are a total of 2un−2 in this case.
Thus: un = 2un−1 + 2un−2 , where u0 = 1.
(b) un = 2un−2 + un−1 , where u0 = 1
For n = 1, any single letter is a valid word (ie ‘B’, ‘A’, ‘R’). So u1 = 3.
276