Discrete Mathematics: Counting & Graphs
Discrete Mathematics: Counting & Graphs
Contents
1. Counting problems 3
1.1. Basic results on counting sets 3
1.2. Binomial coefficients 4
2. Estimates: O, o-notation, Stirling formula, Birthday paradox and the bell curve 7
2.1. O, o-notation 7
2.2. Stirling’s formula 7
2.3. Twin paradox 7
3. Inclusion-exclusion principle 10
3.1. Inclusion-exclusion principle 10
3.2. Number of permutations without fixed points 10
3.3. Euler’s totient function 11
4. Generating functions 12
4.1. Combinatorial applications of polynomials 12
4.2. Multinomial theorem 12
4.3. Calculation with power series 12
4.4. Examples of generating functions 13
5. Generating functions. Binary trees. 14
5.1. Binary trees 14
6. Fibonacci numbers and linear recurrence relations 16
6.1. Fibonacci sequence 16
6.2. Linear recurrence relations 18
7. Möbius invertion formula 19
7.1. Identities with Euler’s totient function 20
7.2. Number of cyclic sequences 20
7.3. Partially ordered sets (or posets) 23
7.4. Hasse diagram 23
7.5. Möbius invertion for posets 23
8. Elements of graph theory 27
8.1. Definition and characterizations of trees 27
9. Equivalent definitions of a tree, number of labeled trees 28
9.1. Graph isomorphisms 28
9.2. Characterizations of trees 28
9.3. Counting labeled trees 28
9.4. Counting unlabeled trees 29
10. Kruskal’s algorithm for finding a minimal spanning tree 30
10.1. Subgraphs, induced subgraphs, and spanning trees 30
10.2. Weighted graphs 30
11. Counting spanning trees in a graph. Kirchhoff’s theorem 32
11.1. A useful fact form linear algebra 32
11.2. Laplace matrix and incidence matrix 32
11.3. Kirchhoff’s theorem 32
12. The probabilistic method. 33
12.1. Finite probability spaces 33
12.2. Applications of probabilistic method 33
1
2
1. Counting problems
To read:
[1]: 1.2. Sets, 1.3. Number of subsets, 1.5. Sequences, 1.6. Permutations, 1.7. Number of The
Number of Ordered Subsets, 1.8. The Number of Subsets of a Given Size, 3.1. The Binomial
Theorem, 3.2. Distributing Presents, 3.5. Pascal’s Triangle, 3.6. Identities in Pascal’s Triangle.
[3], Chapters 3.1-3.3.
1.1. Basic results on counting sets.
Notation. Let A be a finite set. We denote by |A| the cardinality of A, i. e. the number of
elements in the set.
Definition 1.1. Denote by [n] the set of first n natural numbers: [n] := {1, 2, . . . n}.
Theorem 1.2. If there exists a bijection between finite sets A and B then |A| = |B|.
Theorem 1.3. (Addition rule) Let A and B be finite sets. If A∩B = ∅ then |A∪B| = |A|+|B|.
Theorem 1.4. (Product rule) Let A and B be finite sets. Then
|A × B| = |A| · |B|.
Recall the following formulas:
Proposition 1.5. The number of functions from [m] to [n] is nm . This is the number of m-letter
words in an n-letter alphabet.
Proposition 1.6. The number of permutations of a set of n elements is n!
Proof. This is likely to be familiar to you, but at any rate it follows from the multiplication rule.
Call the elements 1, . . . , n. A permutation can send 1 to any of n elements. Then 2 to any of
the n − 1 elements remaining, since 1 and 2 cannot be sent to the same. Each step leaves one
less option at the next step, for a total of
n × (n − 1) × . . . × 2 × 1
permutations. This is n! by definition (or really, if we refuse to skip steps, by induction).
Proposition 1.7. The number of ways in which one can choose k objects out of n distinct
n!
objects, assuming the order of the elements matters, is (n−k)! .
Proof. It will dramatically speed up computations to note that
n!
= n(n − 1) . . . (n − k + 1)
(n − k)!
This should be calculated as a product of k numbers, not a ratio of two factorials. In fact, this
form also shows how to deduce the formula from the multiplication rule. One has n choices for
the first object, then n − 1 for the second, culminating in n − k + 1 for the last of the k objects.
Notice that when k = n, Propositions 1.6 and 1.7 agree. This would be clear even without
the explicit formulae: an ordered choice of all n out of the n objects is simply a way to permute
them.
Set-theoretically, n(n − 1) · · · (n − k + 1) is also the number of injective functions from [k] to
[n].
Proposition 1.8. The number of ways in which one can choose k objects out of n distinct
n!
objects, assuming the order of the elements does not matter, is (n−k)!k! =: nk . This is the same
as the number of subsets of k elements of an n-element set.
4
n n!
Definition 1.9. The numbers k = (n−k)!k! are called binomial coefficients.
Proof. We already know the number of ordered subsets, by Proposition 1.7. On the other hand,
an ordered subset can be obtained in two steps: choose a subset, and then order it. Once the
choice of k elements is made, Proposition 1.6 tells us there are k! ways to do the ordering. By
the multiplication rule,
n! n
= k!
(n − k)! k
and we complete the proof by solving for nk .
As with unordered choices, there is no need to compute all the factorials. Instead, note that
n n! n(n − 1) . . . (n − k + 1)
= =
k (n − k)!k! k!
If k is small, then we can afford to compute k! in the denominator. If k is large, then it is better
to exploit a basic symmetry of the binomial coefficients.
Proposition 1.10.
n n
=
k n−k
We will be convenient for us to use the following notation:
A
Notation. Let A be a finite set and k be a nonnegative integer. Then k is the set of k-element
subsets of A. We have A = |A|
k k .
Row
0
0 0 =1
1 1
1 0 =1 1 =1
2 2 2
2 0 =1 1 =2 2 =1
3 3 3 3
3 0 =1 1 =3 2 =3 3 =1
4 4 4 4 4
4 0 =1 1 =4 2 =6 3 =4 4 =1
5 5 5 5 5 5
5 0 =1 1 =5 2 = 10 3 = 10 4 =5 5 =1
Proof. To prove the binomial theorem, consider how to distribute the multiplication in
(1 + x)n = (1 + x)(1 + x) . . . (1 + x)
From each factor 1 + x, we can choose either the 1 or the x to form a product with theother
terms. This product is xk provided we choose x in k out of the n factors. There are nk such
choices, and collecting terms gives the sum k nk xk as claimed.
P
Adding, respectively subtracting the two relations, and dividing each by two, one obtains
n−1 n n
2 = + + ...
0 2
n−1 n n
2 = + + ...
1 3
which proves the statements about the number of even/odd sets.
Proposition 1.14. Assume we have k identical objects and n different persons. Then, the
number of ways in which one can distribute this k objects among the n persons equals
n+k−1 n+k−1
= .
n−1 k
Equivalently, it is a number of solutions of the equation x1 + . . . + xn = k in nonnegative integers
or the number of k-multisets containing elements from [n]. If k ≥ n and each persons receives
k−1
at least 1 object, then the number of possible ways to distribute is n−1 .
Proof. Let A be the set of all solutions of the equation
(1) x1 + . . . + xn = k, xi ∈ Z≥0 .
6
2.1. O, o-notation.
Definition 2.1. Let f, g : Z≥0 → R. We say that f is big-Oh of g and we write f (x) = O(g(x))
if there exist n0 and c constants such that for all n > n0 , we have |f (n)| < c · |g(n)|.
Definition 2.2. Let f, g : Z≥0 → R. We say that f is little-oh of g and we write f (x) = o(g(x)) if
f (n)
lim = 0.
n→∞ g(n)
Examples: n = O(n2 ) and also n = o(n2 ), n = O(2n ), n = o(2n ), sin(n) = O(1) and sin(n) is
not o(1).
−k(k−1) −k(k−1)
e 2(n−k+1) ≤ P ≤ e 2n .
Proof. We will use the following inequality for ln(x).
Lemma 2.5. For x > 0,
x−1
≤ ln(x) ≤ x − 1.
x
Now we estimate
nk
n n n
ln = ln + ln + . . . + ln
n(n − 1) · · · (n − k + 1) n−1 n−2 n−k+1
n n n
− 1 − 1 − 1 1 2 k−1
≥ n−1n + n−2n + . . . + n−k+1
n = + + ... +
n−1 n−2 n−k+1 n n n
1 k(k − 1)
= (1 + 2 + . . . + (k − 1)) = .
n 2n
8
Also we find
nk
n n n
ln = ln + ln + . . . + ln
n(n − 1) · · · (n − k + 1) n−1 n−2 n−k+1
n n n 1 2 k−1
≤ −1 + − 1 + ... + −1 = + + ... +
n−1 n−2 n−k+1 n−1 n−2 n−k+1
1 2 k−1 1
≤ + + ... + = (1 + 2 + . . . + (k − 1))
n−k+1 n−k+1 n−k+1 n−k+1
k(k − 1)
= .
2(n − k + 1)
Applying the exponential function to both sides of our estimates we get the following:
−k(k−1) n(n − 1) · · · (n − k + 1) −k(k−1)
e 2(n−k+1) ≤ k
≤ e 2n .
n
So the answer to the question in the beginning of this paragraph is between 96.51% and
97.93%. More precisely, the probability is about 97.03%.
Now we will estimate the binomial coefficients. The binomial coefficients in the n-th row of
the Pascal’s triangle satisfy the following inequalities:
n n n
< < ··· <
0 1 [n/2]
and
n n n n
> > ··· > > .
[n/2] + 1 [n/2] + 2 1 0
n
Therefore, the middle binomial coefficient [n/2] is the largest in the respective row. Stirling’s
formula implies that the largest binomial coefficient satisfies
r
n 2 n
∼ 2 .
n/2 πn
Also we have the following formula describes how binomial coefficients decrease as we move away
from the middle of the Pascal’s triangle.
Proposition 2.6. Let m, t be positive integers and t ≤ m. Then
2m
2 /(m−t+1) m−t 2 /(m+t)
e−t ≤ 2m
≤ e−t .
m
Proof. Here we prove the lower bound. We have
2m
m (m + t)(m + t − 1) · · · (m + 1)
2m = m(m − 1) · · · (m − t + 1)
.
m−t
It will be convenient for us to estimate the logarithm of this quantity.
(m + t)(m + t − 1) · · · (m + 1) m+t m+t−1 m+1
ln = ln + ln + . . . + ln
m(m − 1) · · · (m − t + 1) m m−1 m−t+1
m+t m+t−1 m+1 t t t
≤ −1 + − 1 + ... + −1 = + + ... +
m m−1 m−t+1 m m−1 m−t+1
t t t t2
≤ + + ... + = .
m−t+1 m−t+1 m−t+1 m−t+1
9
This finishes the proof of the first inequality. The proof of the second inequality is left to the
reader.
10
3. Inclusion-exclusion principle
To read:
[1] 2.2.1. Induction, 2.3. Inclusion-Exclusion.
[3] 3.7. Inclusion - Exclusion, 3.8. The hat-check lady.
3.2. Number of permutations without fixed points. A hat-check girl completely loses
track of which of n hats belong to which owners, and hands them back at random to their n
owners as the latter leave. What is the probability pn that nobody receives their own hat back?
This question can be reformulated in the following way: find the number of permutations
of the set {1, 2, . . . , n} without fixed points. In order to count these, we apply the inclusion-
exclusion principle. Let A be the set of all permutations and Ai be the set of permutations of
the set {1, 2, . . . , n} for which i is a fixed point. The number of permutations with no fixed
points is
[n
|A| − Ai .
i=1
We know that |A| = n!, so we need to count | ni=1 Ai |. We do this using the inclusion principle.
S
Note that Ai ∩ Aj represents the set of all permutations for which i and j are fixed points. One
can see that |Ai | = (n − 1)! for all i, while |Ai ∩ Aj | = (n − 2)!. Using the same idea, we obtain
|Ai ∩ Aj ∩ Ak | = (n − 3)! and so on. Altogether, this gives
n
[ n n
|A| − Ai = n! − (n − 1)! + (n − 2)! − . . .
1 2
i=1
n!(n − 1)! n!(n − 2)!
= n! − + − ...
1!(n − 1)! 2!(n − 2)!
1 1 1
= n!( − + − . . .)
0! 1! 2!
≈ n! exp(−1).
11
Thus we see that the probability pn that nobody receives their own hat back is
1 1 1 1
pn = − + − . . . + (−1)n
0! 1! 2! n!
As n goes to infinity this number converges to 1e ≈ 0.37.
3.3. Euler’s totient function. In number theory, Euler’s totient function φ(n) counts the
positive integers up to a given integer n that are relatively prime to n. For example, among the
numbers {1, 2, 3, 4, 5, 6} only 1 and 5 are coprime to 6. Therefore, we find that φ(6) = 2. If p is
a prime number then φ(p) = p − 1 and φ(pk ) = pk − pk−1 .
Proposition 3.2. Suppose that a number n has the prime factorization n = pk11 · · · pkmm . Then
by the inclusion-exclusion principle we find
X n m
X n X n Y 1
φ(n) = n − + − + . . . = n (1 − ).
pi pi pj pi pj pk pi
1≤i≤m 1≤i<j≤m 1≤i<j<k≤m i=1
Proof. Let A be the set of all numbers in [n] not coprime with n.
Let Ai be the
S set of all numbers in [n] divisible by pi .
Then A = m i=1 A i and |A i | = n
, n
pi |Ai ∩Aj | = pi pj , and so on. By the inclusion-exclusion formula
we find
φ(n) =n − |A|
X n m
X n X n Y 1
=n − + − + . . . = n (1 − ).
pi pi pj pi pj pk pi
1≤i≤m 1≤i<j≤m 1≤i<j<k≤m i=1
12
4. Generating functions
To read:
[3] Chapters 12.1, 12.2.
1−xn
therefore s − xs = 1 − xn . Thus s = 1−x for x 6= 1. If |x| < 1 the series converges as n goes to
infinity. Therefore, we have
∞
2 3
X 1
1 + x + x + x + ... = xk =
for |x| < 1.
1−x
k=0
P∞ k 1 P∞ k
Since |cx| < 1, we get k=0 |cx| = 1−|cx| . We have shown that k=0 ak x is absolutely
convergent, hence it is convergent.
4.4. Examples of generating functions. Consider the following two examples.
Example 1. Consider the sequence an = n + 1, n ∈ Z≥0 . Then the generating function is
2 d 2 d 1 1
A(x) = 1 + 2x + 3x + . . . = (1 + x + x + . . .) = = .
dx dx 1 − x (1 − x)2
Example 2. Consider the sequence bn = (n + 1)2 , n ∈ Z≥0 . Arguing in a similar way, one gets
d
that the generating function is B(x) = dx A(x) − A(x).
Exercise 2. What is the generating function of the sequence (a0 , a1 , . . .) with ak = 2bk/2c ?
Theorem 4.4. (Generalized binomial theorem). For every r ∈ R and every integer n ≥ 0, let
r r(r − 1) · · · (r − n + 1)
= .
n n!
Then, the following holds:
r r r r 2
(1 + x) = + x+ x + ···
0 1 2
for every x with |x| < 1.
Proof. Let f (x) = (1 + x)r , then f (n) (0) = r(r − 1)(r − 2) · · · (r − n + 1). Since nr =
r(r−1)(r−2)···(r−n+1) (n)
, we have nr = f n!(0) . For a series a(x) = a0 +a1 x+a2 x2 +. . . the element an
n!
n
is uniquely determined by an = a n!(0) . Therefore (1 + x)r = 0r + 1r x + 2r x2 + . . .+ nr xn + . . ..
Next we have to show that the series converges for |x| < 1: The series ∞ r n
P
n=0 n x converges
if
r
n+1
n+1 x
lim r
n
< 1.
n x
n→∞
The inductive definition of a binary tree implies the following recursive formula for bn :
(3) bn = b0 bn−1 + b1 bn−2 + b2 bn−3 + . . . + bn−1 b0 , n ∈ Z≥1 .
P∞
Let b(x) = n=0 bn x
n be the generating series of the sequence {bn }∞
n=0 . We find
We have computed that eb0 = eb(0) = 1. Moreover, the function eb(x) satisfies the quadratic
equation
x eb(x)2 − eb(x) + 1
15
and therefore the sequence {ebn }∞n=0 satisfies the recursive relation (3). Since the sequences satisfy
the same initial conditions b0 = eb0 and the same recursive relation (3) we conclude that bn = ebn
for all n ∈ Z≥0 . The generalized binomial theorem implies
∞
√
k 1/2
X
1 − 4x = (−4) xk .
k
k=0
−1 n+1 1/2
This implies bn = 2 (−4) n+1 .
Exercise 3. Show that
1 2n
bn = .
n+1 n
Definition 5.2. The numbers bn are known by the name Catalan numbers.
Exercise 4. Consider an n × n chessboard:
B
A
Consider the shortest paths from the corner A to the corner B following the edges of the squares
(each of them consists of 2n edges).
(a) How many such paths are there?
(b)* Show that the number of paths that never go below the diagonal (the line AB) is exactly
bn , i.e. the Catalan number. One such path is drawn in the figure.
16
This is a system of two equations with A and B as unknowns, so we can obtain exact values for
A and B:
x1 −x2
A= √ B= √ .
5 5
One can obtain that:
A B A 1 B 1
F (x) = + =− x − =
x − x1 x − x2 x 1 1 − x1 x2 1 − xx2
∞ ∞
A X −n n B X −n n
=− x1 x − x2 x
x1 x2
n=0 n=0
∞ ∞
1 X −n n 1 X −n n
=√ x1 x − √ x2 x .
5 n=0 5 n=0
∞
X 1
√ x−n −n
n
= 1 − x2 x .
n=0
5
Method 2.
We look first for a geometric series that satisfies An = An−1 + An−2 , that is An = c · αn for all
n ∈ Z≥0 . This implies that√cαn = cαn−1 + cαn−2 and thus α2 − α − 1 = 0. Solving this quadratic
equation, we get α1,2 = 1±2 5 . Next, we search for Fn in the form
√ !n √ !n
1 + 5 1 − 5
Fn = c1 α1n + c2 α2n = c1 + c2
2 2
F0 =c1 + c2 = 0
√ ! √ !
1+ 5 1− 5
F1 =c1 + c2 = 1.
2 2
6.2. Linear recurrence relations. In general, to solve linear recurrence relations of the form
an+k = ck−1 an+k−1 + . . . + c0 an
we have the following recipe. Denote by λ1 , . . . λs the (possibly complex) roots of the equation
λk = ck−1 λk−1 + . . . + c0
where λi has multiplicity ki and si=1 ki = k.
P
Theorem [Link] formula for an is the solutions to the recurrence above if and only if it has
the form an = si=1 Pi (n)λni , where each Pi (n) is a polynomial of degree ki − 1 with coefficients
chosen arbitrarily. Moreover, for any set of initial values a0 , . . . , ak−1 one can find coefficients
of the polynomials Pi (n) so that the solution fits to the initial values. Note that the number of
coefficients to be determined is equal to k, the number of initial values.
19
Next, suppose that n > 1 and it has the prime decomposition n = pe11 · · · perr . Set n∗ := p1 · · · pr .
If d | n and d - n∗ then d has a prime divisor of multiplicity bigger then 1 and therefore µ(d) = 0.
Hence, we have X X
µ(d) = µ(d).
d|n d|n∗
Now we can easily compute
X r r r
µ(d) = 1 − + − + . . . = (1 − 1)r = 0.
∗
1 2 3
d|n
Then X
g(n) = µ(d) f (n/d).
d|n
Proof. We have X
f (n/d) = for all d | n.
d0 |(n/d)g(d0 )
Therefore X X X
µ(d) f (n/d) = µ(d) g(d0 ).
d|n d|n d0 |(n/d)
20
Let n = dd0 n1 . For a fixed d0 , the value of d runs over all positive divisors of n/d0 . Hence we get
X X X X
µ(d) g(d0 ) = g(d0 ) µ(d).
d|n d0 |(n/d) d0 |n d|(n/d0 )
P
We apply the previous lemma to the sum d|(n/d0 ) µ(d) and obtain
X X
g(d0 ) µ(d) = g(n).
d0 |n d|(n/d0 )
Proof. A period of a cyclic sequence (a1 , . . . , an ) is a minimal number k ∈ {1, 2, . . . , n} such that
(a1 , . . . , an ) = (a1+k , . . . , an , a1 , . . . ak ) (equal as linear sequences). Note that the period of a
sequence is a divisor of the the sequence’s length.
Let M (d, r) be the number of cyclic sequences of of length d and period exactly d. It is easy
to see that X
rn = d M (d, r).
d|n
The Möbius inversion formula implies
X
(4) n M (n, r) = µ(n/d) rd .
d|n
We have X
T (n, r) = M (d, r).
d|n
We combine this identity with (4) and obtain
X1X 0
T (n, r) = µ(d0 /d) rd
d 0
d|n d |d
d
(here we intoduce a new summation variable d00 = 0 )
d
X 0 X 1
= rd 0 d00
µ(d00 ) .
0 00 n
d
d |n d | d0
7.3. Partially ordered sets (or posets). This section is written by Dr. Matthew de Courcy-
Ireland.
Definition 7.7. A binary relation on a set A is a subset R ⊆ A × A. A relation is reflexive
provided that (x, x) ∈ R for every x ∈ A. A relation is antisymmetric provided that (a, b) ∈ R
and (b, a) ∈ R together imply a = b. A relation is transitive if (a, b) ∈ R and (b, c) ∈ R together
imply (a, c) ∈ R. A relation is reflexive if (a, a) ∈ R for all a ∈ R.
Definition 7.8. (partial order) A partial order on a set A is an antisymmetric, reflexive, and
transitive relation R ⊆ A × A. A partially ordered set, or poset for short, is a set together with
a partial order.
Example. The subsets of a given set A are partially ordered by inclusion.
1234
123 124 134 234
12 13 23 14 24 34
1 2 3 4
∅
7.4. Hasse diagram. The Hasse diagram is a useful way to draw partially ordered sets. Es-
sentially, we draw a point for each element of the poset, and a line from x to y when x < y. But
many of these lines are redundant, in view of transitivity:
x < y < z =⇒ x < z
So we need only draw a line when x < y and there is no element in between. By convention, we
draw x lower than y.
Example. Let X be the factors of 12, ordered by divisibility. The Hasse diagram is then
12
4 6
2 3
1
7.5. Möbius invertion for posets. Given a function f defined on a partially ordered set
(X, ≤), we may form the sum X
g(x) = f (y)
y≤x
assuming that f is real-valued, or at least that there is some way to add the values f (y). To
guarantee that the sum is well-defined, we assume that there are only finitely many terms y
beneath any given x. For instance, this holds if X is finite. How do we recover f from g?
24
Theorem 7.9. (Möbius inversion for posets) Given a partially ordered set X, there is a two-
variable function M : X × X → R such that
X X
g(x) = f (y) ⇐⇒ f (x) = g(y)M (y, x)
y≤x y≤x
This function M is called the Möbius function of the poset. To show it exists for any partial
order, and to compute it for specific orders, we introduce an algebraic structure that captures
the order relation.
Definition 7.10. (incidence algebra) Given a partially ordered set X, the incidence algebra
A(X) is the set of all real-valued functions f : X 2 → R satisfying f (x, y) = 0 unless x ≤ y.
More generally, for any abelian group G, we define AG (X) as the set of all G-valued functions
f : X 2 → G satisfying f (x, y) = 0 unless x ≤ y, where 0 now denotes the identity element of G.
The elements of AG (X) are called incidence functions, or G-valued incidence functions.
If G is a field, in particular for G = R, then AG (X) is a vector space over G with respect to
pointwise addition and scalar multiplication. The extra structure that makes it an “algebra” is
the following operation.
Definition 7.11. (convolution) Given f, g ∈ A(X), their convolution f ∗ g is defined by f ∗
g(x, y) = 0 unless x ≤ y, in which case
X
f ∗ g(x, y) = f (x, z)g(z, y)
x≤z≤y
The sum is well-defined assuming that there are finitely many z in between x and y, which is
certainly the case for finite posets and also holds for many natural infinite ones. By construction,
f ∗ g is again in A(X).
Definition 7.12. (locally finite) A poset X is called locally finite provided that for any elements
x, y, there are only finitely many z ∈ X in the interval x ≤ z ≤ y.
Example. The rational numbers, in their usual order, do not form a locally finite poset. The
interval 0 < z < 1 contains infinitely many elements 1/n for n = 1, 2, 3, . . .
To define convolution for G-valued functions, there must be some notion of multiplication as
well as addition. Thus the same concept applies for any ring instead of R.
Example. If X = {1, . . . , n} with the usual order 1 < . . . < n, then a two-variable function
f (x, y) is just an n × n matrix, and the incidence condition f (x, y) = 0 unless x ≤ y says that
this is a triangular matrix. Convolution is the usual notion of matrix multiplication.
In particular, the example of matrix multiplication shows that convolution is not always
commutative.
Example. (delta function) Returning to a more general poset, the analogue of the identity matrix
is (
1 if x = y
δ(x, y) =
0 if not
Clearly δ(x, y) unless x ≤ y, indeed unless x = y. Thus δ is an incidence function. For any
incidence function f ,
δ∗f =f ∗δ =f
25
because there is one non-zero term f (x, z)δ(z, y) in the interval x ≤ z ≤ y, namely z = y. So
the sum defining f ∗ δ(x, y) is just f (x, y). Similarly, for δ ∗ f (x, y) we have only a single term
f (x, y) when z = x.
Proposition 7.13. Convolution is associative: for any incidence functions f, g, h on a (locally
finite) poset X
(f ∗ g) ∗ h = f ∗ (g ∗ h)
Sketch of proof. For any x ≤ y, both sides (f ∗ g) ∗ h(x, y) and f ∗ (g ∗ h)(x, y) are given by the
sum of f (x, z)g(z, w)h(w, y) over all z and w between x and y and satisfying z ≤ w.
Proposition 7.14. (convolution inverses) Let X be a (locally) finite poset. An incidence func-
tion f (x, y) has an inverse g satisfying f ∗ g = δ if and only if f (x, x) 6= 0 for all x. In that
case, the inverse works on both sides: f ∗ g = g ∗ f = δ.
Proof. Suppose there is an inverse. Then, for any x,
f ∗ g(x, x) = δ(x, x) = 1
On the other hand, there is only one term f (x, x)g(x, x) in the sum over x ≤ z ≤ x defining
f ∗ g(x, x), namely z = x (a partial order is antisymmetric!). If f (x, x)g(x, x) = 1, then
f (x, x) 6= 0 or else the product would be 0.
Conversely, suppose f (x, x) 6= 0 for all x. We define g(x, y) inductively. Note that there are
only finitely many z in the interval x ≤ z ≤ y. For x = y, define g(x, x) = 1/f (x, x). Then the
required identity holds in the form g(x, x)f (x, x) = 1 = δ(x, x) because the sum over x ≤ z ≤ y
is just a single term in this case where x = y (this uses the fact that ≤ is antisymmetric to go
from x ≤ z ≤ x to z = x). If x 6= y, we assume inductively that g(x, z) has already been defined
for z < y, and then define
1 X
g(x, y) = − g(x, z)f (z, y)
f (y, y)
x≤z<y
By construction, g ∗ f (x, y) = 0 = δ(x, y) since multiplying through gives the missing term
g(x, y)f (y, y) corresponding to z = y in the sum. One can construct g 0 satisfying f ∗ g 0 = δ
by a similar induction, and it must be that g = g 0 because ∗ is associative. Indeed, start from
f ∗ g 0 = δ and multiply on the left by g. We obtain g ∗ (f ∗ g 0 ) = g ∗ δ = g because δ is the
neutral element. But by associativity, the other side is
g ∗ (f ∗ g 0 ) = (g ∗ f ) ∗ g 0 = δ ∗ g 0 = g 0
appealing once again to the neutrality of δ. It follows that g = g 0 .
Definition 7.15. The zeta function of a poset is defined by
(
1 if x ≤ y
Z(x, y) =
0 if not
Since Z(x, x) = 1 6= 0 for every x, the Proposition 7.14 implies that there is an incidence function
M satisfying
M ∗Z =Z ∗M =δ
This M is called the Möbius function of the poset. From the construction of inverses, we have
M (x, x) = 1 for every x and, for x < y,
X
M (x, y) = − M (x, z)
x≤z<y
26
Now we can prove Theorem 7.9. The required function M is exactly the Möbius function of
the poset. Recall what we have to show:
X X
g(x) = f (y) ⇐⇒ f (x) = g(y)M (y, x)
y≤x y≤x
Define a new poset X0 by adding a new element less than everything in X. In other words, let
−∞ be anything not already in X and extend the order by −∞ < x for all x ∈ X. For any
function f on X, there is a corresponding incidence function f 0 on X 0 defined by
f 0 (−∞, x) = f (x), f 0 (x, y) = 0 for all x, y ∈ X
The zeta and Möbius functions of X 0 extend those of X by
Z(−∞, y) = 1 for all y ∈ X 0
so we use the same symbols Z and M rather than Z 0 and M 0 .
Because Z and M are convolution inverses,
g 0 = f 0 ∗ Z ⇐⇒ f 0 = g 0 ∗ M
In particular, evaluated at the pair (−∞, x), the quantity on the left is
X X
g(x) = g 0 (−∞, x) = f 0 (−∞, y)Z(y, x) = f (x)
−∞≤y≤x y≤x
while the quantity on the right is
X X
f (x) = f 0 (−∞, x) = g 0 (−∞, y)M (y, x) = g(y)M (y, x)
−∞≤y≤x y≤x
We obtain Theorem 7.9 as originally stated.
Exercise 8. The set Z≥0 is partially ordered by the usual ≤ relation. Compute the Möbius
function of this poset.
27
Step 1: Find the leaf with the smallest label and write down the number of its neighbor.
Step 2: Delete this leaf, together with the only edge adjacent to it.
Step 3: Repeat until we are left with only two vertices.
We present an algorithm that reconstructs the tree from the Prüfer code.
Step 1: Draw the n nodes, and label them from 1 to n.
Step 2: Make a list of all the integers (1, 2, . . . , n). This will be called the list.
29
Step 3: If there are two numbers left in the list, connect them with an edge and then stop.
Otherwise, continue on to step 4.
Step 4: Find the smallest number in the list which is not in the sequence. Take the first number
in the sequence. Add an edge connecting the nodes whose labels correspond to those
numbers.
Step 5: Delete the smallest number from the list which is not in the sequence and the first
number in the sequence. This gives a smaller list and a shorter sequence. Then return
to step 3.
9.4. Counting unlabeled trees. The number of unlabeled trees, that is, classes of pairwise
nonisomorphic trees is only exponential in the number of vertices. We prove the following
theorem:
Theorem 9.5. The number of pairwise nonisomorphic trees on n vertices is at most 22n−4 .
Here is a sketch of a proof: The proof uses the following encoding of trees. We think of a
tree hanged from one of its vertices on a plane (we think of gravity working in the negative
y-direction). We go around the tree and form a binary sequence. If we are going one edge down,
we write 1 in the sequence. If we are going up - we write 0. At the end we corresponded one 0
and one 1 to each edge, which gives us a binary sequence of length 2n − 2. The last bit is always
0, and the first bit is always 1, so the total number of these sequences is at most 22n−4 .
nn−2
Theorem 9.6. The number of pairwise nonisomorphic trees on n vertices is at least n! .
30
7
2
3 5
8 1
One way to solve the problem of finding a minimum spanning tree is using Kruskal’s algorithm.
This works as follows:
Step 1. Start with an empty graph.
Step 2. Take all the edges that have not been selected and that would not create a cycle with
the already selected edges and select it unless it creates a cycle. Add the one with the
smallest weight.
Step 3. Repeat until the graph is connected.
31
Definition 11.4. The Laplace matrix of G is the matrix L(G) ∈ M|V |×|V | (Z), where the its
entries Lu,v for u, v ∈ V are given by
deg(u), if u = v,
Lu,v = −1, if u 6= v and {u, v} is an edge,
0, otherwise.
d) If E(X) = m, then there is at least one elementary event A1 such that X(A1 ) ≥ m, and,
analogously, there is at least one elementary event A2 such that X(A2 ) ≤ m.
A general framework for the probabilistic method is the following: we are given a finite set of
objects Ω and X : Ω → R is a function assigning to each object A ∈ Ω a real number. The goal
is to show that there is at least one element A ∈ Ω for which X(A) is at least a given value m.
For this, we define a probability distribution p : Ω → [0, 1] and consider the resulting probability
space, where X becomes a random variable. Showing that the expected value of X is at least m
is enough, since, if this holds, then there exists at least one event A ∈ Ω for which X(A) ≥ m.
Theorem 12.1. Let G be a graph with an even number, 2n, of vertices and with m > 0 edges.
Then the set V = V (G) can be divided into two disjoint n-element subsets A and B in such a
way that more than m/2 edges go between A and B.
Schütte’s problem can be formulated as follows: do such tournaments exist, for every k fixed?
The answer is given by the following theorem:
Theorem 12.6. For every integers k ≥ 1 and n ≥ k 2 2k (ln(2) + o(1)), there exist a tournament
on n vertices having property Sk .
Proof. The proof can be found in [4], pages 44–45 or [3] pages 299–300.
35
Acknowledgements: I thank Prof. Janos Pach for designing this course and Dr. Matthew de
Courcy-Ireland for sharing his lecture notes.
References
[1] Discrete Mathematics (L. Lovasz, J. Pelikan , K. Vesztergombi);
[2] Combinatorics: Set Systems, Hypergraphs, Families of Vectors and Combinatorial Probability (B. Bollobas);
[3] Invitation to Discrete Mathematics (J. Matousek, J. Nesetril).
[4] Extremal combinatorics (S. Jukna).
[5] Combinatorial theory (M. Hall), Blaisdell publishing company, 1967.