Combi
Combi
1 Combinatorics 1
1.1 The Pigeonhole Principle . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Putting Things In Order . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Bijections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Subsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 The Principle of Inclusion-Exclusion . . . . . . . . . . . . . . . . . 11
1.6 The Erdős-Ko-Rado Theorem . . . . . . . . . . . . . . . . . . . . 15
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2 Graph Theory 24
2.1 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.3 Graph Coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.4 Ramsey Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.5 The Probabilistic Method . . . . . . . . . . . . . . . . . . . . . . . 42
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Combinatorics
Theorem 1.1. (Pigeonhole Principle)1 Let b and n be positive integers with b > n.
If we place b balls into n boxes, then some box must contain at least two balls.
If the Pigeonhole Principle seems obvious, that’s good. But it is worth pausing
for a moment and asking ourselves how we would prove such a statement, i.e., how
could we convince a doubtful person beyond any doubt whatsoever using a reasoned
argument?
This silly-sounding principle is actually quite useful. We just need to free our
minds from thinking literally about boxes and balls, or pigeons and pigeonholes,
and to think more generally about placing a finite set of things into a fixed num-
ber of categories. We recall that the set of integers is the set of whole numbers
. . . , −2, 1, 0, 1, 2, . . ..
Example 1.3. No matter how you choose 6 positive integers, two of them will differ
by a multiple of 5.
Proof. We observe that two numbers differ by a multiple of 5 precisely when their
remainders upon division by 5 are the same. There are only 5 possible remainders
0, 1, 2, 3, 4,
so the Pigeonhole Principle implies that given any six numbers, some pair of them
have the same remainder.
Example 1.4. Given any five points in a square of side length 1, some two of them
are at distance < 0.75 of each other.
You might enjoy playing with this example. For example, if you are allowed to
choose only four points instead of five, you can put them at the four corners of the
square. But if you have to choose five points, we’re claiming that two of them will
be within < 0.75 of each other no matter what. Try it!
How can we prove this using the Pigeonhole Principle? What are the pigeons?
What are the pigeonholes? What we would really like is to be able to identify four
reasonably small regions of the square that cover the entire square. Then at least two
of the five given points lie in one of the regions, so are reasoanbly close to each other.
Here are the details.
Proof. Divide the square into four smaller squares of side length 1/2, as illustrated in
Figure 1.1. Given five points, the Pigeonhole Principle implies that two of the points
lie within one of the small squares. Hence the distance between√these two points is
at most the length of the diagonal of the small squares, which is 2/2 ≈ 0.707.
1 1
2 2
1
2
1
2
How many different ways can we put n distinct symbols in some order?
Let’s try writing down all the ways to order 1, . . . , n for some small values of n.
Writing down small examples is often a good strategy to get started in solving a math
problem.
We get 1, 2, 6, 24, . . . .
Definition. Let n be a positive integer. The factorial of n is the product
n · (n − 1) · · · · · 3 · 2 · 1.
and notice that the remaining strings constitute all ways to order the remaining n − 1
symbols. Thus each group has size (n − 1)!. So, there are
(n − 1)! + · · · + (n − 1)! = n · (n − 1)! = n!
| {z }
n copies of (n − 1)!
Let’s generalize:
Proposition 1.6. (Multiplication rule) Let n ≥ 1 and let m1 , . . . , mn be positive
integers. Suppose we have a collection C of strings of symbols of length n, such that:
• there are m1 symbols that may appear as the first symbol of a string in C;
• for each i = 2, . . . , n, any initial substring contisting ofof i − 1 symbols ap-
pearing in C may be extended in exactly mi ways to a substring of i symbols
appearing in C.
Then
|C| = m1 · m2 · · · · mn .
Proof. We leave the proof as an exercise; see Exercise 1.2.
The statement of Proposition 1.6 sounds more complicated than it should. It ba-
sically says that if you need to make a sequence of n choices, and the number of
choices you have at each juncture doesn’t depend on past choices, then all in all, you
should multiply the number of choices you have at each juncture. To see this, think
of the strings of symbols as all of the possible written records of the choices you
made.
Example 1.7. A binary string is a sequence of 0s and 1s. How many binary strings
of length k are there?
Solution. By the multiplication rule, it’s
2| · 2{z· · · 2} = 2k .
k factors of 2
Example 1.8. Suppose that there are 100 students in a class. How many ways are
there to choose a president, a vice-president, and a treasurer, if we specify that no
student may hold more than one position?
Solution. There are 100 choices of president. Having chosen a president, there are 99
choices of vice-president. Having made those choices, there are 98 choices of trea-
surer. There are 100 · 99 · 98 = 970200 choices in all. Notice, by the way, that we
can write this answer as
100!
100 · 99 · 98 =
97!
using a whole lot of cancellation.
Generalizing:
Proposition 1.9. Suppose we have n distinct symbols, and let k be a positive integer
with k ≤ n. There are
n!
n · (n − 1) · · · (n − k + 1) =
| {z } (n − k)!
k factors
1.3 Bijections
This is as good a time as any to mention that bijections between finite sets are a
combinatorialist’s favorite tool for counting.
Definition.
Bijective correspondence simply means that there exists a bijection from one set to
the other.
The claim made in Theorem 1.11 is obvious, right? Then we should be able to
prove it.
Proof. Let |X| = n. What does that actually mean? Presumably, it means that
there is a bijection between X and the set {1, . . . , n}. If so, then by composing
that bijection with a bijection between X and Y , we obtain a bijection between Y
and {1, . . . , n}, so |Y | = n also.
One might view the set {1, . . . , n} as the refference n-element set sitting on a shelf at
the National Bureau of Standards. The point is that one way to count the elements in a
set Y is simply to establish a bijection between Y and some set X whose cardinality
you already know. This comes up constantly, and is extremely satisfying! In fact, one
could argue that this is the best and most explicit way to count things—the various
other methods that we discuss are but tricks that we use when we are unable to
produce an explicit bijection.
We will see many examples, starting straightaway in the next section.
1.4 Subsets
Definition. For n ≥ 0 an integer, we denote the set {1, . . . , n} by [n]. Somewhat
strangely, this convention includes [0] = ∅.
We ask:
Definition. Let X be any set. The power set of X is the set of all subsets of X; it is
denoted P(X).
So there are four of them. One way to compute that number, four, is as follows. We
already know that there are 4 · 3 · 2 = 24 ways to choose 3 elements of the 4 and
place them in order. Now, consider the function
ordered triples (a, b, c) of distinct 3-element subsets of
−→
elements of the set {1, 2, 3, 4} the set {1, 2, 3, 4}
that forgets the ordering. (This kind of function really is referred to as a forgetful
function, since its job is to forget some stuff, in this case, to forget the ordering of the
triple.) Here it is, written in full detail:
In general, each set downstairs has 6 = 3 · 2 · 1 elements sitting above it, where 6
represents the number of ways to order the three given symbols. So we compute the
answer 4 as the solution to the problem ? · 6 = 24. More generally:
of k-element subsets of an n-element set. Such expressions are called binomial co-
efficients, for reasons that will be clear soon. We note that this quantity is also called
the number of combinations of n things taken k at a time and is sometimes denoted
by C(n, k), but these days the notation nk is considered more stylish.
where we recall that P (n, k) denotes the number of ways to choose k elements from
an n-element set and order them.
There is so much to say about the binomial coefficients! Let’s start by arranging
them visually on the page in a big triangle, where the nth row goes from n0 to nn .
0
0
1 1
0 1
2 2 2
0 1 2
3 3 3 3
0 1 2 3
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
Proof. We prove the first statement of Conjecture 1.14 and leave the other parts as
homework; see Exercise 1.16. Conjecture 1.14(a) claim amounts to proving that the
identity
n n−1 n−1
= +
k k k−1
is true for all integers n ≥ 1 and for all integers k satisfying 1 ≤ k ≤ n.
We could hash this out using the expression (1.1), but we’ll leave that for you,
and we’ll take a more combinatorial, less computational, approach. We are going
to give a “bijective proof.” We consider the set X of k-element subsets of [n]. For
example, if n = 4 and k = 2, then
X = {1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 4}, {3, 4} .
We note that X1 is in bijection with the set of k-element subsets of [n − 1], since,
the sets in X1 are exactly the subsets of [n − 1]. And X2 is in bijection with the
set of (k − 1)-element subsets of [n − 1], since each set in X2 is formed by taking a
k − 1-element subset of [n − 1] and throwing in the element n. Alternatively, we can
define a bijection X2 → [n − 1] by taking a set in X2 and removing the element n.
All in all, we find that
n n−1 n−1
= |X| = |X1 | + |X2 | = + ,
k k k−1
which is exactly what we wanted to show.
Sometimes binomial coefficients are used to count things in unexpected ways:
Example 1.15. You have n numbered boxes. How many ways are there to put k
indistinguishable balls into them? Note tha “indistinguishable” means that we care
only about how many balls go in each box; the balls themselves are identical.
Solution. Convince yourself that you may count instead sequences consisting of k
symbols that look like • and n − 1 symbols that look like |. The circles represent the
balls and the vertical bars represent box-separators. Here is an example of a sequence
of symbols and how it translates into balls in boxes:
Box 1
Box 2 Box 3 Box 4
n−1+k
The number of such sequences of circles and bars is , since we can
k
view the problem as that of selecting k of the n − 1 + k symbols to be circles, and
then the other n − 1 symbols must be bars.
The method that we have used to solve this problem is sometimes referred to as
the “stars and bars” method (although we have used circles instead of stars), but at
least one mathematician from the Midwest has suggested that it should be called the
“cows and fences” method.
Example 1.16. Same question as in Example 1.15, but now we require that every box
contains at least one ball.
Solution. If n > k, then the answer is clearly 0, so we assume that n ≤ k. Then we
need to start by using k of the balls to put one in each box. This leave k−n balls to be
distributed in any way we please, so we are in the exactly situation of Example 1.15,
except we only have k − n balls to put into the n boxes. So the answer is
n−1+k−n k−1 k−1
= = ,
k−n k−n n−1
where for the second equailty comes we use the symmetry of Pascal’s triangle.
Finally we come to the binomial theorem, which will also tells us the origin of
the name binomial coefficient. This theorem explains the pattern of the coefficients
when we take powers of x + y:
(x + y)0 = 1
(x + y)1 = 1x + 1y
(x + y)2 = 1x2 + 2xy + 1y 2
(x + y)3 = 1x3 + 3x2 y + 3xy 2 + 1y 3
(x + y)4 = 1x4 + 4x3 y + 6x2 y 2 + 4xy 3 + 1y 4
..
.
(x + y)(x + y)(x + y) = xxx + xxy + xyx + xyy + yxx + yxy + yyx + yyy.
In such an expansion, there are 2n terms (why?). Now collecting them together using
the commutative law, we see that the term xk y n−k appears a total of nk times: this
This shows that the number of subsets of [n] of even size equals the number of subsets
of [n] of odd size. Can you give a bijective proof of this fact?
There is a whole theory of multinomial coefficients as well, i.e., the coefficients
of
(x1 + · · · + xd )n
for some fixed d > 2. See if you can compute the multinomial coefficients and
generalize the ideas in this section. If you are stuck, look them up!
Proof. Well, you probably already believe it, if you’re like 99% of people. The idea
is that each element of X1 ∪ X2 is counted the same number of times on both left
and right. It is an exercise for you to make that statement entirely precise.
Similarly, if we have three sets that may have elements in common, then
and in general:
Theorem 1.21. (Principle of Inclusion/Exclusion, general case) Let n ≥ 1, and
let X1 , . . . , Xn be finite sets. Then
X \
|X1 ∪ · · · ∪ Xn | = (−1)|I|−1 Xi . (1.3)
∅6=I⊆[n] i∈I
Proof. As in our proof sketch of Theorem 1.20, we verify that every element x ∈
X1 ∪ · · · ∪ Xn ends up contributing exactly one to the expression on the right hand
side of (1.3). Let
Jx = {i ∈ [n] : x ∈ Xi }.
For example, if x is in X1 and X3 and no other sets, then Jx = {1, 3}. On the right
hand side of (1.3), we consider the terms in the sum that have a non-zero from x.
These are exactly the terms where I is a subset so that x is in Xi for every i ∈ I, i.e.,
these are exactly the terms where I is contained in Jx . And these terms are counted
with sign +1 if |I| is odd and with sign −1 if |I| is even.
Thus each x ∈ X1 ∪ · · · ∪ Xn contributes exactly
to the right hand side of (1.3), and we need to show that (1.4) is equal to 1. But we
know from Example 1.19 that
and that gives the desired result, since in 1.4 we haven’t included the empty set
amongthe sets with an even number of elements.
Example 1.22. (The problem of derangements). There are n people sitting on a com-
pletely full airplane. The airline decides to wreak maximum havoc by reassigning
seats in such a way that no person remains in the same seat. How many ways are
there to do this? Such a reassignment is called a derangement.
For example, for three people, there are six possible ways to rearrange them, but
we find that only two of those six permutations are derangements:
123 (all fixed), 132 (1 is fixed), 321 (2 is fixed), 213 (3 is fixed),
312 (derangement), 231 (derangement).
Note that ∪Xi is the set of all seat reassignments in which someone stays in their
seat, so the number that we seek is
is the number of seat reassignments in which the people numbered by J stay in their
seat. There are (n − j)! ways for this to happen. Moreover, there are nj subsets
of [n] of size j. Applying PIE wile grouping together the subsets of [n] by size, gives
that
n
j−1 n
X
|X1 ∪ · · · ∪ Xn | = (−1) (n − j)!. (1.5)
j=1
j
Example 1.23. (Counting surjective functions). Let n and k be positive integers. How
many surjective functions [n] → [k] are there?
Solution. This example is similar to Example 1.22. First, the multiplication rule says
that there are k n functions [n] → [k]. Now for each i ∈ {1, . . . , k}, let Xi denote
the set of functions f : [n] → [k] such that i is not in the image of f . In other words,
there is no x ∈ [n] such that f (x) = i. The answer we seek, then, is
k n − |X1 ∪ · · · ∪ Xk |.
Now let’s use PIE. We note that if J ⊆ [k] has size j, then
\
Xi = (k − j)n .
i∈J
So PIE says
k
j−1 k
X
n
=k − (−1) (k − j)n
j=1
j
k
X k
j
= (−1) (k − j)n .
j=0
j
That’s the answer. An amusing side note is that if k > n, then since there are no
surjective maps [n] → [k], this last sum must equal 0. But this fact is is not at all
clear if one just looks at the sum.
By the way, there is a closely related quantity that people sometimes refer to as
the Stirling numbers (of the second kind). (If you’re interested, you can look up the
Stirling numbers of the first kind.)
Definition. Let n and k be positive integers. We define the Stirling numbers of the
second kind to be the quantities
k
1 X k
S(n, k) = (−1)j (k − j)n ,
k! j=0 j
So Example 1.23 says that the number of surjective functions [n] → [k] is k!·S(n, k).
The Stirling number S(n, k) also count somethng interesting, which in particular,
implies that they are integers.
Proposition 1.24. The number of ways to divide a pile of n labeled objects into
exactly k piles is the Stirling number S(n, k).
Proof. If the k piles were labeled, this would be exactly the number of surjective
funtions [n] → [k], where the image of each object tells us in which pile it sits, and
the surjectivity is required to ensure that we end up with exactly k piles. However,
the piles are not supposed to be labeled, so we need to divide by the k! ways that we
can rearrange them. Hence the answer is
S ∩ T 6= ∅.
We ask:
For example, how large can an intersecting family of 2-element subsets of [4] be?
Relabeling, we can always start with the subset {1, 2}. Our next subset must share
an element with {1, 2}, so after relabeling, they share 1 and the new element is 3,
i.e., our second subset is {1, 3}. In order to form a third subset, we could take {1, 4},
and then every pair of subsets shares 1, or we could take {2, 3}, in which case we
again get an intersecting family. And that’s as far as we can go. So the answer to our
question when n = 4 and r = 2 is that an intersecting family of 2-element subsets
of [4] contains at most 3 subsets, and that this can be achieved in two distinct ways
(up to relabeling the elements),
n o n o
F1 = {1, 2}, {1, 3}, {1, 4} and F2 = {1, 2}, {1, 3}, {2, 3} (1.6)
1 1 1
4 C1 2 3 C2 2 4 C3 3
3 4 2
1 1 1
2 C4 3 3 C5 4 2 C6 4
4 2 3
Next we say that a subset of [n] is an interval of a cyclic order if its elements
appear consecutively in the cyclic order. For example, in Figure 1.3 the set {3, 4} is
an interval of C1 , C2 , C4 , and C6 , while {1, 2, 3} is an interval of all six of the Ci .
We note that if n ≥ 24, then a given cycle C has exactly n intervals of length r,
which are formed by starting at each element of C and taking the set consisting of r
consecutive elements. Thus the cycle C1 in Figure 1.3 has 4 intervals of length 2,
namely {1, 2}, {2, 3}, {3, 4}, and {1, 4}.
2 More precisely, a cyclic ordering is an equivalence class of cyclic permutations of {1, . . . , n}, under
Now let’s count the elements of X by first choosing the cycle C, which as we
saw earlier can be done in (n − 1)! ways, and then estimate how many S ∈ F can be
intervals of the given C. We saw above that C contains n distinct intervals, but since
we are restricting to intervals that are in the intersecting family F, we claim that at
most r members of F may appear as intervals of C.
To see why, suppose that I is an interval of C that is in F. We can shift I either
clockwise or counterclockwise to get other intervals of C, but if we shift I too far,
we’ll get an interval that has no elements in common with I, so it can’t be in F.
More precisely, there are r − 1 clockwise shifts of I that have an element in common
with I, and similarly there are r −1 counterclockwise shifts of I that have an element
in common with I. But a clockwise shift I 0 and a counterclockwise shift I 00 will
have no elements in common if the total shift for I 0 plus I 00 is r or greater. Hence
the intersecting family F contains at most r elements that can appear as an interval
of C. In symbols, we have shown that
Combining the two expressions (1.8) and (1.9) for |X|, we get
so
(n − 1)! · r (n − 1)! n−1
|F| ≤ = = ,
r! · (n − r)! (r − 1)!(n − r)! r−1
which is exactly what we wanted to show.
Exercises
Section 1.1. The Pigeonhole Principle
1.1. Prove Theorem 1.2, the general version of the Pigeonhole Principle. Hint. Try to imitate
the proof of Theorem 1.1.
1.2. Prove the multiplication rule stated in Proposition 1.6. Hint. Give a proof by induction
on n, imitating the proof of Proposition 1.5.
1.3. Suppose there are four rows of seats in a classroom, each row containing six seats. How
many students are necessary to guarantee that no matter how they seat themselves, some row
will be full?
Note that if you think the answer is N , then you need to argue both that N students force
a row to be full, but fewer than N students may seat themselves such that no row is full.
1.4. Prove that no matter how you choose five points in an equilateral triangle of side length 1,
some pair of them will be at distance at most 0.5 from each other.
1.5. Let us say that two positive integers have a common factor if they are a common multiple
of some integer > 1. For example, of the three numbers 6, 10, and 15, each pair has a common
factor.
(a) Can you find 50 numbers between 1, . . . , 100 such that every pair of them has a common
factor?
(b) Prove that for any 51 numbers between 1, . . . , 100, some pair will have no common
factor.
1.6. Suppose we have 12 dots arranged in a 2 × 6 square grid, as shown. Prove that no matter
how you choose seven of these dots, some three of them are the vertices of an isoceles triangle.
(Let us agree that three dots lying on a line do not form a triangle at all.)
1.7. Explore: Suppose now that we have a 3 × 3 square grid of dots. What is the smallest
number N such that no matter how you choose N of the dots, some three of them form an
isoceles triangle?
What about a 4 × 4 square grid of dots? (I don’t know the answer.)
+1 + 3 + 4 +1−3+4 −1+3+4
1 + 1 + 1 + 1 + 1 + 1 + 1, 1 + 1 + 1 + 1 + 3, 1 + 3 + 3, 1 + 1 + 5, 7
and
1 + 2 + 4, 3 + 4, 2 + 5, 1 + 6, 7
so an = bn = 5.
(a) Write out the various decompositions for n = 5 and n = 6, and verify that a5 = b5 and
a6 = b6 .
(b) Prove that an = bn for all n.
Section 1.4. Subsets
1.15. Prove Proposition 1.12, which says that the number of k-element subsets of an n element
set is given by the formula
!
n P (n, k) n!
= = .
k k! k!(n − k)!
1.16. Prove the remaining parts (b), (c), and (d) of Conjecture 1.14, although you may first
need to formulate more rigorous versions.
1.17. In Example 1.19 we used the binomial formula to prove that the number of subsets
of [n] of even size equals the number of subsets of [n] of odd size. Give a bijective proof of
this fact.
1.18. Let n ≥ 0 be an integer. Let An ⊆ P([n]) be the set of subsets [n] that do not contain
any consecutive pairs of numbers. For example,
(a) Compute A0 , A1 , A2 , A3 , A4 , A5 .
(b) Make a conjecture about the sequence of sizes |An | for all n ≥ 1.
(c) Prove your conjecture.
1.19. Let n ≥ 0 be an integer. How many nested pairs of subsets of [n] are there? In other
words, compute the size of the set
(B1) How many of them are surjective and take the value 1 exactly four times?
(B2) How many of them are surjective and nondecreasing?
(B3) How many of them take the value 1 exactly four times and are nondecreasing?
(B4) How many of them are surjective and nondecreasing and take the value 1 exactly four
times?
(C1) How many of them are surjective or take the value 1 exactly four times?
(C2) How many of them are surjective or nondecreasing?
(C3) How many of them take the value 1 exactly four times or are nondecreasing?
(C4) How many of them are surjective or nondecreasing or take the value 1 exactly four
times?
Hint. : You may wish to use the Venn diagram in Figure 1.4 to organize your counting.
1.21. Of the numbers 1, . . . , 225, how many of them are relatively prime to 225? (Two posi-
tive integers are called relatively prime if their greatest common divisor is 1.)
1.22. Explore: In the setting of Example 1.22, suppose one of the n! possible seat reassign-
ments is chosen uniformly at random. On average, how many people stay in their seat?
nondecreasing
Figure 1.4: Venn diagram of functions [6] → [3] for Exercise 1.20.
1.23. Fix an integer n > 0. Suppose F ⊆ P([n]) is an intersecting family of subsets of [n].
In other words, for all S, T ∈ F we have S ∩ T 6= ∅.
(a) Prove that |F| ≤ 2n−1 .
(b) Find an example of an intersecting family F as above that has size exactly 2n−1 .
Note: the difference between this problem and the Erdős-Ko-Rado theorem is that we no
longer require that all sets in F have the same fixed size.
1.24. Explore: Let n = 2r. The Erdős-Ko-Rado theorem says that there are at most n−1
r−1
intersecting families of r-elements subsets of [n].
(a) If n > 2r, prove that every intersecting family F of r-elements subsets of [n] has
the property that there is a common element in every S ∈ F. (Hint. Use this stronger
assumption n > 24 in the proof of the Erdős-Ko-Rado theorem.)
(b) We saw in (1.6) that (a) is not true for r = 2 and n = 4, since {1, 2}, {1, 3}, {2, 3} is a
family of 2 element subsets of [4] where the subsets do not share a common element. Up
to relabeling the elements, find all intersecting families of 3 element subsets of [6]. How
many are there? Do the same for 4 element subsets of [8].
(c) Show that every n = 2r, there is a family of r-elements subsets of [n] that do not share
a common element. Generalize (b) by finding a formual for the number of such families,
up to relabeling.
(d) Same question as (c), but for n < 2r.
Graph Theory
2 3
1
4
You can draw a graph by drawing points to represent the vertices, and line seg-
ments connecting the points to represent the edges. (Of course, a given graph may be
drawn in many different ways.) Thus in some sense, you have already studied graph
theory if you ever did “Connect-the-Dots” drawings as a child. But in saying that, we
don’t mean to trivialize the field of graph theory. Although graphs are easy to define,
1 For those readers who are really keeping track of minutae, we stipulate that V ∩ E = ∅. In practice,
it suffices to always take V = [n] for some integer n and then never again have to worry about this issue.
there are plenty of deep theorems about them. We will see a few of these theorems
in this chapter.
In addition, graphs are quite useful as structures on which to build models of
many real-world phenomena, in particular phenomena that have to do with pairwise
interactions across a collection of agents. For example, many models of networks,
such as social networks, computer networks, transportation networks, etc., are built
using the data structure of graphs.
2.1 Graphs
In this section we take G = (V, E) to be a graph.
Definition. Let v, w ∈ V be vertices of G, and let e ∈ E be an edge of G.
1. The edge e is incident to the vertex v if e contains v, in which case we also
say that v is an endpoint of e.
2. If vw is an edge of G, then v and w are adjacent vertices, or neighbors, of
that edge.
3. The degree of the vertex v, denoted deg(v), is the number of edges incident
to v. The degree of v is also sometimes called the valence of v.
Example 2.1. Suppose that there are 41 people at a party, and suppose that each pair
of people either know each other or don’t know each other. Then I claim that someone
at the party knows an even number of people. How could we possibly deduce such
a fact from so little information? The answer is provided by the following little gem
from graph theory.
Proposition 2.2. Let G = (V, E) be a graph. If every vertex of a graph has odd
degree, then G has an even number of vertices. In other words,
A good way to visualize such a pair (v, e) is as a “half-edge” in the graph, i.e., an
edge with exactly one of its endpoints, as in the following picture:
We know tha each edge has exactly exactly two endpoints, so we can count the
number of elements of H by computing
X X
|H| = {v ∈ V : v is an endpoint of e} = 2 = 2|E|.
e∈E e∈E
We are told that deg(v) is odd for every vertex v, number, whereas we know that |H|
is even. So we have shown that
that we proved. The proof of (2.1) is a good example of the technique of double-
counting, that is, counting the same thing two different ways in order to deduce the
equality of the two counts.
• The complete graph on n vertices is a graph with n vertices such that there
is an edge joining every pair of vertices. Typically one uses [n] as the vertex
set [n], and then the edge set is2
[n]
:= {S ⊆ [n] : |S| = 2}.
2
and integer k ≥ 0, we write Tk to denote the collection of k-element subsets of T . With this notation,
K4 C6 P5 K3,3
Just as sets have subsets, graphs have subgraphs, as in the following definition.
and 2-cycles.
2 3 2
1 1
4 4
Graph G Subgraph G0 of G
2 3 B C
1 A
4 D
recall that ij is shorthand for {i, j}, and similarly f (i)f (j) is shorthand for
(We
f (i), f (j) .)
If you are given two very small graphs, such as the ones in Figure 2.4, it is easy
to tell whether they are isomorphic. But for graphs with many vertices and edges, the
general problem of determining whether two graphs are isomorphic is very difficult.
This Graph Isomorphism Problem is one of the deep problems in computational
complexity.
3 5
2 3 2 6
1 1
4 7
4
2.2 Trees
First, we define what it means for a graph to be connected: it means that we can start
at any vertex and take a walk in the graph to get to every other vertex.
Definition. A graph G is connected if it contains a path between any two vertices.
This is the kind of property that you would want if, say, you ran an airline. You
would want your network of cities and direct flights to be connected, so that a cus-
tomer could travel from any city to any other city on your flights.
In other words, a graph T is a tree if it is connected, but removing any edge would
make it disconnected. Thus it’s connected, but just barely, there’s no redundancy in
the connectivity.5 See Figure 2.5 for some examples of trees.
Let’s try to understand the structure of trees. First, we observe that trees are
acyclic. After all, if there were a cycle, then removing an edge e lying in the cycle
would not disconnect the graph. (Do you see why?) In fact, we have the following
characterization of trees.
5 And of course, the graph theory name for a graph that is a disjoint union of trees is a forest.
There are many equivalent characterizations of trees, some of which you will
encounter in the exercises.
Proposition 2.5. Trees have leaves. More precisely, if T is a tree on at least two
vertices, then T has at least two leaves.7
Proof. First, let’s give the idea. Suppose you are sitting around on the middle of an
edge ij of T , and you want to find a leaf. What would you do? You would start
walking towards i and then keep walking, and walking, until you reach a dead end.
That dead end is a leaf. If you go in the other direction toward j instead, you’d get a
second leaf. The point is that you cannot loop back to any previously visited vertex,
because trees are acyclic.
Now we give the official proof.
The assumption that T has at least 2 vertices and is connected means that T
contains at least one edge, so T contains some non-trivial paths. Let P be a maximal
path in T , i.e., the path P has the property that it is not contained in a longer path
of T .
Let ` and m be the endpoints of P . The ` is incident to an edge of P , as is m, so
in particular deg(`) ≥ 1 and deg(m) ≥ 1.
We claim that the vertices ` and m have degree at most 1. To see why, suppose
that deg(`) ≥ 2. We already know that there is a vertix x ∈ P that is adjacent to `.
Suppose that there were some other y ∈ T that is adjacent to `. If y ∈ / P , the we
can extend P to y. This creates a longer path, which contradicts our choice of P . On
the other hand, if y ∈ P , then the edge `y together with the path in P from y to ` is
a cycle, contradicting the assumption that T is acyclic. Hence deg(`) ≤ 1, and the
same argument gives deg(m) ≤ 1. Therefore ` and m are leaves of T .
according to the following simple procedure. Given a tree T , erase the leaf of T with
largest label, and write down the label of the vertex to which it was adjacent. Keep
doing that until you are left with only two vertices. Call the sequence that you wrote
down the Prüfer code of T , denoted Pn (T ). See Figure 2.6 for an example of a tree T
and its Prüfer code.
7 5 7 5 7
1 remove 6
1 remove 5
1 remove 4
4 2 −
−−−−→ 4 2 −
−−−−→ 4 2 −
−−−−→
6 list 3 list 7 list 1
3 3 3
7
1 7 7
−−−−→ 1 −−→ 1
remove 3
2 − remove 2
list 1
2 −−−list 7
3
Our goal is to show that Pn provides a bijection between the trees on vertex
set [n] and the nn−2 sequences of length n − 2 with alphabet [n]. The key is the
following innocuous looking lemma.
Lemma 2.8. Let T be a tree on vertex set [n]. Then the leaves of T are precisely the
vertices not appearing in the Prüfer code of T .
Proof. If a number i appears in Pn (T ), that means that at some point there was an
edge incident to i whose other endpoint was a leaf, and the leaf and edge were ripped
off. So i is not a leaf.
If i is not a leaf, then it has at least two incident edges. At least one of these
edges must have been ripped off at some point. Consider the exact moment when the
first of these edges was ripped off; it couldn’t have been that i was the leaf, since i
had degree at least 2. Therefore a leaf was ripped off of the other end of an edge
containing i, so i appears in Pn (T ).
Incidentally, Lemma 2.8 shows that if you are given a Prüfer code Pn (T ), but
you don’t know T , you can at least determine one small thing that’s true about T .
Namely, if v is the largest vertex not in Pn (T ), then the first thing that was done was
to rip the leaf v off of the vertex whose label is recorded first in Pn (T ). Amazingly,
this fact is all that we need to give an inductive proof of Cayley’s Theorem.
But now we are done! By induction, the tree T 0 with Prüfer code s2 · · · sn−2
exists and is unique, and the two conditions determine a unique T from the given T 0
and `, i.e., we must take T 0 and attach the leaf ` to the vertex s1 . So T also exists and
is unique.
This proof may annoy you a little, because we have not directly described a
procedure for taking a Prüfer code and recovering a tree. This is a nice problem for
you to try.
We give an informal argument, just to get a feel for chromatic numbers. Figure 2.7
shows how to 3-color C5 and how to 2-coloring of C4 . It is clear how to generalize
these examples to 2-color Ceven and to 3-color Codd . It remains to show that we can’t
do better.
First, since n ≥ 3, we clearly need at least 2 colors, so χ(Cn ) ≥ 2. This handles
the case that n is even. Suppose that n is odd and that we have a 2-coloring of Cn .
Start at a vertex that has color 1 and trace the vertices clockwise around the cycle.
They must be colored alternately 12121 · · · . But since n is odd, when we get back
to the original vertex, we’ll be stuck with adjacent vertices that are both colored 1.
Hence we need a third color.
1
*
2 * * 1
3 * * 2
2 * * 1 1 * * 2
Example 2.10. At the other extreme, the complete graph Kn on n vertices has chro-
matic number χ(Kn ) = n. This is clear, since every pair of vertices are connected
by an edge, so every vertex needs its own color. On the other hand, the complete
bipartite graph Km,n is 2-colorable, that is, χ(Km,n ) = 2. This, too, is clear, since
taking the vertices to be V = A ∪ B as in the definition of Km,n , we use one color
for the vertices in A and a second color for the vertices in B. See Exercise 2.11 for a
converse statement.
8 This is the Greek letter χ, pronounced “ki”. It is the first letter of the Greek word χρωµατ ικòς for
chromatic.
2.3.1 Planar Graphs and the Four and Five Color Theorems
Let G be a graph.
Definition. We say that G is planar if it can be drawn in the plane, i.e., on a sheet of
paper, without edge crossings.
We will be somewhat informal about what exactly a drawing is, but what you
picture in your mind is likely to be correct. Namely, a drawing consists of a placement
of the vertices of G at distinct points of your sheet of paper, and edges drawn in a
reasonable non-intersecting way, e.g. using a finite sequence of line segments or
smooth curves.9
It is important to note that planarity is a property of an abstract graph: it asserts
the existence of a drawing in the plane without edge-crossings. It does not assert that
9 For those of you who think we are being too uptight about this, we want to inform, or remind, you
any particular drawing has no edge-crossings. For example, the graph K4 is a planar
graph, as illustrated in right-hand picture in Figure 2.8, even though if you were to
draw K4 the first way that pops into your head, it might well be as the left-hand
picture in Figure 2.8 that has an edge-crossing.
Suppose that you want to draw a map of the world, with all the countries colored
in various shades. As is usual with maps, you impose the condition that two bordering
countries receive different colors.
What does this have to do with graphs? Draw a vertex inside each country. Then,
if two countries share a border, draw an edge between their vertices crossing the
border. The resulting graph is called the dual graph, and the map-coloring question
becomes a question of properly coloring the dual graph.
Mapmakers over the ages have long known, heuristically at least, that four colors
are always enough.
Theorem 2.12. (The Four Color Theorem) Every planar graph is 4-colorable.
Theorem 2.13. (The Five Color Theorem) Every planar graph is 5-colorable.
This result was proven by Heawood in 1890 while exposing an error of a pur-
ported proof by Kempf of the four color theorem published in 1879. It is remarkable
that it then took more than a century to squeeze that fifth color out of the theorem
statement!
Before proving the five color theorem, we first state a result that we will use
without proof. First of all, if G is a planar graph, equipped with a fixed drawing on
your sheet of paper, we define a face to be a region of the complement of G. This
includes the infinite “outer” face that surround the entire graph.
Intuitively, if you take scissors and cut your paper along all of the edges of G,
then the faces are the pieces of paper that are left over. The formula that we need
gives a beautiful relationship satisfies by the vertices, edges, and faces.
Proposition 2.14. (Euler’s Polyhedron Formula) Let G be a connected graph drawn
in the plane, with v vertices, e edges, and f faces. Then
v − e + f = 2.
Euler’s Formula is a deep theorem that you will likely discuss in the Geometry
unit. By the way, a special case of this formula states that any polyhedron in R3 at
all, e.g., a cube, a tetrahedron, a dodecahedron, etc., satisfies v − e + f = 2 for its
vertices, edges, and faces. Do you see why this statement about polyhedra follows
from Proposition 2.14?
As we now prove, a consequence of Euler’s formula is that every planar graph
has a vertex of degree at most 5.
Lemma 2.15. Every planar graph has a vertex of degree at most 5.
Proof. We may as well prove that every connected planar graph G has a vertex of
degree at most 5. Suppose to the contrary that G is a connected planar graph and
that every vertex of G has degree 6 or more. Consider a plane drawing of G with v
vertices, e edges, and f faces.
We start by by double-counting the set of edge-face incidences, i.e. the set of
ordered pairs
EF := (b, c) : b is an edge bounding the face c .
We note that each edge bounds exactly 2 faces, and every face is bounded by at least 3
edges (since the boundary of a face is a cycle in G). This allows us to double-count
the set EF :
X
|EF | = {c ∈ F (G) : b is an edge of c} = 2 E(G) = 2e.
b∈E(G)
X
|EF | = {b ∈ E(G) : b is an edge of c} ≥ 3 F (G) = 3f.
c∈F (G)
Hence
2
3f ≤ |EF | = 2e, so f ≤
e.
3
Next we double-count the set VE of vertex-edge incidences, i.e. the set of ordered
pairs
Thus
1
6v ≤ |VE| = 2e, so v ≤ e.
3
Using the estimates f ≤ 23 e and v ≤ 13 e, we find that
2 1
v−e+f ≤ e − e + e = 0,
3 3
which contradicts Euler’s Formula (Lemma 2.14).
We are ready to prove the five color theorem. Our strategy will be to delete a
strategically chosen vertex v of G, inductively color the rest of G, and then show
that things may be arranged so that there is still a color available for v.
Proof. (Proof of Theorem 2.13, the Five Color Theorem) We wish to show that every
planar graph is 5-colorable. We induct on the number of vertices. It is obvious that
a 1-vertex graph is 5-colorable; indeed, it is 1-colorable! Now suppose that n > 1
and that we have already proved that every graph with n − 1 vertices is 5-colorable.
Let G be a planar graph on n vertices. We need to show that G is 5-colorable.
It is enough to prove the statement for connected planar graphs, since once we do
that, then we can 5-color any planar graph by 5-coloring its connected components
one at a time. So we may assume that G is connected.
Let v ∈ V (G) be a vertex of degree at most 5. The existence of such a vertex
is asserted in Lemma 2.15. Let G0 denote the graph obtained from G by deleting v
and the 5 edges incident to v. Then our inductive hypothesis says that we can find a
5-coloring c : G0 → [5] of G0 .
If v has degree less than 5, then we win by coloring v using a color not yet
used on any of its neighbors. Note that such a color exists because there are 5 colors
available, but v has at most 4 neighbors. So we may assume that deg(v) = 5.
Let v1 , . . . , v5 be the neighbors of v, ordered clockwise around v, as illustrated
in Figure 2.9. If 2 or more of those 5 neighbors are the same color, then there is a
color left over that we can use for v. So we may assume that v1 , . . . , v5 use up all 5
colors, i.e., c(v1 ), . . . , c(v5 ) are distinct.
We make the following simple observation: if the proper coloring of G0 may be
tweaked in some way so that at most 4 colors are used on v1 , . . . , v5 , then as above,
we win.
v1
v5 v2
v
v4 v3
Note that c0 is also a proper 5-coloring of G0 , since the vertices that are adjacent to
vertices of G013 have colors different from c(v1 ) and c(v3 ).
If the vertex v3 is not in the subgraph G13 , then the color of c3 did not get
swapped. Thus using our new coloring c0 , the vertices v1 and v3 have the same color,
and we’re done.
But what do we do if the vertex v3 is in the subgraph G13 ? Note that this happens
precisely when there is an alternating 1-3 path that starts at v1 and ends at v3 . In that
case, we repeat the above construction using the subgraph G24 , which is the largest
connected subgraph of G0 that contains v2 and whose vertices are colored using only
the two colors c(v2 ) and c(v4 ). As above, if the vertex v4 is not in the subgraph G24 ,
then we can swap the colors of the vertices in G24 and win.
So the proof is done unless the graph G0 contains both an alternating 1-3 path
that starts at v1 and ends at v3 and an alternating 2-4 path that starts at v2 and ends
at v4 . But it is not possible for both such paths to exist. Indeed, they would have to
cross at some vertex! We have completed the proof of the five color theorem.
know each other, or there are three people who all don’t know each other. This is an
example of Ramsey theory, which is a beautiful topic that we explore in this section.
We can formulate this statement in terms of coloring the edges of K6 , the com-
plete graph on 6 vertices.
E E E
D F D F D F
A C A C A C
B B B
ACD and BEF ADE and ADF and BEF ABC and DEF
Figure 2.10: Some 2-edge colored K6 graphs with indicated monochromatic trian-
gles
Proof. For psychological ease, we label the vertices 1, . . . , 6, and call the colors
red and blue. There are five edges incident to vertex 1, and only two colors, so the
Pigeonhole Principle tells us that three of these edges are the same color, which we
may as well assume is red. So there are edges 1i, 1j, and 1k that are red.
If any of the three edges ij, ik, or jk are red, then we have found an edge that
completes a monochromatic red triangle. On the other hand, if ij, ik, or jk are
all blue, then they form a monochromatic blue triangle. So in either case we get
a monochromatic triangle, and we are done.
R(1, `) = R(k, 1) = 1.
n − 1 = R(k − 1, `) + R(k, ` − 1) − 1
edges incident to vertex 1. Among these, the Pigeonhole Principle implies that either
there are R(k − 1, `) red edges or there are R(k, ` − 1) blue edges. Let us suppose
that there are R(k − 1, `) red edges incident to vertex 1; the other case can be argued
analogously.
We consider the R(k − 1, `) vertices at the other ends of these red edges. By the
inductive hypothesis, there is either a red Kk−1 or a blue K` among them. In the
second case, we win. In the first case, we also win, since the red Kk−1 together with
the vertex 1 forms a red Kk .
Three colors. Why stop at two colors? Suppose that you are given three in-
tegers k, `, m ≥ 1. Does there exist an n such that every 3-edge-coloring of KN
contains a red Kk , a blue K` , or a green Km ?
Definition. Let k, `, m ≥ 1 be integers. We define the (k, `, m)-Ramsey number,
denoted R(k, `, m), to be the smallest number n, if such a number exists, such that
every 3-edge-coloring of Kn using colors red, blue, and green contains a red Kk , a
blue K` , or a green Km .
Proposition 2.18. For all integers k, `, m ≥ 1, the Ramsey number R(k, `, m) exists.
Proof. We claim that R(k, `, m) exists and satisfies
R(k, `, m) ≤ R k, R(`, m) .
The idea is to suppose that we are temporarily unable to distinguish between blue
and green.
Let n = R k, R(`, m) and suppose we have a 3-edge-coloring of Kn . Con-
sider it as 2-edge-coloring of Kn using colors “red” and “blue-green.” Then Propo-
sition 2.17 says that either there is a red Kk or a blue-green KR(`,m) . In the first
case we win. In the second case, remembering again the difference between blue and
green, we see that the original coloring has a KR(`,m) -subgraph which is 2-edge-
colored blue and green. By definition of R(`, m), this subgraph contains either a
blue K` or a green Km , and again we are done.
This same idea may be extended to arbitrarily many colors.
Proposition 2.19. Let n ≥ 1 be an integer. For integers m1 , . . . , mn ≥ 1, there
exists a number N with the following property: for every n-edge-coloring of the
complete graph KN , there is some i ∈ {1, . . . , n} so that KN contains a complete
subgraph Kmi whose edges are all colored i.
Proof. Exercise, imitating the proof of Proposition 2.18.
Definition. We write R(m1 , . . . , mn ) for the smallest such N such that Proposi-
tion 2.19 is true. It is called the (m1 , . . . , mn )-Ramsey number.
What about lower bounds on Ramsey numbers? Let’s unpack this. The statement
R(k, `) > n
means that there exists a 2-edge-coloring of Kn with no red Kk and no blue K` .
For example, in Exercise 2.15 you will show that R(3, 3) > 5 by producing an
appropriate 2-edge-coloring of K5 .
Question 2.20. What is the best lower bound for R(3, 4) that you can find?
Imagine trying to find a lower bound for R(100, 100). It seems that you would
have to painstakingly construct a 2-edge-coloring of a truly enormous graph and then
demonstrate in some way that the graph contains no monochromatic K100 subgraphs.
That sounds hard!
It turns out that there is an amazing way to get around this difficulty. It hinges on
a crucial idea that has been a theme of this text: it is possible to prove that something
exists without actually constructing it. It’s better, of course, to give a constructive
proof, but sometimes that can be very hard. For example, we haveseen several argu-
ments by contradiction that show that something exists without necessarily giving a
way to find it. Instead, we simply assume that it does not exist, and then derive an
absurdity.
In the next section we discuss a remarkable idea, called the probabilistic method,
that can sometimes be used to prove that something exists without actually con-
structing it. We will apply this method to prove some lower bounds on Ramsey num-
bers R(k, `).
nk
n n · (n − 1) · (n − k + 1)
= ≤ .
k k! k!
(2k/2 )k 1−(k2)
n k 1 k2 k 1
· 21−(2) ≤ · 2 2 +1−(2) =
k
·2 = · 21+ 2 < 1.
k k! k! k!
(We leave it for you to check that the final inequality is true, e.g., by induction.) This
is the desired result, and we’re done.
Proof of Proposition 2.21. Let n be a positive integer satisfying the inequality (2.3).
We want to show that there is a 2-edge-coloring of Kn with no monochromatic Kk .
There are finitely many 2-edge-colorings of Kn . We pick one at random and shall
demonstrate that the probability that our randomly chosen coloring contains no
monochromatic Kk is positive. That’s the probabilistic method.
n
There are a total of 2( 2 ) distinct 2-edge-colorings of Kn , since Kn has n2 edges.
Let’s start by focusing our attention on one particular Kk subgraph—for instance, the
one on vertices {1, . . . , k}—and asking in how many of the 2-edge colorings of Kn
is this particular Kk monochromatic. The answer is
n k
2 · 2( 2 )−(2) ,
since there are two ways to monochromatically 2-color Kk , multiplied by all the
different ways to 2-color the other n2 − k2 edges. And of course, this number does
To this day, the lower bounds on Ramsey numbers proven by the probabilistic
method are better than those that have been given in a constructive manner, but this
is a topic of current research. It is also interesting that the only values of R(k, k) that
we know exactly are R(1, 1) = 1, R(2, 2) = 2, R(3, 3) = 6, and R(4, 4) = 18. For
higher values of k there are upper and lower bounds, for example 43 ≤ R(5, 5) ≤ 48
and 102 ≤ R(6, 6) ≤ 165.
In fact, something tantalizing can be gleaned from the bound that we derived
for R(k, k). We showed that if n = b2k/2 c , then the probability that a random
1
2-edge-coloring of Kn has no monochromatic Kk is k! · 21+k/2 . Not only is that
number smaller than 1 when k ≥ 3, it is much, much smaller than 1 when k large.
For example, when k = 10 it is roughly 0.0000176, and when k = 100, it is smaller
than 10−142 .
This says that a great way to construct a 2-edge coloring of Kn with no
monochromatic Kk is to pick a coloring at random. You should then check that the
one you picked is a good one, but it’s very likely to be good. (The reason that this
isn’t the same as a constructive lower bound on Ramsey numbers is that it only deals
with one k at a time, and not all k at once.)
With hindsight, it’s reasonable that we appealed to a probabilistic method to ob-
tain a lower bound on Ramsey numbers, since a lower bound asserts the existence
of a structure that is rather disordered, i.e., there are no large clumps of red and no
large clumps of blue. Roughly speaking, if you try to write down 2-edge-colorings
in some systematic way, you will tend to find these large monochromatic clumps. In
some vague philosophical sense, that’s due to the very fact that you are being sys-
tematic. On the other hand, a random 2-edge-coloring of Kbk/2c is likely to be not
very clumpy and thus do the trick.
This is a demonstration, at least morally, of an aptly named principle that is found
all over mathematics and computer science, the so-called difficulty of finding hay in
a haystack.10 In practice, it can indeed be hard to find hay in a haystack, despite the
fact that 99.9% (or whatever) of the haystack is made of hay, since every time you
systematically reach into the haystack and pull something out, you may find that it is
a needle!
10 This is from a 2017 talk “Finding Hay in Haystacks: The Power and Limits of Randomness” by math-
One final remark: you might complain that we haven’t really used probability,
as opposed to just counting, in a meaningful way. Indeed, in our proof of Propo-
sition 2.21, we counted the number of 2-edge-colorings of Kn not containing a
monochromatic Kk and showed that this number is smaller than the total number
of 2-edge-colorings of Kn . Your complaint is a good one. In this particular instance,
everything we did can be phrased simply in terms of counting and without mention
of probabilities. However, in many situations the perspective of probability and the
probabilistic method, and the techniques they bring to bear, are very useful, even
when applied in purely combinatorial situations. That is a story for another time,
which you can read about in [1]. For further reading, see Bóna’s excellent text-
book [2] on combinatorics and Diestel’s graduate level textbook [3] on graph theory.
Exercises
Section 2.1. Graphs
2.1. Prove that in any graph, there are two vertices having equal degree. (Hint. Assume not,
and think about the set of vertex degrees.)
2.2. Let G and G0 be the two 6-vertex graphs shown below. How many isomorphisms (see
page 28) from G to G0 are there? Explain your answer briefly.
1 3 5 A C E
2 4 6 B D F
G G0
2.4. Prove that a graph G is a tree if and only if it is maximally acyclic. In other words, G is
a tree T if and only the following two facts are true:
• T is acyclic.
• Adding a new edge connecting two vertices of T creates a cycle.
2.5. Draw six nonisomorphic trees on vertex set {1, 2, 3, 4, 5, 6}, and compute each of their
Prüfer codes.
2.6. Let n ≥ 2 be an integer. Of the nn−2 trees on vertex set [n], prove that exactly 2nn−3
of them contain the edge {1, 2}. Here are two hints suggesting possible ways to sole this
problem.
(i) Double-count the elements of the set
(T, {i, j}) : T is a tree with vertices [n] and {i, j} is an edge of T .
(ii) Alternatively, prove carefully that a tree contains the edge {1, 2} if and only if its Prüfer
code ends in 1 or 2.
2.7. Let n ≥ 2 be an integer. Of the nn−2 trees on vertex set [n], in how many of them is
vertex n a leaf?
2.8. Let m > n ≥ 2 be integers. Of the nn−2 trees on vertex set [n], how many have
exactly m leaves?
2.9. Explore: Let n ≥ 3 be an integer. Among the nn−2 trees on vertex set [n], what is the
average number of leaves?
χ(G) ≤ D + 1.
2.11. Let G be a graph that is 2-colorable, i.e., χ(G) = 2. Prove that G is a subgraph of a
complete bipartite graph Km,n with m + n = |V |.
2.12. Let G be a graph on n vertices. The complement of G, denoted G, is the graph obtained
from G by changing edges to non-edges and non-edges to edges. In other words, ij ∈ E(G)
if and only if ij 6∈ E(G). Prove that
χ(G) · χ(G) ≥ n.
2.13. The four-color theorem asserts that every planar graph is 4-colorable. Is the converse
true? That is, is every 4-colorable graph planar?
2.14. Explore: Lemma 2.15 says that every planar graph has a vertex of degree at most 5. Try
to find a planar graph such that every vertex has degree exactly 5. Hint. Use Euler’s formula
with a double count of edge-face incidences and vertex-edge incidences, as in the proof of
Lemma 2.15, to find the minimum number of vertices, edges, and faces that might work.
2.17. Consider an N × N square grid of dots, with rows and columns labeled 1, . . . , N .
For n ≤ N , let S, T ⊆ [N ] be subsets of size n. An n × n square subgrid is the set of the n2
dots in rows S and columns T . In particular, square subgrids don’t have to be contiguous.
(a) Given n ≥ 1, is it true that there exists a number N such that every 2-coloring of the
dots in an N × N square grid contains an n × n monochromatic square subgrid?
(b) If n = 2, can you calculate the smallest N with the property of part (a)?
(2) The set Yn of sequences of n open parenthesis symbols ( and n close paren-
thesis symbols ) that are correctly parenthesized, meaning that in any initial
subsequence, one never encounters more close parentheses ) than open paren-
theses (. For example, here are two valid sequences and one that is not valid:
1 3 4
2 5 6
1 This exercise is inspired by Exercise 6.19 in Richard Stanley’s classic text Enumerative Combina-
II.[4] However, instead of having only 4 sets, Stanley lists 66 sets asks the reader to come
torics, Volume
up with 66 2
bijections!
Hint. You probably won’t want to actually try to draw all of them when there
are 5 or 6 vertices!
[1] N. Alon and J. H. Spencer. The probabilistic method. Wiley Series in Discrete
Mathematics and Optimization. John Wiley & Sons, Inc., Hoboken, NJ, fourth
edition, 2016.
[2] M. Bóna. A walk through combinatorics. World Scientific Publishing Co., Inc.,
River Edge, NJ, 2002. An introduction to enumeration and graph theory, With a
foreword by Richard Stanley.
[3] R. Diestel. Graph theory, volume 173 of Graduate Texts in Mathematics.
Springer-Verlag, New York, 1997. Translated from the 1996 German original.
[4] R. P. Stanley. Enumerative combinatorics. Vol. 2, volume 62 of Cambridge
Studies in Advanced Mathematics. Cambridge University Press, Cambridge,
1999. With a foreword by Gian-Carlo Rota and appendix 1 by Sergey Fomin.
[5] R. P. Stanley. Enumerative combinatorics. Volume 1, volume 49 of Cambridge
Studies in Advanced Mathematics. Cambridge University Press, Cambridge,
second edition, 2012.