Notes
Notes
Stephen Suen
Department of Mathematics
University of South Florida
December 17, 2015
Contents
1 Basic Counting Principles
1.1 Representing the Situation .
1.2 Sum Principle . . . . . . . .
1.3 Product Principle . . . . . .
1.4 Factorials and Permutations
1.5 Stirlings formula . . . . . .
1.6 Combinations . . . . . . . .
1.7 Binomial Coefficients . . . .
1.8 Multinomial Coefficients . .
1.9 Small Cases . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
1
2
2
3
3
4
6
7
8
.
.
.
.
.
12
12
13
16
18
20
3 Stirling Numbers
21
3.1 The Second Kind . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2 The First Kind . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4 Principle of Inclusion-Exclusion
28
4.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2 Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
ii
iii
CONTENTS
5 Generating Functions
36
5.1 A Quick Introduction . . . . . . . . . . . . . . . . . . . . . . . 36
5.2 Inverses of Generating Functions . . . . . . . . . . . . . . . . 38
5.3 Identical Balls and Distinct Boxes, Again! . . . . . . . . . . . 40
6 Integer Partitions Revisited
42
6.1 The Generating Function for pk . . . . . . . . . . . . . . . . . 43
6.2 The Generating Function for pk,n . . . . . . . . . . . . . . . . 45
6.3 One More Example . . . . . . . . . . . . . . . . . . . . . . . . 48
7 Recurrence Relations
7.1 Ordinary Generating Functions
7.2 Fibonacci Numbers . . . . . . .
7.3 Bell Numbers Revisited . . . . .
7.4 Catalan Numbers . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
49
49
51
53
54
8 Permutations
8.1 Notation . . . . . . . . . . . . . . . . .
8.2 Random Permutations . . . . . . . . .
8.3 Analysis of a Simple Algorithm . . . .
8.4 Number of Permutations with k Cycles
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
57
57
58
59
63
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
66
66
68
68
73
.
.
.
.
.
.
.
.
.
.
.
.
Inversions
10.1 A Recurrence for nk . . . . . . . . . . . . . . . . . . . . . . . 75
10.2 The Average Length of the k-th Run . . . . . . . . . . . . . . 77
10.3 Inversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
11 Extension to Complex Numbers
11.1 The Gamma Function . . . . . . .
11.2 Convergence of the Infinite Product
11.3 Factorials in the Complex Plane . .
11.4 The Falling Factorial . . . . . . . .
11.5 The Binomial Coefficient . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
86
86
87
87
91
92
iv
CONTENTS
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
107
. 107
. 107
. 109
. 112
. 114
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
117
117
118
119
120
123
129
15 Hypergeometric Series
132
15.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
15.2 Reduction to Standard Hypergeometric Functions . . . . . . . 133
16 Gospers Algorithm
16.1 A Brief Description .
16.2 The Functions a, b, c
16.3 The Function x . . .
16.4 Examples . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
139
139
140
143
145
17 Zeilbergers Algorithm
152
17.1 Sister Celines Method . . . . . . . . . . . . . . . . . . . . . . 153
17.2 Zeilbergers Algorithm . . . . . . . . . . . . . . . . . . . . . . 156
18 Burnsides Lemma
159
18.1 Proof of Burnsides Lemma . . . . . . . . . . . . . . . . . . . 162
18.2 Two More Examples . . . . . . . . . . . . . . . . . . . . . . . 166
CONTENTS
19 Polyas Theory of Counting
19.1 Groups Acting on Functions . . .
19.2 Cycles and Burnsides Lemma . .
19.3 The Cycle Index of a Permutation
19.4 Counting Nonisomorphic Graphs
. . . .
. . . .
Group
. . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
168
. 168
. 169
. 172
. 174
Chapter 1
Basic Counting Principles
1.1
xi = 1, 2, 3, 4, 5, 6,
i = 1, 2, 3, 4.
i = 1, 2, 3, 4}.
The event that the experiment results in a sum less than 6 is the set of all
outcomes (x1 , x2 , x3 , x4 ) such that
x1 + x2 + x3 + x4 5.
An event is said to occur if one (and exactly one) of the outcomes in the
event has happened. In the example, the event that the sum is at most 5 is
in fact
E = {(x1 , x2 , x3 , x4 ) : x1 + x2 + x3 + x4 5}
= {(1, 1, 1, 1), (2, 1, 1, 1), (1, 2, 1, 1), (1, 1, 2, 1), (1, 1, 1, 2)}.
There are therefore 5 ways for the event to happen.
1
1.2
Sum Principle
Two events are disjoint if their intersection is empty. Note that two disjoint
events cannot happen at the same time. Note that for (mutually) disjoint
sets E1 , E2 , , En ,
|E1 E2 En | =
n
X
j=1
|Ei |.
Hence, for disjoint events E1 , E2 , , En , the number of ways for at least one
of them to happen can be obtained by adding the numbers of ways for each
individual event to happen.
1.3
Product Principle
Recall that
A B = {(a, b) : a A, b B},
and that
|A B| = |A| |B|.
Thus, if an event E can be divided in two stages where there are m outcomes
for the first stage and if for each of the outcomes in the first stage, there are
n outcomes for the second stage, then the number of ways for E to happen
is m n. This can be generalized to events that can be separated into more
than 2 stages.
Example 1.2. There are 7 men and 8 women in a club. Nominate a person
for the president and a person for the treasurer. A nomination is a pair (x, y)
where x (for president) and y (for treasurer) are club members.
(a) If a person can be the president and the treasurer at the same time,
then the number of possible different nominations is 15 15 = 225.
(b) If no person can hold both positions at the same time, then the number
of possible different nominations is 15 14 = 210.
(c) If people with different gender are to hold the positions, then the number of possible different nominations is
(7)(8) + (8)(7) = 112.
Notice that the set of nominations in this case is the union of two
disjoint sets.
1.4
1.5
Stirlings formula
Note that
n!
2n nn en .
That is,
n!
1
2n nn en
Thus, n! is a huge number when n is big.
1.6
as n .
Combinations
Define nk as the number of k-subsets of an n-set. Since a k-subset of an
n-set represents
a selection of k distinct elements from a set of n (distinct)
n
elements, k is also known as the number of ways to select (where order in
which objects are selected is immaterial) k (distinct) objects from n (distinct)
objects.
Theorem 1.1.
(n)k
n
n!
=
=
,
k
k!
(n k)! k!
n, k 0.
Proof. This proof serves as an example of a general technique in combinatorics which we call equivalence via a bipartite graph. Let A be the set of all
k-subsets of a given n-set X and let B be the set of all k-lists of elements in
X. The objects, k-sets and k-lists, in A and B are vertices in the bipartite
graph whose edges are defined as follows. For a set A A and a list B B,
we join A and B by an edge iff the list B can be obtained by ordering the
elements in A. Every k-list B in B is related (by an edge) to exactly one
k-subset of X. Thus, the number of edges is (n)k . On the other hand, each
k-subset
of X can be ordered in k! ways, giving rise to k! k-lists. Thus, there
are nk k! edges. It therefore follows that
(n)k
n
n
=
k! = (n)k , or
k
k
k!
as required.
Example 1.4. Consider strings of 0s and 1s, length n.
(a) There are 2n different strings since there are two possible choices for
each element in the string.
n
. The reason is
(b) The number of strings
with
k
0s
(and
n
k
1s)
is
k
n
that there are k ways to select k elements (out of n elements) of the
string to be filled with 0s.
(c) Let us find the number of strings with k 0s (and n k 1s) such that
no two 0s are adjacent. Observe that there are n k 1s in each
string of length n and that these 1s separate the string into n k + 1
substrings. Each substring either is empty or has exactly one 0 because
no two 0s are adjacent. Thus, each string in this case is specified by
the k nonempty
substrings out of n k + 1 substrings. The answer is
n
therefore k .
(d) Using (c), the number of strings with length n and no adjacent 0s is
X n k + 1
k0
(n+1)/2
X
k=0
nk+1
.
k
1.7
Binomial Coefficients
Recall that nr is the number of r-subsets of an n-set and is equal to the
number of ways to select, order not important, r objects from
a group of n
distinct objects. We shall give one more interpretation of nr in this section.
Theorem 1.2 (Pascals Triangle). For integers n, r satisfying n, r 0,
n+1
n
n
=
+
.
r+1
r
r+1
Also, since
1.8
n
r
n
nr
n
r
= 2n1 ,
n 1,
n 1.
, we have
n
X
2n + 1
= 22n .
r
r=0
Multinomial Coefficients
n
be the number of ways to form subsets A1 , A2 , , Am of an
Let k1 ,k2 ,
,km
n-set such that Ai Aj = for all i 6= j and |Ai | = ki , i = 1, 2, , m.
Theorem 1.4.
n
k1 , k2 , , km
n!
.
k1 ! k2 ! km !
=
km
k2
k1
k1 , k2 , , km
n!
= =
.
k1 ! k2 ! km !
=
=
=
=
Corollary 1.1.
km
k2
k1
n
.
k1 , k2 , , km
n
= mn ,
k1 , k2 , . . . , km
where the sum is taken over all k1 , k2 , . . . , km such that ki 0 and k1 + k2 +
+ km = n.
X
1.9
Small Cases
This section is related to enumeration by brute force. Brute force is only good
for small cases, but it often gives us insights into the general problems. In
addition, it is often good to be able to verify general formulas by considering
small examples.
We shall be using balls and boxes as examples here. The balls can be
distinct or identical and the same is true for the boxes. Thus we have 4
cases. For each case, one might put conditions on the number of balls in
each box.
Example 1.7. There are 5 balls and 3 boxes. Solve the following two problems under the 4 cases where the balls are either distinct or identical and
where the boxes are either distinct or identical.
(a) Find the number of ways to put the balls into the boxes (with no
additional condition).
(b) Find the number of ways to put the balls into the boxes so that no box
is empty.
Solution. Case ONE: The 5 balls are distinct and the 3 boxes are distinct,
labeled X, Y, Z.
(a) Each ball has 3 choices, and hence there are 35 = 729 ways.
(b) Suppose that box X has i balls. Then the remaining 5 i balls are to
be put into boxes Y, Z so that Y and Z are nonempty. Obviously 5 i 2
because boxes Y and Z are nonempty. The number of ways to put balls into
Y and Z is 25i 2 because there are two ways for either box Y or box Z to
be empty. Thus, the answer is
3
X
5
5
5i
(25i 2) = 70 + 60 + 20 = 150.
(2 2) =
i
i
i=1
i1,5i2
X
Case TWO: The 5 balls are distinct and the 3 boxes are identical.
(b) We shall consider first the condition where no box is empty. In this
case, the numbers of balls in the boxes can be 1, 2, 2 or 1, 1, 3. For the 1, 2, 2
situation, the number of ways is
5
number of ways to put balls a, b, c, d into 2 identical boxes,
1
which is equal to
5 4 2
1 2 2
1
2
= 15,
where the factor 12 comes from the fact that the boxes are identical. Similarly,
for the 1, 1, 3 case, we have
5 4 3
12 = 10.
1 1 3
Thus, the number of ways in this case is 15 + 10 = 25. Note that there is
a simple way to relate the answer here to the answer in (b) in the previous
case later.
(a) Here the numbers of balls in the boxes can be
(i) for two empty boxes: 0, 0, 5,
(ii) for one empty box: 0, 1, 4 or 0, 2, 3,
10
Case THREE: The 5 balls are identical and the 3 boxes are distinct, labeled
X, Y, Z.
(a) Let x, y, z be the number of balls in boxes X, Y, Z respectively. Then the
number of ways is
5 X
5x
X
1=
5
X
x=0
(5 x + 1) =
5
X
x=0
(6 x) = 36 (6)(5)/2 = 21.
(b) For the condition where there is no empty box, since the balls are identical, we may as well put one ball into each box to satisfy the nonemptyness
condition first. Thus, the answer is
2 X
2x
X
1=
3
X
x=0
(3 x) = 9 (3)(2)/2 = 6.
Case FOUR: The 5 balls are identical and the 3 boxes are identical.
(a) The outcomes are multisets of three nonnegative integers that sum to 5:
{0, 0, 5}, {0, 1, 4}, {0, 2, 3}, {1, 1, 3}, {1, 2, 2}.
Thus, there are 5 ways.
(b) From (a) above, we see that if no box is empty, then there are 2 ways.
The following table summarizes the answers obtained in the previous
example.
5 balls
3 boxes
distinct
distinct
identical
identical
distinct
identical
distinct
identical
11
Example 1.8. In combinatorics, it is often the case that astray ideas can
lead us into the wrong the direction. Small examples can help sort this out
quickly. Consider the following way to enumerate the number of ways to put
5 distinct balls into 3 distinct boxes so that no box is empty: First put a
ball into box X 5 ways; put a ball into box Y 4 ways; put 1 ball into box
Z 3 ways; then put the remaining two balls into the boxes (3)(3) ways.
Hence the answer is
(5)(4)(3)(9) = 540.
Is the above correct? Give reasons.
Solution. The above is not correct. For example, consider the distribution
where balls a, b are in box X, balls c, d are in box Y and ball e is in box Z.
Now it is obvious that this distribution is counted more than once by the
above method, because the above method distinguishes between the order in
which the balls are put into the boxes.
Example 1.9. This example is equivalent to one of the previous examples.
Find the number of integer solutions to
x1 + x2 + x3 = 5,
x1 , x2 , x3 0.
Solution.
Observe that each solution corresponds to a distribution of 5
identical balls to 3 distinct boxes (as the values of the variables x1 , x2 , x3
specify the number of balls in each of the 3 distinct boxes). Thus, from a
previous example, the answer is 21.
Chapter 2
Balls and Boxes
We shall be considering the distributions of balls into boxes in some generality
as many enumeration problems can be formulated using balls and boxes.
Recall that the balls and boxes can be distinct or identical, and conditions
may be placed on the number of balls per box. We shall assume that there
are always k balls and n boxes.
2.1
n!, n = k,
0, n =
6 k.
(c) The number of surjections (onto functions) equals the number of distributions of k distinct balls to n distinct boxes with at least one ball per
box, and is
X
k
,
i1 , i2 , . . . , i n
12
13
2.2
14
4
2
= 6 ways to
k
X
k
Bk =
,
n
n=1
k 1.
15
1 X
k
k
=
,
n
i1 , i2 , . . . , in
n!
16
Solution.
k
= 2k1 1.
2
2.3
This kind of distributions is related to two well known problems in combinatorics: counting multisets and integer solutions.
A multiset is a collection of objects (elements from a set) in which an
object can appear more than once. For example,
{1, 2, 2, 4, 5, 5}
is a multiset of elements in [5].
Theorem 2.7. (a) The number of multisets with k elements chosen from
[n] equals the number of integer solutions to
x1 + x2 + + xn = k,
xi 0,
i = 1, 2, . . . , n.
(b) The number of binary strings with k 0s and n1 1s equals the number
of integer solutions to
x1 + x2 + + xn = k,
(c) All three numbers equal
k+n1
k
xi 0,
i = 1, 2, . . . , n.
17
xi 0,
x1 + x + 2 + + xn = k.
Also, each integer solution gives a binary string with k 0s and n 1 1s.
(c) Simply observe
that the number of binary strings with k 0s and n 1
k+n1
.
1s is
k
xi 0,
i = 1, 2, . . . , n.
Since each distribution gives an integer solution to the above equation, and
each integer solution corresponds to a distribution, the theorem therefore
follows.
Theorem 2.9. The number of distributions
of k identical balls to n distinct
k1
.
boxes with no empty boxes equal kn
Proof. The number of distributions equals the number of integer solutions to
x1 + x2 + + xn = k,
xi 1,
i = 1, 2, . . . , n.
yi 0,
i = 1, 2, . . . , n,
18
2.4
k
X
p(k, n).
n=1
min(k,n)
p(k, i) =
p(k, i).
i=1
i=1
n
X
i=1
p(k n, i).
Before we prove the theorem, let us consider first its consequence. Recall
that
p(k, k) = p(k, 1) = 1,
k 1,
and
p(k, n) = 0,
k < n.
19
Thus, we know the value of p(1, n) for all n 1. We claim that the formula
in the theorem, together with the above boundary conditions, completely
determine p(k, n) for 1 n k. This claim can be proved by induction
on k. Assume as induction hypothesis that for integer k0 2, the values of
p(k, n) are known for all n 1 and all k < k0 . Then the value of p(k0 , n),
where n < k0 , can be calculated by
p(k0 , n) =
n
X
i=1
p(k0 n, i),
since by the induction hypothesis, the values of p(k0 n, i) are known, for
all values of i 1. Note also that for n = k0 , we have p(k0 , k0 ) = 1. Thus,
the following table of values of p(k, n) can be calculated row by row using
the formula in the theorem.
k
1
2
3
4
5
6
7
p(k, 1)
1
1
1
1
1
1
1
p(k, 2)
p(k, 3)
p(k, 4)
p(k, 5)
p(k, 6)
p(k, 7)
1
1
2
2
3
3
1
1
2
3
4
1
1
2
3
1
1
2
1
1
For example, to calculate p(7, 3), one can go up 3 rows (where the value of k
is 7 3 = 4) and then sum the first 3 entries in that row to get 1 + 2 + 1 = 4.
Proof of Theorem. Recall that p(k, n) equals the number of distributions of
k identical balls to n identical boxes so that no box is empty. For each such
distribution, suppose that a ball is removed from each box and it results in
i n nonempty boxes, then we have a distribution of k n identical balls
to n identical boxes (with no condition on the number of balls per box).
20
n
X
i=1
p(k n, i).
2.5
Summary
The following tables summarize the different types of problems, and their
solutions, discussed in this chapter.
k 1 balls
n 1 boxes
distinct
distinct
identical
identical
distinct
identical
distinct
identical
boxes
distinct
identical
distinct
identical
related problems
functions
set partitions
multisets, integer solutions
integer partitions
Chapter 3
Stirling Numbers
3.1
Recall that
sets.
k
n
0
k
= k,0 ,
=
k
0
k
= 0,
n
21
k < n.
22
k
= n!
,
n
k
=
n
and that
k
1 X
k
,
=
n!
i1 , i2 , . . . , in
n
where is the sum is taken over all i1 , i2 , . . . , in such that i 1 and i1 + i2 +
+ in = k.
However, the above formula is useless when both n and k n are large.
We shall develop recurrence relations for computing Stirling numbers of the
2nd kind.
Theorem 3.1. For integers k 1 and n 1,
k
k1
k1
=
+n
.
n
n1
n
Case TWO: The box containing the k-th ball has at least 2 balls in it. Then
removing the k-th ball gives a distributions of k 1 distinct balls to n distinct
boxes with no empty boxes. In reversing this process, we need to decide which
of the n boxes to put the k-th ball in, and there are n choices. Thus, the
number of distributions in this case equals n times the number of distributions
of k1 distinct balls to n distinct boxes with no empty boxes, and is therefore
equal to
k1
n n!
.
n
23
which implies the formula in the theorem. You can see that the method
works (more directly) if we consider identical boxes instead.
Notice that the above formula together with the boundary conditions:
k
0
1, k = 0,
=
= k,0 =
0, k 6= 0,
0
k
completely determines nk for all integers k, n 0. Therefore, we obtain the
following table of values of nk .
k
0
1
2
3
4
5
6
k
0
1
0
0
0
0
0
0
k
1
1
1
1
1
1
1
k
k
k
k
k
1
3
7
15
31
1
6
25
90
1
10
65
1
15
1
j
n
j=0
Proof. Consider the distributions of k distinct balls to n identical boxes with
no empty boxes. Consider the box containing the k-th ball. If it contains i
balls then there are k i balls in the other n 1 boxes. As there are k1
i1
ways to choose the i balls in the box containing the k-th ball, we see that
the number of distributions of k distinct balls to n identical boxes with no
24
k
# distributions of k distinct balls to n
X
k
identical boxes so that there is no empty box and that
=
n
i=1 there are i balls in the box containing the k-th ball
k1
X
k1
# distributions of k i distinct balls to n 1
=
identical boxes so that there is no empty box
i
1
i=1
k1
X
k1
ki
=
i1
n1
i=1
k1
X
j
k1
,
=
n1
j
j=0
where the last equality is obtained from the previous one by replacing i with
k j throughout.
As an example, for integer k 2,
X
X
k1
k1
k1
j
k1
k
= 2k1 1.
=
=
j
1
j
2
j=1
j=0
Also, for integers k 3,
X
X
k1
k1
k
k1
j
k1
=
=
(2j1 + 1) = 21 (3k1 + 1) 2k1 .
3
j
2
j
j=0
j=2
Theorem 3.3.
X k
x =
(x)n ,
n
n0
k
integer k 0.
Note that
(x)n = (x)(x 1) (x n + 1),
and that in particular,
(x)1 = x,
(x)0 = 1.
integer n 0.
25
0
n
= n,0 , we
For the induction step, assume 1 and the formula in the theorem holds
for all values of k < . Then since 0 = 0, we have
X
(x)n
n
n0
X 1
1
=
+n
(x)n
n
1
n
n1
X 1
X 1
(x)n
(x)n+1 +
n
=
n
n
n1
n0
X 1
X 1
(x)n
(x)n (x n) +
n
=
n
n
n1
n0
X 1
X 1
X 1
(x)n
(x)n +
n
(x)n
n
= x
n
n
n
n1
n0
n0
= x (x1 ),
= x .
This completes the induction step and the proof of the theorem.
3.2
k1
Y
j=0
(x j) = (x)(x 1) (x k + 1),
integer k 0.
Note that since the empty product is 1, we have (x)0 = 1. Define Stirling
numbers of the first kind by
s(k, n) = [xn ](x)k ,
integers n, k 0.
26
k1
Y
j=0
(x + j) = (x)(x + 1) (x + k 1),
integer k 0,
integers n, k 0.
27
we get that
k
= 0, k 1.
0
This shows that the boundary conditions are satisfied. To prove the recurrence relation, let k 1 and consider
X k
xn = x(k)
n
n0
= (x + k 1)x(k1)
= xx(k1) + (k 1)x(k1)
X k 1
X
k1 n
n+1
=
x
+
(k 1)
x
n
n
n0
n0
X k 1
k1
k1
n
=
+ (k 1)
x + (k 1)
.
n1
n
0
n1
k
0
1
0
0
0
0
0
0
k
1
1
1
2
6
24
120
k
k
k
k
1
3
11
50
274
1
6
35
225
1
10
85
1
15
k
n
. We find that
k
6
Chapter 4
Principle of Inclusion-Exclusion
4.1
Notation
Ai ,
iK
N = |U |.
29
Then
M0 = # distributions not in A1 , A2 , A3
= # distributions with no empty box.
Now the following formula (which is a special case of the principle of inclusionexclusion) is well known:
M0 = |A1 A2 A3 |
= |U | (|A1 | + |A2 | + |A3 |)
+(|A1 A2 | + |A1 A3 | + |A2 A3 |) |A1 A2 A3 |.
Here,
|U | = 39 ,
|A1 | = |A2 | = |A3 | = 29 ,
|A1 A2 | = |A1 A3 | = |A2 A3 | = 1,
|A1 A2 A3 | = 0.
Thus, the number of distribution of 9 distinct balls to 3 distinct boxes with
no empty box equals
M0 = 39 (3)(29 ) + (3)(1) 0 = 18150.
For 5 balls, we have
M0 = 35 (3)(25 ) + (3)(1) 0 = 150,
as before.
For the general case where there are k distinct balls and 3 distinct boxes, we
have
M0 = 3k (3)(2k ) + 3.
4.2
Formulas
We shall first give a general formula, and derive from it other useful formulas.
Theorem 4.1. For K P ,
MK =
J:KJP
(1)|J||K| NJ .
30
Proof. Recall that MK is the number of objects with exactly those properties
in K while NJ is the number of objects with at least those properties in J.
We shall prove the theorem by considering the contribution of an object q to
the sum on the RHS.
Case ONE: If q does not possess all properties in K, then q contributes
nothing to NJ for any J K. So q contributes nothing to the sum.
Case TWO: If q possesses exactly all properties in K and no others, then q
contributes 1 to NK but none to NJ for any J % K (and J 6= K). So q
contributes 1 to the sum.
Case THREE: If q possesses i, i 1, properties in addition to those in K,
then let X be the set of properties that q possesses. Thus q contributes 1 to
NJ if J satisfies K J X P , and q contributes 0 to NJ if otherwise.
Hence, qs contribution to the sum equals
|X|
X
X
|J||K|
j|K| |X K|
(1)
=
(1)
j |K|
J:KJX
j=|K|
i
X
i
=
(1)
=0
= 0.
Combining these three cases, we see that the sum equals # objects with
exactly those properties in K. That is, the sum equals MK as asserted in
the theorem.
For the other formulas, we need to define for integer j 0,
X
X
\
Sj =
NJ .
Ai =
J: |J|=j,JP
iJ
J: |J|=j,JP
n
31
(1)|J||K| NJ
K:|K|=i,KP J:KJP
=
=
=
(1)|J||K| NJ
J:|J|i,JP K:KJ,|K|=i
n
X
X
j=i J:|J|=j,JP
n
X
j
ji
j=i
(1)
j
(1)ji NJ
i
Sj .
n
X
(1)j Sj .
j=0
4.3
32
Examples
Example 4.2. Prove the following formula for nk :
X
n
k
j n
(n j)k .
=
(1)
n!
j
n
j=0
Solution.
Consider the # distributions of k distinct balls to n distinct
boxes but no empty boxes. Notice that this is equal to the LHS of the
above identity. Thus, it is sufficient to show that the number of distributions
equals the RHS. We shall use inclusion-exclusion. Here, the objects are
distributions, and property j is box j is empty:
Aj = {distributions in which box j is empty},
j P = [n].
n
X
(1)j Sj .
j=0
J:JP,|J|=j
Thus,
n
n
(n j)k .
|A1 A2 Aj | =
NJ =
j
j
n
X
n
M0 =
(1)
(n j)k ,
j
j=0
as desired. This gives yet another formula for nk :
X
n
n
k
(1)j (n j)k X (1)nj j k
=
=
.
n
j!(n j)!
(n j)! j!
j=0
j=1
j
j)!
j!
j=1
as before.
33
i [n].
and by symmetry,
n!
n
n
Sj =
|A1 A2 . . . Aj | =
(n j)! = .
j
j
j!
Thus,
M0 = n!
n
X
(1)j
j=0
j!
X
(1)j
= e1 .
j!
j=0
Notice that
|M0 n!e1 | = n!
(1)j /j!
j>n
1
n+1
1
,
for all n 1.
2
<
34
Example 4.4. There 2n beads in n pairs. Each pair of beads have the same
color but different shapes. Beads from different pairs have different colors.
Arrange the beads in a circle so that no two beads from a pair are next to
each other. How many different arrangements?
Solution. When n = 1, there is only one pair, and the number of arrangements is 0. We shall therefore assume n 2. Also, note that the number of
ways to arrange m 1 different objects in a circle is (m 1)!. We shall use
inclusion-exclusion. Here the objects are circles with the 2n beads. A circle
has property j iff beads from pair j are next to each other in the circle. That
is,
Aj = {circles where beads in pair j stay together}.
We like to find the number of circles without any of these properties. Observe
that by symmetry,
n
|A1 A2 Aj |.
Sj =
j
To find |A1 A2 Aj |, we take the two beads in pair i, 1 i j, as a
group. Together with the other 2n 2j beads, there are 2n 2j + j objects
to be arranged in a circle, and there are (2n j 1)! such circles. For each
such circle, there are 2j ways to arrange the beads in each group. Hence,
|A1 A2 Aj | = 2j (2n j 1)!.
Thus, the number of circles in which no beads in the same pair are together
is
n
n
X
X
n
j
M0 =
(1) Sj =
(1)j 2j (2n j 1)!.
j
j=0
j=0
Example 4.5. Suppose that k is a positive integer with P as its set of prime
divisors. Find the number
(k) = |{x : gcd(x, k) = 1, 1 x k}|.
Solution. The objects are integers 1, 2, . . . , k. An integer x has property p
iff x is divisible by the prime p P . That is,
Ap = {x : p|x, 1 x k},
p P.
35
(1)|I|
IP
pP
Thus,
Ap .
pI
Ap = {x : p|x, p I, 1 x k} = Q
k
pI
Y
X Y 1
1
=k
1
.
M0 =
(1) Q
=k
p
p
pI p
pP
IP
IP pI
X
|I|
Chapter 5
Generating Functions
5.1
A Quick Introduction
Recall that to get a term in the expansion of a product of factors, for example,
(1 + x + x4 ) (1 + y 2 + y 5 ),
one can simply choose one term from each factor, and multiply them together
to form a term. This is not very much different from enumeration. Each
factor represents a stage (in the product principle) and the terms in each
factor represent the choices within the stage represented by the factor.
Example 5.1. Let us consider a very detailed example. Choose k items
from a basket of 2 apples, 1 orange and 5 pears. Fruits of the same type are
considered identical. Then we can use
xi , 0 i 2, denote choosing i apples,
y i , 0 i 1, denote choosing i orange,
z i , 0 i 5, denote choosing i pears.
Now consider the product
(x0 + x1 + x2 )(y 0 + y 1 )(z 0 + z 1 + z 2 + z 3 + z 4 + z 5 ).
Each term is of the form xa y b z c and it represents the selection of a apples,
b oranges and c pears. The number of ways to choose k fruits equals the
36
37
0 x 2,
0 y 1,
0 z 5.
and is hence 6.
Example 5.3. How about 5 different math books and 4 identical copies of
Arthur C. Clarke novels?
Solution. The enumerator for each math book is 1 + x, and the enumerator
for the Clarke novels is 1 + x + x2 + x3 + x4 . Thus, the generating function
for the numbers ar of ways to choose r books is
(1 + x)5 (1 + x + x2 + x3 + x4 ).
Example 5.4. Let ak be the number of combinations of pennies, nickels and
dimes to give k cents of change in a check-out counter. Then the enumerator
for pennies is
1
,
1 + x + x2 + =
1x
the enumerator for nickels is
1 + x5 + x10 + =
1
,
1 x5
38
1
.
1 x10
5.2
We shall consider formal power series. That is, we are only interested in the
algebraic properties (differential operator included) of power series. We shall
not be concerned with analytical properties (such as convergence).
If G, F are generating functions and GF = 1, then G is the inverse of F
and write
1
F 1 = G = .
F
For example,
(1 + x + x2 + )(1 x) = 1,
and hence
F = 1 + x + x2 + =
Similarly, we have by replacing x with 3x,
1
.
1x
1 3x + 9x2 27x3 + . . . =
1
.
1 + 3x
Also, we have
1 + 2x + 3x2 + 4x3 + =
(k + 1)xk =
k0
1
,
(1 x)2
39
F =
ai x i ,
a0 6= 0,
i0
then F 1 exists.
Proof. Consider G =
FG =
i0 bi x
ai x i
i0
where
ci =
i
X
j=0
. Then
!
bi xi
i0
c i xi ,
i0
aj bij = a0 bi + a1 bi1 + + ai b0 ,
i 0.
Now if we know b0 , b1 , . . . , bi1 and ci , then we can solve for bi (since a0 6= 0).
Thus, if F G = 1, then we have
c0 = 1,
ci = 0,
i 1.
has an inverse. However, notice that the power series does not converge for
x 6= 0 and that Taylors theorem does not apply here.
40
5.3
Consider putting identical balls into individual (distinct) boxes. The enumerator for each box is
1 + x + x2 + =
1
,
1x
where the term xi indicates that there are i balls in the box. Hence, the
generating function for the numbers (fk )k0 of distributions of k identical
balls into n distinct boxes is
1
.
(1 x)n
Now we learned before that
k+n1
fk =
.
k
Hence, we have given a combinatorial proof of the formal power series:
X
k+n1 k
1
x .
=
k
(1 x)n
k=0
Or equivalently,
(1 + x)
X
k+n1
k=0
(1)k xk .
Let us generalize the definition of the binomial coefficient and the binomial theorem. Using Taylor Series, we have for any real number r,
X xk d k
X (r)k
r
r
(1 + x) =
=
(1
+
z)
xk .
k
k! dz
k!
z=0
k0
k0
41
In view of the Taylor series for (1 + x)r , if we generalize our definition of the
binomial coefficient so that for all r R and all k Z,
(r)
k
r
, k 0,
k!
=
0,
k < 0.
k
then the binomial theorem can be written as
X
r k X r k
r
x ,
x =
(1 + x) =
k
k
k
k=0
r R.
Thus, we must have for all integer n 0 and all integer k that
k+n1
n
n
(1) =
.
k
k
We shall show that the above is in fact true for all r R. Suppose that
k 0. Then
(r)(r 1) (r k + 1)
r
=
k
k!
(k + r 1)k
= (1)k
k!
k k+r1
.
= (1)
k
Notice that the above equality also holds for k < 0 as both sides are 0. Thus,
we have
r
k k+r1
,
r R, k Z.
= (1)
k
k
As simple examples, we
1
1x
1
(1 x)2
1
(1 x)3
observe that
= 1 + x + x2 + x3 + ,
= 1 + 2x + 3x2 + 4x3 + ,
= 1 + 3x + 6x2 + 10x3 + .
Chapter 6
Integer Partitions Revisited
Recall that p(k, n) equals the number of distributions of k identical balls into
n identical boxes with no empty box, and is equal to the number of integer
partitions of k into n (positive) parts. Also, p(k) is the number of partitions
of k. For this section, we write
pk,n = p(k, n),
pk = p(k).
For example,
p4,2 = 2
because 1 + 3 = 2 + 2 = 4, and
p4 = 5.
because in addition to the previous 2 partitions of 4, we also have 3 other
partitions of 4: 1 + 1 + 1 + 1 = 1 + 1 + 2 = 4.
As in Stirling numbers, we define
p0,n = 0,n ,
pk,0 = k,0 .
42
6.1
43
x, y 0?
Theorem 6.1. The generating function for the sequence (pk )k0 is
Y 1
.
1 xi
i1
Proof. We regard a partition of k as deciding, for each i 1, the number of
parts with size i it contains. Thus, the enumerator for (the contribution to
the partition by) parts of size i is
1 + xi + (xi )2 + =
1
,
1 xi
where (xi )j represents the situation that the partition contains j parts of size
i (thus making a contribution of ki to the partition of k). Then the number
of partitions of k equals the coefficient of xk in
Y 1
,
i
1
x
i1
which implies the theorem.
44
Example 6.2. (a) The generating function for the numbers of integer partitions with all parts at most n is
n
Y 1
1
pn (x) =
=
.
(1 x)(1 x2 ) (1 xn ) i=1 1 xi
(b) The generating function for the numbers of integer partitions with all
odd parts only is
Odd(x) =
Y
1
1
=
.
3
5
(1 x)(1 x )(1 x ) i0 1 x2i+1
(c) The generating function for the numbers of integer partitions with all
even parts only is
Even(x) =
Y 1
1
=
.
(1 x2 )(1 x4 )(1 x6 ) i1 1 x2i
x
(1
x
(1
x
)
i1
i1
i0
We see that u(x) = Odd(x) and hence the two corresponding sequences
represented by the generating functions are equal.
6.2
45
Define
F (x, y) =
XX
pk,n xk y n .
k0 n0
Now x is for the sum of the parts and y is for the number of parts. Thus,
the enumerator for the parts of size i is
1 + xi y + (xi y)2 + (xi y)3 + =
Hence, we have
F (x, y) =
Y
i1
1
.
1 xi y
1
,
1 xi y
XX
pk,n xk y n =
k0 y0
Notice that
pk =
Y
i1
1
.
1 xi y
pk,n ,
n0
XX
X
1
k
=
F
(x,
1)
=
p
x
=
p k xk ,
k,n
i
1
x
k1
k0 n0
k0
Y
as expected.
Theorem 6.4.
(1 xy)F (x, y) = F (x, xy).
46
1
1 xi y
i1
1 Y
1 xy
i2
1
1 xi y
1 Y
1
=
1 xy i1 1 xi (xy)
=
1
F (x, xy)
1 xy
Observe that
F (x, y) =
XX
pn,k xk y n =
k0 n0
gn (x)y n ,
n0
n0
n 1.
x
gn1 (x),
n 1.
1 xn
Also, it can be checked from the definition of gn (x) that
gn (x) =
g0 (x) = 1.
47
n
Y
x
xn
Q
g
(x)
=
.
n
i 0
i)
1
x
(1
x
i=1
j=1
XX
pk,n xk y n =
k0 n0
XX
pk,n xk (xy)n .
k0 n0
k n
k, n 1.
k, n 1.
With the boundary conditions stated in the beginning of this chapter, we see
that this recurrence completely determines pk,n . Notice that this recurrence
is essentially the same as the one studied in a previous chapter:
pk,n =
n
X
k > n 1.
pkn,i ,
i=1
Let us try
gn (x) =
X
x
g
(x)
=
x1+jn gn1 (x),
n1
n
1x
j0
where
gn (x) =
n 1,
pk,n xk .
k0
g0 (x) = 1,
6.3
48
Finally, let us consider the generating function for the number of integer
partitions with largest part size equal to n. For i = 1, 2, . . . , n 1, the
enumerator for the part with size i is 1/(1 xi ) as before. The enumerator
for the part of size n is
xn
x + x(x ) + (x ) + =
,
1 xn
n
n 2
n 3
since there is at least one part of size n. Thus, the generating function is
xn
,
i
i=1 (1 x )
Qn
which is the same as gn (x). Recall that gn (x) is the generating function
for the number of integer partitions with n parts and that the generating
function for the number of integer partitions with part sizes at most n is
1
.
i
i=1 (1 x )
Qn
Chapter 7
Recurrence Relations
We have seen how to solve simple recurrence relations. The purpose of this
chapter is to introduce a standard (and powerful) solution method by using
generating functions.
7.1
The general method is as follows. Use the recurrence to find the generating
function of the sequence. Then expand the generating function to obtain a
formula for the n-th term of the sequence.
Example 7.1. Solve the recurrence
with initial conditions
sn = 2sn1 sn2 ,
s0 = 0,
Solution.
Let
G(x) =
n 2,
s1 = 1.
X
s n xn .
n0
n1
n0
49
50
or
G(x) =
x
.
(1 x)2
n1
n0
Thus,
sn = n,
n 0.
n 2,
with
Solution.
f0 = 2,
Let
F (x) =
f1 = 1.
X
f n xn .
n0
1
3
2 + 13x
=
+
.
(1 5x)(1 2x)
1 5x 1 2x
Expanding F (x) to obtain
X
X
F (x) =
5n xn 3
2n xn .
F (x) =
n0
n0
Thus,
fn = 5n (3)(2n ),
n 0.
7.2
51
Fibonacci Numbers
n 2,
with
a0 = 0,
1 = a1 .
f1 = 2.
n 0.
(n+1)/2
X
k=0
nk+1
.
k
Thus, we see that for n 1 (and one can check that the following is also
true for n = 0),
(n1)/2
X
nk1
.
an =
k
k=0
52
Then
giving that
x
.
1 x kx2
Consider 1 x kx2 = 0 = (1 x)(1 x), where and are zeros of
y 2 y k = 0. Thus,
1 + 1 + 4k
1 1 + 4k
=
,
=
,
2
2
with
+ = 1,
= k.
G(x) =
G(x) =
B
A
+
,
1 x 1 x
1 + 4k
1 + 4k
Therefore, gn equals
[xn ] G(x) = An + B n
n
n !
1 1 + 4k
1
1 + 1 + 4k
.
=
2
2
1 + 4k
In particular, we have proved that for Fibonacci numbers, an equals
!n
!n !
(n1)/2
X
1
nj1
1+ 5
1 5
=
.
j
2
2
5
j=0
We shall study more of this in a later chapter.
7.3
53
Recall that the Bell numbers Bn is the number of partitions of an n-set. Also,
we obtained the recurrence:
n1
X
n1
Bn =
Bj , n 1,
B0 = 1.
j
j=0
The purpose of this section is to introduce the exponential generating function
(which, in this case, is an ordinary generating function for the sequence
Bn /n!). The final solution requires solving a differential equation.
Define
F (x) =
Bn
n0
xn
.
n!
n1
xn X X n 1
xn
Bn
Bj ,
=
n!
n!
j
n1
n1 j=0
X
giving that
G(x) B0 =
n1
XX
Bj
n1 j=0
xn
,
j! n(n 1 j)!
X X Bj
xn
=
j! n(n 1 j)!
j0 nj+1
Thus,
X X Bj
xn1
,
j!
(n
j)!
j0 nj+1
X Bj
=
x j ex ,
j!
j0
G (x) =
= ex G(x).
G(x) = Aee ,
54
X ejx
j!
j0
= e1
X X (jx)n
j!n!
!
X j n xn
X
=
e1
.
j! n!
j0
n0
j0 n0
Thus,
Bn = e1
X jn
j0
7.4
j!
Catalan Numbers
n1
X
i=1
fi fni ,
n 2.
55
n
X
fi fni ,
i=0
n 2,
Define
G(x) =
f0 = 0, f1 = 1.
f n xn .
n0
Then
X
x fn =
G(x) xf1 f0 =
fi fni xn ,
n2 i=0
n2
or
n
XX
n
XX
n0 i=0
fi fni xn x
1
X
i=0
fi f1i f0 f0 .
n
XX
fi fni xn ,
n0 i=0
XX
fi fni xn ,
i0 ni
2
= G(x) .
That is,
G(x)2 G(x) + x = 0.
To solve for G(x), we take the above equation as a quadratic in G(x) and
find that
1 1 4x
G(x) =
.
2
Now G(0) = f0 = 0 enables us to determine that
1 1 4x
G(x) =
.
2
We next use Taylors expansion to get that the n-th term of the power series
of (1 + y)1/2 is
y n (1/2)n
y n dn
1/2
(1
+
y)
=
.
n! dy n
n!
y=0
56
=
2
n!
n!
(2n 2)!
=
(n 1)!n!
1 2n 2
.
=
n n1
We therefore find that
fn =
0,
1 2n2
n n1
n = 0,
, n 1.
Note: Catalan numbers, Cn , appear in many problems and they are usually
defined as Cn = fn+1 . That is,
1
2n
Cn =
, n 0.
n+1 n
Chapter 8
Permutations
A permutation on [n] is a bijection on [n]. We write i = (i). Permutations have rich properties in groups, combinatorics and analysis of sorting/searching algorithms.
8.1
Notation
Notice that the outdegree and indegree of each vertex are both equal to
1. Thus, the digraph is simply a collection of (directed) cycles. The cycle
notation simply lists all cycles in the permutation.
57
58
CHAPTER 8. PERMUTATIONS
5
1
111111111
000000000
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
00
11
0
1
0
1
111111111
000000000
00
11
0
1
0
1
2
6
11
00
00
11
11
00
00
11
00
11
4
11
00
00
11
00
11
1
8.2
Random Permutations
CHAPTER 8. PERMUTATIONS
59
>
end;
>
P;
> end:
> P := RandPerm(10,201):
> for i from 1 to 10 do printf("%a ",P[i]); end do;
Method TWO: Take a random permutation on [n1] and place 1 , 2 , . . . , n1
in a row, creating n slots between them:
|{z} 1 |{z} 2 |{z} |{z} n1 |{z} .
AllPerm := proc(i,n,B)
local C, j, t;
if (i=0) then
for j from n by -1 to 1 do printf("%a ",B[j]); end do:
printf("\n");
else
for j from 1 to n do C[j] := B[j]; end do;
for j from i by -1 to 1 do
t := C[i]; C[i] := C[j]; C[j] := t;
AllPerm(i-1,n,C);
end do;
end if;
end:
n := 5:
for i from 1 to n do A[i] := i: end do:
AllPerm(n,n,A);
8.3
60
CHAPTER 8. PERMUTATIONS
Algorithm FindMin
Input: n numbers B[i], i = 1, 2, . . . , n
Output: mini B[i]
Assume: the numbers B[i] 6= B[j] for all i 6= j.
> FindMin := proc(n,B)
>
local i;
>
for i from 2 to n do
>
if (B[1] > B[i]) then B[1] := B[i]; end if;
>
end do;
>
B[1];
> end:
> _seed := 2003: n := 10:
> for i from 1 to n do
>
P[i] := rand(1..1000)();
> end:
> FindMin(10,P);
Let An be the number of times that the assignment statement B[1] := B[i]
is performed. Assume without loss of generality that B is a permutation on
[n].
Best Case: An = 0. This occurs when B[1] = 1 is the minimum, and it
happens with probability
# permutations with B[1] = 1
(n 1)!
1
=
= .
n!
n!
n
Worst Case: An = n 1. This occurs when B[i] = n i + 1 for all i =
1, 2, . . . , n and it happens with probability
P r(An = 0) =
1
.
n!
Our question is about the average case. Suppose that each permutation on
[n] is equally likely to be the input, what can we say about An ? How about
its mean and variance:
X
E(An ) =
jP r(An = j),
P r(An = n 1) =
j0
One of the first way to try to solve problems like this is by recurrence
relations. Recall that a random permutation on [n] can be constructed by
61
CHAPTER 8. PERMUTATIONS
in distribution.
in distribution.
Notice that An1 and (B[1] = n) on the right above are independent.
To calculate the mean of An , observe that
E(An ) = E(An1 ) + E((B[1]=n) ) = E(An1 ) +
1
.
n
1
1
1 1
+ + +
+ .
2 3
n1 n
62
CHAPTER 8. PERMUTATIONS
To calculate the variance of An , we use independence to get
var(An ) = var(An1 ) + var((B[1] = n)).
Now
var((B[1]=n)) =
E(2(B[1]=n) )
1
E((B[1]=n) ) = (1)
n
2
2
1
1
1
= 2.
n
n n
Thus,
1
1
2
n n
X 1
1
= var(A1 ) +
j j2
j2
var(An ) = var(An1 ) +
= Hn Hn(2) ,
where
Hn(s)
n
X
1
=
js
j=1
V ar(An ) = ln(n) +
2
+ o(1).
6
in distribution,
n1
1
pn1,k + pn1,k1 ,
n
n
n 2.
Also, we have
p1,k = k,0 ,
k,
and
pn,k = 0,
k < 0.
63
CHAPTER 8. PERMUTATIONS
Define the generating function
Pn (x) =
pn,k xk ,
and we have
Pn (x) =
n1
x
x+n1
Pn1 (x) + Pn1 (x) =
Pn1 (x),
n
n
n
n 2.
(x + n 1)n1
P1 (x).
(n)n1
(x)n
n
1
k+1 (x)n
= [x ]Pn (x) = [x ]
.
= [x ]
=
xn!
n!
n! k + 1
k
8.4
Recall that a permutation can be represented by cycles. Now the cycle representation is not unique in the sense that a permutation can have two (or
more) cycle representations as described before. In order to have a unique
representations, we use the so-called canonical cycle representation:
Step ONE: always list the vertices in a cycle starting from the smallest label,
CHAPTER 8. PERMUTATIONS
64
65
CHAPTER 8. PERMUTATIONS
E(Cn ) = Hn ,
Gn (x) =
n
X
P (Cn = k)xk =
k=0
Thus,
E(Cn ) =
n
X
(x)n
.
n!
kP (Cn = k) = Gn (1).
k=0
But
(1)n
= n! and
Gn (x)
giving that
E(Cn ) =
n1
X
1
1
,
= (x)n
n!
x+k
k=0
Gn (1)
n1
X
k=0
1
= Hn .
1+k
Chapter 9
A Generating Function for
Permutations
The Cycle Index of Sn
9.1
ti = 0,
i > n.
(n)
(n)
Let St1 ,t2 ,...,tn = St1 ,t2 ,... be the number of permutations in Sn with cycle class
(n)
(t1 , t2 , . . .). To find St1 ,t2 ,... , we follow these steps:
Step ONE: Fix the vertices in the cycles, and number of ways to do this is
n
Y
1
1
n
,
= n!
ti t !
n t1 ! t2 ! . . . , tn !
(i!)
1, . . . , 1, 2, . . . , 2, . . . , |{z}
i
i=1
| {z } | {z }
t1
t2
1
ti !
tn
comes from the fact that the cycles of lengths i are not
66
((i 1)!)ti .
Thus,
(n)
St1 ,t2 ,...,tn
= n!
n
Y
i=1
it i
1
.
ti !
Zn (x1 , x2 , . . .) =
1 X Y ti ()
x
n! S i1 i
n
1
n!
xtii .
i1
n
Y
1 xi ti
ti ! i
i=1
Y 1 xi ti
.
ti ! i
i1
t1 ,t2 ,...0
P
i1 iti =n
t1 ,t2 ,...0
P
i1 iti =n
9.2
The generating function for the cycle indices Zn of the symmetric groups Sn ,
n 0, is
X
G(z; x1 , x2 , . . .) =
Zn (x1 , x2 , . . .)z n .
n0
Simplifying to obtain
G(z; x1 , x2 , . . .) =
X
n0
t1 ,t2 ,...0
P
i1 iti =n
Y 1 xi ti
zn
t
!
i
i
i1
n0
t1 ,t2 ,...0
P
i1 iti =n
X Y
t1 ,t2 ,...0 i1
i1
1
ti !
z i xi
i
t i !
t !
z i xi i
i
ti !
X 1 z i xi
=
t!
i
i1
ti 0 i
i
Y
z xi
=
exp
i
i1
!
X z i xi
= exp
.
i
i1
Y
1
ti !
Notice that this is also an exponential generating function for the number of
permutations on [n] with cycle classes (t1 , t2 , . . .). The term exponential
comes from the factor 1/n! hidden in Zn .
9.3
Examples
X x
n0
(z)n .
Now the number of permutations on [n] with k cycles is n! times the coefficient
of xk z n in G and is therefore
n! [xk z n ]G(z; x, x, . . .) = [xk ](x)n (1)n
= [xk ](x)n
n
=
,
k
where nk is an unsigned Stirling number of the 1st kind. We have seen this
before.
Example 9.2. Find an expression for the # permutations on [n] with k
cycles of length . Cycles of other lengths are allowed.
Solution. The answer is
n! [xk z n ] G(z; 1, . . . , 1, x , 1, 1, . . .)
!
X z i x z z
= n! [xk z n ] exp
+
i1
Note that when k = 0 and = 1, the above formula gives the number
of derangements as discussed before. Also, as n , the proportion of
Example 9.3. A cycle is even (resp. odd) if it have an even (resp. odd)
number of vertices. Find fn,k which is the number of permutations on [n]
with exactly k even cycles and no odd cycles.
Solution. Take G(z; x1 , x2 , . . .) and set x1 = x3 = = 0, x2 = x4 = = x
to get
!
X xz 2
G(z; 0, x, 0, x, . . .) = exp
2
1
!
x X (z 2 )
= exp
2 1
= (1 z 2 )x/2 .
(2m)! k
[x ](x/2)m (1)m
m!
(2m)! k
=
[x ](x/2)m
m!
(2m)! m
.
=
2k m! k
f2m,k =
Can you find a combinatorial argument to get this formula? Also, one might
want to verify that the formula works at least for f4,1 = 6 and f4,2 = 3.
Example 9.4. Let us consider the number gn of permutations on [n] without
odd cycles. This number equals
!
X z 2
n
n
n! [z ]G(z; 0, 1, 0, 1, . . .) = n![z ] exp
2
1
= n1/2 .
Example 9.5. How about the number of permutations on [n] with k odd
cycles and no even cycles? The number equals n! times
!
X xz 21
n k
n k
.
[z x ]G(z; x, 0, x, 0, . . .) = [z x ] exp
2 1
1
But
exp
X xz 21
1
2 1
= exp
X xz
1
X xz 2
1
= (1 z)x (1 z 2 )x/2
x/2
1+z
.
=
1z
Note that
(1 z)x (1 z 2 )x/2 =
X (x)j
j0
j!
(z)j
X (x/2)
0
(z 2 ) .
X (x/2) (x)n2
(1)n
!(n 2)!
=0
n/2
X (x/2) (x)n2
=
(1) .
!(n
2)!
=0
Also,
[x
](x/2) (x)n2
k
X
n 2
(1/2)kj (1)k+j .
=
k
j
j
j=0
Thus, the number of permutations on [n] with k odd cycles and no even
cycles is
n/2
k
X X
n!(1)kj
n 2
.
kj !(n 2)!
2
j
k
j
=0 j=0
I do not know if this formula can be simplified. One can however put this
formula into Maple to verify it for small cases of n and k.
Example 9.6. How about the number permutations on [n] with no even
cycles. Well, one can take the formula in the previous example and sum over
k but this is too cumbersome. Instead, we observe that the answer equals n!
times
n/2
X
j 1/2
n
1
2 1/2
(1)
,
[z ](1 z) (1 z ) =
j
j=0
which after simplifying (see Theorem 12.4 later) equals
2m 1
m 1/2
=
(1)
,
where m = n/2.
m 4m
m
That is, the answer is
n! 2m
,
4m m
where m = n/2.
9.4
Sn
where
sgn() =
sgn()
n
Y
Mi,i ,
i=1
1,
is even,
1, is odd.
i = j ,
j = j ,
k = k , k 6= i, j.
1
2
i1
1
(1 z)
i1
+ (1 + z) .
1
n!,
2
1,
n 2,
n = 0, 1.
Can you find the number of even permutations on [n] with k cycles?
Chapter 10
Permutation Runs and
Inversions
A permutation (in linear notation) can be divided into segments where each
segment is a maximal increasing sequence called runs. For example, the
permutation 2, 5, 9, 3, 8, 7, 1, 4, 6 contains 4 runs:
2, 5, 9; 3, 8; 7; 1, 4, 6.
Let nk be the number of permutations on [n] with k runs. These numbers are
called Eulerian numbers. This is not to be confused with the Euler constant
= .5772156649 or the Euler numbers.
10.1
A Recurrence for
n
k
Recall that to generate all permutations on [n], we need only take each
permutation on [n 1] and insert n into one of the n possible slots:
|{z} 1 |{z} 2 |{z} |{z} n1 |{z} .
Observe that (1) if n is inserted at the end of one of the runs in , then the
number of runs remains unchanged, and that (2) if n is inserted in any other
positions, then the number of runs is increased by 1.
75
76
one
n1
(n k + 1) permutations on [n] with k runs.
k1
We therefore obtain the recurrence:
n
n1
n1
= (n k + 1)
+k
, n, k 1.
k
k1
k
We next need to consider boundary conditions. In order for the above to
work for n = 1 or k = 1, we need
n
0
= n,0 ,
= 0,k ,
n, k 0.
0
k
Let
G(t, z) =
X X n z k tn
n0 k0
n!
1z
,
1 z exp(t(1 z))
X
k
n
j n+1
(k j)n ,
=
(1)
j
k
j=0
n, k 0,
10.2
77
Consider a random permutation on [n]. Let wk,p be the probability that the
first k runs have a total length at least p. Then
wk,p = P r(1 , 2 , . . . , p has at most k runs)
k
X
=
P r(1 , 2 , . . . , p has j runs)
j=1
k
X
1 p
=
,
p! j
j=1
1 p n,
1 k.
Pk
1 p
j=0 p! j
0,
, 0 p n,
p > n.
Let i be the average length of the i-th run. If we use a standard result in
elementary probability theory, the expected total length of the first k runs
equals
1 + 2 + + k
X
=
P r(the first k runs have a total length at leaset p)
p1
wk,p .
p1
78
Then
1 + 2 + + k
X
=
p P r(The first k runs have a total length equal to p)
p1
X
p1
X
p1
p(wk,p wk,p+1 )
p wk,p
X
p2
(p 1)wk,p
wk,p .
p1
Therefore,
k =
X
p1
X
p1
But wk,p =
that
and hence
Pk
wk,p
wk1,p
p1
(wk,p wk1,p ).
1 p
j=1 p! j
n
X
1 p
k =
(wk,p wk1,p ) =
,
p!
k
p=1
p1
X
k 1.
k 0.
We obtain a formula for k from an earlier formula on kp . Or we can go
through the generating function as follows. Recall that
X X n z k tn
1z
G(t, z) =
=
.
k n!
1 z exp(t(1 z))
n0 k0
79
t)(1
ze
p=0
n0 k0
Thus, the average length of the k-th run in a random permutation on [n]
equals
1z
(1 t)(1 zet(1z) )
1 z X j jt(1z)
= [z k tn ]
z e
1 t j0
[z k tn ]
= [z k tn ]
1 z X j X j i ti (1 z)i
z
1 t j0 i0
i!
= [z ](1 z)
=
k
X
[z kj ]
j=0
n
XX
z j (1 z)i
n
X
j i (1 z)i+1
i!
i=0
k X
n
X
(1)kj j i
j=0 i=0
i!
j0 i=0
i!
i+1
kj
Example 10.1. We can verify the above formula for n = 3. Using Maple,
> kthRun := proc(k,n)
>
add(add(j^i * binomial(i+1,k-j) * (-1)^(k-j) /i!,
>
i=0..n), j=0..k);
> end:
> n := 3:
> for k from 1 to 3 do
>
printf("For n=%a, average length of %a-th run is %a.\n",
>
n,k,kthRun(k,n));
> end;
For n=3, average length of 1-th run is 5/3.
For n=3, average length of 2-th run is 7/6.
For n=3, average length of 3-th run is 1/6.
80
permutation
1, 2, 3
1, 3; 2
2, 3; 1
2; 1, 3
3; 1, 2
3; 2; 1
1st run
3
2
2
1
1
1
length of
2nd run 3rd run
0
0
1
0
1
0
2
0
2
0
1
1
Thus, we have from the table that the average length of the 1st run is 10/6, of
2nd run is 7/6 and of 3rd run is 1/6. These figures agree with those obtained
from the formula.
Let k be a fixed nonnegative integer and let Lk be the limit of k as
n . That is, Lk is the average length of the k-th run (when n )
and Lk equals
i+1
k X
X
(1)kj j i kj
i!
j=0 i=0
k
X
(1)
j=0
kj
X
ji
i=0
i+1
kj
i!
!
X z i (i + 1)m
i! m!
im1
d X z i+1 (i)m1
dz im1 m!
i!
z im+1 z m
d X
dz im1 (i m + 1)! m!
d zm z
e
dz m!
1
(m + z)z m1 ez .
=
m!
=
81
Also, it can be checked easily that the above formula works for m = 0, and
for all z. (When z = 0 and m = 0, take the limit z 0.) Thus, with z = j
and m = k j, we have
i+1
X j i kj
1
=
kj kj1 ej .
i!
(k j)!
i0
Therefore, the length of the first k-th run, as n , equals
k
X
(1)kj
j=0
(k j)!
kj kj1 ej .
Note that
L1 = e 1
L2 = e2 2e
L3 = e3 3e2 + 32 e
1.718,
1.952,
1.996.
Consult Knuth, The Art of Computer Programming, Vol 3, for more information.
10.3
Inversions
82
We may assume without loss of generality that A[i] = i and is a permutation on [n]. Consider the number of swaps executed by BUBBLESORT.
Note that each swap corrects one inversion in and hence
Xn () = # swaps executed by BUBBLESORT.
Best Case: This happens when is the identity, and hence
Xn () = 0,
P r(Xn = 0) =
1
.
n!
Worst Case: This occurs when 1 > 2 > > n , that is, when i =
n i + 1. Hence
Xn () = 21 n(n + 1),
1
.
n!
Mn,k z k ,
n 1.
We shall find a recurrence for Gn (z). Recall that a permutation on [n] can
be obtained from a permutation on [n 1] by inserting n into any of the
n possible positions:
|{z} 1 |{z} 2 |{z} n1 |{z},
n1
n2
where the number of inversions created by the insertion is given below the
corresponding underbraces. Every permutation on [n] appears once in this
construction if we take all permutations on [n 1] and insert n into every n
possible slots.
Thus, we have
Gn (z) = (z 0 + z 1 + + z n1 )Gn1 (z) =
Also, when n = 1, we have
M1,k = k,0 ,
1 zn
Gn1 (z),
1z
n 2.
83
z k P r(Xn = k) =
k0
Thus,
X
k0
Fn (z) =
and
zk
Mn,k
1
= Gn (z).
n!
n!
1 1 zn
Fn1 (z), n 2,
n 1z
F1 (z) = G1 (z) = 1.
Let
n = E(Xn ) = Fn (1).
Then
n
1
=
n
n1
X
j=0
z=1
1 1
n(n
1)
+
n
=
n1
n 2
= 21 (n 1) + n1 ,
n 2.
Thus,
n =
since 1 = 0.
1
2
n
X
1
(i 1) + 1 = n(n 1),
4
i=2
i<j
84
Also,
Fn (z) =
+ Fn (1) Fn (1)2
1
2
n1
(1 + z + z + + z ) Fn1 (z).
n
We shall first show this general result (which is standard in probability theory). let
A(z) = B(z)C(z)
where B(1) = C(1) = 1. Then
A (1) = (B (z)C(z) + B(z)C (z))z=1 = B (1) + C (1),
and
A (1) = (B (z)C(z) + 2B (z)C (z) + B(z)C (z))z=1
= B (1) + 2B (1)C (1) + C (1).
Using the above equations, we find that
A (1) + A (1) A (1)2 = (B (1) + B (1) B (1)2 ) + (C (1) + C (1) C (1))2 .
Now, taking B(z) = n1 (1 + z + z 2 + + z n1 ) and C(z) = Fn1 (z), we see
that
2
n2 = (B (1) + B (1) B (1)2 ) + n1
.
85
Here,
n1
1 X j1
B (z) =
jz ,
n j=0
and
B (1) = 21 (n 1),
n1
1X
B (z) =
j(j 1)z j2 ,
n j=0
giving
n1
1
1X
j(j 1) = (n 1)(2n 1) 12 (n 1).
B (1) =
n j=1
6
Thus,
1
1
B (1) + B (1) B (1)2 = (n 1)(2n 1) (n 1)2 /4 = (n2 1).
6
12
Thus,
n2
X 1
1
2
(i2 1) + 12 .
=
= (n2 1) + n1
12
12
i=2
Now 1 = 0 and so
1 1
1
2
n =
(n)(n + 1)(2n + 1) n = n(n 1)(2n + 5).
12 6
72
Note: BUBBLESORT is not a very efficient sorting algorithm. MERGESORT and HEAPSORT, for example, are more efficient. The average case
analysis of HEAPSORT was not resolved until a few years ago.
Chapter 11
Extension to Complex
Numbers
11.1
Y
1
z
= ze
((1 + z/n) exp(z/n)) ,
(z)
n=1
z C,
86
Re(z) > 0,
11.2
X
n=1
and hence
|an | <
an is convergent.
n=1
n=1
11.3
exp(an ) is convergent.
n=1
Theorem 11.1.
1
(z)
= 0 iff z = 0, 1, 2, . . ..
Thus,
1
(z)
Y
1
= zez
((1 + z/n) exp(z/n)) ,
(z)
n=1
= 0 iff
z = 0,
That is,
z C.
1
(z)
or
= 0 iff
z = 0,
or
z = 1, 2, . . . .
87
1
= 0 for z = 0, 1, 2, . . . .
(z)
z! = (z + 1),
That is,
n! is undefined for n = 1, 2, . . ..
Theorem 11.2.
(a)
lim
zn
1
= 0,
z!
n = 1, 2, . . . .
(b)
0! = 1
and
z! = z(z 1)!,
(c)
(z)!(z 1)! =
z 6= 0, 1, 2, . . . .
,
sin(z)
(d)
( 12 )! =
z 6 Z.
88
89
Y
1
= e
((1 + 1/n) exp(1/n))
(1)
n=1
= e lim
m
Y
i=1
= e lim (m + 1) exp
m
m
X
1/n
n=1
!
m
X
m
+
1
exp ln(m)
1/n
= e lim
m
m
n=1
!!
m
X
m
+
1
exp lim ln(m)
= e lim
1/n
m
m
m
n=1
= e e
= 1
m
Y
n=1
m
Y
= exp(z) lim
lim
= exp(z)
n=1
1
.
=
z(z)
m+1
Y
n=1
n+1
n
z
1+
n+1
z+1
exp
n
n=1
exp
z
m+1
m
X
1
exp
+ log(m + 1) +
n
n=1
!!
90
m
Y
1
1
e lim
m
z(1 z)
(1 + z/n)(1 + (1 z)/n) exp(1/n)
n=1
m
Y
1
n2 exp(1/n)
=
e
lim
m
z(1 z)
(n + z)(n + 1 z)
n=1
!
m
Y
1
n2 exp(1/n)
m + 1 z n=1 (n + z)(n z)
!
! m
m
X
Y
1
1
.
exp
1/n
m
1 z 2 /n2
n=1
n=1
1
=
e
lim
m
z
=
1
e
lim
m
z
But
sin(z) = z
(1 z 2 /n2 ),
n=1
and
lim
Hence,
m
X
1
1/n
exp
m
n=1
!!
= e .
,
z 6= 0, 1, 2, . . . .
sin(z)
4
2
4
0
2
4
6
8
10
2
z
91
11.4
n = 0, 1, 2, . . . ,
z!
,
zr (z n)!
r R.
r, n C.
(r)n = lim
1
,
(r + 1)(r + 2) (r + m)
r C,
r 6= 1, 2, . . . , m.
Proof. (a) This part shows that our definition corresponds to our old definition. For n = 0, 1, . . .,
z!
= lim z(z 1) (z n + 1) = r(r 1) (r n + 1).
zr
zr (z n)!
(r)n = lim
(r)n = lim
1
(z + m)(z + m 1) (z + 1)
1
=
.
(r + 1)(r + 2) (r + m)
= lim
zr
(r)(r 1) (r n + 1)
(1)n (r)(r + 1) (r + n 1)
(1)n (r)n
(1)n (r + n 1)n .
11.5
92
n = 0, 1, 2, . . . ,
r R,
n = 1, 2, . . . .
r
(z)w
= lim lim
,
zr wn w!
n
r, n C.
Notice that the order of the limits is important. Also, we usually consider
only the case when n Z.
Theorem 11.4. For r C and n Z,
(r)n
r
, n = 0, 1, 2, . . . ,
n!
=
0,
n = 1, 2, . . . .
n
Proof. This theorem shows that our new definition of the binomial coefficient
is consistent with our earlier one. Notice that
z!
r
= lim lim
.
zr wn (z w)!w!
n
Since y! is defined for all y 6= 1, 2, . . ., we see that there is a neighborhood
N (not including r since we are taking limits) of r such that
1
1
=
,
wn (z w)!
(z n)!
lim
z N.
93
z!
r
= lim
0 = 0.
zr (z n)!
n
X
(r)n n X r n
r
(1 + z) =
z ,
|z| < 1, r R.
z =
n
n!
n=0
n
11.6
r
k
r+k1
(1)k .
k
94
Proof.
(a) If k is a negative integer, we have from an earlier theorem that
n
= 0. So assume that k is a nonnegative integer. If k > n 0 then
k
(n)k
n
=
= 0.
k
k!
If n k 0 then
(n)k
n
n!
n
=
=
=
.
k
k!
(n k)!k!
nk
(b) Follows from (a) immediately. Notice that the formula does not hold
when n is a negative integer. For example, when n = 4 and k = 2, we have
(4)2
n
=
= (4)(5)/2 = 10,
k
2
but
n
4
n
.
= 0 6=
=
k
6
nk
(c) We know that the identity holds for integers
r, k 1 because of a combinatorial argument using the definition that nk is the number of k-subsets of
[n]. Also, the identity works when k = 0 (since both sides equal 1). Hence
the identity works for all integer r 1 and all integer k 0. Now for each
integer k 0, both sides are polynomials of degree at most k in r and they
agree on more than k points (r = 1, 2, . . .). Thus, the identity is true for
all r C and all integer k 0. Finally, the identity holds for all negative
integer k and all r C because both sides are 0.
(d) For k = 0, 1, 2, . . .,
(r)k
r
=
k
k!
(r)(r 1) (r k + 1)
=
k!
(r)(r + 1) (r + k 1)
(1)k
=
k!
(r + k 1)k
=
(1)k
k!
r+k1
(1)k .
=
k
Chapter 12
Binomial Identities
We shall be interested in identities involving the binomial coefficient xk
where k is usually an integer, but x is a real number (or complex number,
using the extension by the polynomial argument). The identities are not to
memorize; they are here for reference and as examples.
12.1
Basic Identities
(c)
k 6= 0.
x
x1
k
=x
.
k
k1
x
x1
x
(x k)
=x
= (k + 1)
.
k
k
k+1
Proof. We shall show (a) only. The other two identities can be proved simi-
95
96
This shows that the identity holds for all integers x k 1. Now both sides
of the identity are polynomials in x of degree at most k and they agree on
more than k values of x. Thus, the identity holds for all x C and integer
k 1. Finally, when k = 1, 2, . . ., both sides are 0. Thus, the formula
works for all x C and all integers k 6= 0.
Theorem 12.2. For integers m, b, a with b a and x C,
b
X
x+a
x+b+1
x+k
.
=
m+1
m+1
m
k=a
Proof. Recall that
r
r1
r1
=
+
,
k
k
k1
k Z,
r C.
Thus,
b
X
x+k+1
b
X
x+k
k=a
x+k
=
m+1
m+1
k=a
x+a+1
x+b+1
.
=
m+1
m+1
n
X
x+k
k=0
integers n 0 and m 6= 1.
x+n+1
,
n
n Z.
97
Proof. (a) Take the identity in the previous theorem and set x = a = 0,
b = n. Then it becomes
n
X
k
n+1
0
=
.
m
m+1
m+1
k=0
0
= 0 and so (a) follows.
When m 6= 1, we have m+1
(b) Consider first the special case where x is a nonnegative integer m. Take
the identity in the previous theorem and set x = m, a = 0, b = n. Then it
becomes
n
X
m+k
m+n+1
m
m+n+1
=
=
.
m
m
+
1
m
+
1
m
+
1
k=0
Now for integers m, k, n 0, we have
n+m+1
n+m+1
m+k
m+k
=
,
=
n
m+1
k
m
Thus, we have for integers n, m 0,
n
X
m+k
k=0
m+n+1
.
n
Now both sides are polynomials in m with degrees at most n and they are
equal for more than n values of m. This shows that we can replace m with
x C, giving that for integer n 0 and x C,
n
X
x+k
k=0
x+n+1
.
n
The identity now follows by observing that both sides are 0 when n is a
negative integer.
Theorem 12.4.
n
X
x
n x1
(1)
= (1)
,
k
n
k=0
k
n Z.
98
Proof. We give two proofs here. We can take the identity in (b) in the
previous theorem and replace x with x 1 throughout to get
n
X
x 1 + k
x + n
=
,
n Z.
k
n
k=0
We next negate the upper entry:
x 1 + k
k x
,
= (1)
k
k
to get
n
X
x
k=0
x + n
n
x1
,
n
= (1)
x1
,
n
n Z.
r
km k
? Following the above argument
X r
km
m
X
[z k ](1 + z)r
k=0
m
which does not look promising! Note that sums often do not have closed
forms.
99
Proof. If m < 0 then both sides are 0 because the binomial coefficients
are 0. So assume m 0. Suppose for now that r is an integer satisfying
m r 0. Then
LHS =
m+r
X
k=0
m + r k mk
x y
= (x + y)m+r y r ,
k
and
RHS =
r
X
r
k=0
(x)k (x + y)mk
x
1
= (x + y)
x+y
m+r r
= (x + y)
y
= LHS.
m
r
12.2
Vandermondes Convolution
m
+
n
k
(c) For integer 0 and integers m, n,
X s + k
k
+m s m
.
(1) = (1)
(12.3)
n
m+k
n
k
(d) For integer m 0 and integers , n,
X k s
k
+m s m 1
.
(1) = (1)
(12.4)
n
k
n
m
k
(e) For integers , m 0 and integers n q 0,
X
+q+1
q+k
k
.
=
(12.5)
m
+
n
+
1
n
m
k=0
Proof. (a) For integers m, n,
X r s
X
=
[z m+k ](1 + z)r [z nk ](1 + z)s
m
+
k
n
k
k
k
= [z m+n ](1 + z)r (1 + z)s
r+s
.
=
m+n
s
=
mk
n+k
m+k
n+k
k
k
+s
=
,
m+n
where the last equality follows from (a).
(c) Observe that for integer 0 and integer m,
X
(1)m+k (1 z)m+k .
z = (1 (1 z)) =
m
+
k
k
100
101
sm
(1)m+k (1 z)s+k ,
z (1 z)
=
m
+
k
k
giving that for integer 0 and integers m, n,
X
m+k+n s + k
n
sm
(1)
.
[z ]z (1 z)
=
m
+
k
n
k
Therefore, for integer 0 and integers m, n,
X s + k
(1)k = [z n ](1)m+n z (1 z)sm
n
m+k
k
= [z n ](1)m+n (1 z)sm
m+n s m
.
= (1)
n
Now consider
k
m
r
k
integer n, k and n 0,
r+k1
,
k
k Z, r C.
n
m
k
k
m1
km
102
= 0 if k > . Thus,
X
X k s
m 1
s
k
m
(1) =
(1)
m
km kn
kn
k
k
X
m 1
s
m
=
(1)
km kn
k
m s m 1
,
= (1)
nm
which is the RHS of the given formula. Notice that induction can be used to
prove the formula, but it can be quite tedious. I shall include an induction
proof as an example. Let us prove the formula by induction on m.
Basis. When m = 0, using the formula
X r
k
r1
,
integer ,
(1) = (1)
k
k
we have
LHS =
=
=
=
X s
(1)k
kn
k
X s
(1)k+n
k
kn
n
n s 1
(1) (1)
n
RHS.
n
m
k
X k k 1 s
=
(1)k
kn
m +1
m
k
X k k1
s
(1)k .
=
+1
n
m
m
k1
Now using the induction hypothesis, we have
X n k 1 s
(1)k
m +1
m
kn
k1
s m 1
1+m n
= (1)
.
m + 1 1 m n
and the induction hypothesis, we have
Also, using k xk = x x1
k1
X n k k 1 s
(1)k
kn
m +1
m
k1
X s
s1
k1
=
(1)k
+1
k
1
m
m
k1
s
s m 2
1+m
=
.
(1)
m n 2
m + 1
m + 1 1 m n
m + 1
m n 1
s m 2
=
,
m n 1
103
104
1+m
s m 2
,
m n 1
n 1
m 1
=
(1)
km q+kn
k=0
X
n 1
m 1
m+qn
.
= (1)
km q+kn
k=0
Now, if m, 0 then
m 1
= 0,
km
and if n q 0 then
n 1
= 0,
q+kn
m+qn
105
= (1)
m+qn
= (1)m+qn
X
m 1
n 1
km q+kn
k=0
X m 1 n 1
km q+kn
m n 2
m+qn
k
= (1)m+qn
+q+1
=
m+qn
+q+1
=
,
m+n+1
since + q + 1 Z+ .
106
Chapter 13
More Binomial Identities
We have seen several methods in proving identities (without using the computer). We shall try to give a brief description of some common techniques.
13.1
Recall that
r
k
r+k1
(1)k ,
k
k Z, r C.
Notice that we have used this method in proving the identities (12.4) and
(12.5). We refer the reader to those proofs for examples.
13.2
Differences
Observe that if
then
g(x) = f (b + 1) f (a).
107
108
=
m+1
m+1
m+1
m
and the above is useful when the index of the summation is in the upper
entry:
b
X
a
b+1
x
.
=
m
+
1
m
+
1
m
x=a
We have in fact come across the above formula before.
Example 13.1. Get a closed form for
h
X
m
k
n ,
k
k=0
integers n m h 0.
Solution. First observe that some factors in the summand can be canceled:
m
m! (n k)!
nk
m!(n m)!
1
(n k)!
k
.
=
= n
n =
nm
n! (m k)!
n!
(n m)!(m k)!
k
m
h
1 X
nk+1
nk
n
nm+1
nm+1
m k=0
1
nh
n+1
.
n
nm+1
nm+1
m
If h = m, then we have
m
X
k=0
m
k
n
k
=
=
n+1
n
nm+1
m
n+1
.
nm+1
We shall come back to this when we talk about Gospers algorithm later.
109
13.3
=
,
k
k
k
k1
k Z.
m
mn
Thus, for integer m and integer n 0, we have
x
n x
=
m
mn
n
X n
x
nk k
(1) E
=
m
k
k=0
n
X
n
nk x + k
(13.1)
,
=
(1)
m
k
k=0
which is in fact equivalent to the convolution identity (12.3).
zr
(z + 1 m)! (z m)!
z!
= lim
((z + 1) (z + 1 m))
zr
(z + 1 m)!
= lim m(z)m1
zr
= m(r)m1 .
This shows that for m Z,
n (r)m = (m)(m 1) (m n + 1)(r)mn .
Now take r = x 1 and m = 1 and we have for integer n 0,
n (x 1)1 = (1)(2) (n)(x 1)1n = (1)n n!(x 1)n1 .
Recall that for integer k 1,
(r)k =
1
,
(r + 1)(r + 2) (r + k)
giving that
(x 1)1n =
and hence
n
(x 1)1
Thus,
1
,
(x)(x + 1)(x + 2) (x + n)
(1)n n!
.
=
(x)(x + 1)(x + 2) (x + n)
(1)n n!
= n (x 1)1
(x)(x + 1)(x + 2) (x + n)
n
X
n
(1)nk E k ((x 1)1 )
=
k
k=0
n
X
n
=
(1)nk (x 1 + k)1
k
k=0
n
X n
1
(1)nk
=
,
k
x
+
k
k=0
110
111
1
which is essentially a partial fraction of (x)(x+1)(x+2)(x+n)
. Notice that it is
1
actually very easy to obtain a partial fraction of (x)(x+1)(x+2)(x+n) . Suppose
that
n
X
Ai
1
=
.
(x)(x + 1)(x + 2) (x + n)
n+i
i=0
giving that
(1)i
(1)i n
.
Ai =
=
i
(n i)!i!
n!
=
k
n
k
nm
k
k
m
X n X
x+k1
m
mj j
(1)
E
=
n
j
k
j=0
k
m
X n X
m
mj x + k 1 + j
(1)
=
k
j
n
j=0
k
m
X
m
(1)mj (x + j)n
=
j
j=0
m
X
m
=
(1)j (x + m j)n .
j
j=0
If x = 0 then
X n k 1
k
nm
m
X
m
j=0
n
.
(1) (m j) = m!
m
j
j
112
13.4
Inversion
Proof.
X
an,k gk =
an,k
X X
j
bk,j fj
an,k bk,j
fj
n,j fj
= fn .
n n
n n
is an inversion
, (1)
From Assignment 3, Q3, we see that (1)
m
m
n n
n n
pair. Similarly, one can show that (1) m , (1) m is an inversion pair
also.
Also from (13.1), we have for integer n 0 that
X
n
n
x
nk x + k
(1)
.
=
k
m
mn
k=0
m
m
k
k=0
n
and itself is an inversion pair. That is,
Thus, we see that (1)n m
X n
X n
n
n
gk .
fk
iff
fn = (1)
gn = (1)
k
k
k
k
113
n
m
X mn
j!
(1) n = (1)
.
j
j
j
n m
Hence, by taking
m
,
fj = j!
j
n m
gn = (1) n ,
we have
gn = (1)
X n
j
fj ,
X
n
n
m
(1)nk k m .
n!
=
k
n
k=0
n
X
n
j=0
Dnj =
n
X
n
j=0
Dj .
114
13.5
Generating Functions
We have seen how identities are proved using generating functions. Here are
two examples:
Example 13.7 (Generalized Fibonacci numbers again). Let m be an integer
and m 0. Consider
m
X
mk k
Im =
x .
k
k=0
Then since
mk
m1k
m1k
=
+
,
k
k
k1
we have for m 1 that
m
X
mk k
x
Im =
k
k=0
m1
X m k
xk
=
k
k=0
m1
X m 1 k m 1 k
+
xk
=
k
k
1
k=0
m1
X m 2 (k 1)
= Im1 + x
xk1
k
1
k=1
= Im1 + xIm2 .
Notice that
I0 = 1,
and
1 0
0
I1 =
x +
x = 1.
0
1
115
m+1
m+1 !
1
1 + 1 + 4x
1 1 + 4x
Im =
.
2
2
1 + 4x
In particular, for x = 1, we have
1 + 3
= e 3 i,
2
= e 3 i .
Thus, for x = 1,
Im =
m
X
mk
k=0
(1)k
k
(m+1)
(m+1)
e 3 i e 3 i
1
=
3i
2
= sin((m + 1)/3)
3
m 0, 1 (mod 6)
1,
0,
m 2, 5 (mod 6)
=
1, m 3, 4 (mod 6).
n+k
m + 2k
n+k1
n+k1
=
+
,
m + 2k
m + 2k 1
116
we see that
Im,n = Im,n1 + Im1,n1 ,
integers m, n 1.
Chapter 14
A Generalized Urn Model
The purpose here is to introduce an example. The example consists of three
parts:
(1) Finding an optimal solution;
(2) Simplification of the solution;
(3) Asymptotics.
The example is a generalization of the model in a paper by Chen, Zame,
Odlyzko and Shepp, appeared in SIAM J. Discrete Math. 11, 185-195, 1998.
14.1
The Model
117
14.2
118
Realizations
In order to study this urn model, we shall need some enumeration techniques.
We start with the following basic observation. Given that the urn has m 1
balls and p +t balls, we define a realization as a sequence of m + p balls
drawn without replacement from the urn.
Lemma 14.1. Each realization is equally likely, and the probability that a
1
particular realization happens is m+p
.
(m)
Proof. This is actually quite obvious. In order to be rigorous, we shall give a
proof based on induction on the number m + p of balls. If there is one ball in
the urn, then
there is one realization and the probability of that happening
1
is 1 = 1/ 1 . Suppose next as induction hypothesis that the lemma holds for
less than m + p balls. Consider the situation when there are m + p balls with
m 1 balls and p +t balls, and let be a realization. If the realization
is such that the first ball drawn is a 1 ball, then using the induction
hypothesis,
m
1
1
P () =
m+p1 = m+p .
m + p m1
m
If on the other hand the realization is such that the first ball drawn is a +t
ball, then
p
1
1
P () =
m+p1 = m+p .
m+p
m
m
This completes the induction step and hence the lemma is proved.
14.3
119
B(m, p) =
G(m, p) =
Then
G(m, p) = max(A(m, p), B(m, p))
p
m
A(m, p) =
(t + G(m, p 1)) +
(1 + G(m, p))
m+p
m+p
p
m
B(m, p) =
G(m, p 1) +
G(m, p)
m+p
m+p
The last two equations show that
A(m, p) =
pt m
+ B(m, p).
m+p
Thus, an optimal strategy is to place a bet on the next ball if pt > m and
do not bet on the next ball if otherwise.
Let Xn be the value of the urn at stage n (after having chosen n balls).
Then
X0 = pt m,
Xm+p = 0.
Our optimal strategy is to bet on the next (n + 1-st) ball iff Xn > 0. Observe
that pt m is the expected gain if the strategy is to bet on all balls. Note
also that if Xi = x is known then one can calculate the current numbers a, b
of +t balls and 1 balls respectively. This is because
a + b = m + p i,
from which a and b can be found.
and
at b = x,
14.4
120
Proof. Since X0 0, the player under our optimal strategy will not place
bets until after the first time, say time n, when the value of the urn is at least
0. The player will then gain Gn until the next time X 0. The process is
then repeated until the urn is empty. Thus, if
1, if Xn = 0,
n =
0, if Xn 6= 0,
then the gain of the player (under the optimal strategy) is
X
Gn n ,
n6=m+p
n6=m+p
121
action
no bet
start betting
start betting
start betting
..
.
X
t
0
1
2
..
.
Gn
0
1
2
3
..
.
+1
start betting
(t 1)
Lemma 14.3.
P (Gn = | Xn = 0) =
1
,
t+1
= 0, 1, 2, . . . , t.
1
.
t+1
122
= 1, 2, . . . , t.
Now h exists because Xn+1 = t and that the Xs can only increase by 1.
Also, the ball drawn at stage h + 1 must be a 1 ball because if it were
a +t ball, then Xh+1 = 2t 1 and there would be a j > h such that
Xj = t 1. Now relocating the balls in stages j + 1, j + 2, . . . , m + p
to immediately after stage n gets back a realization with Xn = 0, Xn+1 =
1, Gn = .
Thus,
t
1 X t
= .
E(Gn | Xn = 0) =
t + 1 i=0
2
t X
P (Xn = 0).
2 n6=m+p
pk
m+p
p
kt+k
k
tX
G(m, p) =
2 k=1
m+pkkt
pk
m+p
p
123
k
p
k=0
t
t
G(m, p) = +
2 2
14.5
pk
m+p
p
= 1.
A Simplified G(m, p)
k
k
p
k
k=0
k=0
This shows that for m pt,
p
X
m+pk
(t + 1)
m+p
pk
p
k=0
p
t
t 1 X
nk m + k
.
= + m+p
(t + 1)
k
2 2 p k=0
t
t
G(m, p) = +
2 2
124
p
X
p + m + 1 pk
t .
m+p
k
p
k=0
1
i
X
ai ,
i = 0, 1, 2, . . . , n + nt,
X0 = 0,
j=1
n 1.
j = 0, 1, . . . , t.
125
that the kj s are well-defined. Note also that by maximality in the definition
of kj , we must have akj +1 = +1 and that Xh Xkj +1 for all h satisfying
kj + 1 h < nt + n. Now it is clear that the sequences
(a1 , a2 , . . . , ak0 ),
(ak0 +2 , . . . , ak1 ),
..
.
(aki1 +2 , . . . , aki ),
..
.
(akt1 +2 , . . . , akt )
are all (t, ni ) sequences for some ni 0, i = 1, 2, . . . , t. The total lengths of
these sequence is nt + n t 1 because one t and t +1s are dropped
from the original sequence. Furthermore, since only one t is dropped,
we must have n0 + n1 + nt = n 1. The lemma now follows because the
above process can be reversed to obtain a (t, n) sequence.
We next write for t 2 and n 0,
G(t)
n = gn (t 1).
Also,
G0 (t) = g0 (t 1) = 1.
126
i=1,2,...,t
ni 0
= z
t
Y
i=1
(t)
(t) n
G(t)
n 1 Gn 2 Gn t z
(t)
(t) n
G(t)
n 1 Gn 2 Gn t z
ni
G(t)
ni z
ni 0
t
= zBt (z) .
Therefore, we have for t 2,
X
z n dn1
(f (y)(y)n )
n1
n!
dy
n=1
.
y=y0
X z n dn
f (y)
=
(f (y)(y)n )
1 z (y) n=0 n! dy n
To apply LIF to
Bt (z) = 1 + zBt (z)t ,
.
y=y0
127
(y) = y t ,
y0 = 1,
f (y) = y r ,
X
z n dn1
r1 nt
Bt (z) = f (1) +
ry
y
n! dy n1
n=1
r
Thus, for n 1,
r Z+ ,
.
y=1
r dn1 nt+r1
y
n! dy n1
y=1
r
(nt + r 1)n1
=
n!
r
nt + r
=
.
nt + r
n
[z n ]Bt (z)r =
Also, if we write
G
(t,r)
then
Bt (z)r
,
(z) =
1 ztBt (z)t1
Bt (z)r
1 ztBt (z)t1
f (y)r
=
1 z (y)
X
z n dn
=
(f (y)(y)n )
n
n!
dy
n=0
G(t,r) (z) =
n=0
y=1
z d nt+r
y
n! dy n
y=1
zn
(nt + r)n
n!
n=0
X
nt + r n
=
z .
n
n=0
Also,
G
(t,0)
X
ztBt (z)t1
1
nt n
=1+
=
z .
(z) =
t1
t
1 ztBt (z)
Bt (z) ztBt (z)
n
n=0
128
(t,r)
Bt (z)r
(z) =
1 ztBt (z)t1
Bt (z)r
,
(1 ztBt (z)t1 )2
ztBt (z)t1
1+
Bt (z) ztBt (z)t
[z ]H
(t,r)
(z) = t H
(t,r+n(t1))
(0) +
n1
X
i=0
Note that H (t,r+n(t1)) (0) = 1 from the definition of H (t,r) (z), and that since
G
(t,r)
(z) =
X
nt + r
n=0
zn,
we have
[z
ni
]G
(t,r+i(t1))
(z) =
r + i(t 1) + (n i)t
ni
r + nt i
.
ni
Hence
n
[z ]H
(t,r)
X
n1
n
X
r + nt i i
i r + nt i
(z) = t +
=
t
t.
ni
ni
i=0
i=0
n
X
nt + r n
z
n
n=0
X
nt
n=0
zn
129
[z ]H
(t,r)
(z) =
n
X
(n k)t + r kt
nk
k=0
i
k
n
k
i=0
k=0
Now the polynomial argument extends r, t to any numbers, and hence Theorem 14.1 is proved.
14.6
Asymptotics
p
X
m + p + 1 pk
t .
m+p
k
p
k=0
1
Proof. Let
tk =
Then
rk =
t+1
,
2( 1)
m
p
t as m , then
p .
m + p + 1 pk
t .
k
m+p+1k1
tk+1
.
=
tk
k+1
t
Since k p, we have
m+1
m
rk
=
t(p + 1)
pt
1+
1+
1
m
1
pt
130
p1/2
m
p1/2 1
p
1+
1
This shows that for k satisfying p p1/2 k p, there are functions f1 (p)
and f2 (p) which do not depend on k and which tend to 0 as p such
that
(1 + f1 (p)) rk (1 + f2 (p)).
For p p1/2 k p, we write
rk = (1 + o(1))
to denote the fact that rk can be bounded above and below by functions,
independent of k, that tend to 0 as p . Hence we have as p that
X m + p + 1
tpk
k
pp1/2 kp
X
= tp
((1 + o(1))k
0kp1/2
1/2
1 ((1 + o(1))p
1 ((1 + o(1))1
1
= tp
(1 + o(1))
1 1
(1 + o(1)).
= tp
1
tp
m+p+1p
> 1,
(p + 1)t
1/2
131
giving that as p ,
X m + p + 1
1/2
tpk ptp ((1 + o(1)))p = tp o(1) = o(tp ).
k
1/2
0kpp
Thus,
p
X
m+p+1
k=0
(1 + o(1))
1
m+p+1
(1 + o(1)).
=
1
p
tpk = tp
m
pt
1
m+p
p
> 0 as p , we have
p
X
m+p+1
tpk
k
k=0
t
t 1
m+p+1
= + m+p
(1 + o(1))
2 2 p
1
p
t
tm+p+1
(1 + o(1))
= +
2 2 m+1 1
t 1 t + 1
= +
(1 + o(1))
2 2 1
t+1
(1 + o(1)).
=
2( 1)
Chapter 15
Hypergeometric Series
15.1
Definition
P
Consider the series k0 tk where tk can depend on some other parameters
(and such parameters are regarded as constants). If
tk+1
= x,
tk
then
then
P
P
k0 tk
is a geometric series. If
P (k)
tk+1
,
=
tk
Q(k)
k0 tk
is a hypergeometric series.
k
k
k
k
Then
Since
tk+1
tk
tk+1
nkn+ak nk
.
=
tk
k+1 k+1 k+1a
133
(15.1)
,
sin(z)
giving that
(2z 1)! sin(2z)
(2z)!
(z)!
=
=
cos(z).
(2z)!
(z 1)! sin(z)
z!
15.2
(z)!
(2n)!
=
(1)n .
zn (2z)!
n!
lim
P
Consider the hypergeometric series k0 tk . We shall assume that t0 = 1.
If not, then we can shift k so that t0 6= 0 and then divide every term by t0 .
Then rewrite the ratio of successive terms as
tk+1
P (k)
(k + a1 )(k + a2 ) (k + ap ) 1
=
=
x.
tk
Q(k)
(k + b1 )(k + b2 ) (k + bq ) k + 1
The series is now identified as the hypergeometric function
a1 , . . . , ap
;x
p Fq
b1 , . . . , bq
Note that if we write (a)m = (a)(a + 1) (a + m 1) as the rising factorial,
then
X
(a1 )k (a2 )k (ap )k 1 k
a1 , . . . , ap
x .
;x =
p Fq
b1 , . . . , bq
(b1 ) (b2 ) (bq ) k!
k0
134
nk
(1)k
We next look up known formulas (see for example A=B) for hypergeometric
functions, and find that
(a b)!(a c)!( a2 )!( a2 b c)!
a,
b,
c
.
F
;
1
=
3 2
1 + a b, 1 + a c
a!( a2 b)!( a2 c)!(a b c)!
Here, we replace the constants a, b, c in the formula with a n, a n, n
respectively and find that
(a)!( an
)!( a+3n
)!
n, a n, a n
2
2
.
;1 =
3 F2
na
a+n
1,
1a
(a n)!( 2 )!( 2 )!n!
135
Notice that if the denominator and numerator are both zero, then we should
(7!)
take limits. For example, when n = 10, a = 4, we have (14)!
, and so we
consider the limit (and using (15.2))
(z)!
14!
= ,
z7 (2z)!
7!
lim
k
k
n
k
k
k=4
k0
(6!)(14!)(1)(17!)
(7!)(7!)(3!)(10!)2
= 11124256.
=
na
)(1
2
n a)
One can check that this is equivalent to our answer by using the identity
(15.1).
Example 15.3. Let us try this one:
X
n+k
k k+a
4k ,
(1)
a
2k
+
2a
k
n, a Z,
n 0.
136
The terms are 0 if k is a negative integer. Also, if 2a > n then each term is
0. So assume n 2a throughout. Here
n
.
t0 =
2a
Also,
tk+1
(n + k + 1)(n k 2a)
k+1+a
(4)
= (1)
tk
k+1
(2k + 2a + 2)(2k + 2a + 1)
(k + 1 + n)(k + 2a n)
.
=
(k + 12 + a)(k + 1)
The series is therefore
X
n
n+k
n + 1, 2a n
k
k k+a
4 =
(1)
;1
2 F1
1
+a
2a
2k
+
2a
a
2
k
We look up existing hypergeometric identities, and we find Gausss identity:
If b is a nonpositive integer or if c a b has positive real part, then
(c a b)(c)
a, b
.
;1 =
2 F1
c
(c a)(c b)
Here we take
a = 1 + n,
b = 2a n,
c=
1
2
+a
and we get
c a b = 12 a,
c a = a 21 n,
cb=
1
2
a + n,
giving that
( 21 a)( 12 + a)
(c a b)(c)
.
=
(c a)(c b)
(a 12 n)( 21 a + n)
We next want to simplify the above expression. Recall that from (15.1)
(1 z)(z) =
.
sin(z)
137
.
z sin(z)
Taking z = a + 12 , we get
( 21 a)( 21 + a) =
( 12
.
+ a) sin(( 21 + a))
Taking z = a 12 n, we get
(a n) sin((a 21 n))
=
1
(a 2 n) sin((a + 21 )) cos((n + 1))
n+1
.
=
1
1 (1)
(a 2 n) sin((a + 2 ))
(n + 21 a)(a 12 n) =
1
2
It follows that
( 21 a)( 21 + a)
n + 1, 2a n
;
1
=
F
2 1
1
+a
(a 12 n)( 21 a + n)
2
a 21 n
(1)n+1
a + 12
n 2a + 1
=
(1)n .
2a + 1
n
+
k
z
n
+
k
k0
Here
t0 =
2x
xn
2z
zn
138
t0 3 F2
2n,
x n, z n
;1 .
x n + 1, z n + 1
a = 2n,
a b = x n,
b = x n,
a c = z n,
a
2
a = 2n,
b = x,
a
2
a
2
c = z n,
= n,
c = z,
a
2
a
a
2
b c = x + z + n,
b c = x + z.
Notice that for example, if n is a positive integer, then (n)! and (2n)! are
both zero. In situations like this, we would consider the limit when z n.
Thus, using (15.2), we as z n, where n is a positive integer, that
X
2x
2z
k 2n
(1)
k
xn+k
zn+k
k0
=
(2x)!(2z)!(2n)!(x + z + n)!
(1)n .
(x + n)!(z + n)!n!x!z!(x + z)!
Chapter 16
Gospers Algorithm
P
The aim is to find a simple form for the sum S(m) = m
n=0 tn where r(n) =
tn+1 /tn is a rational function of n. That is, tn is a hypergeometric term in n
and does not depend on m.
16.1
A Brief Description
zn+1 zn = tn ,
zn
=
tn
1
,
1
zn+1
zn
140
The main step is to find functions a(n), b(n) and c(n) (with some required
properties to be stated later) so that
(16.3)
r(n) =
tn+1
a(n) c(n + 1)
,
=
tn
b(n) c(n)
c(n)y(n)
,
b(n 1)
or
y(n) =
b(n 1)x(n)
,
c(n)
16.2
zn = y(n)tn =
b(n 1)x(n)
tn .
c(n)
The Functions a, b, c
a(n) c(n + 1)
,
b(n) c(n)
where
(i) gcd(a(n), b(n + h)) = 1 for all integer h 0,
(ii) gcd(a(n), c(n)) = 1,
(iii) gcd(b(n), c(n + 1)) = 1
141
f (n)
,
g(n)
c1 (n) =
h
Y
u(ni) =
i=1
h1
Y
u(nh+i),
i=0
giving that
r(n) =
f (n)
f1 (n) u(n)u(n 1) u(n h + 1)
f1 (n) c1 (n + 1)
=
=
.
g(n)
g1 (n) u(n 1)n(n 2) u(n h)
g1 (n) c1 (n)
If gcd(f1 (n), g1 (n)) = 1 then we are done, else we can repeat the above
process for f1 (n) and g1 (n).
From our proof, we need to find h > 0 (if possible) and the correspond(n)
and gcd(f (n), g(n)) = 1.
ing function u. We can assume that r(n) = fg(n)
Furthermore, we assume that f and g are factored into products of monic
polynomials. Then if
u(n) = gcd(f (n), g(n + h)) 6= 1,
for some h 1,
then there are nontrivial factors df (n) and dg (n) of f (n) and g(n) such that
u(n) = df (n),
u(n) = dg (n + h).
This shows that the degrees of df (n) and dg (n) are equal, say d, and that if
df (n) = nd + And1 + . . . ,
dg (n) = nd + Bnd1 + ,
142
or
h=
AB
.
d
This observation restricts our search for h, and provides a criterion for deciding when such an integer h 1 is not available (whence the process stops).
Example 16.1. Consider
r(n) =
2(n2 + 4n + 5)(n + 3)
f (n)
= 2
.
g(n)
(n + 1)(n2 + 3)n(n + 21 )(n + 2)
We compare pairs of factors df (n), dg (n), with the same degree, of f (n), g(n).
(1) For the pair df (n) = n2 + 4n + 5 and dg (n) = n2 + 1 (where A = 4, B = 0)
and we have
h = (4 0)/2 = 2
a(n) c(n + 1)
,
b(n) c(n)
where
a(n) = 2,
143
The Function x
16.3
Theorem 16.2. Suppose that a(n) and b(n) are such that
gcd(a(n), b(n + h)) = 1,
f (n)
,
g(n)
Then we have
(16.5)
Assume for the purpose of contradiction that g(n) is a nonconstant polynomial. Then let N be the largest integer N 0 such that
u(n) | g(n) and u(n) | g(n + N ),
where u(n) is irreducible and is not a constant. Since g(n) is nonconstant,
the existence of such N 0 is guaranteed (as 0 is a possible value of N ).
Also, N < because g has finitely many irreducible factors. Now
=
=
144
Next, since u(n) | g(n), we have u(n + 1) | g(n + 1). But gcd(f (n + 1), g(n +
1)) = 1 and u is not a constant. This shows that u(n+1) f (n+1). Similarly,
since u(n) | g(n + N ), we have u(n N ) | g(n) and so u(n N ) f (n). It
therefore follows that
=
=
=
We shall use deg(P ) and lc(P) respectively for the degree and the leading
coefficient of a polynomial P . Assume that the degree of x is d and we write
x(n) =
d
X
Ai ni .
i=0
145
Case ONE: The leading coefficients of the terms on the LHS of (16.6) do not
cancel. That is, deg(a) 6= deg(b) or lc(a) 6= lc(b). Then we have
max(deg(a) + d, deg(b) + d) = deg(c),
giving that
d = deg(c) max(deg(a), deg(b)).
Case TWO: We have the complement of case ONE, that is, deg(a) = deg(b) =
and lc(a) = lc(b) = . Then either one of the following two subcases must
happen:
(i) The terms of the 2nd highest degree on the LHS of (16.6) do not cancel,
and this gives
deg(a) + d 1 = deg(c),
or
d = deg(c) deg(a) + 1.
(ii) The terms of the 2nd highest degree on the LHS of (16.6) cancel. Then
if
a(n)
b(n 1)
x(n)
x(n + 1)
=
=
=
=
n + An1 +
n + Bn1 +
Cd nd + Cd1 nd1 +
Cd nd + (dCd + Cd1 )nd1 + ,
where Cd 6= 0, then because the 2nd highest degree term on the RHS of
(16.6) cancel, we have
ACd + (dCd + Cd1 ) (BCd + Cd1 ) = 0,
or
d = (B A)/.
16.4
Examples
m
X
2n
n=0
zn.
146
4(n + 12 )
tn+1
(2n + 2)(2n + 1)
r(n) =
z.
=
z=
tn
(n + 1)2
n+1
Obviously,
r(n) =
a(n) c(n + 1)
,
b(n) c(n)
where
a(n) = 4z(n + 12 ),
If z 6=
1
4
b(n) = n + 1,
c(n) = 1.
K = 2.
b(n 1)x(n)
2n 1 n
( ) ,
zn =
tn = 2n
n 4
c(n)
2m + 2 1 m+1
2n 1 n
( )
( ) = zm+1 z0 = 2(m + 1)
.
m+1 4
n 4
(n 1)!2
.
(n z)!(n + z)!
147
n2
a(n) c(n + 1)
=
.
(n + 1 z)(n + 1 + z)
b(n) c(n)
b(n) = (n + 1 z)(n + 1 + z),
c(n) = 1.
00
= 0.
1
Thus, deg(x) = 0 is the only possibility. Suppose that x(n) = K, and we
have
n2 K (n2 z 2 )K = 1,
=
K = 1/z 2 .
deg(x) =
Hence
zn =
b(n 1)x(n)
(n 1)!2
n2 z 2
(n 1)!2
tn =
=
.
c(n)
z 2 (n z)!(n + z)!
z 2 (n 1 z)!(n 1 + z)!
The sum is
m
X
n=1
(n 1)!2
= zm+1 z1
(n z)!(n + z)!
=
m!2
1
2
.
2
z (m z)!(m + z)! z (z)!z!
(n 1)!2
m!2
1
= 2
2
(n z)!(n + z)!
z (m z)!(m + z)! z (z)!z!
!
m
2
Y
1
i
= 2
1
2
z (z)!z! i=1 i z 2
!
m
2
Y
i
sin(z)
1 ,
=
3
2
z
i z2
i=1
148
X
k=0
Here
tk =
and
m
k
n .
k
m
k
n ,
k
km
.
kn
Assume first that n m 6= 0, 1, 2, . . .. Then we can take
r(k) =
a(k) = k m,
b(k) = k n,
c(k) = 1,
1
,
n+1m
b(k 1)x(k)
kn1
zk =
tk =
c(k)
n+1m
Thus,
X
k=0
m
k
n
k
n
= z+1 z0 =
n+1m
m
+1
n
+1
m
k
n .
k
n+1
.
n+1m
mm
m
X
nn
nn + 1
+1
k
+
lim lim
.
n = nnn
nn
mmm nn + 1 mm
nn + 1 mm
+1
k=0 k
b(k) = 1,
c(k) = (k m 1)nm .
149
zr
1
(k
nm+1
m 1)nm+1 .
Thus,
1
b(k 1)x(k)
(k m 1)nm+1
tk =
zk =
c(k)
n m + 1 (k m 1)nm
and the rest proceeds as before.
Example 16.5. Consider
kn1
=
nm+1
m
k
n ,
k
m
X
n4 4 n
2n .
n=0
m
k
n
k
4(n + 1)4
(n + 1)2
r(n) =
n4
(2n + 2)(2n + 1)
5
2(n + 1)
=
n4 (2n + 1)
4
n+1
n+1
.
=
n
n + 12
Obviously,
a(n) = n + 1,
b(n) = n + 12 ,
c(n) = n4 .
150
21 1
deg(x) =
6 Z.
1
Thus, we have deg(x) = 4, which is a pain!!!
Nevertheless, we write
x(n) =
4
X
Ai ni ,
i=0
Ai (n + 1)
i+1
4
X
Ai n
i+1
1
2
4
X
Ai ni = 1.
i=0
i=0
2
.
11
40
.
231
151
52
.
693
A4 + A3 + A2 + A1 + A0 + 12 A0 = 0,
or
4
A0 = 32 (A4 + A3 + A2 + A1 ) = 231
.
Thus,
x(n) =
2 4
n
11
or
x(n) =
1
693
and
40 3
n
99
40 2
n
231
52
n
693
4
,
231
63n4 140n3 + 60n2 + 26n 6 ,
b(n 1)x(n)
tn
c(n)
(n 12 ) n4 4n
=
2n x(n)
n4
n
zn =
4n (2n 1)
x(n).
=
2 2n
n
m
X
n4 4 n
= zm+1 z0
2n
n=0
4(m+1) (2m + 1)
x(m + 1) + 12 A0
2m+2
2 m+1
4(m+1) (2m + 1)
x(m + 1)
2 2m+2
m+1
2
.
231
Chapter 17
Zeilbergers Algorithm
The aim is to find a closed form for
f (n) =
F (n, k).
n!(2n 2k)!
(1)k ,
k!(n k)!(n + a)!(n 2k a)!
17.1
153
P
The method aims to turn a sum f (n) = k F (n, k) into a recurrence relation
in f (n). Solving the recurrence will then give f (n).
The method searches for a (non-trivial) recurrence of the form
I X
J
X
i=0 j=0
aij F (n j, k i) = 0,
where aij does not depend on k (but may depend on n). It uses trial and error
for different values of I and J, starting with (I, J) = (1, 1) and increasing I
and/or J if necessary.
k
P
2 . We need to find a recurrence of
Example 17.1. Try the sum k n+k
k
the form
I X
J
X
aij F (n j, k i) = 0.
i=0 j=0
F (n 1, k)
F (n, k 1)
F (n 1, k 1)
+ a10
+ a11
= 0.
F (n, k)
F (n, k)
F (n, k)
n
2k
2nk
+ a10
+ a11
= 0,
n+k
n+k
(n + k)(n + k 1)
or
a00 (n + k 1)(n + k) + a01 n(n + k 1) + a10 (2k)(n + k 1) + 2a11 kn = 0.
We can compare the coefficients of k 0 , k, k 2 to find the aij s. Or we can
proceed as follows:
(1) for k = (n 1), we get a11 = 0,
(2) for k = 0, we get a00 + a10 = 0,
(3) for k = n, we get a01 + 2a10 = 0. We therefore see that
a11 = 0,
a10 = 12 a01 ,
a01 = a00 .
154
X k
k
giving that
2k =
2k = 2,
k0
X n + k
2k = 2n+1 .
f (n) =
k
k
How about the sum
f (n) =
n
X
n+k
k=0
2k ?
155
Since
2n n
F (n, n) =
2 ,
F (n, 0) = F (n 1, 0) = 1,
n
2n n
2n 1 n+1
2 = F (n, n),
2
=
F (n, n 1) =
n
n1
we find that (by coincidence)
f (n) = 2f (n 1) = 2n f (0).
This time
and so
0
X
k k
f (0) =
2 = 1,
k
k=0
n
X
n + k k
2 = 2n .
f (n) =
k
k=0
The next theorem shows the correctness of Sister Celines method.
Theorem 17.1. If F (n, k) is a proper hypergeometric term, then there exist
I, J 1 and polynomials aij = aij (n), not all 0, such that
I X
J
X
i=0 j=0
aij F (n j, k i) = 0.
Proof. We shall only say a few words about the proof. Notice that the recurrence in the theorem, after multiplying both sides by the common denominator and canceling all common factors, is a polynomial in k, with degree of
the form I + J + , where , , are constants depending on a, b, u, vs.
Equating coefficients of k i gives I + J + + 1 equations. However, there
are (I + 1)(J + 1) unknown in aij s. Now by choosing sufficiently large I and
J, we see that we have
# unknown > # equations.
This implies that non-trivial solutions to aij s exist.
17.2
156
Zeilbergers Algorithm
J
X
j=0
The LHS is a polynomial L of the shift operator (on n) together with the
function G is called a Zeilberger pair. If a Zeilberger
pair is found, then
P
summing over k results in a recurrence in f (n) = k F (n, k):
J
X
(17.2)
aj f (n + j) = 0.
j=0
aij F (n j, k i) = 0.
157
j=0
J
X
aj F (n + j, k),
zk = G(n, k).
j=0
n
k
,
z+k
k
integer n 0.
Try J = 0 (and please bear in mind that this is a simple example) and so
tk = a0 F (n, k),
and hence
r(k) =
tk+1
nk
kn
F (n, k + 1)
=
=
.
=
tk
F (n, k)
z+k+1
k+z+1
Thus, we take
a(k) = k n,
b(k) = k + z + 1,
p(k) = 1.
158
1
.
n+z
G(n, k) =
b(k 1)x(k)
k+z
tk =
F (n, k).
p(k)
n+z
That is,
F (n, k) = G(n, k + 1) G(n, k).
Summing over k from 0 to n gives
f (n) = G(n, n + 1) G(n, 0) =
z
.
n+z
It should be noted that most problems are more complicated than this example.
Chapter 18
Burnsides Lemma
A group G acts on a set X if for each g G, there is a permutation (bijection)
g on X such that
g h = gh ,
g, h G,
where the product of two permutations is their composition (that is, g h =
g h ).
Example 18.1. Let be the rotation by 90 clockwise. Then
G = {0 , 1 , 2 , 3 }
is a cyclic group of order 4. Let X = R2 . Then G induces permutations
i = i on X,
i = 0, 1, 2, 3,
We often identify g with g (for g G). Thus, we have for (x, y) R2 that
0 ((x, y)) = (x, y),
2 ((x, y)) = (x, y),
160
Example 18.2 (Coloring the edges of a square, Part I). Color the edges of
a square with exactly two colors: 0, 1. That is, each edge is colored by 0 or
1, and both colors are used. Our aim is to answer this question: How many
different colorings are there, assuming equivalence by rotations? This is our
first example and we shall be more detailed than necessary.
Name the four sides of the square as a, b, c, d in clockwise order and let
E = {a, b, c, d}. Each coloring is a mapping : E {0, 1}. The set of
colorings that we are interested in is
X = set of all surjections : E {0, 1}
{0, 1}E ,
which is the set of all mappings from E to {0, 1}.
The rotations are i , i = 0, 1, 2, 3 and the group is G = {i : i = 0, 1, 2, 3} as
before. Now G acts on X as follows. For g G, define a function g on X
as follows:
(g ())() = (g 1 ()),
X, E.
E,
is,
161
=
=
=
=
Thus, there are 4 different orbits, and therefore there are 4 nonequivalent
colorings.
162
The Burnside Lemma relates the number of orbits (which is the answer
we seek in the previous example) to (g)s.
Theorem 18.1 (Cauchy-Frobenius-Burnside). If a group G acts on X, then
# orbits of G (acting on X) is
1 X
(g).
|G| gG
Example 18.4 (Coloring the edges of a square, Part III). Recall that
(0 ) = 14,
(1 ) = (3 ) = 0,
(2 ) = 2,
and that
|G| = 4.
Thus, by the Theorem 18.1, we have
# nonequivalent colorings = # orbits
= 41 (14 + 0 + 2 + 0)
= 4.
18.1
e e = ee = e
e = (e )(e )1 = 1X ,
163
164
g (x) = x = h (x)
g (x) = h (x)
(g )1 h (x) = x
g1 h (x) = x
g 1 h Gx .
Thus Gx is a subgroup of G.
(b) Observe that for g, h G,
iff
iff
iff
iff
g (x) = h (x)
g1 h (x) = x
g 1 h Gx
h gGx
g, h are in the same left coset of Gx .
Thus,
|G|
,
|Gx |
since all left cosets have the same cardinality and they form a partition of
G.
|Ox | = # left cosets of Gx =
or
g1 (t) = s.
Recall that
Gs = {g G : g (s) = s},
Gt = {g G : g (t) = t}.
165
h Gs
h (s) = s
h (g1 (t)) = g1 (t)
ghg1 (t) = t
ghg 1 Gt
X X
orbit O xO
orbit O
orbit O
|Gx |,
|Ox ||Gx |,
|G|,
since s, t Ox = |Gs | = Gt |
by a previous lemma
= |G| # orbits.
We therefore have
# orbits =
1 X
(g),
|G| gG
166
18.2
1 X gcd(i,n)
=
m
n i=1
1X
=
#{i : gcd(i, n) = d, i = 1, 2, . . . , n}md
n
d|n
1X
=
#{j : gcd(j, n/d) = 1, j = 1, 2, . . . , n/d}md
n
d|n
1X
=
(n/d)md ,
n
d|n
(5) = 4,
(2) = 1,
(1) = 1,
167
gcd(i, n) = d,
where the term m is due to the fact that there are m monochromatic colorings. Thus,
# nonequivalent colorings
1 X
=
(g)
|G| gG
n
1 X gcd(i,n)
=
(m
m)
n i=1
1X
=
#{i : gcd(i, n) = d, i = 1, 2, . . . , n}md m
n
d|n
1X
#{j : gcd(j, n/d) = 1, j = 1, 2, . . . , n/d}md m
=
n
d|n
1X
(n/d)md m,
=
n
d|n
when n = 4, we have
(4) = 2,
(2) = 1,
(1) = 1,
Chapter 19
Polyas Theory of Counting
This is a powerful technique for enumeration with equivalence under symmetry imposed by a group. We shall start by formalizing some concepts
understood in the previous chapter.
19.1
Lemma 19.1. Let A and B be finite sets and consider the set B A of functions
from A to B. Let G be a permutation group on A. Then G acts on B A with
g (f ) = f g 1 ,
g G,
f BA.
Proof. We first show that g is 1-1 for all g G. Suppose that g G. Then
for any f1 , f2 B A ,
g (f1 ) = g (f2 )
f1 g 1 = f2 g 1
f1 = f2 .
168
169
g (h (f ))
g (f h1 )
(f h1 )g 1
f (h1 g 1 )
f (gh)1
gh (f ).
19.2
Example 19.2 (Coloring the edges of a square, Part V). Suppose that the
edges of the square are labeled a, b, c, d clockwise. Then A = {a, b, c, d} and
the permutation group is {i : i = 0, 1, 2, 3}, where
(a) = b,
(b) = c,
(c) = d,
(d) = a,
and i denotes composition of with itself for i times. There are 4 cycles
(each with length 1) in 0 which is the identity mapping; 1 cycle of length 4
in 1 and 3 , and 2 cycles of lengths 2 in 2 .
Theorem 19.1. Let A and B be finite sets, and G be a permutation group
on A. Denote by ck (G) the number of permutations g in G that have exactly
k cycles. Then the number of orbits of G acting on B A is
1 X
ck (G)|B|k .
|G| k1
170
1 X
(g),
|G| gG
f g 1 = f.
or
and
f g k = f,
k Z.
1 X
(g)
|G| gG
X
1 X
|G|
k1
gG
g has k cycles
|B|k
1 X
ck (G)|B|k .
|G| k1
h = 0, 1, 2, . . . , nk 1,
171
with k cycles is
ck (G) = #{i : gcd(i, n) = k, 1 i n}
= #{i : gcd(i, n/k) = 1, 1 i n/k}
= (n/k).
Hence, by the previous theorem, we have
1X
ck mk
n k1
1X
=
(n/k)mk ,
n
# nonequivalent colorings =
k|n
172
and reflection?
Solution. The beads in a necklace are the vertices of an n-gon and the types
are the colors of the vertices. The permutation group on the set A of vertices
contains these elements:
(A) n rotations, and as before, the number of rotations with k cycles, where
k | n, is (n/k). The contribution of the rotations to the sum is
X
(n/k)mk .
k|n
(B) n reflections, but there are two cases here. (i) if n is odd, then each
reflection is about an axis through a vertex and the mid point of the opposite
edge. There is 1 cycle of length 1 (consisting of the vertex at the axis of
reflection) and (n 1)/2 cycles of lengths 2. Thus there are (n + 1)/2 cycles
in each reflection and so contribution of the reflections to the sum is
nm(n+1)/2 .
(ii) if n is even, then there are two kinds of reflections: There are n/2 reflections about the axes through opposite vertices, and each reflection contains
2 + (n 2)/2 cycles because there are 2 cycles of lengths 1 and (n 2)/2 cycles of lengths 2. Also, there are n/2 reflections about axes through the mid
points of opposite edges, and each reflection contains n/2 cycles of lengths
2. Thus, the contribution of the reflections to the sum is
n
n
+1
n
2
2
m
+
m
.
2
1 nm(n+1)/2 + P (n/k)mk ,
if n is odd,
k|n
2n
# orbits =
P
k
1 n mn/2 (m + 1) +
, if n is even.
k|n (n/k)m
2n
2
19.3
ti (g)i = n.
173
We now use
1t1 (g) 2t2 (g) ntn (g)
1 X Y ti (g)
ZG (X1 , X2 , . . . , Xn ) =
.
X
|G| gG i=1 i
Recall that ck (G) is the number of permutations in G with k cycles, and
1 X
ck (G)mk .
# orbits =
|G| k1
P
Now i1 ti (g) is the number of cycles in g, and so
1 X Pi1 ti (g)
m
|G| gG
1 X # cycles in g
m
=
|G| gG
1 X
=
ck (G)mk
|G| k1
ZG (m, m, . . . , m) =
= # orbits.
1 X Y ti (g)
X
ZG (X1 , X2 , . . . , Xn ) =
|G| gG i=1 i
1 P (n/k)X k + n X2(n2)/2 X12 + n X2n/2 , if n is even,
n/k
2n
2
Pk|n
2
=
(n1)/2
k
1
X1 ,
if n is odd.
k|n (n/k)Xn/k + nX2
2n
By setting Xi = m for all i, we get the number necklace with n beads from
m types.
19.4
174
Computing the exact number of nonisomorphic graphs is a very hard problem. No known efficient computer algorithm has been found, and most people (in the research area) do not expect that there is one. We shall work on
graphs with 5 vertices.
as the set of all unordered
Let V = [5] be the vertex set. Define E = [5]
2
pairs of vertices. A graph is a function f : E {0, 1}. Let G be the
permutation group on [5]. For G, define (2) on E by
(2) ({x, y}) = {(x), (y)}.
Thus, is a relabeling of the vertices and two graphs f1 , f2 are isomorphic
iff they are equivalent under a vertex labeling G. That is, f1 , f2 are
isomorphic iff there is G such that
f1 (e) = f2 ( (2) (e)),
e E.
Lemma 19.2. Let G(2) = { (2) : G}. Then G(2) is a permutation group
on E.
Proof. We first show that (2) is 1-1. Thus, for e1 = {x1 , y1 }, e2 = {x2 , y2 }
E, we have
=
=
=
175
We next show that G(2) is closed under inverse. It is easy to check that
for any G, we have
(2) ( 1 )(2) = ( 1 )(2) = (1G )(2) ,
where 1G is the identity in G and (1G )(2) is the identity in G(2) . Thus, G(2)
is closed under inverse.
Thus G(2) is a subgroup of the symmetric group on E. That is, G(2) is a
permutation group on E.
Since G(2) acts on {0, 1}E , the number of orbits is the number nonequivalent functions in {0, 1}E under the vertex relabelling G. Thus,
the number of nonisomorphic graphs equals the number of orbits of G(2)
acting on {0, 1}E . We restate this as a lemma below.
Lemma 19.3. Let V be a vertex set, and E = V2 be the set of unordered
pairs of vertices. Then the number of nonisomorphic graphs with vertex set
V equals the number of orbits of G(2) acting on {0, 1}E .
We shall now proceed to find the cycle index of G(2) .
cycle classes of
15
13 21
14 23
12 31
11 33
11 41
42 21
11 22
12 24
21 31
11 31 61
51
52
number of permutations
1
5
= 10
2
5
(2) = 20
3
5
(3!) = 30
4
5 3 1
= 15
2 1 2
5
(2!) = 20
3
4! = 24
176
P
Notice that a cycle class (t1 , t2 , . . .) must satisfy i1 iti = 10 because there
are 10 edges in E. Also, there are 5! = 120 permutations G and hence
120 permutations (2) in G(2) . Also, let us say a few words how the cycle
classes of (2) are decided. For example, if the cycle class of is 13 21 , then
edges with end
points in 2 of the 3 1-cycles in form a 1-cycle in (2) and
there are 32 = 3 such 1-cycles; an edge with one end point in a 1-cycle of
andother end point in a 2-cycle of is part of a 2-cycle in (2) and there
are 31 = 3 such 2-cycles; an edge with both end points in the 2-cycle of
gives a 1-cycle in (2) and there are 1 such 1-cycle. Hence the corresponding
cycle class of (2) is 14 23 .
From the table, we see that the cycle index of G(2) is
ZG(2) =
1
X110 + 10X14 X23 + 20X1 X33
5!
+30X2 X42 + 15X12 X24 + 20X1 X3 X6 + 24X52 ) .
Thus, the number of nonisomorphic graphs on [5] equals the number of orbits
[5]
of G(2) acting on {0, 1}( 2 ) , and is equal to
1 10
2 + 10(27 ) + 20(24 ) + 30(23 ) + 15(26 ) + 20(23 ) + 24(22 ) = 34.
5!
Chapter 20
A Generating Function for the
Number of Orbits
Suppose that A, B are finite sets. Let R be the set of polynomials with real
coefficients, and let w : B R be a weight function. Define W : B A R
by
Y
W (f ) =
w(f (a)).
aA
W (f1 (g(a)) =
aA
aA
where the last but one equality follows from the fact that g is a permutation
on A. This shows that if f1 and f2 are in the same orbit, then W (f1 ) = W (f2 ).
Therefore, the functions in the an orbit have the same weight. Let D be a
system of distinct representatives for the collection of orbits. That is, D
contains exactly one function from each orbit. Then we have the following
theorem.
177
20.1
178
where
Xi =
w(b)i ,
i = 1, 2, . . . , n.
bB
Proof. Let
N=
W (f ).
gG,f B A
f g=f
f B A
f B A
f D
W (f )
gG,f g=f
W (f )|Gf |
W (f ) |Of | |Gf |
= |G|
W (f ),
f D
where the last but one equality follows from the fact that functions f1 Of
satisfies W (f1 ) = W (f ). Next, recall that the cycle index of G is
n
1 X Y ti (g)
ZG (X1 , X2 , . . . , Xn ) =
.
X
|G| gG i=1 i
179
n
XY
t (g)
Xi i ,
gG i=1
where
Xi =
w(b)i ,
i = 1, 2, . . . , n.
bB
Note that
N=
X
gG
W (f ),
f B A ,f g=f
f B A ,f g=f
aA
i=1
aCi
where the last inequality is due to the fact that f is constant on each Ci .
Consider the sum
X
X
W (f ) =
w(f (a1 ))|C1 | w(f (a2 ))|C2 | w(f (ak ))|Ck | .
f B A ,f g=f
f B A ,f g=f
b1 B b2 B
f B A ,f g=f
k
Y
i=1
w(bi )
|Ci |
bi B
k
X
Y
i=1
bB
n
Y
=1
bk B
bB
w(b)|Ci |
w(b)
!t (g)
180
where denotes the length of a cycle, and t (g) is the number of cycles of
length in g. Thus,
X
W (f ) =
n
Y
t (g)
X ,
where X =
=1
f B A ,f g=f
w(b) .
bB
n
X Y
gG
t (g)
=1
as required.
Theorem 20.2. Let
A be a finite set with |A| = n,
G be a permutation group on A,
B be a finite set of m colors.
So B A is the set of colorings of A with m colors. Let
F (x1 , x2 , . . . , xm ) = ZG (X1 , X2 , . . . , Xn ),
where
X =
m
X
xj .
j=1
181
W (f ).
f D
It follows that
i=1 xi .
20.2
Examples
Example 20.1. Recall that the cycle index of G(2) in nonisomorphic graphs
on 5 vertices is
ZG(2) =
1
X110 + 10X14 X23 + 20X1 X33
5!
+30X2 X42 + 15X12 X24 + 20X1 X3 X6 + 24X52 ) .
182
1
(45 + 90 + 30 + 75) = 2.
120
183
!n/d
For example, the generating function for the # colorings of the vertices of
an 8-gon using 3 colors c1 , c2 , c3 is
1
(x1 + x2 + x3 )8 + (x21 + x22 + x23 )4
F (x1 , x2 , x3 ) =
8
4
4
4 2
8
8
8
+2(x1 + x2 + x3 ) + 4(x1 + x2 + x3 ) .
In particular, the number of colorings of the vertices of a 8-gon such that 3
vertices are red, 2 are blue and 3 are green equals
8
1
3 2 3
= 70.
[x1 x2 x3 ]F (x1 , x2 , x3 ) =
8 3, 2, 3
Example 20.3. Consider the necklace problem with n beads of m types,
with equivalence under rotations and reflections. The cycle index is (from
before)
ZG (X1 , X2 , . . . , Xn )
P
n n/2
n (n2)/2 2
k
1
X
X
+
X
, if n is even,
(n/k)X
+
1
n/k
2n
2 2
Pk|n
2 2
=
(n1)/2
k
1
X1 ,
if n is odd.
k|n (n/k)Xn/k + nX2
2n
m
X
i=1
xi =
m1
X
i=0
xi =
xm 1
.
x 1
If n is odd, then the number of necklaces with n beads that cost k dollars
equals the coefficient of xk in
k
(n1)/2
m
2m
mn/k
x 1
x 1
x
1
1 X
.
+
n
(n/k)
2n
xn/k 1
x2 1
x1
k|n
184
36
x 1
x9 1
+2
12
x 1
x3 1
3
x 1
x1
9
+9
x 1
x2 1
4
x 1
x1
Example 20.4 (Rotations of the cube). There are three kinds of axes of
rotation:
a
b
c
y
(A) There are three axes like xy, and each has rotations by 0, 2 , .
(B) There are six axes like ab, and each has rotations by 0, .
(C) There are four axes like cd, and each has rotations by 0, 2
.
3
Note that only the identity rotation appears more than once in the above,
and hence there are (3)(4 1) + 6(2 1) + 4(3 1) + 1 = 24 rotations.
Example 20.5 (Coloring the Vertices Of a Cube). Let A be the set of the 8
vertices of a cube. The 24 rotations of the cube induce 24 permutations on
A. We next calculate the cycle index of the group of these 24 permutations:
!
185
1
X18 + 6X42 + 9X24 + 8X12 X32 .
24
Thus, the number of colorings of the vertices of the cube using m colors,
equivalent under rotation, is
1
1
m8 + 6m2 + 9m4 + 8m4 =
m8 + 6m2 + 17m4 .
24
24
Also, for example, the number of colorings of the vertices of the cube so that
3 are red, 3 are blue and 2 are green equals
[x3 y 3 z 2 ]F (x, y, z),
where
F (x, y, z) =
Thus,
1
(x + y + z)8 + 6(x4 + y 4 + z 4 )2
24
+9(x2 + y 2 + z 2 )4 + 8(x2 + y 2 + z 2 )(x3 + y 3 + z 3 )2 .
[x3 y 3 z 2 ]F (x, y, z)
8
2
2
1
+0+0+8
=
24
3, 3, 2
0, 0, 2 1, 1, 0
1
=
(560 + 16)
24
= 24.
Chapter 21
Symmetry in B
We shall only touch on this topic. Our aim is to solve this problem. What is
the number of distributions of 2 red, 2 yellow and 4 green balls into 1 round
box and 3 square boxes? We shall develop a general solution method. Here
A is the set of balls and B is the set of boxes. Unfortunately some boxes are
identical as well as some balls.
Notice that since we can permute the balls with the same color, the
symmetry on A is given by S2 S2 S4 , where Sn is the symmetric group
with n elements. Similarly, the symmetry in B is given by S1 S3 .
Lemma 21.1. Suppose that A, B are finite sets and G, H are permutation
groups on A and B respectively. Then G H is a group acting on B A by
(g,h) (f ) = hf g 1 ,
g G,
h H,
f BA.
187
(g,h) (h f g 1 )
hh f g 1 g 1
hh f (gg )1
(gg ,hh ) (f ).
21.1
The Theorem
Theorem 21.1. Suppose that A and B are finite sets. Let |A| = n and let
G, H be permutation groups on A, B respectively. Then the number of orbits
of G H on B A is
1 X
ZG (m1 (h), m2 (h), . . . , mn (h)),
|H| hH
where
mi (h) =
tj (h),
i = 1, 2, . . . n,
j|i
where (g, h) is the number of functions f B A fixed by (g, h). Note that
a function f is fixed by (g, h) iff
f = hf g 1 ,
or equivalently
hf = f g.
Therefore
# orbits of G H on B A
!
1 X
1 X
# f B A such that hf = f g .
=
|H| hH |G| gG
188
where (as before) td (h) is the number of cycles in h with length d. Thus, the
number of functions f : A B fixed by (g, h) equals
k
Y
mcj (h),
j=1
where k is the number of cycles in g and cj s are the lengths of those cycles.
But
k
n
Y
Y
mci (h) =
mi (h)ti (g) .
i=1
i=1
# f B A such that hf = f g
n
1 X Y
=
mi (h)ti (g)
|G| gG i=1
= ZG (X1 , X2 , . . . , Xn ),
!
where Xi = mi (h).
21.2
189
The Example
= X1 ,
= 12 X12 + X2 ,
= 61 X13 + 3X1 X2 + 2X3 ,
1
X14 + 8X1 X3 + 6X12 X2 + 3X22 + 6X4 .
= 12
Note that the cycle index of a product of groups equals the product of the
cycle indices of the groups. Hence
ZG =
2
1
X12 + X2
X14 + 8X1 X3 + 6X12 X2 + 3X22 + 6X4 .
(2)(2)(24)
# such h
1
3
2
cycle class of hs
14
12 21
11 31
m1 (h)
4
2
1
m2 (h)
4
4
1
m3 (h)
4
2
4
m4 (h)
4
4
1