0% found this document useful (0 votes)
378 views238 pages

FGFDG

fdff

Uploaded by

arkaprava paul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
378 views238 pages

FGFDG

fdff

Uploaded by

arkaprava paul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 238

Cambridge University Press

978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics


Peter J. Cameron
Frontmatter
More Information

Notes on Counting: An Introduction to


Enumerative Combinatorics

Enumerative combinatorics, in its algebraic and analytic forms, is vital to many


areas of mathematics, from model theory to statistical mechanics. This book, which
stems from many years’ experience of teaching, invites students into the subject and
prepares them for more advanced texts. It is suitable as a class text or for individual
study.
The author provides proofs for many of the theorems to show the range of
techniques available and uses examples to link enumerative combinatorics to other
areas of study. The main section of the book introduces the key tools of the subject
(generating functions and recurrence relations), which are then used to study the most
important combinatorial objects, namely subsets, partitions, and permutations of a
set. Later chapters deal with more specialised topics, including permanents, SDRs,
group actions and the Redfield–Pólya theory of cycle indices, Möbius inversion, the
Tutte polynomial, and species.

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

A U S T R A L I A N M AT H E M AT I C A L S O C I E T Y L E C T U R E S E R I E S

Editor-in-chief:
Professor J. Ramagge, School of Mathematics and Statistics, University of Sydney, NSW 2006,
Australia
Editors:
Professor G. Froyland, School of Mathematics and Statistics, University of New South Wales, NSW
2052, Australia
Professor M. Murray, School of Mathematical Sciences, University of Adelaide, SA 5005, Australia

Professor C. Praeger, School of Mathematics and Statistics, University of Western Australia, Crawley,
WA 6009, Australia

1. Introduction to Linear and Convex Programming, N. CAMERON


2. Manifolds and Mechanics, A. JONES, A. GRAY & R. HUTTON
3. Introduction to the Analysis of Metric Spaces, J. R. GILES
4. An Introduction to Mathematical Physiology and Biology, J. MAZUMDAR
5. 2-Knots and their Groups, J. HILLMAN
6. The Mathematics of Projectiles in Sport, N. DE MESTRE
7. The Petersen Graph, D. A. HOLTON & J. SHEEHAN
8. Low Rank Representations and Graphs for Sporadic Groups,
C. E. PRAEGER & L. H. SOICHER
9. Algebraic Groups and Lie Groups, G. I. LEHRER (ed.)
10. Modelling with Differential and Difference Equations,
G. FULFORD, P. FORRESTER & A. JONES
11. Geometric Analysis and Lie Theory in Mathematics and Physics,
A. L. CAREY & M. K. MURRAY (eds.)
12. Foundations of Convex Geometry, W. A. COPPEL
13. Introduction to the Analysis of Normed Linear Spaces, J. R. GILES
14. Integral: An Easy Approach after Kurzweil and Henstock,
L. P. YEE & R. VYBORNY
15. Geometric Approaches to Differential Equations,
P. J. VASSILIOU & I. G. LISLE (eds.)
16. Industrial Mathematics, G. R. FULFORD & P. BROADBRIDGE
17. A Course in Modern Analysis and its Applications, G. COHEN
18. Chaos: A Mathematical Introduction, J. BANKS, V. DRAGAN & A. JONES
19. Quantum Groups, R. STREET
20. Unitary Reflection Groups, G. I. LEHRER & D. E. TAYLOR
21. Lectures on Real Analysis, F. LÁRUSSON
22. Representations of Lie Algebras, A. HENDERSON
23. Neverending Fractions, J. BORWEIN et al.
24. Wavelets: A Student Guide, P. NICKOLAS
25. Classical Groups, Derangements and Primes, T. BURNESS & M. GIUDICI
26. Notes on Counting: An Introduction to Enumerative Combinatorics, P. J. CAMERON

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

Australian Mathematical Society Lecture Series: 26

Notes on Counting: An Introduction to


Enumerative Combinatorics
P E T E R J . C A M E RO N
University of St Andrews, Scotland

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

University Printing House, Cambridge CB2 8BS, United Kingdom


One Liberty Plaza, 20th Floor, New York, NY 10006, USA
477 Williamstown Road, Port Melbourne, VIC 3207, Australia
4843/24, 2nd Floor, Ansari Road, Daryaganj, Delhi – 110002, India
79 Anson Road, #06-04/06, Singapore 079906

Cambridge University Press is part of the University of Cambridge.


It furthers the University’s mission by disseminating knowledge in the pursuit of
education, learning and research at the highest international levels of excellence.

www.cambridge.org
Information on this title: www.cambridge.org/9781108417365
DOI: 10.1017/9781108277457
c Peter J. Cameron 2017

This publication is in copyright. Subject to statutory exception
and to the provisions of relevant collective licensing agreements,
no reproduction of any part may take place without the written
permission of Cambridge University Press.
First published 2017
Printed in the United Kingdom by Clays, St Ives plc
A catalogue record for this publication is available from the British Library.
ISBN 978-1-108-41736-5 Hardback
ISBN 978-1-108-40495-2 Paperback
Cambridge University Press has no responsibility for the persistence or accuracy of
URLs for external or third-party Internet Web sites referred to in this publication
and does not guarantee that any content on such Web sites is, or will remain,
accurate or appropriate.

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

Contents

Preface ix

1 Introduction 1
1.1 What is counting? 1
1.2 About how many? 7
1.3 How hard is it? 7
1.4 Exercises 8

2 Formal power series 12


2.1 Fibonacci numbers 12
2.2 Formal power series 16
2.3 Variation and generalisation 20
2.4 Relation with analysis 21
2.5 Exponential, logarithmic and binomial series 23
2.6 Exercises 25

3 Subsets, partitions and permutations 29


3.1 Subsets 29
3.2 Partitions 37
3.3 Permutations 42
3.4 Lah numbers 47
3.5 More on formal power series 48
3.6 Unimodality 50
3.7 Appendix: Exponential and logarithm 54
3.8 Exercises 56

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

vi Contents

4 Recurrence relations 64
4.1 Linear recurrences with constant coefficients 65
4.2 Linear recurrence relations with polynomial coefficients 77
4.3 Some non-linear recurrence relations 83
4.4 Appendix: Euler’s Pentagonal Numbers Theorem 85
4.5 Appendix: Some Catalan objects 89
4.6 Appendix: The RSK algorithm 97
4.7 Appendix: Some inverse semigroups 99
4.8 Exercises 101

5 The permanent 106


5.1 Permanents and SDRs 106
5.2 Hall’s Theorem 107
5.3 The van der Waerden conjecture 108
5.4 Latin squares 110
5.5 Latin rectangles 113
5.6 Exercises 113

6 q-analogues 114
6.1 Motivation 114
6.2 q-integers 116
6.3 The q-Binomial Theorem 118
6.4 Elementary symmetric functions 119
6.5 Partitions and permutations 121
6.6 Irreducible polynomials 122
6.7 Quantum calculus 124
6.8 Exercises 125

7 Group actions and the cycle index 131


7.1 Group actions 131
7.2 The Orbit-counting Lemma 133
7.3 The cycle index 135
7.4 Labelled and unlabelled 137
7.5 Exercises 139

8 Möbius inversion 141


8.1 The Principle of Inclusion and Exclusion 141
8.2 Partially ordered sets 144
8.3 The incidence algebra of a poset 146
8.4 Some Möbius functions 147
8.5 Classical Möbius inversion 149
8.6 The general linear group 151
8.7 Exercises 152

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

Contents vii

9 The Tutte polynomial 156


9.1 The chromatic polynomial 156
9.2 The Tutte polynomial 159
9.3 Orbit counting and the Tutte polynomial 161
9.4 The Matrix-Tree Theorem 166
9.5 Exercises 168

10 Species 170
10.1 Cayley’s Theorem 170
10.2 Species and counting 171
10.3 Examples of species 173
10.4 Operations on species 174
10.5 Cayley’s Theorem revisited 176
10.6 What is a species? 177
10.7 Oligomorphic permutation groups 178
10.8 Weights 181
10.9 Exercises 183

11 Analytic methods: a first look 187


11.1 The language of asymptotics 187
11.2 Stirling’s formula 188
11.3 Complex analysis 190
11.4 Subadditive and submultiplicative functions 192
11.5 Exercises 194

12 Further topics 195


12.1 Lagrange inversion 195
12.2 Bernoulli numbers 200
12.3 The Euler–Maclaurin sum formula 204
12.4 Poly-Bernoulli numbers 205
12.5 Hayman’s Theorem 207
12.6 Theorems of Meir and Moon and of Bender 208
12.7 Exercises 210

13 Bibliography and further directions 212


13.1 The On-line Encyclopedia of Integer Sequences 212
13.2 Books on combinatorial enumeration 213
13.3 Papers cited in the text 215

Index 217

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

Preface

Combinatorics is the science of pattern and arrangement. A typical problem in


combinatorics asks whether it is possible to arrange a collection of objects accord-
ing to certain rules. If the arrangement is possible, the next question is a counting
question: how many different arrangements are there? This is the topic of the
present book.
Often a small change in the detail of a problem turns an easy question into
one which appears impossibly difficult. For example, consider the following three
questions.
• In how many ways can the numbers 1, . . . , n be placed in the cells of an n × n
grid, with no restriction on how many times each is used? Since each of the
n2 cells can have its entry chosen independently from a set of n possibilities,
2
the answer is nn .
• In how many ways can the arrangement be made if each number must occur
once in each row? Once we notice that each row must be a permutation of
the numbers 1, . . . , n, and that the permutations can be chosen independently,
we see that the answer is (n!)n (as there are n! permutations of the numbers
1, . . . , n).
• In how many ways can the arrangement be made if each number must oc-
cur once in each row and once in each column? For this problem, there is
no formula for the answer. Such an arrangement is called a Latin square.
The number of Latin squares with n up to 11 has been found by brute-force
calculation. For larger values, we don’t even have good estimates: the best
known upper and lower bounds differ by a factor which is exponentially
large in terms of the number of cells.
Not all problems are as hard as this. In this book you will learn how to count

ix

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

x Preface

the number of permutations which move every symbol, strings of zeros and ones
containing no occurrence of a fixed substring, invertible matrices of given size over
a finite field, expressions for a given positive integer as a sum of positive integers
(the answers are different depending on whether we care about the order of the
summands or not), trees and graphs on a given set of vertices, and many more.
Very often I will not be content with giving you one proof of a theorem. I may
return to an earlier result armed with a new technique and give a totally differ-
ent proof. We learn something from having several proofs of the same result. As
Michael Atiyah said in an interview in the Newsletter of the European Mathemat-
ical Society,

I think it is said that Gauss had ten different proofs for the law of
quadratic reciprocity. Any good theorem should have several proofs,
the more the better. For two reasons: usually, different proofs have
different strengths and weaknesses, and they generalise in different
directions — they are not just repetitions of each other.

In particular, there are two quite different styles of proof for results in enumer-
ative combinatorics. Consider a result which asserts that two counting functions
F(n) and G(n) are equal. We might prove this by showing that their generating
functions are equal, perhaps using analytic techniques of some kind. Alternatively,
we might prove the result by finding a bijection between the sets of objects counted
by F(n) and G(n). Often, when such an identity is proved by analytic methods,
the author will ask for a ‘bijective proof’ of the result.
As an example, if n is even, then it is fairly straightforward to prove by analytic
methods that the number of permutations of {1, . . . , n} with all cycles even is equal
to the number with all cycles odd. But finding an explicit bijection between the
two sets is not straightforward, though not too difficult.
I should stress, though, that the book is not full of big theorems. Tim Gowers, in
a perceptive article on ‘The two cultures of mathematics’, distinguishes branches
of mathematics in which theorems are all-important from those where the empha-
sis is on techniques; enumerative combinatorics falls on the side of techniques. (In
the past this has led to some disparagement of combinatorics by other mathemati-
cians. Many people know that Henry Whitehead said ‘Combinatorics is the slums
of topology’. A more honest appraisal is that the techniques of combinatorics
pervade all of mathematics, even the most theorem-rich parts.)
The notes which became this book were for a course on Enumerative and
Asymptotic Combinatorics at Queen Mary, University of London, in the spring
of 2003, and subsequently as Advanced Combinatorics at the University of St
Andrews. The reference material for the subject has been greatly expanded by
the publication of Richard Stanley’s two-volume work on Enumerative Combina-
torics, as well as the book on Analytic Combinatorics by Flajolet and Sedgewick.
(References to these and many other books can be found in the bibliography at the

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

Preface xi

end.) Many of these books are encyclopaedic in nature. I hope that this book will
be an introduction to the subject, which will encourage you to look further and to
tackle some of the weightier tomes.
What do you need to know to read this book? It will probably help to have had
some exposure to basic topics in undergraduate mathematics.
• Real and complex analysis (limits, convergence, power series, Cauchy’s the-
orem, singularities of complex functions);
• Abstract algebra (groups and rings, group actions);
• Combinatorics.
None of this is essential; in most cases you can pick up the needed material as you
go along.
The heart of the book is Chapters 2–4, in which the most important tools of the
subject (generating functions and recurrence relations) are introduced and used to
study the most important combinatorial objects (subsets, partitions and permuta-
tions of a set). The basic object here is a formal power series, a single object
encapsulating an infinite sequence of numbers, on which a wide variety of manip-
ulations can be done: formal power series are introduced in Chapter 2.
Later chapters treat more specialised topics: permanents, systems of distinct
representatives, and Latin squares in Chapter 5, ‘q-analogues’ (familiar formu-
lae with an extra parameter arising in a wide variety of applications) in Chap-
ter 6, group actions and the Redfield–Pólya theory of the cycle index in Chapter 7,
Möbius inversion (a wide generalisation of the Inclusion–Exclusion Principle) in
Chapter 8, the Tutte polynomial (a counting tool related to Inclusion–Exclusion)
in Chapter 9, species (an abstract formalism including many important count-
ing problems) in Chapter 10, and some miscellaneous topics (mostly analytic)
in Chapters 11 and 12. The final chapter includes an annotated list of books for
further study.
As always in a combinatorics book, the techniques described have unexpected
applications, and it is worth looking through the index. Cayley’s Theorem on
trees, for example, appears in Chapter 10, where several different proofs are given;
Young tableaux are discussed in Chapter 4, as are various counts of inverse semi-
groups of partial permutations.
The final chapter includes an annotated book list and a discussion of using the
On-line Encyclopedia of Integer Sequences.
The first few chapters contain various interdependences. For example, bino-
mial coefficients and the Binomial Theorem for natural number exponents appear
in Chapter 2, although they are discussed in more detail in Chapter 3. Such occur-
rences will be flagged, but I hope that you will have met these topics in undergrad-
uate courses or will be prepared to take them on trust when they first appear.
I am grateful to many students who have taken this course (especially Pablo
Spiga, Thomas Evans, and Wilf Wilson), to colleagues who have helped teach

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Frontmatter
More Information

xii Preface

it (especially Thomas Müller), and to others who have provided me with exam-
ples (especially Thomas Prellberg and Dudley Stark), and to Abdullahi Umar for
the material on inverse semigroups. I am also grateful to Morteza Mohammed-
Noori, who used my course notes for a course of his own in Tehran, and did a
very thorough proof-reading job, spotting many misprints. (Of course, I may have
introduced further misprints in the rewriting!)
The book will be supported by a web page at

http://www-circa.mcs.st-and.ac.uk/~pjc/books/counting/

which will have a list of misprints, further material, links, and possibly solutions
to some of the exercises.

© in this web service Cambridge University Press www.cambridge.org


Preface

Combinatorics is the science of pattern and arrangement. A typical problem in


combinatorics asks whether it is possible to arrange a collection of objects accord-
ing to certain rules. If the arrangement is possible, the next question is a counting
question: how many different arrangements are there? This is the topic of the
present book.
Often a small change in the detail of a problem turns an easy question into
one which appears impossibly difficult. For example, consider the following three
questions.
• In how many ways can the numbers 1, . . . , n be placed in the cells of an n × n
grid, with no restriction on how many times each is used? Since each of the
n2 cells can have its entry chosen independently from a set of n possibilities,
2
the answer is nn .
• In how many ways can the arrangement be made if each number must occur
once in each row? Once we notice that each row must be a permutation of
the numbers 1, . . . , n, and that the permutations can be chosen independently,
we see that the answer is (n!)n (as there are n! permutations of the numbers
1, . . . , n).
• In how many ways can the arrangement be made if each number must oc-
cur once in each row and once in each column? For this problem, there is
no formula for the answer. Such an arrangement is called a Latin square.
The number of Latin squares with n up to 11 has been found by brute-force
calculation. For larger values, we don’t even have good estimates: the best
known upper and lower bounds differ by a factor which is exponentially
large in terms of the number of cells.
Not all problems are as hard as this. In this book you will learn how to count

ix
20:11:43, subject to the Cambridge
.001
x Preface

the number of permutations which move every symbol, strings of zeros and ones
containing no occurrence of a fixed substring, invertible matrices of given size over
a finite field, expressions for a given positive integer as a sum of positive integers
(the answers are different depending on whether we care about the order of the
summands or not), trees and graphs on a given set of vertices, and many more.
Very often I will not be content with giving you one proof of a theorem. I may
return to an earlier result armed with a new technique and give a totally differ-
ent proof. We learn something from having several proofs of the same result. As
Michael Atiyah said in an interview in the Newsletter of the European Mathemat-
ical Society,

I think it is said that Gauss had ten different proofs for the law of
quadratic reciprocity. Any good theorem should have several proofs,
the more the better. For two reasons: usually, different proofs have
different strengths and weaknesses, and they generalise in different
directions — they are not just repetitions of each other.

In particular, there are two quite different styles of proof for results in enumer-
ative combinatorics. Consider a result which asserts that two counting functions
F(n) and G(n) are equal. We might prove this by showing that their generating
functions are equal, perhaps using analytic techniques of some kind. Alternatively,
we might prove the result by finding a bijection between the sets of objects counted
by F(n) and G(n). Often, when such an identity is proved by analytic methods,
the author will ask for a ‘bijective proof’ of the result.
As an example, if n is even, then it is fairly straightforward to prove by analytic
methods that the number of permutations of {1, . . . , n} with all cycles even is equal
to the number with all cycles odd. But finding an explicit bijection between the
two sets is not straightforward, though not too difficult.
I should stress, though, that the book is not full of big theorems. Tim Gowers, in
a perceptive article on ‘The two cultures of mathematics’, distinguishes branches
of mathematics in which theorems are all-important from those where the empha-
sis is on techniques; enumerative combinatorics falls on the side of techniques. (In
the past this has led to some disparagement of combinatorics by other mathemati-
cians. Many people know that Henry Whitehead said ‘Combinatorics is the slums
of topology’. A more honest appraisal is that the techniques of combinatorics
pervade all of mathematics, even the most theorem-rich parts.)
The notes which became this book were for a course on Enumerative and
Asymptotic Combinatorics at Queen Mary, University of London, in the spring
of 2003, and subsequently as Advanced Combinatorics at the University of St
Andrews. The reference material for the subject has been greatly expanded by
the publication of Richard Stanley’s two-volume work on Enumerative Combina-
torics, as well as the book on Analytic Combinatorics by Flajolet and Sedgewick.
(References to these and many other books can be found in the bibliography at the

20:11:43, subject to the Cambridge


.001
Preface xi

end.) Many of these books are encyclopaedic in nature. I hope that this book will
be an introduction to the subject, which will encourage you to look further and to
tackle some of the weightier tomes.
What do you need to know to read this book? It will probably help to have had
some exposure to basic topics in undergraduate mathematics.
• Real and complex analysis (limits, convergence, power series, Cauchy’s the-
orem, singularities of complex functions);
• Abstract algebra (groups and rings, group actions);
• Combinatorics.
None of this is essential; in most cases you can pick up the needed material as you
go along.
The heart of the book is Chapters 2–4, in which the most important tools of the
subject (generating functions and recurrence relations) are introduced and used to
study the most important combinatorial objects (subsets, partitions and permuta-
tions of a set). The basic object here is a formal power series, a single object
encapsulating an infinite sequence of numbers, on which a wide variety of manip-
ulations can be done: formal power series are introduced in Chapter 2.
Later chapters treat more specialised topics: permanents, systems of distinct
representatives, and Latin squares in Chapter 5, ‘q-analogues’ (familiar formu-
lae with an extra parameter arising in a wide variety of applications) in Chap-
ter 6, group actions and the Redfield–Pólya theory of the cycle index in Chapter 7,
Möbius inversion (a wide generalisation of the Inclusion–Exclusion Principle) in
Chapter 8, the Tutte polynomial (a counting tool related to Inclusion–Exclusion)
in Chapter 9, species (an abstract formalism including many important count-
ing problems) in Chapter 10, and some miscellaneous topics (mostly analytic)
in Chapters 11 and 12. The final chapter includes an annotated list of books for
further study.
As always in a combinatorics book, the techniques described have unexpected
applications, and it is worth looking through the index. Cayley’s Theorem on
trees, for example, appears in Chapter 10, where several different proofs are given;
Young tableaux are discussed in Chapter 4, as are various counts of inverse semi-
groups of partial permutations.
The final chapter includes an annotated book list and a discussion of using the
On-line Encyclopedia of Integer Sequences.
The first few chapters contain various interdependences. For example, bino-
mial coefficients and the Binomial Theorem for natural number exponents appear
in Chapter 2, although they are discussed in more detail in Chapter 3. Such occur-
rences will be flagged, but I hope that you will have met these topics in undergrad-
uate courses or will be prepared to take them on trust when they first appear.
I am grateful to many students who have taken this course (especially Pablo
Spiga, Thomas Evans, and Wilf Wilson), to colleagues who have helped teach

20:11:43, subject to the Cambridge


.001
xii Preface

it (especially Thomas Müller), and to others who have provided me with exam-
ples (especially Thomas Prellberg and Dudley Stark), and to Abdullahi Umar for
the material on inverse semigroups. I am also grateful to Morteza Mohammed-
Noori, who used my course notes for a course of his own in Tehran, and did a
very thorough proof-reading job, spotting many misprints. (Of course, I may have
introduced further misprints in the rewriting!)
The book will be supported by a web page at

http://www-circa.mcs.st-and.ac.uk/~pjc/books/counting/

which will have a list of misprints, further material, links, and possibly solutions
to some of the exercises.

20:11:43, subject to the Cambridge


.001
CHAPTER 1

Introduction

This book is about counting. Of course this doesn’t mean just counting a single
finite set. Usually, we have a family of finite sets indexed by a natural number n,
and we want to find F(n), the cardinality of the nth set in the family. For example,
we might want to count the subsets or permutations of a set of size n, lattice paths
of length n, words of length n in the alphabet {0, 1} with no two consecutive 1s,
and so on.

1.1 What is counting?


There are several kinds of answer to this question:

• An explicit formula (which may be more or less complicated, and in partic-


ular may involve a number of summations). In general, we regard a simple
formula as preferable; replacing a formula with two summations by one with
only one is usually a good thing.
• A recurrence relation expressing F(n) in terms of n and the values of F(m)
for m < n.This allows us to compute F(0), F(1), . . . in turn, up to any desired
value.
• A closed form for a generating function for F. We will have much more
to say about generating functions later on. Roughly speaking, a generat-
ing function represents a sequence of numbers by a power series, which in
some cases converges to an analytic function in some domain in the com-
plex plane. An explicit formula for the generating function for a sequence of
numbers is regarded as almost as good as a formula for the numbers them-
selves.

1
20:11:31, subject to the Cambridge
.002
2 Introduction

If a generating function converges, it is possible to find the coefficients by


analytic methods (differentiation or contour integration).
In the examples below, we use two forms of generating function for a se-
quence (a0 , a1 , a2 , . . .) of natural numbers: the ordinary generating function,
given by
∑ an x n ,
n≥0
and the exponential generating function, given by
an x n
∑ .
n≥0 n!

We will study these further in the next chapter, and meet them many times
during later chapters. In Chapter 10, we will see a sort of explanation of
why some problems need one kind of generating function and some need
the other.
• An asymptotic estimate for F(n) is a function G(n), typically expressed in
terms of the standard functions of analysis, such that F(n) − G(n) is of
smaller order of magnitude than G(n). (If G(n) does not vanish, we can
write this as F(n)/G(n) → 1 as n → ∞.) We write F(n) ∼ G(n) if this holds.
This might be accompanied by an asymptotic estimate for F(n) − G(n), and
so on; we obtain an asymptotic series for F. (The basics of asymptotic anal-
ysis are described further in the next section of this chapter.)
• Related to counting combinatorial objects is the question of generating them.
The first thing we might ask for is a system of sequential generation, where
we can produce an ordered list of the objects. Again there are two possibili-
ties.
If the number of objects is F(n), then we can in principle arrange the objects
in a list, numbered 0, 1, . . . , F(n) − 1; we might ask for a construction which,
given i with 0 ≤ i ≤ F(n) − 1, produces the ith object on the list directly,
without having to store the entire list and count through from the start.
Alternatively, we may simply require a method of moving from each object
to the next.
• We could also ask for a method for random generation of an object. If we
have a technique for generating the ith object directly, we simply choose a
random number in the range {0, . . . , F(n) − 1} and generate the correspond-
ing object. If not, we have to rely on other methods such as Markov chains.

Here are a few examples. These will be considered in more detail in Chapter 3;
it is not necessary to read what follows here in detail, but you are advised to skim
through it.

20:11:31, subject to the Cambridge


.002
1.1 What is counting? 3

Example: subsets The number of subsets of {1, . . . , n} is 2n . For each subset is


specified by saying, for each number i ∈ {1, . . . , n}, whether i is in the subset or
not; thus n binary choices are required to specify the subset.
Not only is this a simple formula to write down; it is easy to compute as well.
It can clearly be done by starting with 1 and doubling n times (that is, n integer
additions). Alternatively, it can be computed with at most 2 log2 n integer multi-
plications. (In other words, we can choose to have fewer but more complicated
operations.)
To see this, write n in base 2: n = 2a1 + 2a2 + · · · + 2ar , where a1 > · · · > ar .
i
Now we can compute 22 for 1 ≤ i ≤ a1 by a1 successive squarings (noting that
i+1
 
i 2 a ar
22 = 22 ); then 2n = (22 1 ) · · · (22 ) requires r − 1 further multiplications.
There is a simple recurrence relation for F(n) = 2n , namely

F(0) = 1, F(n) = 2F(n − 1) for n ≥ 1.

This expresses the calculation of 2n by n doublings. Another recurrence relation,


expressing the more efficient technique just outlined for computing 2n , is given by

2F(n − 1) if n is odd,
F(0) = 1, F(n) =
F(n/2)2 if n is even.

The ordinary generating function of the sequence (2n ) is

1
∑ 2nxn = 1 − 2x ,
n≥0

while the exponential generating function is

2n xn
∑ = exp(2x).
n≥0 n!

(I will use exp(x) instead of ex in these notes, except in some places involving
calculus.)
No asymptotic estimate is needed, since we have a simple exact formula. In-
deed, it is clear that 2n is a number with n log10 2 decimal digits.
Choosing a random subset, or generating all subsets in order, are easily achieved
by the following method. For each i ∈ {0, . . . , 2n − 1}, write i in base 2, producing
a string of length n of zeros and ones. Now j belongs to the ith subset if and only
if the jth symbol in the string is 1.
A procedure for moving from one set to the next can be produced using the
odometer principle, based on the odometer or mileage gauge in a car. Represent
a subset as above by a string of zeros and ones. To construct the next subset in
the list, first identify the longest substring of ones at the end of the string. If the

20:11:31, subject to the Cambridge


.002
4 Introduction

string consists entirely of ones, then it is last in the order, and we have finished.
Otherwise, this string is preceded by a zero; change the zero to a one, and the ones
following it to zeros. For example, for n = 3, the odometer principle generates the
strings
000, 001, 010, 011, 100, 101, 110, 111,
which correspond to the subsets

/ {3}, {2}, {2, 3}, {1}, {1, 3}, {1, 2}, {1, 2, 3}
0,

of {1, 2, 3}.
Notice that the binary strings are in lexicographic order, the order in which they
would appear in a dictionary, regarding them as words over the alphabet {0, 1}.
For 0 ≤ k ≤ n, the number of k-element subsets of {1, . . . , n} is given by the
binomial coefficient  
n n(n − 1) · · · (n − k + 1)
= .
k k(k − 1) · · · 1
The binomial coefficients are traditionally written
   in a triangular
 array where, for
n ≥ 0, the nth row contains the numbers n0 , n1 , . . . , nn . This is usually called
Pascal’s triangle, though, as we will see, it was not invented by Pascal. It begins
like this:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
The most important property, and the reason for the name, is the form of the
generating function for these numbers (regarded as a sequence indexed by k for
fixed n), the Binomial Theorem:
n  
n
∑ k xk = (1 + x)n.
k=0

Example: permutations A permutation of the set {1, . . . , n} is a rearrangement


of the elements of the set, that is, a bijective function from the set to itself. The
number of permutations of {1, . . . , n} is the factorial function n! , defined as usual
as the product of the natural numbers from 1 to n. This formula is not so satisfac-
tory, involving an n-fold product. It can be expressed in other ways, as a sum:
n  
n
n! = ∑ (−1)n−k k
(n − k)n ,
k=0

20:11:31, subject to the Cambridge


.002
1.1 What is counting? 5

or as an integral: ∞
n! = xn e−x dx.
0
Neither of these is easier to evaluate than the original definition. (We will meet
both these formulae later on.)
The recurrence relation for F(n) = n! is
F(0) = 1, F(n) = nF(n − 1) for n ≥ 1.
This leads to the same method of evaluation as we saw earlier.
The ordinary generating function for F(n) = n! fails to converge anywhere
except at the origin. The exponential generating function is 1/(1 − x), convergent
for |x| < 1.
As an example to show that convergence is not necessary for a power series to
be useful, let
−1
1 + ∑ n!xn = 1 − ∑ c(n)xn .
n≥1 n≥1
Then c(n) is the number of connected permutations on {1, . . . , n}. (A permutation
π is connected if there does not exist k with 1 ≤ k ≤ n − 1 such that π maps
{1, . . . , k} to itself.) This will be proved in the next chapter.
The approximate size of the factorial function is not obvious, as it was for
powers of 2. An asymptotic estimate for n! is given by Stirling’s formula:
√  n n
n! ∼ 2πn .
e
We give the proof later.
It is possible to generate permutations sequentially, or choose a random permu-
tation, by a method similar to that for subsets, using a variable base.
The set of permutations of {1, . . . , n} forms a group under the operation of
composition, the symmetric group of degree n, denoted by Sn .

Example: derangements A derangement is a permutation with no fixed points.


Let d(n) be the number of derangements of n.
There is a simple formula for d(n): it is the nearest integer to n!/e. (This is
one of the oldest formulae in combinatorics, having been proved by de Montmort
in 1713.) This is also satisfactory as an asymptotic expression for d(n); we can
supplement it with the fact that |d(n) − n!/e| < 1/(n + 1) for n > 0.
This formula is not very good for calculation, since it requires accurate knowl-
edge of e and operations of real (rather than integer) arithmetic. There are, how-
ever, two recurrence relations for d(n); the second, especially, leads to efficient
calculation:
d(0) = 1, d(1) = 0, d(n) = (n − 1)(d(n − 1) + d(n − 2)) for n ≥ 2;
d(0) = 1, d(n) = nd(n − 1) + (−1)n for n ≥ 1.

20:11:31, subject to the Cambridge


.002
6 Introduction

The ordinary generating function for d(n) fails to converge, but the exponential
generating function is equal to exp(−x)/(1 − x).
These facts will be proved in Chapter 4.
Since the probability that a random permutation is a derangement is about 1/e,
we can choose a random derangement as follows: repeatedly choose a random
permutation until a derangement is obtained. The expected number of choices
necessary is about e.

Example: partitions The partition number p(n) is the number of non-increasing


sequences of positive integers with sum n. There is no simple formula for p(n).
However, quite a bit is known about it:
• The ordinary generating function is
∑ p(n)xn = ∏ (1 − xk )−1.
n≥0 k≥1

• There is a recurrence relation:


p(n) = ∑(−1)k−1 p(n − k(3k − 1)/2),
where the sum is over all non-zero values of k, positive and negative, for
which n − k(3k − 1)/2 ≥ 0. Thus,
p(n) = p(n − 1) + p(n − 2) − p(n − 5) − p(n − 7) + p(n − 12) + · · · ,

where there are about 8n/3 terms in the sum.
These facts will be proved in Chapter 4.
The asymptotics of p(n) are rather complicated, and were worked out by Hardy,
Littlewood, and Rademacher:
1 √
p(n) ∼ √ eπ 2n/3
4n 3
(more precise estimates, including a convergent series representation, exist).

Example: set partitions The Bell number B(n) is the number of partitions of
the set {1, . . . , n}. Again, no simple formula is known, and the asymptotics are
very complicated. There is a recurrence relation,
n  
n−1
B(n) = ∑ B(n − k),
k=1 k − 1
and the exponential generating function is
B(n)xn
∑ n!
= exp(exp(x) − 1).
Based on the recurrence one can derive a sequential generation algorithm, which
calls itself recursively.

20:11:31, subject to the Cambridge


.002
1.2 About how many? 7

1.2 About how many?


As noted in the last section, if F and G are two functions on the natural numbers
which do not vanish, we write F ∼ G if F(n)/G(n) → 1 as n → ∞. If F(n) is the
solution to a counting problem and G(n) is a familiar analytic function, this tells
us roughly the size of the collection we are counting. For example, we mentioned
already that the number n! of permutations of a set of size n is given approximately
by Stirling’s formula
√  n n
n! ∼ 2πn .
e
Since n! is the product of n numbers each at most n, it is clear that n! ≤ nn ; the
asymptotic formula gives a much more precise estimate.
In Chapter 11 we will also introduce further notation for asymptotic analysis,
and in that chapter and the next we describe a variety of techniques for proving
such estimates.

1.3 How hard is it?


A formula like 2n (the number of subsets of an n-set) can be evaluated quickly
for a given value of n. A more complicated formula with multiple sums and prod-
ucts will take longer to calculate. We could regard a formula which takes more
time to evaluate than it would take to generate all the objects and count them as
being useless in practice, even if it has theoretical value.
Traditional computational complexity theory refers to decision problems, where
the answer is just ‘yes’ or ‘no’ (for example, ‘Does this graph have a Hamiltonian
circuit?’). The size of an instance of a problem is measured by the number of bits
of data required to specify the problem (for example, n(n − 1)/2 bits to specify
a graph on n vertices). Then the time complexity of a problem is the function f ,
where f (n) is the maximum number of steps required by a Turing machine to com-
pute the answer for an instance of size n. (A Turing machine is a simple theoretical
model of a computer which is capable of any theoretically-possible computation.)
To allow for variations in the format of the input data and in the exact specifi-
cation of a Turing machine, complexity classes are defined with a broad brush: for
example, P (or ‘polynomial-time’) consists of all problems whose time complex-
ity is at most nc for some constant c. (For more details, see Garey and Johnson,
Computers and Intractability.)
For counting problems, the answer is a number rather than a single Boolean
value (for example, ‘How many Hamiltonian circuits does this graph have?’).
Complexity theorists have defined the complexity class #P (‘number-P’) for this
purpose.
Even this class is not really appropriate for counting problems of the type we
mostly consider. Consider, for example, the question ‘How many partitions does

20:11:31, subject to the Cambridge


.002
8 Introduction

an n-set have?’ The input data is the integer n, which (if written in base 2) requires
only m = 1 + log2 n bits to specify. The question asks us to calculate the Bell
number B(n), which is greater than 2n−1 for n > 2, and so it takes time exponential
in m simply to write down the answer! To get round this difficulty, it is usual
to pretend that the size of the input data is actually n rather than log n. (We can
imagine that n is given by writing n consecutive 1s on the input tape of the Turing
machine, that is, by writing n as a tally rather than in base 2.)
We have seen that computing 2n (the number of subsets of an n-set) requires at
most log n integer multiplications. But the integers may have as many as n digits,
so each multiplication takes about n Turing machine steps. Similarly, the solution
to a recurrence relation can be computed in time polynomial in n, provided that
each individual computation can be.
On the other hand, a method which involves generating and testing every subset
or permutation will take exponentially long, even if the generation and testing can
be done efficiently.
A notion of complexity relevant to this situation is the polynomial delay model,
which asks that the time required to generate each object should be at most nc
for some fixed c, even if the number of objects to be generated is greater than
polynomial.
Of course, it is easy to produce combinatorial problems whose solution grows
faster than, say, the exponential of a polynomial. For example, how many inter-
secting families of subsets of an n-set are there? The total number, for n odd, lies
n−1 n
between 22 and 22 , so that even writing down the answer takes time exponential
in n.
We will not consider complexity questions further in this book.

1.4 Exercises
1.1 Construct a bijection between the set of all k-element subsets of {1, . . . , n}
containing no two consecutive elements, and the set of all k-element  subsets
 of
n−k+1
{1, . . . , n − k + 1}. Hence show that the number of such subsets is .
k
When the UK National Lottery was introduced in 1994, the draw consisted
of choosing six distinct numbers randomly from the set {1, . . . , 49}. What is the
probability that the draw contained no two consecutive numbers?

1.2 (a) In Vancouver in 1984, I saw a Dutch pancake house advertised ‘a thou-
sand and one combinations’ of toppings. What do you deduce?
(b) More recently McDonalds offered a meal deal with a choice from eight com-
ponents of your meal, and advertised ‘40 312 combinations’. What do you
deduce?

20:11:31, subject to the Cambridge


.002
1.4 Exercises 9

1.3 Prove the second formula for n! given in the text:



n! = xn e−x dx.
0

1.4 Let f (n) be the number of partitions of an n-set into parts of size 2.

(a) Prove that 


0 if n is odd;
f (n) =
1 · 3 · 5 · · · (n − 1) if n is even.

(b) Prove that the exponential generating function for the sequence ( f (n)) is
exp(x2 ).

(c) Use Stirling’s formula to prove that


 m
√ 2m
f (n) ∼ 2
e

for n = 2m.

1.5 Show that it is possible to generate all subsets of {1, . . . , n} successively in


such a way that each subset differs from its predecessor by the addition or removal
of precisely one element. (Such a sequence is known as a Gray code.)
This picture might help.
{1,3} {1,2,3}
 
  
{3}  
{2,3}

{1} {1,2}
 



 
0/ {2}

Remark Gray codes are used in analog-to-digital converters. Since only one
digit changes at a time when the input varies continuously, the damage caused by
an error in reading the changing digit is minimised.

1.6 Counting can be used to prove structural results, as in the following exercise,
which proves a theorem of Mantel: A graph with n vertices and more than n2 /4
edges must contain a triangle.
Consider a graph with n vertices, e edges and t triangles. Let xi be the number
of edges containing vertex i.

(a) Show by Inclusion–Exclusion that, if vertices i and j are joined, then at least
xi + x j − n triangles contain these two vertices.

20:11:31, subject to the Cambridge


.002
10 Introduction

(b) Hence show that


6t ≥ ∑ xi2 + ∑ x2j − 2ne.
i j

(c) Use the Cauchy–Schwarz inequality to show that

∑ xi2 ≥ 4e2/n.
i

(d) Deduce that


t ≥ 13 e(4e − n2 )/n.

(e) Hence show that, if e > n2 /4, the graph contains a triangle.

Remark The Cauchy–Schwarz inequality states that, if x1 , . . . , xn and y1 , . . . , yn


are two sequences of real numbers, then

2


n n n
∑ xiyi ≤ ∑ xi2 ∑ y2i .
i=1 i=1 i=1

Geometrically, the norm of the vector x = (x1 , . . . , xn ) is



1/2
n

x
= ∑ xi2 .
i=1

The Cauchy–Schwarz inequality says that the inner product of two vectors x and
y cannot exceed in modulus the product of the norms of the vectors. Indeed, the
ratio (x ·y)/
x
·
y
is equal to the cosine of the angle between x and y.
This is a remarkably useful inequality, in combinatorics as well as other branches
of mathematics.
Can you prove the inequality? [Hint: Calculate the squared norm of the vector
x + λy; this is a quadratic function of λ which can never be negative.]

1.7 (a) Find an iterative method for listing the k-subsets of the natural numbers
in reverse lexicographic order (that is, ordered by the largest element, and if
largest elements are equal then by the second largest, and so on). Thus, for
k = 4, the list begins

0123, 0124, 0134, 0234, 1234, 0125, . . .

Your method should give an algorithm for moving from any subset to the
next in the list.

20:11:31, subject to the Cambridge


.002
1.4 Exercises 11

(b) Show that, if a1 < · · · < ak , then the position of {a1 , . . . , ak } in the list is
given by      
a1 a2 ak
+ +···+ .
1 2 k
Can you describe the inverse of this function, which enables us to write down
the nth subset in the list?

20:11:31, subject to the Cambridge


.002
CHAPTER 2

Formal power series

Formal power series are central to enumerative combinatorics. A formal power


series is just an alternative way of representing an infinite sequence of numbers.
However, the use of formal power series introduces new techniques, especially
from analysis, into the subject, as we will see.
This chapter provides an introduction to formal power series and the opera-
tions we can do on them. Examples are taken from elementary combinatorics of
subsets, partitions and permutations, and will be discussed in more detail in the
next chapter. We also take a first look at the use of analysis for finding (exactly or
asymptotically) the coefficients of a formal power series; we return to this in the
last two chapters. The exponential, logarithmic and binomial series are of crucial
importance; we discuss these, but leave their combinatorial content until the next
chapter.

2.1 Fibonacci numbers


Leonardo of Pisa, also known as Fibonacci, published a book in 1202 on the use
of Arabic numerals, then only recently introduced to Europe. He contended that
they made calculation much easier than existing methods (the use of an abacus,
or the clumsy Roman numerals used for records). As an exercise, he gave the
following problem:
At the beginning of the year, I acquire a new-born pair of rabbits. Each
pair of rabbits produces a new pair at the age of two months and every
subsequent month. How many pairs do I have at the end of the year?
Let Fn be the number of pairs of rabbits at the end of the nth month. Then
F0 = 1 (given), and F1 = 1 (since the rabbits do not breed in the first month of

12
20:11:16, subject to the Cambridge
.003
2.1 Fibonacci numbers 13

life). Also, for n ≥ 2, we have


Fn = Fn−1 + Fn−2 ,
since at the end of the nth month, we have all the pairs who were alive a month
earlier, and also new pairs produced by all pairs at least two months old (that is,
those which were alive two months earlier).
From this recurrence relation, it is easy to calculate that
F2 = 2, F3 = 3, F4 = 5, F5 = 8, . . . , F12 = 233.
Fibonacci’s book was by no means the first occurrence of these numbers. This
representation of the Fibonacci numbers was discussed by Virahanka in the 6th
century, in connection with Sanskrit poetry. A vowel in Sanskrit can be long (guru)
or short (laghu). If we assume that a long vowel is twice as long as a short vowel,
in how many ways can we make a line of poetry of length n out of long and short
vowels? For example, the lines of length 4 are
GG, LLG, LGL, GLL, LLLL,
where G and L denote guru and laghu respectively.
Let Sn be the number of patterns of long and short vowels in a line of length n
(measured in units of the short vowel). We have S0 = 1 and S1 = 1. Moreover,
a line of length n ≥ 2 can be formed either by adding a short vowel to a line of
length n − 1, or by adding a long vowel to a line of length n − 2; all lines are
accounted for, and there is no overlap. So Sn = Sn−1 + Sn−2 for n ≥ 2. Now an
easy induction shows that Sn = Fn for all n ≥ 0.
Despite Virahanka’s precedence, the numbers Fn are usually referred to as Fi-
bonacci numbers.
Can we find a formula for the nth term Fn in this sequence? Doing so directly
is not easy. Instead, we construct the power series
F(x) = ∑ Fnxn = F0 + F1x + F2x2 + · · · .
n≥0

What is (1 − x − x2 )F(x)? Clearly this product has constant term 1, while the term
in x is (1)(1) + (−1)(1) = 0. For n ≥ 2, the term in xn is (1)Fn + (−1)Fn−1 +
(−1)Fn−2 = 0. In other words, we have
(1 − x − x2 )F(x) = 1,
so that F(x) = 1/(1 − x − x2 ).
This is an explicit formula for the power series; how can we turn it into a
formula for the coefficients? In this case, there are many ways to proceed; the
most elementary uses partial fractions. Write
1 − x − x2 = (1 − αx)(1 − β x),

20:11:16, subject to the Cambridge


.003
14 Formal power series

where α and β satisfy α + β = 1, αβ = −1. Thus √ α and β are √ the roots of


the quadratic x2 − x − 1 = 0, so we have α = (1 + 5)/2, β = (1 − 5)/2. The
number −β = α − 1 is the golden ratio. Putting φ = 1/α = α − 1, we see that
φ = (1 − φ )/φ . In other words, if a unit interval is divided into two pieces of
lengths φ and 1 − φ , then the ratio of the smaller to the larger is equal to the ratio
of the larger to the whole interval.
Now by the old-fashioned technique of partial fractions, we can write
1 A B
= + .
1−x−x 2 1 − αx 1 − β x
We can calculate A and B by clearing denominators and equating powers of x: thus

1 = A(1 − β x) + B(1 − αx),

so that

A + B = 1,
Aβ + Bα = 0.

The solution of these equations is


√ √
α 5+1 β 5−1
A= = √ , B= = √ .
α −β 2 5 β −α 2 5
Now 1/(1 − αx) is the sum of the geometric series

∑ (αx)n = 1 + αx + α 2x2 + · · · ,
n≥0

and similarly with β replacing α; so we find that

∑ Fnxn = ∑ (Aα n + Bβ n)xn.


n≥0 n≥0

Equating coefficients of powers of x gives



√ n+1
√ n+1
1 1+ 5 1 1− 5
Fn = Aα + Bβ = √
n n
−√ .
5 2 5 2

We have succeeded in finding a formula for the Fibonacci numbers. There are
several things to note about this formula. √
√ good asymptotic estimate. For α = (1+ 5)/2 is greater
First, it gives us a very
than 1, while β = (1 − 5)/2 is between 0 and −1 (in fact, α and β are approx-
imately 1.618 and −0.618 respectively), so, as n → ∞, α n grows exponentially
while β n decays exponentially to zero. Thus, Fn ∼ Aα n .

20:11:16, subject to the Cambridge


.003
2.1 Fibonacci numbers 15

Indeed, the second term in our formula above is always √ less than 1/2
√ in modu-
lus, so we can conclude that Fn is the nearest integer to (1/ 5)((1 + 5)/2)n+1 .
Second, the formula is all but useless for calculation. Evaluating it for n = 100
would require
√ doing two binomial expansions, cancelling half the terms, and then
knowing 5 to sufficient accuracy that we could evaluate the result to within an
integer. Using the recurrence relation, as Fibonacci did, is a much more efficient
method! We will see an even quicker method in Exercise 2.12, allowing the evalu-
ation of Fn in only 2 log n arithmetic operations with integers (though each of these
operations will take about n steps, since the integers have this many digits).
Third, it is almost always easier to prove properties of the Fibonacci numbers
using the recurrence relation than to use the formula.
Finally, you may feel a bit uneasy about the manipulations used in the argu-
ment. In analysis, you learn that these manipulations are justified if the series
converge absolutely; we did them with no regard to convergence, and the results
we obtain could be used to show that the series do converge. However, it all seems
a bit suspicious!
2.1.1 How do the Fibonacci numbers start?

Nobody doubts that the recurrence relation for the Fibonacci numbers is Fn =
Fn−1 + Fn−2 . But there is no general agreement on the ‘initial conditions’. There
are three fairly common conventions:

(a) F0 = 0, F1 = 1

(b) F0 = 1, F1 = 1

(c) F0 = 1, F1 = 2

Changing from one convention to another simply shifts the sequence by one or
two places, and requires a corresponding adjustment in the formula for the nth
Fibonacci number.
The second and third conventions are both rather natural if you believe that
the Fibonacci numbers count things. If, like Virahanka, you think that Fn is the
number of compositions of n made of 1s and 2s, then you will probably use the
second convention above; if you think that it is the number of zero-one sequences
with no two consecutive ones, then you will use the third convention.
The first convention has some remarkable properties. For a start, it satisfies
gcd(Fn , Fm ) = Fgcd(m,n) , so that in particular, if m divides n then Fm divides Fn .
A consequence is that Fn is prime only if n is prime (apart from one small case:
F2 = 1 with this convention, and F4 = 3). Thus, F3 = 2, F5 = 5, F7 = 13, . . . . There
is also the very curious property that F12 = 122 .

20:11:16, subject to the Cambridge


.003
16 Formal power series

What convention did Fibonacci himself adopt? He used his problem


about rabbits to demonstrate the superiority of the ‘arabic’ numerals
(then new to Europe) for calculation. The Wikipedia article on Fi-
bonacci gives a lovely illustration of a page from Fibonacci’s book
Liber Abaci which has a table of the Fibonacci numbers F0 , . . . , F12 ,
showing clearly that F12 = 377. (The table taken from this public do-
main image is shown on the right.) To obtain this value, Fibonacci
must have used convention (c) above. This is a little odd, because his
famous problem about the breeding rabbits seems to fit more naturally
with convention (b), as I did at the start of this chapter, which would
give F12 = 233.
I don’t know the solution to this little mystery!

2.2 Formal power series


The answer to a counting problem is a sequence a0 , a1 , a2 , . . . of non-negative
integers, where an is the number of objects we are counting based on a set of size n.
A glance at the On-line Encyclopedia of Integer Sequences will reveal that very
many interesting sequences arise in this way as counting problems.
A sequence is a single mathematical object with infinitely many terms. How-
ever, it is convenient to translate it into a different kind of mathematical object. A
formal power series is a series of the form
∑ anxn = a0 + a1x + a2x2 + · · · .
n≥0
We say that the term a0 is the constant term of the series, and that an xn is the term
of degree n.
The sequence and the corresponding formal power series convey exactly the
same information. But there are two enormous advantages to using power series.
First, we are going to define operations on formal power series: addition, mul-
tiplication, substitution, differentiation. These definitions would be unmotivated
and hard to remember if we just gave them for sequences; the power series make
it clear what the definitions should be.
Second, although none of the arguments we use to produce the power series
involve any calculus, it may happen that the power series (regarded as a series
in which x is a real or complex variable) converges in some non-trivial interval
or region. If so, it defines a complex analytic function, and we can apply all the
resources of analysis to it. These let us prove things which would not be available
in any other way.
Finally, we note that integers, complex numbers, etc., are not crucial to the
definitions which follow. All that we need is that we can add and multiply the
entries in the sequences, and a few simple rules are satisfied (the commutative,

20:11:16, subject to the Cambridge


.003
2.2 Formal power series 17

associative, and identity laws for addition and multiplication, the distributive law,
and the existence of additive inverses or negatives of all elements). In other words,
the entries should be taken from a commutative ring with identity.
We denote the set of all formal power series with coefficients in R, a fixed
commutative ring with identity, by R[[x]].
From this point of view, we can regard a polynomial with coefficients in R as a
formal power series, all of whose terms are zero from some point on. Thus the set
R[x] of polynomials can be identified as a subset (indeed, a subring) of R[[x]].
Now we come to the definitions. It is important to note that, even though we
write a formal power series as if it were an infinite sum, the definitions below
require no infinite processes or taking limits; everything we do will involve only
sums and products of finite numbers of terms in the sequences.

Addition Let A = ∑ an xn and B = ∑ bn xn be formal power series. We define their


sum to be
A + B = ∑(an + bn )xn .
In terms of the sequences, we simply add corresponding terms.

Scalar multiplication Similarly, to multiply a formal power series A = ∑ an xn


by a scalar r, we simply multiply every term by r:

rA = ∑(ran )xn .

Multiplication Let A = ∑ an xn and B = ∑ bn xn be formal power series. We define


their product to be AB = C = ∑ cn xn , where
n
cn = ∑ ak bn−k .
k=0

Note that calculating the term of degree n requires n + 1 multiplications and n


additions. The definition is natural: we obtain the term in xn in the product by
multiplying the term in xk in the first by the term in xn−k in the second for all
possible k, and summing the results. The corresponding operation on sequences is
often called convolution.

Proposition 2.1 Let R be a commutative ring with identity. Then the set R[[x]] of
formal power series over R, with the above operations, is also a commutative ring
with identity.

20:11:16, subject to the Cambridge


.003
18 Formal power series

We will not prove this result, which involves checking all the appropriate ax-
ioms for R[[x]], using the fact that they hold in R.
We can extend the definition of multiplication to give the product of a finite
number of formal power series in an obvious way.
As usual, we define A(x)n by repeated multiplication, or by induction:
A(x)0 = 1, A(x)n+1 = A(x)(A(x))n for n ≥ 0.

Substitution Let A = ∑ an xn and B = ∑ bn xn be formal power series, and suppose


that the constant term of B is zero, that is, b0 = 0. Now we define the result of
substituting B into A by
A(B(x)) = ∑ an B(x)n .
n≥0
We have to look more closely to see that this involves only finite operations. Since
the constant term of B is zero, an induction argument shows that all the terms in
Bm of degrees 0, 1, . . . , m − 1 are zero. So when we come to evaluate the term of
degree m in the infinite sum ∑ an Bn , there is no contribution from any terms Bm+1
or higher. So this term can be evaluated by calculating the powers of B up to Bm
and taking the appropriate linear combination of the terms.
As a very special case, the substitution rule applies with B(x) = x, and gives
∑ an xn its expected meaning.

Infinite product Under certain conditions, we can multiply together infinitely


many formal power series.
Suppose that A1 , A2 , . . . are formal power series. We make two assumptions:
(a) all the power series have constant term 1;
(b) there is a function s(n), satisfying s(n) → ∞ as n → ∞, such that the terms
of degree 1, 2, . . . , s(n) − 1 in An are all zero.
Now consider evaluating the infinite product. First note that the constant term
should be the (infinite) product of the constant terms in the series. But assumption
(a) means that all terms in this product are 1, so we take the constant term in the
product also to be 1. More generally, we are allowed to multiply together infinitely
many coefficients as long as all but finitely many of them are equal to 1; the product
is just the product of the finitely many terms which are not 1.
Now consider calculating the term of degree m in the infinite product. It is built
by choosing terms in the factors whose degrees sum to m in all possible ways,
multiplying them together, and adding up the result. But assumption (b) shows
that there are only finitely many series in which we can choose a non-zero term
which is not the constant term, since terms with degree greater than m are not
allowed. So the sum we have to evaluate will have only finitely many terms, and
the product is well-defined.

20:11:16, subject to the Cambridge


.003
2.2 Formal power series 19

Differentiation This operation sounds suspiciously like calculus, but all we take
from calculus is the rule for differentiating positive powers of x. We define an
operator D on formal power series by the rule that, if A = ∑ an xn , then DA =
∑ nan xn−1 ; in other words, the term of degree n in DA is (n + 1)an+1 xn . (We don’t
get a negative power of x since, as expected, the derivative of the constant term is
zero.)
As usual, we usually write d f /dx instead of D f (assuming that the variable in
the formal power series is x). But remember that no calculus is involved here!

Some examples

Example 1 Let A(x) = ∑ xn . We claim that (1 − x)A(x) = 1. The term of


degree n in (1 − x)A(x) is (1)(1) + (−1)(1) = 0 for n > 0; the constant term is 1.
So the claim is correct.
Naturally, we write A(x) = (1 − x)−1 , in agreement with the usual formula for
the sum of a geometric series. More generally,
(1 − cx)−1 = ∑ cn x n .
n≥0

Also A(x)2 = ∑ bn xn , where


n
bn = ∑ 1 · 1 = n + 1;
k=0

in other words, A(x)2 = 1 + 2x + 3x2 + . . . .

Example 2 The infinite product

∏ (1 + xn)
n≥1

satisfies the hypotheses above, so is defined as a formal power series. Suppose


that it is ∑ an xn . Then the rule above shows that an is obtained by selecting factors
(1+xk ) with k ≤ n for which the exponents add up to n, multiplying the coefficients
(these are all 1, so we end up with 1), and summing all these terms.
In other words,
an is the number of ways of writing n as a sum of distinct positive
integers.
For example, since
8 = 7 + 1 = 6 + 2 = 5 + 3 = 5 + 2 + 1 = 4 + 3 + 1,
we see that a8 = 6.

20:11:16, subject to the Cambridge


.003
20 Formal power series

Example 3 Suppose that A(x) = ∑ an xn is a formal power series with constant


term 1. Then there is a formal power series B(x), also with constant term 1, such
that A(x)B(x) = 1.
For let B(x) = ∑ bn xn . Then we have a0 b0 = 1, so b0 = 1. For n > 1 we have
n
∑ ak bn−k = 0,
k=0
so
n
bn = − ∑ ak bn−k .
k=1
This is a recurrence relation for bn ; if we know b0 , b1 , . . . , bn−1 , then we can cal-
culate bn . So finding the inverse of a formal power series is equivalent to solving a
special sort of recurrence relation; it is linear, and its coefficients are the negatives
of the terms in the first series, but unlike Fibonacci’s recurrence it is not in general
of fixed length.
Let us see a more elaborate example, which was introduced in Chapter 1. Part
of the point of this example is that the series that occur converge nowhere except
at the origin; so our subject is not simply a branch of analysis.
Let A(x) = ∑ n! xn . The coefficient of xn is the number of permutations of the
set {1, . . . , n}. Now say that a permutation π is connected if there is no number k,
with 1 ≤ k ≤ n − 1, such that π maps the set {1, . . . , k} into itself (and so also the
set {k + 1, . . . , n} to itself). Now we claim:
A(x)−1 = B(x) = 1 − ∑ Cn xn ,
n≥1
where Cn is the number of connected permutations of {1, . . . , n}.
Proof Let Cn be the number of connected permutations of {1, . . . , n}. Given any
permutation π, let k be the smallest number for which π maps the set {1, . . . , k}
into itself. Then k = n if and only if π is connected. In general, π is composed of a
connected permutation of {1, . . . , k} and an arbitrary permutation of {k + 1, . . . , n};
so the number of permutations with a given value of k is Ck (n − k)!. Summing, we
obtain
n
n! = ∑ Ck (n − k)!.
k=1
Rearranging this equation shows that the numbers Cn satisfy the recurrence relation
for the coefficients of A(x)−1 .

2.3 Variation and generalisation


As we have seen, a formal power series is a single object which is equivalent to
an infinite sequence (a0 , a1 , a2 , . . .) of numbers. We will say that the formal power
series A(x) = ∑ an xn is the generating function of the sequence, or g.f. for short.

20:11:16, subject to the Cambridge


.003
2.4 Relation with analysis 21

This name is not really accurate since, as we have seen, the concept of a formal
power series makes sense even when the series does not converge (and so does not
define an analytic function). A more accurate term would be generating power
series; this term is sometimes used, but ‘generating function’ is more common, so
we will stick to that.
Sometimes the series A(x) above is called the ordinary generating function,
abbreviated to o.g.f. This contrasts with the exponential generating function or
e.g.f., which is defined by
an x n
a(x) = ∑ ,
n≥0 n!

in other words the generating function of the sequence with nth term an /n!. Later
in this book we will see many examples, and motivation, for using the exponential
generating function in counting problems. The name comes from the fact that the
exponential generating function of the all-1 series is the exponential function:

xn
ex = ∑ n! .
n≥0

Note that the exponential generating function will converge in many cases where
the ordinary generating function does not.
Another variant is useful when, instead of a single sequence, we have a two-
variable array of numbers, say an,m , where n and m are integers and the points
(n, m) lie in some appropriate region of the first quadrant. We associate a formal
variable with each subscript (say x with n and y with m in this case), and define the
multivariate generating function

A(x, y) = ∑ an,m xn ym .
n,m

We will see an example in the next chapter, for the array of binomial coefficients.
This can be further varied, for example, we might take the ordinary generating
function in one variable and the exponential in the other, say

an,m xn ym
∑ n!
.
n,m

2.4 Relation with analysis


Our definitions of operations on formal power series were carefully designed
so that each coefficient is generated by finitely many additions or multiplications
of the coefficients of the constituent series; so no analysis is required for the defi-
nitions.

20:11:16, subject to the Cambridge


.003
22 Formal power series

Nonetheless, we often find that our series are actually convergent in some re-
gion of the complex plane, maybe even the whole plane. Let us just stop and
remind ourselves about convergence of complex power series.

Let A(x) = ∑ an xn be a power series with complex coefficients.


Then there is a number r (a non-negative real number or ∞) such that
• the series converges if |x| < r;
• the series diverges if |x| > r.
Here r = 0 means that the series diverges for all non-zero x, while
r = ∞ means that it converges for all x.
The number r is called the radius of convergence of the power
series. It is obviously unique.
If r > 0, then the series converges to a complex analytic function
for |x| < r. If r is finite, then this function has a singularity at some
point x with |x| = r.

For example, the geometric series ∑ cn xn converges for |x| < 1/|c|, and the limit
is equal to 1/(1 − cx) in this domain; it has a singularity (a simple pole) at x = 1/c.
Now, in analysis, one learns rules for addition and multiplication of convergent
series, and (under extra conditions) for infinite products, substitution, and differ-
entiation of power series. In every case, these definitions agree with the ones we
have given. So we have the following result:

Theorem 2.2 Suppose that a collection of formal power series over C converge in
the domain |x| < r, for some positive real number r. Then the formal power series
defined by addition, multiplication or differentiation of these series also converge
in this domain, and their limits are the sum, product or derivative of the limit
functions of the original series.

There are similar results for infinite products and substitution, but their state-
ments require a little more care. (In our earlier example of an infinite product, the
factors are polynomials and so converge everywhere, but it can be shown that the
product has radius of convergence 1.)
In other words, we can operate on formal power series with no consideration
of convergence; if the series happen to converge, then all our conclusions will be
correct for the limit functions of the series.
These theorems allow us to bring all the resources of analysis to bear on com-
binatorial counting problems. We will see examples of this later. First, here is a
very simple example of such a result.

Theorem 2.3 Let A(x) = ∑ an xn be a formal power series with non-negative coef-
ficients. Suppose that the radius of convergence of the series is r, and assume that
r > 0.

20:11:16, subject to the Cambridge


.003
2.5 Exponential, logarithmic and binomial series 23

(a) If r is finite, and c = 1/r, then the nearest singularity to the origin of the
limit function is at x = r, and for any ε > 0, we have

• an < (c + ε)n for n ≥ n0 (ε);


• an > (c − ε)n for infinitely many values of n.

(b) If r = ∞, then an = o(cn ) for any c > 1.

2.5 Exponential, logarithmic and binomial series


There are three special power series which occur in analysis, which are of great
importance in enumeration. First, the exponential series:
xn
exp(x) = ∑ n! ,
n≥0

or, more generally,


an x n
exp(ax) = ∑ .
n≥0 n!

Note that we write exp(x) rather than ex , to stress that we are thinking of it as a
formal power series. Its characteristic property is that it is equal to its derivative:
d
exp(ax) = a exp(ax).
dx
The exponential series also has a multiplicative property. This will be familiar
to you from analysis; we give a combinatorial proof here.
Proposition 2.4

exp(x + y) = exp(x) · exp(y).

Proof The nth term of the left-hand side is


n  
n n−k k
(x + y)n /n! = ∑ x y /n!
k=0 k
n
= ∑ (xn−k /(n − k)!) · (yk /k!).
k=0

(In the first line we use the Binomial Theorem to expand (x + y)n ; and in getting
from the first line to the second we use the formula
 
n n!
= .
k k! (n − k)!

20:11:16, subject to the Cambridge


.003
24 Formal power series

Now on the right we have exactly the terms of total degree n in the two variables
which arise from multiplying the two exponential series on the right. We see that
the multiplicative property of the exponential series is equivalent to the Binomial
Theorem for positive integer exponents.

The second type of series is the binomial series for arbitrary exponent. First we
generalise the definition of binomial coefficients as follows. Let a be an arbitrary
complex number, and n a non-negative integer. Define
 
a a(a − 1) · · · (a − n + 1)
= .
n n!

The numerator and denominator each have n factors, starting at a or n respectively


and decreasing by 1 at each step. For n = 0, as usual we take the empty product to
be 1, and define  
a
= 1.
0
If a is a non-negative integer, then the numerator includes a factor 0 for n > a, so
that the binomial coefficient is zero.
The binomial series with exponent a is defined to be the formal power series
 
a n
(1 + x)a = ∑ x .
n≥0 n

We see that, if a is a non-negative integer, the series is finite, and agrees with the
series (1 + x)a by the Binomial Theorem; so the definition is actually a theorem in
this case.
In general, the series converges for |x| < 1, and the sum can be shown to agree
with the analytic definition of powers with arbitrary exponent.
The exponent laws hold:

(1 + x)a · (1 + x)b = (1 + x)a+b ;


((1 + x)a )b = (1 + x)ab ;
(1 + x)a (1 + y)a = (1 + x + y + xy)a .

In the second and third equations, we use the substitution rule for formal power
series to evaluate ((1 + x)a )b or (1 + (x + y + xy))a . (In the first case, we let (1 +
x)a = 1 + u, where u is a formal power series with constant term zero; then, as we
have seen, the formal power series (1 + u)b is well-defined.)
We also have the familiar property of differentiation:

d
(1 + x)a = a(1 + x)a−1 .
dx

20:11:16, subject to the Cambridge


.003
2.6 Exercises 25

The third important formal power series is the logarithmic series

(−1)n−1 xn
log(1 + x) = ∑ n
.
n≥1

Again this series converges for |x| < 1, and the sum function agrees with the an-
alytic definition of the logarithm. Note that we use log(1 + x) rather than log x,
since log x has an essential singularity at the origin and so there is no Taylor series
expansion of it there.
We see that

(d/dx) log(1 + x) = ∑ (−1)nxn = (1 + x)−1.


n≥0

The logarithm is the inverse of the exponential function:

exp(log(1 + x)) = 1 + x,
log(1 + (exp(x) − 1)) = x.

Again, note that exp(x) − 1 has constant term zero and so can be substituted into
the logarithmic series.
There is some elaborate combinatorics underlying these two equations. Some
of this is discussed in an appendix to the next chapter.

2.6 Exercises
2.1 (a) Let (an ) be a sequence of integers, and (bn ) the sequence of partial sums
n
of (an ) (in other words, bn = ∑ ai). Suppose that the generating function
i=0
for (an ) is A(x). Show that the generating function for (bn ) is A(x)/(1 − x).
(b) Let (an ) be a sequence of integers, and let cn = nan for all n ≥ 0. Sup-
pose that the generating function for (an ) is A(x). Show that the generating
function for (cn ) is x(d/dx)A(x). What is the generating function for the
sequence (n2 an )?
(c) Use the preceding parts of this exercise to find the generating function for
n
the sequence whose nth term is ∑ i2, and hence find a formula for the sum
i=1
of the first n squares.

2.2 Suppose that a collection of complex power series all define functions analytic
in some neighbourhood of the origin, and satisfy some identity there. Are we
allowed to conclude that this identity holds between the series regarded as formal
power series?

20:11:16, subject to the Cambridge


.003
26 Formal power series

2.3 Suppose that A(x), B(x) and C(x) are the exponential generating functions of
sequences (an ), (bn ) and (cn ) respectively. Show that A(x)B(x) = C(x) if and only
n  
if
n
cn = ∑ ak bn−k ,
k=0 k
where  
n n!
= .
k k! (n − k)!

2.4 Let R be a commutative ring with identity, and let R[[x]] denote the set of
formal power series over R.
(a) Prove that, with the operations of addition and multiplication defined in this
chapter, R[[x]] is a commutative ring with identity.
(b) Prove that a formal power series ∑ an xn is a unit in R[[x]] (that is, has a
multiplicative inverse) if and only if its constant term a0 is a unit in R.
(c) Suppose that R is a field. Show that R[[x]] has a unique maximal ideal I,
consisting of all formal power series with zero constant term (and this ideal
is generated by x). What is R[[x]]/I?
(d) Suppose that R is a field. Describe all the ideals in R[[x]].

2.5 Prove that (d/dx) exp(ax) = a exp(ax) and (d/dx)(1 + x)a = a(1 + x)a−1 .

Exercises on Fibonacci numbers


In all these exercises except the last, we adopt the convention that F0 = F1 = 1.

2.6 Verify the following formula for the sloping diagonals of Pascal’s triangle:
n/2  
n−i
∑ i
= Fn .
i=0

2.7 (a) Prove that Fn+1 Fn−1 − Fn2 = (−1)n−1 for n ≥ 1.


(b) Prove that F2n = Fn2 + Fn−1
2 and F
2n+1 = Fn (Fn+1 + Fn−1 ) for n ≥ 1.

2.8 (a) Prove that the number of sequences of length n of zeros and ones which
have no two consecutive ones is Fn+1 for n ≥ 0.
(b) In how many ways can zeros and ones be arranged in n positions around a
circle so that no two ones are consecutive?

2.9 Find a recurrence relation which is satisfied by both sequences of alternate


Fibonacci numbers, that is, (F0 , F2 , F4 , F6 , . . .) and (F1 , F3 , F5 , . . .).

20:11:16, subject to the Cambridge


.003
2.6 Exercises 27

2.10 Let G(n) be the number computed in the following way. Write n as a com-
position (an ordered sum) of positive integers in all possible ways. For each ex-
pression, multiply the summands together; then add all the products formed in this
way. For example,

4 = 3 + 1 = 1 + 3 = 2 + 2 = 2 + 1 + 1 = 1 + 2 + 1 = 1 + 1 + 2 = 1 + 1 + 1 + 1,

so
G(4) = 4 + 3 + 3 + 4 + 2 + 2 + 2 + 1 = 21.
Prove that G(n) = F2n−1 .

2.11 In the previous exercise, instead of multiplying the summands, multiply fac-
tors 2d−2 for each summand d > 2. Show that the answer is F2n−2 .

2.12 Let A(n) be the 2 × 2 matrix given by


 
Fn Fn−1
A(n) =
Fn−1 Fn−2
 
1 1
for n ≥ 2, and let A(1) = .
1 0

(a) Prove that A(n)A(1) = A(n + 1) for n ≥ 1.


(b) Deduce that A(n) = A(1)n for n ≥ 1.
(c) Deduce the second part of Exercise 2.7.

2.13 Use the result of the preceding exercise to show that the Fibonacci number
F(n) can be calculated with only c log n arithmetic operations, for some constant
c.

2.14 By computing the coefficient of xm on the two sides of the identity



1
= ∑ ((a + b)x − abx2)n,
1 − (a + b)x + abx2 n=0

prove that
 
am+1 − bm+1 m/2 m − k
= ∑ (−ab)k (a + b)m−2k .
a−b k=0 k
By taking a and b to be the roots of the equation z2 − z − 1 = 0, deduce the
equality of two expressions for the Fibonacci numbers.
(I am grateful to Marcio Soares for this exercise.)

20:11:16, subject to the Cambridge


.003
28 Formal power series

2.15 This exercise explores some remarkable properties of the Fibonacci recur-
rence relation. I learned this (and more) from J. H. Conway; Clark Kimberling
also proved some of these results. There are further properties not discussed here!
(a) Show that any positive integer n can be written uniquely in the form
n = Fm1 + Fm2 + · · · + Fmk ,
where m1 , . . . , mk are positive integers (in increasing order) with no two con-
secutive.
(b) Define the Fibonacci successor function σ on the set of positive integers as
follows: if n is expressed as in the preceding part of the question, then
σ (n) = Fm1 +1 + Fm2 +1 + · · · + Fmk +1 .
Show that σ (σ (n)) = σ (n) + n for any positive integer n.
(c) Construct an array of positive integers as follows:
• The zeroth row consists of the Fibonacci numbers Fn for n ≥ 1: so this
row is (1, 2, 3, 5, . . .).
• The first element in any row after the zeroth is the smallest positive
integer which has not yet occurred in the table (so, for example, the
first number in the first row is 4). Subsequent elements in the row are
found by applying the Fibonacci successor function (so the first row
begins (4, 7, 11, 18, . . .)).
Prove that
• every positive integer occurs exactly once in the table;
• given any sequence (a1 , a2 , . . .) satisfying the Fibonacci recurrence re-
lation an+2 = an+1 + an , the terms of the sequence from some point on
agree with the entries in some row of the table.
(d) Extrapolate every row of the table backwards two places so that the Fi-
bonacci recurrence holds (so, for example, the zeroth row (1, 2, 3, . . .) is
preceded by (0, 1). Show that the first entry in the new nth row of the ta-
ble is n.
2.16 For this exercise, we adopt the convention that F0 = 0 and F1 = 1.
Prove that
(a) gcd(Fm , Fn ) = Fgcd(m,n) ;
(b) if m | n, then Fm | Fn ;
(c) if Fn is prime, then either n is prime or n = 4.
Is the converse of the last statement true?

20:11:16, subject to the Cambridge


.003
CHAPTER 3

Subsets, partitions and permutations

The basic objects of combinatorics are subsets, partitions and permutations. In


this chapter, we consider the problem of counting these. The counting functions
have two parameters: n, the size of the underlying set; and k, a measure of the
object in question (the number of elements of a subset, parts of a partition, or
cycles of a permutation respectively). The corresponding counting functions are
binomial coefficients and the two kinds of Stirling numbers; we study them and
their generating functions in this chapter. We also give a test for unimodality of
a finite sequence and apply it to the binomial coefficients and unsigned Stirling
numbers of both kinds.

3.1 Subsets
The number of k-element subsets of the set {1, . . . , n} is the binomial coefficient
  0 if k < 0 or k > n;
n
= n(n − 1) · · · (n − k + 1) if 0 ≤ k ≤ n.
k k(k − 1) · · · 1

For, if 0 ≤ k ≤ n, there are n(n − 1) · · · (n − k) ways to choose in order k distinct


elements from {1, . . . , n}; each k-element subset is obtained from k! such ordered
selections. The result for k < 0 or k > n is clear.
 
n
Remark The notation is an example of Karamata–Knuth notation. We will
k
see further examples when we meet the Stirling numbers. It is not universally pop-
ular among mathematicians: some people write n Ck instead. Probably a notation
like B(n, k) would be preferable, but this is unlikely to be generally adopted.

29
20:10:59, subject to the Cambridge
.004
30 Subsets, partitions and permutations

Proposition 3.1 The recurrence relation for the binomial coefficients is


         
n n n n−1 n−1
= = 1, = + for 0 < k < n.
0 n k k−1 k

Proof Partition the k-element subsets into two classes: those containing n (which
have the form  {n} ∪ L, where L is a (k − 1)-element subset of {1, . . . , n − 1}, and
so are n−1k−1 in number); and those not containing n (which are k-element subsets
n−1
of {1, . . . , n − 1}, and so are k in number).

The Binomial Theorem for natural number exponents n asserts:


n  
n
Proposition 3.2 (x + y)n = ∑ k xn−k yk .
k=0

Proof The proof is straightforward. On the left we have the product

(x + y)(x + y) · · · (x + y) (n factors);

multiplying this out we get the sum of 2n terms, each of which is obtained by
choosing y from a subset of the factors and x from the remainder. There are nk
subsets of size k, and each contributes a term xn−k yk to the sum, for k = 0, . . . , n.

Once we have the Binomial Theorem, alternative proofs of various facts about
the binomial coefficient become available. Here, for example, is a proof of Propo-
sition 3.1.

Proof We have
(x + y)n = (x + y)n−1 · (x + y).
 
n−k k n
The coefficient of x y on the left is . On the right, this term arises from
k
n−k
multiplying the term in x y k−1 in (x + y) n−1 byy, andalsofrom multiplying
 the
n − 1 n − 1
term xn−k−1 yk by x; so the resulting coefficient is + , as required.
k−1 k

The Binomial Theorem can be looked at in various ways. From none point of
view, it gives the generating function for the binomial coefficients k for fixed n:
 
n
∑ k yk = (1 + y)n.
k≥0

20:10:59, subject to the Cambridge


.004
3.1 Subsets 31

Since the binomial coefficients have two indices, we could ask for a two-variable
generating function:
 
n
∑ ∑ k xnyk = ∑ xn(1 + y)n
n≥0 k≥0 n≥0
1
= .
1 − x(1 + y)
If we expand this in powers of y, we obtain
1 1 1
= ·
(1 − x) − xy 1 − x 1 − (x/(1 − x))y
 
xk
= ∑ yk ,
k≥0 (1 − x)k+1

so that we have the following:


 
n n xk
Proposition 3.3 ∑ x = .
n≥k k (1 − x)k+1
Our next observation on the Binomial Theorem
  concerns Pascal’s triangle, the
triangle whose nth row contains the numbers nk for 0 ≤ k ≤ n. (Despite the name,
this triangle was not invented by Pascal but occurs in earlier Chinese sources.
Figure 3.11 shows the triangle as given in Zhu Shijie’s Siyuan Yujian, dated 1303.
Zhu’s name is sometimes transliterated as Chu Shi-Chieh, and his book as Ssu
Yuan Yü Chien.) The recurrence relation shows that each entry of the triangle is
the sum of the two above it.
At risk ofmaking
 the triangle asymmetric, we turn it into a matrix B = (bnk ),
where bnk = nk for n, k ≥ 0. This infinite matrix is lower triangular, with ones on
the diagonal. Now when two lower triangular matrices are multiplied, each term
of the product is only a finite sum: the (n, k) entry of BC is ∑m bnm cmk , and this is
non-zero only for k ≤ m ≤ n. In particular, we can ask ‘What is the inverse of B?’
The signed
n matrix of binomial coefficients is the matrix B∗ with (n, k) entry
(−1) n−k
k . That is, it is the same as B except that signs of alternate terms are
changed in a chessboard pattern. Now:
Proposition 3.4 The inverse of the matrix B of binomial coefficients is the matrix
B∗ of signed binomial coefficients.
Proof We consider the vector space of polynomials (over R). There is a natural
basis consisting of the polynomials 1, x, x2 , . . .. Now, since
 
n k
(1 + x) = ∑
n
x,
k k
1 Used under Creative Commons license by-sa 3.0, https://creativecommons.org/

licenses/by-sa/3.0/

20:10:59, subject to the Cambridge


.004
32 Subsets, partitions and permutations

Figure 3.1: Zhu Shijie’s triangle

we see that B represents the change of basis to 1, y, y2 , . . ., where y = 1 + x. Hence


the inverse of B represents the basis change in the other direction, given by x =
y − 1. Since  
n k
(y − 1)n = ∑(−1)n−k y,
k k
the matrix of this basis change is B∗ .
There is a huge literature on ‘binomial coefficient identities’. Some of these
are given as exercises to this chapter. Here is just one, for which we provide two
different proofs.
Proposition 3.5 (Vandermonde convolution) Let n, m, k be natural numbers. Then
    
m n n+m
∑ i k−i = k .

Proof The sum is over the finite number of values of i for which both the binomial
coefficients on the right are non-zero; that is, 0 ≤ i ≤ m and 0 ≤ k − i ≤ n.
 Consider
 the coefficient of xk in the expansion of (1 + x)m+n . This is clearly
m+n
. On the other hand, we can write
k
(1 + x)m+n = (1 + x)m (1 + x)n ,

20:10:59, subject to the Cambridge


.004
3.1 Subsets 33

so the coefficient of xk is obtained by summing over i the product of the coefficient


of xi in (1 + x)m and the coefficient of xk−i in (1 + x)n , giving the required formula.
Here is a ‘combinatorial’ proof. The right-hand side counts the number of k-
element subsets of a set of m + n objects. Suppose that m of these objects are
coloured red and the remaining n are blue. The  number
 ofways of choosing k
m n
objects of which i are red and the rest are blue is ; summing gives the
i k−i
result.

The other aspect of the Binomial Theorem is its generalisation to arbitrary real
exponents (due to Isaac Newton). This depends on a revised definition of the
binomial coefficients.
Let a be an arbitrary real (or complex) number, and k a non-negative integer.
Define  
a a(a − 1) · · · (a − k + 1)
= .
k k!
Note that this agrees with the previous definition in the case when n is a non-
negative integer, since if k > n then one of the factors in the numerator is zero. We
do not define this version of the binomial coefficients if k is not a natural number.
Now the Binomial Theorem asserts that, for any real number a, we have
 
a k
(1 + x)a = ∑ x. (3.1)
k≥0 k

Is this a theorem or a definition? If we regard it as an equation connecting real


functions (where the left-hand side is defined by

(1 + x)a = exp(a log(1 + x)), (3.2)

and the series on the right-hand side is convergent for |x| < 1), it is a theorem, and
was understood by Newton in this form. As an equation connecting formal power
series, we may follow the same approach, or we may instead choose to regard (3.1)
as the definition and (3.2) as the theorem, according to taste. Whichever approach
we take, we need to know that the laws of exponents hold:

(1 + x)a · (1 + y)a = (1 + (x + y + xy))a ,


(1 + x)a+b = (1 + x)a · (1 + x)b ,
(1 + x)ab = ((1 + x)a )b .

If (3.1) is our definition, these verifications will reduce to identities between bino-
mial coefficients; if (3.2) is the definition, they depend on properties of the power
series for exp and log, defined as in the last chapter.

20:10:59, subject to the Cambridge


.004
34 Subsets, partitions and permutations

3.1.1 Sampling
I have n distinguishable objects in a hat. In how many ways can I choose k of
them?
The answer depends on how the sampling is done. Two questions must be
resolved:

(a) Is the sampling with replacement (after each item is chosen, I note it down
and return it to the hat), or without replacement (an item once chosen is put
to one side and not used again)?
(b) Does the order in which items are chosen matter or not?

Sampling provides a link between combinatorics and elementary probability


theory, and also results in the informal name ‘permutations and combinations’ for
the subject (permutations and combinations being ordered or unordered samples).

Theorem 3.6 The number of ways of sampling k objects from a set of n is given in
the following table, where (n)k = n(n − 1) · · · (n − k + 1):

Order Order
significant not
 significant

k n+k−1
With replacement n
k 
n
Without replacement (n)k
k

 
n+k−1
Remark The number of samples with replacement and with order
k
not significant can be written as a negative binomial coefficient:
   
n+k−1 k −n
= (−1) .
k k

Proof Three of the entries of the table are straightforward. The one that requires
proof is the number of samples with replacement and with order not significant.
We calculate this by transforming the problem into another.

Step 1 The number of samples of k objects from n, with replacement and with
order not significant, is equal to the number of n-tuples (a1 , . . . , an ) of non-negative
integers with sum k.
We code a sample by the n-tuple whose ith entry ai is the number of occurrences
of the ith object in the sample. Clearly ai ≥ 0 and a1 + · · · + an = k. The bijection
reverses.

20:10:59, subject to the Cambridge


.004
3.1 Subsets 35
 
n+k−1
Step 2 The number of n-tuples of non-negative integers with sum k is .
k
To show this we construct a bijection between the set of n-tuples described and
the set of (n − 1)-element subsets of a set of size n + k − 1: note that
   
n+k−1 n+k−1
= .
n−1 k
Take n + k − 1 boxes in a row. Select n − 1 of them and place barriers in the
chosen boxes. Now let a1 be the number of empty boxes before the first barrier; ai
the number of empty boxes between the (i − 1)st and ith barriers, for 2 ≤ i ≤ n − 1;
and an the number of empty boxes after the (n − 1)st barrier. Clearly a1 , . . . , an are
non-negative and sum to k. Conversely, any such n-tuple can be encoded in this
way: place a barrier after a1 empty boxes; the next barrier after a2 further empty
boxes; and so on.
So the theorem is proved.
There is a bijective proof of the last part which gives further insight. We have
to show that, for unordered samples, the number of samples of k from n with
repetitions allowed is equal to the number of samples of k from n + k − 1 with
repetitions not allowed.
Take a sample of k numbers from {1, . . . , n}, say a1 , . . . , ak . Since the sample
is unordered, we can order it any way we choose; suppose that a1 ≤ a2 ≤ · · · ≤ ak .
Now for i = 1, . . . , k, let bi = ai + i − 1. Then it is clear that b1 , . . . , bk are all chosen
from {1, . . . , n + k − 1}. Also, b1 , . . . , bk are all distinct: for even if ai = ai+1 , say,
the corresponding bs are unequal since they have different numbers added to them.
[You should prove the assertion formally.] Moreover, the correspondence can be
reversed: if b1 , . . . , bk are distinct numbers from {1, . . . , n + k − 1}, arranged in
strictly increasing order, and ai = bi − i + 1 for i = 1, . . . , k, then a1 , . . . , ak are
chosen from {1, . . . , n}.
Since the sets of samples are bijective,  the number  of unordered samples from
n+k−1
{1, . . . , n} with repetitions allowed is .
k
Remark This result can be formulated in various ways.
(a) In how many ways can I distribute k identical sweets among n children? If
the ith childgets ai sweets,
 then ai ≥ 0 and a1 + · · · + an = k; so the number
n+k−1
of ways is .
k
(b) In how many ways can I distribute the sweets if it is required that each child
should have at least one sweet? First give each child one sweet,  and dis- 
k−1 k−1
tribute the remaining k − n sweets; this can be done in =
k−n n−1
ways.

20:10:59, subject to the Cambridge


.004
36 Subsets, partitions and permutations

(c) Given n commuting indeterminates x1 , . . . , xn , how many monomials of total


a1
 the form x1 · · · xn , where ai ≥ 0
degree k are there? Such a monomial has an

n+k−1
and a1 + · · · + an = k; so the number is .
k
Interchanging the roles of n and k, the result in (b) asserts that the number of
compositions of n with k parts
 (that is, expressions for n as an ordered sum of k
n−1
positive integers) is . Summing over k, the total number of compositions
k−1
n  
of n is
n−1
∑ k − 1 = 2n−1
k=1
(compare the introductory example in Chapter 4).

3.1.2 Digression: Computing binomial coefficients


The formula  
n n!
=
k k! (n − k)!
is compact to write down but is not good for calculation. If k is much smaller than
n, then we have to compute the huge number n! and divide it by the huge number
(n − k)! to come up with a much smaller answer. For example,
 
100 9332621544394415268169923885626670049071596826438162146859296389521759999322991560894146397615651828625369792082722375825118521091686400000000
=
3 6 × 961927596824821198533284259495636987123438139191729761581044773193337456124818754988058791755890726512612841896796781676470678323200000000

You see it won’t fit on the page, even at the smallest type size. The answer is
161700.
How can we find this more efficiently?
If k is small compared to n, the formula
 
n n(n − 1) · · · (n − k + 1)
=
k k!

uses only 2(k − 1) multiplications and one division. Even better is to do the multi-
plications and divisions alternately:
   
n n n−k+1
= · .
k k−1 k
This has k − 1 multiplications and the same number of divisions, but the numbers
being divided by are at most k and the numbers in the sum never grow too large.
Moreover, in the sequence
 
n n n−1 n−2
= × × ×···
k 1 2 3

20:10:59, subject to the Cambridge


.004
3.2 Partitions 37
 
n
doing multiplications and divisions alternately, after the lth division we have ,
l
so we get the intermediate ones too.  
n
If you have to work out all the binomial coefficients for fixed n, you can
k
use Pascal’s triangle. Only about n2 /2 additions are required, and additions are
quicker to perform than multiplications and divisions. Moreover, the number can
be roughly halved by using the symmetry of Pascal’s triangle:
   
n n
= .
k n−k
Binomial coefficients can be estimated by using Stirling’s formula. (See Exer-
cise 3.8, for example.)
The Central Limit Theorem from probability theory can also be used to get
estimates for binomial coefficients. Suppose that a fair coin is tossed n times.
n n
Then the probability of obtaining k heads is equal to k /2 . Now the number of
heads is a binomial random variable X; so we have
 
n
P(X = k) = 2n . (3.3)
k
According to the Central Limit Theorem, if n is large then X is approximated
by a normal random variable Y with the same expected value n/2 and variance
n/4. The probability density function of Y is given by
1
e−2(k−n/2) /n .
2
P(Y = y) = (3.4)
πn/2

If k = n/2 + c n and n → ∞, then a precise statement of the Central Limit
Theorem shows that (3.4) gives an asymptotic formula for (3.3). In particular,
when k = n/2, we obtain the result of Exercise 3.8.

3.2 Partitions
In this section, we see for the first time a distinction between ‘labelled’ and ‘un-
labelled’ structures, which will be discussed in more detail in Chapters 7 and 10.
A labelled structure of a certain type is simply a structure on the set {1, 2, . . . , n},
for some n. An unlabelled structure is an equivalence class of labelled structures,
where two structures are equivalent if one can be obtained from the other by some
permutation of the set {1, 2, . . . , n}.
For a rather trivial example, consider the case where our ‘structures’ are subsets
of the set in question. The number of labelled structures is simply the number of
subsets of {1, . . . , n}, which is 2n . Now two subsets are equivalent in the above

20:10:59, subject to the Cambridge


.004
38 Subsets, partitions and permutations

sense if and only if they have the same cardinality. So the number of unlabelled
subsets of an n-set is the number of possible cardinalities: the possibilities are
0, 1, 2, . . . , n, so the number is n + 1.
The Bell number B(n) is the number of partitions of the set {1, . . . , n}. This is a
count of labelled structures. Two partitions are equivalent if and only if the lists of
sizes of the parts, arranged in non-increasing order, are the same in the two cases.
(For if this holds, we may find a permutation mapping the ith part of one partition
to the ith part of the other, for all i.) So the ‘unlabelled’ counting number is p(n),
the partition number, which is the number of partitions of the number n (that is,
lists in non-increasing order of positive integers with sum n). Thus, given any set
partition, the list of sizes of its parts is a number partition; and two set partitions
are equivalent under relabelling the elements of the underlying set (that is, under
permutations of {1, . . . , n}) if and only if the corresponding number partitions are
equal.

3.2.1 Set partitions


The Stirling numbers of the second kind, denoted by S(n, k), are defined by the
rule that S(n, k) is the number of partitions of {1, . . . , n} into k parts if 1 ≤ n ≤ k,
and zero otherwise. Clearly we have
n
∑ S(n, k) = B(n),
k=1

where the Bell number B(n) is the total number of partitions of {1, . . . , n}.
 n By
 analogy with the binomial coefficients, Karamata proposed the notation
for S(n, k). This approach was championed by Knuth, and is sometimes
k
referred to as Karamata–Knuth notation.
Proposition 3.7 The recurrence relation for the Stirling numbers is
S(n, 1) = S(n, n) = 1, S(n, k) = S(n − 1, k − 1) + kS(n − 1, k) for 1 < k < n.

Proof We split the partitions into two classes: those for which {n} is a single part
(obtained by adjoining this part to a partition of {1, . . . , n − 1} into k − 1 parts),
and the remainder (obtained by taking a partition of {1, . . . , n − 1} into k parts,
selecting one part, and adding n to it). There are S(n − 1, k − 1) partitions in the
first class, and kS(n − 1, k) in the second.
Proposition 3.8 (a) The Stirling numbers satisfy the recurrence
n−1  
n−1
S(n, k) = ∑ S(n − i, k − 1).
i=1 i − 1

20:10:59, subject to the Cambridge


.004
3.2 Partitions 39

(b) The Bell numbers satisfy the recurrence


n  
n−1
B(n) = ∑ B(n − i).
i=1 i − 1

Proof Consider the part containing n of anarbitrary  partition with k parts; sup-
pose that it has cardinality i. Then there are n−1
i−1 choices for the remaining i − 1
elements in this part, and S(n − i, k − 1) partitions of the remaining n − i elements
into k − 1 parts. This proves (a); the proof of (b) is almost identical.

The Stirling numbers also have the following property. Let (x)k denote the
polynomial x(x − 1) · · · (x − k + 1).
n
Proposition 3.9 xn = ∑ S(n, k)(x)k .
k=1

Proof We prove this first when x is a positive integer. We take a set X with x
elements, and count the number of n-tuples of elements of x. The total number
is of course xn . We now count them another way. Given an n-tuple (x1 , . . . , xn ),
we define an equivalence relation on {1, . . . , n} by i ≡ j if and only if xi = x j .
If this relation has k different classes, then there are k distinct elements among
x1 , . . . , xn , say y1 , . . . , yk (listed in order). The choice of the partition and the k-
tuple (y1 , . . . , yk ) uniquely determines (x1 , . . . , xn ). So the number of n-tuples is
given by the right-hand expression also.
Now this equation between two polynomials of degree n holds for any positive
integer x, so it must be a polynomial identity.

We can find a generating function in terms of n:

Theorem 3.10 For k ≥ 1,

yk
∑ S(n, k)yn = (1 − y)(1 − 2y) · · · (1 − ky) .
n≥1

Proof We use induction on k. For k = 1, we have S(n, k) = 1 for all n; so


y
∑ S(n, 1)yn = y + y2 + y3 + · · · = 1 − y ,
n≥1

so the formula is true for k = 1.


Now suppose that it is true for k − 1. Let Fk (y) = ∑n S(n, k)yn , so the induction
hypothesis is Fk−1 (y) = yk−1 /(1 − y) · · · (1 − (k − 1)y).

20:10:59, subject to the Cambridge


.004
40 Subsets, partitions and permutations

Remember that we have the recurrence

S(n, k) = S(n − 1, k − 1) + kS(n − 1, k).

Multiplying this equation by yn and summing over n, we have

∑ S(n, k)yn − ky ∑ S(n − 1, k)yn−1 = y ∑ S(n − 1, k − 1)yn−1.


n≥1 n≥1 n≥1

Now in the terms involving S(n − 1, ∗), we first note that we can start the summa-
tion at n = 2 since the terms for n = 1 are zero; then use a new variable m = n − 1;
and finally replace the variable m by n. We get

Fk (y) − kyFk (y) = yFk−1 (y),

so that
y yk
Fk (y) = Fk−1 (y) = .
1 − ky (1 − y) · · · (1 − ky)
Stirling numbers are involved in the substitution of exp(x) − 1 for x in formal
power series. The result depends on the following lemma:
Lemma 3.11
S(n, k)xn (exp(x) − 1)k
∑ n!
=
k!
.
n≥k

Proof The proof is by induction on k, the result being true when k = 1 since
S(n, 1) = 1. Suppose that it holds when k = l − 1. Then (setting S(n, k) = 0 if
n < k) we have
(exp(x) − 1)l 1 (exp(x) − 1)l−1
= · (exp(x) − 1) ·
l! l (l − 1)!



1 xn S(n, l − 1)xn
=
l n≥1∑ n! · ∑ n!
.
n≥1

The coefficient of xn /n! here is


 
n! n−1 1 S(n − i, l − 1) 1 n−1 n
∑ i! · (n − i)! = l ∑ i S(n − i, l − 1)
l i=1 i=1
1
= (S(n + 1, l) − S(n, l − 1)),
l
using the recurrence relation of Proposition 3.8(a). Finally, the recurrence relation
of Proposition 3.7 shows that this is S(n, l), as required.

20:10:59, subject to the Cambridge


.004
3.2 Partitions 41

Proposition 3.12 Let (a0 , a1 , . . .) and (b0 , b1 , . . .) be two sequences of numbers,


with exponential generating functions A(x) and B(x) respectively. Then the fol-
lowing two conditions are equivalent:

(a) b0 = a0 and bn = ∑nk=1 S(n, k)ak for n ≥ 1;

(b) B(x) = A(exp(x) − 1).

Proof Suppose that (a) holds. Without loss of generality we may assume that
a0 = b0 = 0. Then
bn xn
B(x) = ∑
n≥1 n!
n
xn
= ∑ n! ∑ S(n, k)ak
n≥1 k=1
S(n, k)xn
= ∑ ak ∑ n!
k≥1 n≥k
ak (exp(x) − 1)k
= ∑ k!
k≥1
= A(exp(x) − 1),

by Lemma 3.11.
The converse is proved by reversing the argument.

Corollary 3.13 The exponential generating function for the Bell numbers is

B(n)xn
∑ n!
= exp(exp(x) − 1).
n≥0

Proof Apply Proposition 3.12 to the sequence with an = 1 for all n; or sum the
equation of Lemma 3.11 over k.

3.2.2 Number partitions


The partition number p(n) is the number of partitions of an n-set, up to permu-
tations of the set.
The key to evaluating p(n) is its generating function:

−1
∑ p(n)x n
= ∏1−x k
.
n≥0 k≥1

20:10:59, subject to the Cambridge


.004
42 Subsets, partitions and permutations

For (1 − xk )−1 = 1 + xk + x2k + · · ·. Thus a term in xn in the product, with coef-


ficient 1, arises from every expression n = ∑ ck k, where the ck are non-negative
integers, all but finitely many equal to zero. This number is p(n), since we can
regard n = ∑ ck k as an alternative expression for a partition of n.
We will use this in the next chapter to give a recurrence relation for p(n).

3.3 Permutations
A permutation of {1, . . . , n} is a bijective function from this set to itself.
In the nineteenth century, a more logical terminology was used. Such a func-
tion was called a substitution, while a permutation was a sequence (a1 , a2 , . . . , an )
containing each element of the set precisely once. Since there is a natural ordering
of {1, 2, . . . , n}, there is a one-to-one correspondence between ‘permutations’ and
‘substitutions’: the sequence (a1 , a2 , . . . , an ) corresponds to the function π : i → ai ,
for i = 1, . . . , n.
The correspondence between permutations and total orderings of an n-set has
profound consequences for a number of enumeration problems. For now we re-
turn to the usage ‘permutation = bijective function’. We refer to the sequence
(a1 , . . . , an ) as the passive form of the permutation π in the last paragraph; the
function is the active form of the permutation.
Following the conventions of algebra, we write a permutation on the right of its
argument, so that iπ is the image of i under the permutation π (that is, the ith term
of the passive form of π).
The set of permutations of {1, . . . , n}, with the operation of composition, is a
group, called the symmetric group Sn . Products, identity, and inverses of permuta-
tions always refer to the operations in this group.

3.3.1 Cycle structure


In order to treat permutations in a similar way to subsets and partitions, we
need a parameter to take the place of the cardinality of a subset, or the number of
parts of a partition. For this we must first explain the cycle structure and parity (or
sign) of a permutation.
A cycle is a permutation which, for some elements a1 , . . . , ar , maps
a1 → a2 → · · · → ar → a1
and fixes all other points (if any). A transposition is a cycle of length r = 2.
Proposition 3.14 Any permutation of {1, . . . , n} can be written as a product of a
pairwise disjoint collection of cycles, uniquely up to the order of the factors and
the choices of the starting points of the cycles.
Proof Take any point a ∈ {1, . . . , n}, and map it repeatedly until it returns to a

20:10:59, subject to the Cambridge


.004
3.3 Permutations 43

value previously visited. This point must be a, since any other point will already
have a pre-image, and we have a cycle. If not all points have been covered, choose
another point and repeat the procedure, producing a cycle disjoint from the first
(again, no overlap is possible since all points in previously found cycles already
have pre-images). Repeat until all points are included.

This is is called the cycle decomposition of the permutation. This provides us


with a compact notation for permutations. For example, the permutation which
maps x → 3x (mod 10), acting on {1, . . . , 9}, can be written in cycle notation
as (1, 3, 9, 7)(2, 6, 8, 4)(5). (Points fixed by the permutation constitute cycles of
length 1; they are commonly ignored in cycle notation, but for the considerations
here, it is important to include them!)
The parity of a permutation π of {1, . . . , n} is defined as the parity of n − k,
where k is the number of cycles in the cycle decomposition of π (including fixed
points). The sign of π is (−1)n−k , with n and k as above.
Parity and sign have various important algebraic properties. For example, it is
easy to see that every permutation can be written as a product of transpositions. For
using the cycle decomposition, it suffices to show that a cycle is such a product;
we have
(a1 , a2 , . . . , ar ) = (a1 , a2 )(a1 , a3 ) · · · (a1 , ar ).

Proposition 3.15 (a) The parity of π is equal to the parity of the number of
factors in any expression for π as a product of transpositions.
(b) Parity is a homomorphism from the symmetric group Sn to the group Z/(2)
of integers mod 2, and hence sign is a homomorphism to the multiplicative
group {±1}.
(c) For n > 1, these homomorphisms are onto; their kernel (the set of permuta-
tions of even parity, or of sign +1) is a normal subgroup of index 2 in Sn ,
called the alternating group An .

Proof The proof of the first part will be indicated; the rest of the proposition is
an exercise. Let π be a permutation, written as a product of disjoint cycles. Show
that, for any transposition τ = (a, b),
• if a and b lie in distinct cycles C1 and C2 of π, these two are stitched together
into a single cycle of πτ;
• conversely, if a and b lie in the same cycle of π, this cycle is cut apart into
two cycles of πτ.
So the number of cycles increases or decreases by 1, and the parity changes.
Now the empty product of transpositions is the identity permutation, which has
n cycles, and so even parity; every transposition changes the parity, so a product
of l transpositions has the same parity as l.

20:10:59, subject to the Cambridge


.004
44 Subsets, partitions and permutations

3.3.2 Unlabelled permutations


As for partitions, we can consider unlabelled or labelled permutations, that is,
permutations of an n-set or equivalence classes of permutations. We dispose of
unlabelled permutations first.
First we must explain what ‘unlabelled permutations’ are. Two permutations
π1 and π2 of {1, . . . , n} are equivalent if there is a bijection σ of {1, . . . , n} (that is,
a permutation!) such that, for all i ∈ {1, . . . , n}, we have

(iσ )π2 = jσ if and only if iπ1 = j,

in other words, iσ π2 = iπ1 σ for all i, so that π2 = σ −1 π1 σ . Thus, this equiva-


lence relation is the algebraic relation of conjugacy in the symmetric group; the
unlabelled permutations are conjugacy classes of Sn .
Now the following property holds:

Proposition 3.16 Two permutations are conjugate in the symmetric group if and
only if the lists of cycle lengths of the two permutations (written in non-increasing
order) are equal.

Thus equivalence classes of permutations correspond to partitions of the integer


n. This means that the enumeration theory for ‘unlabelled permutations’ is the
same as that for ‘unlabelled partitions’, discussed in the last section.

3.3.3 Labelled permutations


The number of permutations of {1, . . . , n} is given by the factorial function n!.
As in the case of subsets and partitions, we divide the permutations into classes
involving an auxiliary parameter k. This parameter will be the number of cycles in
the cycle decomposition. However, it is traditional to record the parity as well.
The Stirling numbers of the first kind are defined by the rule that s(n, k) is
(−1)n−k times the number of permutations of {1, . . . , n} having k cycles. (Note
that (−1)n−k is the common sign of these permutations.) Sometimes the number
of such permutations is referred to as the unsigned Stirling number, denoted by
u(n, k).
Clearly we have
n
∑ u(n, k) = n! .
k=1
Slightly less obviously,
n
∑ s(n, k) = 0
k=1
for n > 1. The algebraic proof of this depends on the fact that sign is a homo-
morphism to {±1}, so that the two values are taken equally often. We saw an

20:10:59, subject to the Cambridge


.004
3.3 Permutations 45

algebraic proof of this above. Here is a combinatorial translation. Composition


with a fixed transposition τ changes the sign of a permutation, so this map is a
bijection between the set of permutations with sign +1 and the set of those with
sign −1.
There is a Karamata–Knuth notation for unsigned Stirling numbers of the first
kind, analogous nto that for binomial coefficients and Stirling numbers of the second
kind: namely, for u(n, k).
k
Proposition 3.17 The recurrence relation for the Stirling numbers is

s(n, 1) = (−1)n−1 (n − 1)!, s(n, n) = 1,


s(n, k) = s(n − 1, k − 1) − (n − 1)s(n − 1, k) for 1 < k < n.

Proof We split the permutations into two classes: those for which (n) is a single
part (obtained by adjoining this cycle to a permutation of {1, . . . , n − 1} with k − 1
cycles), and the remainder (obtained by taking a permutation of {1, . . . , n − 1} with
k cycles and interpolating n at some position in one of the cycles). The second
construction, but not the first, changes the sign of the permutations.
To see that there are (n − 1)! permutations with a single cycle, note that if we
choose to start the cycle with 1 then the remaining n − 1 elements can be written
into the cycle in any order.

Note that, if we instead define s(n, 0) and s(n, n + 1) to be equal to 0 for n ≥ 1,


then the recurrence holds also for k = 1 and k = n. We use this below.
The generating function is given by the following result:
n
Proposition 3.18 ∑ s(n, k)xk = (x)n.
k=1

Proof The result is clear for n = 1. Suppose that it holds for n = m − 1.


m m m
∑ s(m, k)xk = ∑ s(m − 1, k − 1)xk − ∑ (m − 1)s(m − 1, k)xk
k=1 k=1 k=1
= (x − m + 1)(x)m−1
= (x)m .

Note that substituting x = 1 into this equation shows that ∑k s(n, k) = 0 for
n ≥ 2.

Corollary 3.19 The triangular matrices S1 and S2 whose entries are the Stirling
numbers of the first and second kinds are inverses of each other.

20:10:59, subject to the Cambridge


.004
46 Subsets, partitions and permutations

Proof Propositions 3.9 and 3.18 show that S1 and S2 are the transition matrices
between the bases (xn : n ≥ 1) and ((x)n n ≥ 1) of the space of real polynomials
with constant term zero.
Proposition 3.20 Let (a0 , a1 , . . .) and (b0 , b1 , . . .) be two sequences of numbers,
with exponential generating functions A(x) and B(x) respectively. Then the fol-
lowing two conditions are equivalent:
(a) b0 = a0 and bn = ∑nk=1 s(n, k)ak for n ≥ 1;
(b) B(x) = A(log(1 + x)).

Proof This is the ‘inverse’ of Proposition 3.12.


We have counted permutations by number of cycles. A more refined count is
by the list of cycle lengths.
Let ck (π) be the number of k-cycles in the cycle decomposition of π.
Proposition 3.21 The size of the conjugacy class of π in Sn is
n!
.
∏k kck (π) c k (π)!

Proof Write out the pattern for the cycle structure of a permutation with ck (π)
cycles of length k for all k, leaving blank the entries in the cycles. There are
n! ways of entering the numbers 1, . . . , n in the pattern. However, each cycle of
length k can be written in k different ways, since the cycle can start at any point;
and the cycles of length k can be written in any of the ck (π)! possible orders. So the
number of ways of entering the numbers 1, . . . , n giving rise to each permutation
in the conjugacy class is ∏ kck (π) ck (π)! .
The cycle index of the symmetric group Sn is the generating function for the
numbers ck (π), for k = 1, . . . , n. By convention it is normalised by dividing by n!.
Thus,
n
1 c (π)
Z(Sn ) = ∑ ∏ sk .
n! π∈Sn k=1 k
Because of the normalisation, this can be thought of as the probability generat-
ing function for the cycle structure of a random permutation: that is, the coefficient
of the monomial ∏ sak k (where ∑ kck = n) is the probability that a random permu-
tation π has ck (π) = ak for k = 1, . . . , n – this is
1
.
∏k kak ak !
One result which we will meet later is the following. We adopt the convention
that Z(S0 ) = 1.

20:10:59, subject to the Cambridge


.004
3.4 Lah numbers 47

sk
Proposition 3.22 ∑ Z(Sn ) = exp ∑ .
n≥0 k≥1 k

Proof The left-hand side is equal to


sak k sak k
∑ ∑ ∏ ak = ∑ ∏ ak
n≥0 ∑ a =n k≥1 k ak !
k a1 ,a2 ,... k≥1 k ak !
sak
= ∏∑ a
k≥1 a≥0 k a!
s 
= ∏ exp
k

k≥1 k


sk
= exp ∑
k≥1 k

as required. (The sum on the right-hand side of the first line is over all infinite se-
quences of natural numbers (a1 , a2 , . . .) with only finitely many entries non-zero.)
We will see much more about cycle indices in the chapter on orbit counting.

3.4 Lah numbers


The Lah numbers, sometimes called the ‘Stirling numbers of the third kind’,
can be defined by
n
L(n, k) = ∑ |s(n, m)|S(m, k).
m=k

Put (x)(n) = x(x + 1) · · · (x + n − 1). Then we have


n
(x)(n) = ∑ |s(n, m)|xm,
m=1
m
xm = ∑ S(m, k)(x)k ,
k=1

and so
n
(x)(n) = ∑ L(n, k)(x)k ,
k=1
by the rule for matrix multiplication. In other words, the Lah numbers express the
‘rising factorials’ (x)(n) in terms of the ‘falling factorials’ (x)n .
Now
(x)(n+1) = ∑ L(n, k)(x)k ((x − k) + (n + k))
= ∑(n + k)L(n, k)(x)k + ∑ L(n, k)(x)k+1,

20:10:59, subject to the Cambridge


.004
48 Subsets, partitions and permutations

so
L(n + 1, k) = (n + k)L(n, k) + L(n, k − 1),
with the convention that L(n, k) = 0 if k = 0 or k > n. Now it is straightforward to
show that  
n! n − 1
L(n, k) =
k! k − 1
is the unique solution of this recurrence relation with the appropriate boundary
conditions.
In other words, unlike the Stirling numbers, there is a closed form for the Lah
numbers in terms of factorials.

3.5 More on formal power series


The enumeration of subsets and partitions makes an unexpected appearance in
the rules for differentiating products and composites of formal power series. In
fact, the formulae below work as well for n-times differentiable functions in the
usual sense of calculus, since they depend only on the standard rules for differen-
tiating sums and products and the Chain Rule.
For brevity, we use f (n) (x) for the result of differentiating f (x) n times, and
write f  (x) for f (1) (x).

Products The standard product rule


   
d d d
( f (x)g(x)) = f (x) g(x) + f (x) g(x)
dx dx dx

extends to Leibniz’s rule:

Proposition 3.23
n   k   n−k 
dn n d d
( f (x)g(x)) = ∑ f (x) g(x) .
dxn k=0 k dxk dxn−k

Proof The proof is by induction. The n − 1st derivative is a sumof terms  where
n−1
f is differentiated k times and g n − k − 1 times, with coefficient . By the
k
product rule, terms in (Dk f )(Dn−k g) in Dn ( f g) arise by differentiating terms in
either (Dk−1 f )(Dn−k g) or (Dk f )(Dn−k−1 g), so the coefficient of this term is
     
n−1 n−1 n
+ = .
k−1 k k

20:10:59, subject to the Cambridge


.004
3.5 More on formal power series 49

Taking f (x) = eax and g(x) = ebx , we obtain


n  
n
n (a+b)x
(a + b) e =∑ (ak eax )(bn−k ebx ),
k=0 k
so  
n
n k n−k
(a + b) = ∑
n
ab ,
k=0 k
the Binomial Theorem for positive integer exponents. Similarly, taking f (x) = xa
and g(x) = xb , we obtain
n  
n
(a + b)(n) = ∑ a(k) b(n−k) .
k=0 k

Substitution The Chain Rule tells us that


d
( f (g(x))) = f  (g(x))g (x),
dx
where, to attempt to minimise confusion, I have used f  (x) for the derivative of
f (x) with respect to x, and f  (g(x)) for the result of substituting g(x) for x in this
derivative. As we have seen, the substitution of g into f is valid provided that
g(0) = 0.
The generalisation of this to repeated derivatives is Faà di Bruno’s rule.2 If
a1 , . . . , ak are positive integers with sum n, let P(n; a1 , . . . , ak ) be the number of par-
titions of {1, . . . , n} into parts of size a1 , . . . , ak . Also, we use f (k) (x) for Dk ( f (x)).
In the formula below, the summation is over all expressions for n as the sum of
positive integers a1 , . . . , ak .
Proposition 3.24
dn
dxn
( f (g(x))) = ∑ P(n; a1, . . . , ak ) f (k)(g(x))g(a1)(x) · · · g(ak )(x).
a1 +···+ak =n

Proof Again by induction. Suppose that we have a bijection between partitions


of {1, . . . , n} and terms in the nth derivative of f (g(x)). When we differentiate the
term f (k) (g(x))ga1 (x) · · · g(ak ) (x), corresponding to a partition of {1, . . . , n} into
parts of sizes a1 , . . . , ak , we obtain k + 1 terms:
• f (k+1) (g(x))ga1 (x) · · · g(ak ) (x)g (x), corresponding to the partition of {1, . . . , n+
1} in which n + 1 is a singleton part;
• f (k) (g(x))ga1 (x) · · · g(ai +1) (x) · · · g(ak ) (x), in which n + 1 is adjoined to the ith
part of the partition.
2 Faà di Bruno is possibly the only mathematician who is also a Roman Catholic saint.

20:10:59, subject to the Cambridge


.004
50 Subsets, partitions and permutations

So each partition of {1, . . . , n + 1} corresponds to a unique term in the sum, and


we are done.

For example, we have

n
Dn ( f (exp(x) − 1)) = ∑ S(n, k) f (k)(exp(x) − 1) exp(kx),
k=1

since the sum of P(n; a1 , . . . , ak ) over all (a1 , . . . , ak ) with fixed n and k is just the
number S(n, k) of partitions with k parts. Putting x = 0 we obtain the formula

n
bn = ∑ S(n, k)ak
k=1

relating the coefficients of f (x) and f (exp(x) − 1).

3.6 Unimodality
For the Stirling numbers of the second kind the recurrence is

S(n, k) = S(n − 1, k − 1) + kS(n, k),

so to get any particular value we take the value immediately above, multiply it by
its column number k, and add the value above and to the left:

1 1

1 3 1

1 7 6 1
↓1  ↓2  ↓3  ↓4 
1 15 25 10 1

For the unsigned Stirling numbers of the first kind the recurrence is

u(nk) = u(n − 1, k − 1) + (n − 1)u(n − 1, k),

so it works the same except that we multiply the value immediately above the one

20:10:59, subject to the Cambridge


.004
3.6 Unimodality 51

we want by its row number n − 1 instead of its column number:

1 1

2 3 1

6 11 6 1
↓4  ↓4  ↓4  ↓4 
24 50 35 10 1

In both cases, we notice that the numbers in a row seem to increase to a maxi-
mum and then decrease. We now examine this property.
Given a sequence of positive numbers, say a0 , a1 , a2 , . . . , an , we say that the
sequence is unimodal if there is an index m with 0 ≤ m ≤ n such that

a0 ≤ a1 ≤ · · · ≤ am ≥ am+1 ≥ · · · ≥ an .

Example For fixed n, the binomial coefficients


    
n n n
, ,...,
0 1 n

are unimodal. For we have


   
n n−k n
= ,
k+1 k+1 k
   
n n
so we have greater than, equal to or less than according as n − k is
k+1 k
greater than, equal to or less than k + 1; that is, according as k is less than, equal to
or greater than (n + 1)/2. So, if n = 2m, we have
         
n n n n n
< < ··· < > > ··· > ,
0 1 m m+1 n

while if n = 2m + 1, we have
           
n n n n n n
< < ··· < = > > ··· > .
0 1 m m+1 m+2 n

So the binomial coefficients increase to the middle and then decrease (remaining
constant for one step if n is odd).

20:10:59, subject to the Cambridge


.004
52 Subsets, partitions and permutations

This is all very well, but it depends on having a formula for the binomial coef-
ficients. We want to show that various other sequences are unimodal, so we need
to develop some machinery. Here is a simple but useful test.
The sequence a0 , a1 , a2 , . . . , an of positive integers is said to be log-concave if
a2k ≥ ak−1 ak+1 for 1 ≤ k ≤ n − 1. The reason for the name is that the logarithms
of the as are concave: setting bk = log ak , we have 2bk ≤ bk−1 + bk+1 , or in other
words, bk+1 − bk ≤ bk − bk−1 . So if we plot the points (k, bk ) for 0 ≤ k ≤ n, then
the slopes of the lines joining consecutive points decrease as k increases, so that
the figure they form is concave when viewed from above.

Theorem 3.25 A log-concave sequence is unimodal.

Proof We have a2k ≥ ak+1 ak−1 ; so (ak+1 /ak ) ≤ (ak /ak−1 ). So if ak ≤ ak−1 then
ak+1 ≤ ak . So the numbers ak increase until it first happens that ak ≤ ak−1 and then
decrease.
n
Theorem 3.26 Let P(x) = ∑ ak xk be the generating polynomial for the numbers
k=0
a0 , . . . , an . Suppose that all the roots of the equation P(x) = 0 are real and negative.
Then the sequence a0 , . . . an is log-concave.

Proof The proof goes by induction on n. If n = 1, then there are only two num-
bers, and trivially they form a log-concave sequence. We will look at the case
n = 2 before going on to the general case.
The coefficients of the polynomial P(x) are, by assumption, all positive, so
there cannot be a non-negative root. So our assumption is that the roots are all
real. Now for n = 2 we have P(x) = a0 + a1 x + a2 x2 ; this has real roots if and only
if its discriminant is non-negative, that is, if and only if a21 − 4a0 a2 ≥ 0; but this
implies that a21 ≥ a2 a0 , which is the definition of log-concavity!
Now we turn to the general case. Suppose that P(x) = (x + c)Q(x), where c > 0
and
Q(x) = bn−1 xn−1 + · · · + b1 x + b0 .
Now the polynomial Q(x) has all its roots real and negative, since they are all the
roots of P(x) except for −c. By the inductive hypothesis, the sequence b0 , . . . , bn−1
is log-concave; that is,
b2k ≥ bk−1 bk+1
for k = 1, . . . , n − 2. Also, since P(x) = (x + c)Q(x), we have a0 = cb0 , an = bn−1 ,
and ak = bk−1 + cbk for 1 ≤ k ≤ n − 1.
We first show that bk bk−1 ≥ bk+1 bk−2 for 2 ≤ k ≤ n − 2. For we have

b2k bk−1 ≥ bk+1 b2k−1 ≥ bk+1 bk bk−2 ;

20:10:59, subject to the Cambridge


.004
3.6 Unimodality 53

dividing by bk gives the result.


Now for 2 ≤ k ≤ n − 2, we have

a2k − ak+1 ak−1 = (bk−1 + cbk )2 − (bk + cbk+1 )(bk−2 + cbk−1 )


= (b2k−1 − bk bk−2 ) + c(bk−1 bk − bk+1 bk−2 ) + c2 (b2k − bk+1 bk−1 );

and all three terms are non-negative since c > 0.


We have to check also the cases k = 1 and k = n − 1. For k = 1 we have
a21 − a2 a0 = (b0 + cb1 )2 − (b1 + cb2 )cb0 ; for k = n − 1, we have a2n−1 − an an−2 =
(bn−2 + cbn−1 )2 − bn−1 (bn−3 + cbn−2 ). In each case, it is easy to check that the
expression is non-negative.
So the induction step is proved.

Example 1: Binomial coefficients By the Binomial Theorem, we have


n  
n
∑ k xk = (1 + x)n,
k=0

and the equation (1 + x)n = 0 has just the root −1 with multiplicity n. So the
binomial coefficients are log-concave and hence unimodal.

Example 2: Stirling numbers of the first kind Let u(n, k) be the number of
permutations of {1, . . . , n} having k cycles. We showed earlier that
n
∑ u(n, k)xk = x(x + 1) · · · (x + n − 1),
k=1

and the polynomial on the right has roots 0, −1, −2, . . . , −(n − 1). We can neglect
the zero root: the Stirling numbers start at k = 1 rather than zero, and dividing by
x simply changes the indexing so that they start at 0. So again the Stirling numbers
are log-concave and hence unimodal.

Example 3: Stirling numbers of the second kind Let S(n, k) be the number of
partitions of {1, . . . , n} into k parts. These numbers are also unimodal. The proof
is a little more difficult, but is a good showcase for some elementary real analysis
(Rolle’s Theorem).
We begin with the recurrence relation for the Stirling numbers of the first kind,
proved in Proposition 3.7:

S(n, 1) = S(n, n) = 1, S(n, k) = S(n − 1, k − 1) + kS(n − 1, k) for 1 < k < n.

Let
n
Pn (x) = ∑ S(n, k)xk .
k=0

20:10:59, subject to the Cambridge


.004
54 Subsets, partitions and permutations

We have P0 (x) = 1. For n > 0, we have S(n, 0) = 0, so zero is a root of Pn (x) = 0.


We have to show that the other roots are real and negative; then Theorem 3.26
above applies to Pn (x)/x. We prove this by induction: P1 (x) = x has a single root
at x = 0, while P2 (x) = x + x2 has roots at x = 0 and x = −1; so the induction
begins.
From the recurrence relation, we have
n
Pn (x) = ∑ S(n, k)xk
k=1
n n
= ∑ S(n − 1, k − 1)xk + ∑ kS(n − 1, k)xk
k=1 k=1
= x (dPn−1 (x)/dx + Pn−1 (x)) .

Putting Qn (x) = Pn (x)ex , we see that Pn (x) = 0 and Qn (x) = 0 have the same
roots. The identity above, multiplied by ex , gives

x dQn−1 (x)/dx = Qn (x).

By Rolle’s Theorem, there is a root of Qn (x) between each pair of roots of Qn−1 (x),
and one to the left of the smallest root of Qn−1 (x) (since Qn−1 (x) → 0 as x → −∞);
and also a a root at 0. This accounts for (n − 2) + 1 + 1 roots, that is, all the roots
of Qn (x). So the induction step is complete.

3.7 Appendix: Exponential and logarithm


The exponential and logarithmic series are inverses of each other, under the
operation of substitution: that is,

exp(log(1 + x)) = 1 + x.

We give here a combinatorial proof, rather than the usual analytic proof. We will
see that the proof ultimately rests on facts about the sign of a permutation.

First reduction We are trying to show that exp(log(1 + x)) = 1 + x as formal


power series, that is,
 2
  2
x − x2 + · · ·
x2
1+ x− +··· + + · · · = 1 + x.
2 2!
It is easy to work out the first few terms explicitly and check them. To prove the
result, we have to show that the coefficient of xn on the left-hand side is zero for
n > 1. We show first:

20:10:59, subject to the Cambridge


.004
3.7 Appendix: Exponential and logarithm 55

The coefficient of xn in exp(log(1 + x)) is


n
∑ (−1)n−k T (n, k)/k!,
k=1

where T (n, k) is calculated as follows: for each expression n = a1 +


· · · + ak as an ordered sum (a composition) of k positive integers, take
the product of the reciprocals of a1 , . . . , ak ; then add these products.
For example, if n = 4 and k = 2, there are three expressions, namely 1 + 3, 2 + 2,
3 + 1; so
1 1 1 11
T (4, 2) = + + = .
3 4 3 12
To see this note that the coefficient of xn in exp(log(1 + x)) is the sum (over k)
of its coefficient in (x − x2 /2 + · · ·)k , divided by k!. The latter has a coefficient,
for each expression n = a1 + · · · + ak , obtained by taking the coefficient of xai in
the ith factor. This coefficient is (−1)ai −1 /ai , and the product of these is (−1)n−k
times the product of the reciprocals of the ai , as required.

Expression in terms of permutations To show the required identity, we show


that
k! u(n, k)
T (n, k) = .
n!
For example, there are 11 permutations of {1, . . . , 4} with two cycles; eight of
these consist of a fixed point and a 3-cycle, and three are products of two 2-cycles.
Then 11 · 2!/4! = T (4, 2).
We actually prove a ‘local’ version. Suppose that b1 , . . . , bn are non-negative
integers with b1 + 2b2 + · · · + nbn = n and b1 + b2 + · · · + bn = k. We show that
the contribution to T (n, k) from expressions for n as a sum of b1 ones, b2 twos,
. . . is equal to k!/n! times the number of permutations with bi cycles of length i for
i = 1, . . . , n, which was computed earlier in Proposition 3.21.
For the contribution of such sums to T (n, k) is equal to the number of ways of
ordering the summands times the contribution from each summand. The number
of orderings is
k!
,
b1 ! b 2 ! · · · b n !
the denominator accounting to the fact that reordering identical summands does
not change the expression. Of course the value of each summand is
1
.
1b1 2b2· · · nbn
To count permutations, we write out the ‘pattern’ consisting of bi cycles of
length i, for i = 1, . . . , n. We can write the numbers 1, . . . , n into the pattern in

20:10:59, subject to the Cambridge


.004
56 Subsets, partitions and permutations

n! different ways. But each permutation arises in several different ways, for two
reasons: we may start each cycle at any point (giving a factor 1b1 2b2 · · · nbn ); and
we may rearrange the cycles of the same length (giving a factor b1 ! b2 ! · · · bn !). So
the number of such permutations is
n!
.
2 ! · · · n n bn !
1b 1 b ! 2b2 bb
1
By inspection, we see that the claim is proved.

Completion of the proof We have to evaluate


n
∑ (−1)n−k T (n, k)/k! .
k=1
By the result of the last section, this is equal to
n
1
∑ (−1)n−k u(n, k)/n! = n! ∑ sgn(π) = 0
k=1 π∈Sn

for n > 1, since there are equally many permutations with each sign.

3.8 Exercises
3.1 Write down Pascal’s triangle mod 2; that is, record only whether each entry
is odd or even. You should find that the triangle has a fractal structure; can you
explain why? [Exercise 3.6 below may help.]

3.2 (A few binomial coefficient identities.) Prove the following:


n  
k n
(a) ∑ (−1) = 0.
k=0 k
n  2  
n 2n
(b) ∑ = .
k=0 k n
n  2 
n 0   if n is odd,
(c) ∑ (−1)k = m 2m
k (−1) m if n = 2m.
k=0
3.3 Prove that the generating function for the central binomial coefficients is
 
2n
∑ n xn = (1 − 4x)−1/2,
n≥0

and deduce that   


n
2k 2(n − k)
∑ k n − k
= 4n .
k=0

20:10:59, subject to the Cambridge


.004
3.8 Exercises 57

Remark A bijective proof of the last equality is quite challenging!

3.4 This exercise gives atechnique


 which can in principle be generalised to sum
n
the binomial coefficients with k running over any arithmetic progression.
k
(a) Show that
n/2   (n−1)/2  
n n
∑ 2k
= ∑
2k + 1
= 2n−1 .
k=0 k=0

(b) By applying the Binomial Theorem (1 + i)n , where i is a square root of


√ to iπ/4
−1, and using the fact that 1 + i = 2e , find a formula for
n/4  
n
∑ 4k
.
k=0

(You should distinguish cases depending on the congruence of n modulo 8.)

3.5 Let p be a prime number.


 
p
(a) Show that is congruent to zero (mod p) for 1 ≤ k ≤ p − 1.
k
(b) Hence show that (x + y) p ≡ x p + y p (mod p).
(c) Deduce Fermat’s Little Theorem: n p ≡ n (mod p) for any natural number n.

3.6 Again let p be a prime number. Using the result of the previous exercise, show
the following. Suppose that n = ap + b and k = cp + d, with 0 ≤ b, d ≤ p − 1. By
computing the coefficient of xcp+d in (1 + x)ap+b , show that
    
ap + b a c
≡ (mod p).
cp + d b d

Deduce Lucas’ Theorem: If n = ar pr + ar−1 pr−1 + · · · + a0 and k = br pr +


br−1 pr−1 + · · · + b0 , where 0 ≤ ai , bi ≤ p − 1 for i = 0, . . . , r, then
      
n ar ar−1 a0
≡ ··· (mod p).
k br br−1 b0
 
n
In particular, show that is divisible by p if and only if bi > ai for some
k
value of i.

3.7 Deduce the Binomial Theorem by applying Taylor’s Theorem to the analytic
function (1 + x)a (for arbitrary real number a), using the standard formula for the
derivative of (1 + x)a .

20:10:59, subject to the Cambridge


.004
58 Subsets, partitions and permutations

3.8 Prove that, if n is even, then


 
2n n
≤ ≤ 2n .
n+1 n/2
Use Stirling’s formula to prove that
 
n 2n
∼ .
n/2 πn/2
How accurate is this estimate for small n?

3.9 Use the method of the preceding exercise, together with the Central Limit
Theorem, to deduce the constant in Stirling’s formula.

3.10 Prove directly that, if 0 ≤ k < n, then


     
m−k n m n−m n m
∑(−1) m k
= ∑(−1)
m k
= 0.
m m

3.11 Formulate and prove an analogue of Proposition 3.12 for binomial coeffi-
cients.

3.12 In how many ways can k identical sweets be distributed to n children if the
number xi of sweets given to the ith child is required to satisfy xi ≥ ai , for some
numbers a1 , . . . , an ?
 
n
3.13 Let B be the infinite matrix whose (n, k) entry is . What are the entries
k
of the matrix B2 ?

3.14 Let k1 , k2 , . . . , kr be non-negative integers with sum n. The multinomial co-


efficient is defined as
 
n n!
= .
k1 , k2 , . . . , kr k1 ! k2 ! . . . kr !
Prove that
(a) The number of ways of colouring elements  of an n-set with  colours c1 , . . . , cr
n
so that there are ki objects of colour ci is ;
k1 , k2 , . . . , kr
(b) If the elements are so coloured, and the elements of each colour are ordered,
the number of orderings ofthe whole setinducing the given ordering of the
n
elements of each colour is .
k1 , k2 , . . . , kr

20:10:59, subject to the Cambridge


.004
3.8 Exercises 59

Can you find a bijective proof that the numbers in the two parts are the same?

3.15 Prove the Multinomial Theorem:


 
n
(x1 + x2 + · · · + xr )n = ∑ xk1 xk2 · · · xrkr .
k1 , k2 , . . . , kr 1 2
k1 +k2 +···+kr =n

3.16 Let B(n) be the number of partitions of {1, . . . , n}. Prove that

n! ≤ B(n) ≤ n! .

3.17 Prove that log n! is greater than n log n − n + 1 and differs from it by at
most 12 log n. Deduce that
nn nn+1/2
n−1
≤ n! ≤ n−1 .
e e
3.18 Prove that    
n −n + k − 1
(−1)n−k =
k k
for 0 ≤ k ≤ n. Use this and Proposition 3.3 to prove the Binomial Theorem for
negative integer exponents.

3.19 (a) Prove Proposition 3.16.


(b) Prove Proposition 3.15.

3.20 Let A(x1 , . . . , xn ) be the polynomial in indeterminates x1 , . . . , xn given by

A(x1 , . . . , xn ) = ∏ (x j − xi ).
1≤i< j≤n

Prove that, if two of the indeterminates are transposed and the others are fixed,
then A(x1 , . . . , xn ) is mapped to its negative.
Hence show that, if we define a function s from the symmetric group to the
group of integers mod 2 by the rule that

A(x1π , x2π , . . . , xnπ ) = (−1)s(π) A(x1 , . . . , xn ),

then s is a group homomorphism, and s(π) = −1 if π is a transposition.


Hence show that, if n ≥ 2, then the set of elements π ∈ Sn for which s(π) = −1
is a normal subgroup of index 2 (that is, exactly half of the elements of Sn have
s(π) = −1). This normal subgroup is the alternating group An .

3.21 Prove that


s(n, k)xn (log(1 + x))k
∑ n!
=
k!
n≥k
for k ≥ 1. What happens when this equation is summed over k?

20:10:59, subject to the Cambridge


.004
60 Subsets, partitions and permutations

3.22 What is the relation between the numbers T (n, k) defined in Section 3.7 and
Stirling numbers?
3.23 A total preorder is a reflexive and transitive relation on a set X which satis-
fies the trichotomy law, that is, for any x, y ∈ X, either R(x, y) or R(y, x) holds.
(a) Show that the number of total preorders of an n-set is
n
P(n) = ∑ S(n, k)k! .
k=1

(b) Deduce that the exponential generating function for (P(n)) is 1/(2−exp(x)).

3.24 Prove that the number P(n) of total preorders on n points is given by the
formula
kn
P(n) = ∑ k+1 .
k≥1 2
n
[Hint: kn = ∑ S(n, i)(k)i .]
i=1
Show that the following method allows us to choose a random preorder on n
points uniformly:
(a) choose a positive integer k from the probability distribution K given by
kn
P(K = k) = ;
P(n)2k+1

(b) assign a random score s(x) ∈ {1, . . . , k} to each point x;


(c) put x ≤ y if and only if s(x) ≤ s(y).
(This method is due to H. Maassen and T. Bezembinder.)
3.25 (a) Prove the formula for the Lah numbers given in the text.
(b) Show that L(n, k) is the number of ways of partitioning the set {1, . . . , n}
into k non-empty parts and imposing a linear order on each part. (Contrast
this with the preorder numbers P(n) which count the number of partitions
with a linear order on the set of parts.)
3.26 Prove that the generating function for the central binomial coefficients is
 
2n
∑ n xn = (1 − 4x)−1/2,
n≥0

and deduce that   


n
2k 2(n − k)
∑ k n − k
= 4n .
k=1
[Note: Finding a counting proof of this identity is quite challenging!]

20:10:59, subject to the Cambridge


.004
3.8 Exercises 61

3.27 Find a formula for the number P(n; a1 , . . . , ak ) appearing in Faà di Bruno’s
formula.

3.28 (a) Let pn be the counting function for permutations on an even number
of points: that is, pn = n! if n is even, pn = 0 if n is odd. Show that the
exponential generating function of the sequence (pn ) is P(x) = (1 − x2 )−1 .
(b) Let n = 2m. Show that the number of permutations of {1, . . . , n} with all
cycles even is the square of the number of permutations with all cycles of
length 2. (Hint: if σ and τ are permutations with all cycles of length 2,
colour their cycles red and blue respectively, and produce a permutation with
all cycles even by following red and blue edges alternately. Show that every
pair (σ , τ) gives rise to 2c permutations, where c is the number of cycles of
length greater than 2, while every permutation with all cycles even and c of
length greater than 2 arises from 2c such pairs (σ , τ).)
(c) Deduce that, if en is the number of permutations of {1, . . . , n} with all cy-
cles even, then the exponential generating function for (en ) is E(x) = (1 −
x2 )−1/2 .
(d) Let on be the number of permutations of a set {1, . . . , n} with all cycles odd,
where n is even (that is, on = 0 if n is odd). Show that the exponential
generating function O(x) for the sequence (on ) satisfies E(x)O(x) = P(x),
by decomposing a permutation into the product of a permutation with all
cycles even and one with all cycles odd.
(e) Deduce that en = on for all even numbers n.
This demonstrates a result mentioned in the Preface.

Remark Can you find a bijective proof of the last assertion? [See the paper by
Richard Lewis and Simon Norton for a crib.]

3.29 Give a treatment of the identity

log(1 + (exp(x) − 1)) = x

similar to that for exp(log(1 + x)) = 1 + x in the appendix to this chapter.

3.8.1 A prize question


In the course, a prize was offered for the first solution to this question.

The following problem arises in the theory of clinical trials. A new


drug is to be tested out. Of 2n subjects in the trial, n will receive the
new drug and n will get a placebo. To avoid bias, it is important that
the doctor administering the treatments does not know, and cannot

20:10:59, subject to the Cambridge


.004
62 Subsets, partitions and permutations

reliably guess, which treatment each patient receives. The patients


enter the trial one at a time, and are numbered from 1 to 2n.
If the treatments were allocated randomly with probability 1/2, the
doctor’s guesses could be no better than random (so that the expected
values for the numbers of correct and incorrect guesses are both n);
but then the numbers of patients receiving drug and placebo would
be unlikely to be equal. Given that they must balance, the doctor can
certainly guess at least the last patient’s treatment correctly.
If we allocated the drug and the placebo randomly to patients 2i − 1
and 2i for i = 1, . . . , n, then the doctor can correctly guess the treatment
for each even-numbered patient.
Suppose that instead we choose a random set of n patients toallocate

the drug to, and the remaining n get the placebo; each of the 2nn sets
is equally likely. Suppose also that the doctor guesses according to the
following rule. If the number of patients so far having the drug and
the placebo are equal, he guesses at random about the next treatment.
If the drug has occurred more often than the placebo, he guesses that
the next treatment is the placebo, and vice versa if the placebo has
occurred more often than the drug.
Find a formula, and an asymptotic estimate, for the expected value of
the difference between the number of correct guesses and the number
of incorrect guesses that the doctor makes.

Solution We use the result of Problem 3.3 above, the identity


n   
2k 2(n − k)
∑ n−k
= 22n .
k=0 k

Following the hint, we first calculate the expected number of times during the
trial when the numbers of patients receiving drug and placebo are equal. This
is obtained by summing, over all n-element subsets A of {1, . . . , 2n}, the number  
of values of k for which |A ∩ {1, . . . , 2k}| = k, and dividing by the number 2n n
of subsets. Now the sum can be calculated by counting, for each value of k, the
number of n-subsets A for which |A ∩ {1, . . . , 2k}| = k, and summing the result
over k.  2(n−k)
For a given k, the number of subsets is 2k k n−k , since we must choose k
of the numbers 1, . . . , 2k, and n − k of the numbers 2k+ 1, . . . , 2n. Hence, by the
stated result, the sum is 22n , and the average is 22n / 2n
n .
Now consider the doctor’s guesses in any particular trial. At any stage where
equally many patients have received drug and placebo, he guesses at random, and
is equally likely to be right as wrong. Such points contribute zero to the expected

20:10:59, subject to the Cambridge


.004
3.8 Exercises 63

number of correct minus incorrect guesses. In each interval between two consec-
utive such stages, say 2k, and 2l, the doctor will guess right one more time than
he guesses wrong. (For example, if the 2kth patient gets the drug, then between
stages 2k + 1 and 2l the number of patients getting the drug is l − k − 1 and the
number getting the placebo is l − k, but the doctor will always guess the placebo.)
So the expected number of correct minus incorrect guesses is the number of such
intervals, which is one less than thenumber of times that the numbers√are equal.
2n
So the expected number is 2 / n − 1, which is asymptotically πn, by the
2n

result of Exercise 3.8.

20:10:59, subject to the Cambridge


.004
CHAPTER 4

Recurrence relations

A recurrence relation expresses the nth term of a sequence as a function of the


preceding terms. The most general form of a recurrence relation takes the form

un = Fn (u0 , . . . , un−1 ) for n ≥ 0.

Clearly such a recurrence has a unique solution. (Note that this allows the possi-
bility of prescribing some initial values, by choosing the first few functions to be
constant. Also, it is permissible for the function Fn to depend explicitly on n.)
In this chapter, we will describe the complete solution of linear recurrence rela-
tions of finite length with constant coefficients. For other types, we usually do not
give any general theory, but describe some important examples and methods for
solution. Two of these examples, the partition numbers and the Catalan numbers,
are of such importance that we devote a section to further study of each.
To begin, an example to show that the first recurrence relation we think of for
a sequence of numbers is not always the easiest!

Example: Compositions of an integer In how many ways is it possible to write


the positive integer n as a sum of positive integers, where the order of the sum-
mands is significant? (In the case where the order is not significant, we have a
partition of n; to distinguish the case where order is significant, we call such an
expression a composition of n.
For example, there are five partitions of 4, namely

4 = 3 + 1 = 2 + 2 = 2 + 1 + 1 = 1 + 1 + 1 + 1.

Of these, 3 + 1 can be re-ordered as 1 + 3, and 2 + 1 + 1 as either 1 + 2 + 1 or


1 + 1 + 2. So there are eight compositions of 4.

64
20:10:19, subject to the Cambridge
.005
4.1 Linear recurrences with constant coefficients 65

Let un be the number of compositions of n. One possible composition has a


single summand n. In any other expression, if n − i is the first summand, then
it is followed by an expression for i as an ordered sum, of which there are ui
possibilities. Thus
un = 1 + u1 + u2 + · · · + un−1 ,
for n ≥ 1. (When n = 1, this reduces to u1 = 1.) This is a recurrence relation which
determines un for all n ≥ 1.
Since
un−1 = 1 + u1 + u2 + · · · + uu−2 ,
the recurrence reduces to the much simpler form

un = 2un−1 for n > 1,

with initial condition u1 = 1. This obviously has the solution un = 2n−1 for n ≥ 1.
The simpler recurrence can be proved directly. Starting from a composition
of n − 1, we obtain two compositions of n: one by adding a summand 1 at the
beginning, and the other by increasing the first summand by 1. There is no overlap,
since the first construction gives all compositions beginning with 1, and the second
gives all beginning with a number greater than 1; moreover, every composition of
n is obtained from one or other construction.

4.1 Linear recurrences with constant coefficients


A sequence (un ) satisfies a linear recurrence with constant coefficients if there
is another sequence (an ) (for n ≥ 1) such that
n
un = ∑ anun−k
k=1

for all n ≥ n0 .
This can be expressed in terms of generating functions as follows. Let U(x) =
∑n≥0 un xn and A(x) = 1 − ∑n≥1 an xn .

Proposition 4.1 The sequence (un ) satisfies


n
un = ∑ anun−k
k=1

for all n ≥ n0 if and only if the generating functions defined above satisfy the
condition that U(x)A(x) is a polynomial of degree less than n0 .

Proof The recurrence expresses the condition that the coefficient of xn in U(x)A(x)
is zero for n ≥ n0 .

20:10:19, subject to the Cambridge


.005
66 Recurrence relations

4.1.1 Bounded recurrences


One type of linear recurrence which can be solved completely is of the form

un = a1 un−1 + a2 un−2 + · · · + ak un−k (4.1)

for n ≥ k, where the k values u0 , u1 , . . . , uk−1 are prescribed.


If we consider the recurrence (4.1) without the initial values, we see that sums
and scalar multiples of solutions are solutions. So, taking sequences over a field
such as the rational numbers, we see that the set of solutions is a vector space over
the field. Its dimension is k, since the k initial values can be prescribed abitrarily.
Thus, if we can write down k linearly independent solutions, the general solu-
tion is a linear combination of them.
We can find very easily the generating function for a solution of this recurrence,
as follows.
The characteristic polynomial of the recurrence (4.1) is defined to be the poly-
nomial
A(x) = 1 − a1 x − a2 x2 − · · · − ak xk .
Now we have the following result:

Theorem 4.2 Let (u0 , u1 , . . .) be a sequence of numbers, with generating function


∑ un xn = U(x), and let n0 be an integer satisfying n0 ≥ k. Then the following
conditions are equivalent:

(a) the sequence (un ) satisfies the recurrence relation (4.1) for n ≥ n0 ;
(b) A(x)U(x) is a polynomial of degree less than n0 , where A(x) is the charac-
teristic polynomial of (4.1).

Proof As in Proposition 4.1, the proof is immediate from the observation that the
relation (4.1) asserts that the coefficient of xn in A(x)U(x) is zero.

Corollary 4.3 If a sequence (un ) satisfies the recurrence (4.1) for all n ≥ k, then
its generating function is given by U(x) = P(x)/A(x), where A(x) is the character-
istic polynomial of the recurrence, and P(x) is an arbitrary polynomial of degree
less than k.

The k coefficients in P(x) are the independent parameters in the solution of


the recurrence, and can be found using the initial values u0 , . . . , uk−1 if these are
prescribed.
Now we want to use the generating function to find an explicit form for the
coefficients.

20:10:19, subject to the Cambridge


.005
4.1 Linear recurrences with constant coefficients 67

Theorem 4.4 Suppose that the recurrence relation (4.1) has characteristic poly-
nomial
A(x) = (1 − α1 x)m1 · · · (1 − αr x)mr ,
where α1 , . . . , αr are distinct complex numbers and m1 , . . . , mr are positive inte-
gers. (Thus, we have m1 + · · · + mr = k.) Suppose that the sequence (un ) satisfies
the relation (4.1) for all n ≥ k. Then

un = p1 (n)α1n + · · · + pr (n)αrn ,

where pi is a polynomial of degree at most mi − 1.

Remark The roots α1 , . . . , αr are the inverses of the roots of the characteristic
polynomial of the recurrence; so they are the roots of the ‘inverse polynomial’

xk − a1 xk−1 − a2 xk−2 − · · · − ak = 0.

Proof We have
P(x)
∑ unxn = U(x) = A(x) .
We use the technique of partial fractions to evaluate this fraction.
First, if the degree of P is less than k, we claim that
P(x) P1 (x) Pr (x)
= +···+ ,
A(x) (1 − α1 x)m 1 (1 − αr x)mr
where the degree of Pi is less than mi for i = 1, . . . , r.
To prove this, let

Ri (x) = ∏(1 − α j x)m j = A(x)/(1 − αi x)mi


j=i

for i = 1, . . . , r. The polynomials R1 (x), . . . , Rr (x) have greatest common divisor 1,


so by Euclid’s algorithm there exist polynomials S1 (x), . . . , Sr (x) such that

S1 (x)R1 (x) + · · · + Sr (x)Rr (x) = 1.

Multiplying by P(x), and putting Ti (x) = Si (x)P(x), we have

T1 (x)R1 (x) + · · · + Tr (x)Rr (x) = P(x).

Now let Pi (x) be the remainder when Ti (x) is divided by (1 − αi x)mi . Then

P1 (x)R1 (x) + · · · + Pr (x)Rr (x) ≡ P(x) mod A(x)

and since both left and right sides of this congruence have degree strictly less than
∑ mi = k, we have equality. Now dividing by A(x) gives the claimed result.

20:10:19, subject to the Cambridge


.005
68 Recurrence relations

Next we show that, if P(x) is a polynomial of degree less than m, then


m−1 cj
P(x)
(1 − αx)
= ∑
j=0 (1 − αx)
m j

for some uniquely determined numbers c0 , . . . , cm−1 . To see this, multiply both
sides by (1 − αx)m to obtain an equation between two polynomials, the right-hand
side involving the coefficients c0 , . . . , cm−1 ; equating coefficients of powers of x
from largest to smallest now determines these coefficients.
To conclude the proof, we observe that, by the Binomial Theorem with negative
exponent, we have
 
−j
(1 − αx)−j
= ∑ (−αx)n
n≥0 n
 
j+n−1
= ∑ (αx)n
n≥0 n
 
j+n−1 n n
= ∑ α x ,
n≥0 j−1
 
j+n−1
and the binomial coefficient is a polynomial of degree j − 1 in n.
j−1
Taking a linear combination of such expressions for j = 1, . . . , m gives a coefficient
P(n)α n , where P is a polynomial of degree at most m − 1.
An alternative proof is outlined in Exercise 4.1.
In particular, we see that for a recurrence of depth 2, that is, k = 2, there are
just two possibilities:
(a) the characteristic polynomial is (1 − αx)(1 − β x) with α = β , and the solu-
tion is un = Aα n + Bβ n ;
(b) the characteristic polynomial is (1 − αx)2 , and the solution is (An + B)α n .

Example Consider the recurrence un = 2un−1 − un−2 for n ≥ 2.


The characteristic polynomial is 1 − 2x + x2 = (1 − x)2 ; so the general solution
is un = An + B. The coefficients A and B could be determined from the values of
u0 and u1 if these were given.

Example: Fibonacci numbers Consider the Fibonacci recurrence


Fn = Fn−1 + Fn−2 for n ≥ 2.
The characteristic polynomial is
1 − x − x2 = (1 − αx)(1 − β x)

20:10:19, subject to the Cambridge


.005
4.1 Linear recurrences with constant coefficients 69

where α, β = (1 ± 5)/2. So the general solution is

Fn = Aα n + Bβ n ,

and A and B can be determined from the initial conditions.


If we take as initial conditions F0 = F1 = 1, we obtain the two equations

A + B = 1,
Aα + Bβ = 1.

Solving these equations gives the solution we found earlier.

4.1.2 Sequences with forbidden subwords


This section describes a method due to Guibas and Odlyzko for counting se-
quences of zeros and ones not containing a prescribed finite sequence as a consec-
utive subsequence.
Let a be a binary sequence of length k. How many binary sequences of length n
do not contain a as a consecutive subword?
Suppose, for example, that a = 11, so that we are counting binary strings
with no two consecutive ones. Let f (n) denote the number of such sequences
of length n, and let g(n) the number of sequences commencing with 11 but having
no other occurrence of 11. Then

2 f (n) = f (n + 1) + g(n + 1),

since if we take a string with no occurrence of 11 and precede it with a 1, then the
only possible position of 11 is at the beginning. Also, if we take a string with no
occurrence of 11 and precede it with 11, then the resulting sequence contains 11,
but possibly two occurrences (if the original string began with a 1); so we have

f (n) = g(n + 1) + g(n + 2).

Then f (n) = (2 f (n)− f (n+1))+(2 f (n+1)− f (n+2)), so we have the Fibonacci


recurrence
f (n + 2) = f (n) + f (n + 1).
Since f (0) = 1 = F1 and f (1) = 2 = F2 , a simple induction proves that f (n) = Fn+1
for all n ≥ 0.
Guibas and Odlyzko extended this approach to arbitrary forbidden substrings.
They defined the correlation polynomial of a binary string a of length k to be
k−1
Ca (x) = ∑ ca( j)x j ,
j=0

20:10:19, subject to the Cambridge


.005
70 Recurrence relations

where ca (0) = 1 and, for 1 ≤ j ≤ k − 1,



1 if a1 a2 · · · ak− j = a j+1 a j+2 · · · ak ,
ca ( j) =
0 otherwise.
Thus, for a = 11, we have Ca (x) = 1 + x.
Theorem 4.5 Let fa (n) be the number of binary strings of length n excluding the
substring a of length k. Then the generating function Fa (x) = ∑n≥0 fa (n)xn is given
by
Ca (x)
Fa (x) = k ,
x + (1 − 2x)Ca (x)
where Ca (x) is the correlation polynomial of a.
Proof We define ga (n) to be the number of binary sequences of length n which
commence with a but have no other occurrence of a as a consecutive subsequence,
and Ga (x) = ∑n≥0 ga (n)xn the generating function of this sequence of numbers.
Let b be a sequence counted by fa (n). Then for x ∈ {0, 1}, the sequence xb
contains a at most once at the beginning. So
2 fa (n) = fa (n + 1) + ga (n + 1).
Multiplying by xn and summing over n ≥ 0 gives
2Fa (x) = x−1 (Fa (x) − 1 + Ga (x)). (4.2)
Now let c be the concatenation ab. Then c starts with a, and may contain other
occurrences of a, but only at positions overlapping the initial a, that is, where
ak− j+1 · · · ak b1 · · · bk− j = a1 · · · ak . This can only occur when ca (k − j) = 1, and
the sequence ak− j+1 · · · ak b then has length n + j and has a unique occurrence of a
at the beginning. So
fa (n) = ∑ ga (n + j),
where the sum is over all j with 1 ≤ j ≤ k for which ca (k − j) = 1. This can be
rewritten
k
fa (n) = ∑ ca(k − j)ga(n + j),
j=1
or in terms of generating functions,
Fa (x) = x−kCa (x)Ga (x). (4.3)
Combining equations (4.2) and (4.3) gives the result.
In the case where a = 11, we obtain
1+x 1+x
F11 (x) = = ,
x2 + (1 − 2x)(1 + x) 1 − x − x2
so that f11 (n) = Fn + Fn−1 = Fn+1 , as previously noted.

20:10:19, subject to the Cambridge


.005
4.1 Linear recurrences with constant coefficients 71

4.1.3 Horizontally convex polyominoes


I am grateful to Thomas Müller for suggesting this example.
A polyomino with n cells (sometimes called an n-omino) is a figure formed
from n unit squares, which is connected in the sense that we can move from any
square to any other by a path which crosses edges of the squares not at a corner. A
polyomino is horizontally convex or HC if the cells in any row are all contiguous,
with no gaps. So a 3 × 3 block of unit squares is HC, but if we left out the centre
square it would not be.
We are going to count the HC polyominoes. The argument is quite long and
the manipulations are not written out in detail.
Let an be the number of HC polyominoes made up of n cells, and let f (x) be
its generating power series ∑ an xn . We make the convention here that a0 = 0, so
that the sum starts at n = 1. The sequence begins
1, 2, 6, 19, 61, 196, 629, 2017, 6466, 20727, 66441, 212980, 682721, . . .
In order to do the count, we introduce another parameter. Let bm,n be the num-
ber of HC polyominoes with n cells for which the bottom row consists of m cells.
Thus we have
n
an = ∑ bn,m,
m=1
with bn,n = 1 and bm,n = 0 if m > n. We let g(x) = ∑ ∑ mbm,n . (Here and later, the
double sum means over m and n, and the indices begin at 1.)
The crucial fact is that we can write down a recurrence relation for bm,n . If we
remove the bottom layer of a polyomino counted by bm,n , with m < n, we obtain
one counted by bi,n−m , for some i. There are m + i − 1 ways of putting the bottom
layer back, since the two layers must overlap. So
bm,n = ∑ (m + i − 1)bi,n−m
i≥1

for m < n.
We take the two-variable generating function
F(x, y) = ∑∑ bm,n xn ym .
We note that f (x) = F(x, 1), while g(x) = [(∂ /∂ y)F(x, y)]y=1 .
We separate the expression for F(x, y) into two parts: terms with n = m, and
terms with n = m (necessarily n > m). The first part is just
xy
xy + x2 y2 + · · · = .
1 − xy
The second part, which we shall call Σ, is

∑ bm,nxnym = ∑ ∑(m + i − 1)bi,n−m.


m<n m<n i

20:10:19, subject to the Cambridge


.005
72 Recurrence relations

We write Σ = Σ1 + Σ2 − Σ3 , where each term is a sum over m, n, i with m < n,


and the summands are mbi,n−m xn ym , ibi,n−m xn ym , and bi,n−m xn ym respectively. We
have

Σ1 = ∑ m(xy)m ∑ xn−m ∑ bi,n−m


m≥1 n>m i≥1
= ∑ m(xy) ∑ an−mx
m n−m
m≥1 n>m
xy
= f (x) ,
(1 − xy)2
using the Binomial Theorem with exponent −2. Also

Σ2 = ∑ (xy)m ∑ ibi,n−mxn−m
m≥1 n,i
xy
= g(x) ,
1 − xy
and

Σ3 = ∑ (xy)m ∑ bi,n−mxn−m
m≥1 n,i
xy
= f (x) .
1 − xy
So we get
 2
xy xy xy
F(x, y) = + f (x) + g(x).
1 − xy 1 − xy 1 − xy
Putting y = 1, we obtain
 2
x x x
f (x) = + f (x) + g(x).
1−x 1−x 1−x
Differentiating and putting y = 1, we obtain

x 2x2 x
g(x) = + f (x) + g(x).
(1 − x)2 (1 − x)3 (1 − x)2
We now have two equations for f (x) and g(x), which we can solve to obtain

x(1 − x)3
f (x) = .
1 − 5x + 7x2 − 4x3
By reversing the proof of Theorem 4.2, we conclude that the number an of HC
polyominoes with n cells satisfies the recurrence relation

an = 5an−1 − 7an−2 + 4an−3

20:10:19, subject to the Cambridge


.005
4.1 Linear recurrences with constant coefficients 73

for n ≥ 5. (Remember from the proof that the recurrence relation holds for n at
least one greater than the degree of the polynomial in the numerator.)
It is worth spending a little while trying to deduce this recurrence relation di-
rectly from the definition of an . You will probably not succeed; no such direct
proof is known.

4.1.4 C-finite sequences


This section is based on a survey article by Doron Zeilberger [20]. C-finite
sequences are those which satisfy recurrence relations with constant coefficients.
They have a number of remarkable properties, which yield a method for showing
that two sequences are equal, by a finite amount of computation. We illustrate with
one of Zeilberger’s examples.
Let a = (an ) be a sequence of rational numbers. We define the shift σ a by
moving each term one place left, deleting the first term. Then for a positive integer
k, σ k a denotes the sequence obtained by shifting k times, with σ 0 a = a.
Proposition 4.6 The following conditions on the sequence a are equivalent:
(a) a satisfies a recurrence relation with constant coefficients;
(b) the generating function f (x) of a is a rational function (the quotient of two
polynomials), where the denominator has non-zero constant term;
(c) there is a finite-dimensional subspace of the space of all rational sequences
which contains a and all of its shifts.
Proof We have seen the equivalence of (a) and (b) in Theorem 4.2.
If (a) holds, where the recurrence has d + 1 terms (that is, has the form
d
an = ∑ αi an−i
i=1

for n ≥ d), then σ da = ∑di=1 αi σ d−i a,so that σ d a lies in the span of the sequences
a, σ a, . . . , σ d−1 a. By an easy induction, σ n a lies in this subspace for all n ≥ d, and
(c) holds.
Conversely, if (c) holds, then we may assume that the subspace is spanned by
finitely many shifts of a. So σ d a is a linear combination of a, σ a, . . . , σ d−1 a for
some d, and a satisfies a (d + 1)-term recurrence with constant coefficients.
We denote the subspace spanned by the shifts of a by S(a).
A C-finite sequence is one which satisfies the three equivalent conditions of the
proposition. Its degree can be defined as the smallest d such that the sequence
satisfies a (d + 1)-term recurrence; the smallest degree of the denominator of a
rational function representing the generating function; or the dimension of the
vector space spanned by the shifts of a.
From this, we see immediately:

20:10:19, subject to the Cambridge


.005
74 Recurrence relations

Proposition 4.7 The sum of two C-finite sequences is C-finite; its degree is at most
the sum of the degrees of the two sequences.

Proof Clearly a, b ∈ S(a) + S(b) (where the sum is taken in the space of all se-
quences); and so a + b ∈ S(a) + S(b), a finite-dimensional vector space. Clearly
all shifts of a + b also lie in this space.

Note that the C-finite sequences form a vector space over Q, since scalar mul-
tiplication clearly takes a C-finite sequence to one of the same degree.

Corollary 4.8 Let a and b be two C-finite sequences with degrees d and e respec-
tively, and suppose that the first d + e terms of a and b agree. Then a = b.

Proof a − b is a C-finite sequence of degree at most d + e whose first d + e terms


are zero; so a − b is identically zero.

The power of this test is increased by the following result. The pointwise prod-
uct a ◦ b of two sequences a = (an ) and b = (bn ) is the sequence whose nth term
is an bn .

Proposition 4.9 (a) Let a and b be two C-finite sequences with degrees d and e
respectively. Then a ◦ b is a C-finite sequence with degree at most de.
(b) Let a be a C-finite sequence with degree d. Then a ◦ a is a C-finite sequence
with degree at most d(d + 1)/2.
(c) More generally, if a is C-finite with degree d, then the
 sequence
 of k-th pow-
d +k−1
ers of elements of a is C-finite with degree at most .
k

Proof (a) We consider the set of all infinite matrices (with rows and columns
indexed by the natural numbers) such that each row satisfies the (d + 1)-term re-
currence defining a and each column satisfies the (e + 1)-term recurrence defining
b. It is easy to see that this set is a rational vector space. Moreover, any such ma-
trix is completely determined by the de entries in the first e rows and d columns,
so the vector space has dimension de.
A particular matrix lying in this space has entry bi a j in row i and column j.
All its simultaneous shifts (move everything one place up and to the left, deleting
the first row and column) also belong to this space. Now consider the linear map
which ‘projects’ the vector space onto the diagonal (that is, it maps any matrix to
the sequence of entries on the diagonal). This map is linear, and so its dimension
is at most de. Projecting the matrix with entries bi a j and its shifts by the same
horizontal and vertical amount onto the diagonal, we see that the product sequence
and all its shifts are contained in a space of dimension at most de. The result
follows.

20:10:19, subject to the Cambridge


.005
4.1 Linear recurrences with constant coefficients 75

(b) The proof is similar, except that we can use the space of symmetric matrices
whose rows and columns satisfy the recurrence. To specify such a matrix, we only
need to give the d(d + 1)/2 entries on and above the diagonal in the top left d × d
square.
(c) In the argument in part (b) above, instead of using a matrix, which is a
‘2-dimensional array’, we use a ‘k-dimensional array’. The space of completely
symmetric k-dimensional arrays of side d has dimension equal to the number of
selections of k things from {1, . . . , d} with repetition allowed and order unimpor-
tant.

Here is another closure property of C-finite sequences.

Proposition 4.10 Let a = (an ) be a C-finite sequence of degree d. Then the sum
sequence s = (sn ), where sn = ∑ni=0 ai , is C-finite of degree at most d + 1.

Proof Let F(x) be the generating function of a, a rational function whose de-
nominator has degree d (and non-zero constant term). The sum sequence s is the
convolution of a with the all-1 sequence, whose generating function is 1/(1 − x);
so the generating function for s is f (x)/(1 − x), a rational function with denomi-
nator of degree at most d + 1.

We can use our knowledge of C-finiteness to establish formulae for sequences


with a finite amount of computation. Here is a simple example.

Example The sum of the first n Fibonacci numbers is Fn+2 − 1.


To prove this, we observe that the Fibonacci sequence is C-finite of degree 2, so
its sum sequence is C-finite of degree at most 3; also the right-hand side is C-finite
of degree at most 3 (it is the sum of the Fibonacci sequence, of degree 2, and a
constant sequence, of degree 1). So to prove the assertion, it suffices to verify that
the first six values of the two sequences agree.
In this case it is not too hard to prove the result directly; the point is that, in the
above argument, no thinking is required, the verification is purely mechanical.

Example: Domino tiling of a frame. Donald Knuth, in the Mathematics Mag-


azine, posed the problem: For n ≥ 2, consider the figure obtained from a square
of side n + 2 by removing a square of side n − 2 with the same centre and sides
parallel to those of the original square. In how many ways can this figure be tiled
with 1 × 2 dominoes, which can be placed in either orientation?
Zeilberger, in the cited article, describes this example in detail. The answer is
4(2Fn2 + (−1)n )2 , where Fn is the nth Fibonacci number. Several people gave an
ingenious proof of this. However, once the formula has been guessed, and it has
been checked that both sides of the equality are C-finite sequences (and bounds on

20:10:19, subject to the Cambridge


.005
76 Recurrence relations

their degree established), the result can be checked by mechanical computation (or,
better, by computation involving some clever tricks to reduce the work required).
I won’t give the proof in detail. The fact that the number of domino tilings is
C-finite is obtained using the transfer matrix method. In essence, there are only
a finite number of ways of covering the four 4 × 4 corner squares with dominoes,
some of which may stick out. No matter what corner tilings are chosen, the number
of ways of tiling the sides satisfy the same recurrence relation, with initial condi-
tions depending on the corner tilings chosen. So the required number is a sum of
fourth powers of sequence satisfying a 3-term recurrence (hence of degree 2), and
so itself has degree 5, by Proposition 4.9(c).
The fact that the conjectured answer is C-finite follows from general results
about C-finite sequences. The Fibonacci sequence has dimension 2, so its square
has dimension 3; the sequence (−1)n has dimension 1, so the sum has dimension
at most 4, and its square has dimension at most 10. So the result can be proved by
checking 15 values.
However, with some ingenuity, we can do better. Write the conjectured answer
as 16Fn4 + 16(−1)n Fn2 + 4. Now the fourth powers of Fibonacci numbers have
dimension 5, and the recurrence relation can be computed explicitly; then it can
be shown that the sequence ((−1)n Fn2 ) and the constant sequence both satisfy the
same recurrence relation. So the dimension is 5, and only 10 terms need to be
checked, a substantial saving.

4.1.5 Unbounded recurrences


The definition of a recurrence relation allows the value of the nth term un to
depend on all the preceding values. We saw at the start of this chapter an example,
the number un of compositions of the integer n. We showed that this satisfies the
recurrence relation
un = 1 + u1 + u2 + · · · + un−1 ,
which we were able to reduce to the much simpler recurrence
u1 = 1, un = 2un−1 for n > 1.
We will give here just one further example, a very important one. Recall from
the last chapter that the generating function for the number p(n) of partitions of
the integer n is given by

−1
∑ p(n)xn = ∏ (1 − xk ) .
n≥0 k≥1

Thus, to get a recurrence relation for p(n), we have to understand the coeffi-
cients of its inverse:
∑ a(n)xn = ∏ (1 − xk ).
n≥0 k≥1

20:10:19, subject to the Cambridge


.005
4.2 Linear recurrence relations with polynomial coefficients 77

Now a term on the right arises from each expression for n as a sum of distinct
positive integers; its value is (−1)k , where k is the number of terms in the sum.
Thus, a(n) is equal to the number of expressions for n as the sum of an even
number of distinct parts, minus the number of expressions for n as the sum of an
odd number of distinct parts.
This number is evaluated by Euler’s Pentagonal Numbers Theorem:
Proposition 4.11

a(n) = (−1)k if n = k(3k − 1)/2 for some k ∈ Z,
0 otherwise.

We will prove this theorem in an appendix to this chapter.


Putting all this together, the recurrence relation for p(n) is
p(n) = ∑ (−1)k−1 p(n − k(3k − 1)/2)
k=0
= p(n − 1) + p(n − 2) − p(n − 5) − p(n − 7) + p(n − 12) + · · ·
where the summation is over all values of k for which n − k(3k − 1)/2 is non-
negative. √
The number of terms in the recurrence grows with n, but only like c n. So
evaluating p(n) for n ≤ N requires only cn3/2 additions and subtractions, for some
constant c.

4.2 Linear recurrence relations with polynomial


coefficients
There is a similar, but less complete, theory of linear recurrence relations with
polynomial coefficients. In this case, rather than a simple expression for the gen-
erating function as a rational function (a quotient of two polynomials), we obtain
a linear differential equation. Sequences with this property are called D-finite.
We begin with a couple of examples, and then discuss a ‘general’ method
(which, however, does not always work, unlike the case of constant coefficients).

4.2.1 Derangements
Let d(n) be the number of derangements of {1, . . . , n} (permutations which
have no fixed points). We obtain a recurrence relation as follows. Each derange-
ment maps n to some i with 1 ≤ i ≤ n − 1, and by symmetry each i occurs equally
often. So we need only count the derangements mapping n to n − 1, and multiply
by n − 1.

20:10:19, subject to the Cambridge


.005
78 Recurrence relations

We divide these derangements into two classes. The first type map n − 1 back
to n. Such a permutation must be a derangement of {1, . . . , n − 2} composed with
the transposition (n − 1, n); so there are d(n − 2) such. The second type map i
to n for some i = n − 1. Replacing the sequence i → n → n − 1 by the sequence
i → n − 1, we obtain a derangement of n − 1; every such derangement arises. So
there are d(n − 1) derangements of this type.
Thus,
d(n) = (n − 1)(d(n − 1) + d(n − 2)).
This is a linear recurrence relation, where the coefficients, rather than being con-
stants, are polynomials in n.
There is a simpler recurrence satisfied by d(n), which can be deduced from this
one, namely
d(n) = nd(n − 1) + (−1)n .
To prove this by induction, suppose that it is true for n − 1. Then (n − 1)d(n −
2) = d(n − 1) − (−1)n−1 ; so d(n) = (n − 1)d(n − 1) + d(n − 1) + (−1)n , and the
inductive step is proved. (Starting the induction is an exercise.)
Now this is a special case of a general recursion which can be solved, namely

u0 = c, un = pn un−1 + qn for n ≥ 1.

We can include the initial condition in the recursion by setting q0 = c and adopting
the convention that u−1 = 0.
If qn = 0 for n ≥ 1, then the solution is simply un = Pn for all n, where
n
Pn = c ∏ pi .
i=1

So we compare un to pn . Putting yn = un /Pn , the recurrence becomes


qn
y0 = 1, yn = yn−1 + for n ≥ 1,
Pn
with solution
n
qi
yn = ∑ .
i=0 Pi
(Remember that q0 = P0 = c.) Finally,
n
qi
un = Pn ∑ .
i=0 Pi

For derangements, we have pn = n, c = 1 (so that Pn = n!), and qn = (−1)n .


Thus
n
(−1)i
d(n) = n! ∑ .
i=0 i!

20:10:19, subject to the Cambridge


.005
4.2 Linear recurrence relations with polynomial coefficients 79

It follows that d(n) is the nearest integer to n!/e, since

(−1)i
n!/e − d(n) = n! ∑ ,
i≥n+1 i!

and the modulus of the alternating sum of decreasing terms on the right is smaller
than that of the first term, which is n!/(n + 1)! = 1/(n + 1).
The exponential generating function for the derangement numbers is



d(n) n (−1)i i e−x
∑ n! x = ∑ i! x · ∑ x j = 1 − x .
n≥0 i≥0 j≥0

4.2.2 Two generalisations


The count of derangements can be extended in various ways. I mention two
here, without proof.

First extension: numbers of fixed points If a random permutation is chosen


from the symmetric group of degree n, the probability that it is a derangement
is very close to 1/e. More generally, the number of fixed points of a random
permutation is a random variable, taking non-negative integer values, and we can
ask about its distribution. This turns out to be approximately a Poisson random
variable with parameter 1 (and indeed it converges to this distribution as n → ∞).
This means that, if k is small compared to n, the number of permutations with
k fixed points is approximately e−1 /k!.
In Exercise 7.6 we will see how the generating function for these probabilities
(for fixed n) can be computed.
More generally one could ask about the joint distribution of the numbers of cy-
cles of lengths 1, 2, . . .. These are summarised in a multivariate polynomial which
we will meet in Chapter 7. They are approximately independent Poisson random
variables, where the variable for k-cycles has parameter 1/k.

Second extension: derangements of k-sets Given n and k, how many permuta-


tions of {1, . . . , n} leave no k-element set fixed? This number tends to a limit as
n → ∞ for fixed k. The value of the limit is somewhat mysterious, but a fairly de-
tailed account of its asymptotics (in terms of k) has been given by Eberhard, Ford
and Green.

4.2.3 Involutions
Let sn be the number of elements π of the symmetric group Sn which satisfy
π 2 = 1 (this means that the cycles of π have lengths 1 or 2).

20:10:19, subject to the Cambridge


.005
80 Recurrence relations

We have the recurrence relation

sn = sn−1 + (n − 1)sn−2 .

For count involutions π ∈ Sn according to their effect on the last point n. If nπ = n,


then π is obtained from a unique involution in Sn−1 by adjoining the fixed point n.
If nπ = i ≤ n − 1, then iπ = n; and π is obtained from a unique involution in Sn−2
by adjoining the 2-cycle (i, n). Since there are n − 1 possible values of i, we have
the result.
Using this recurrence, with initial values s0 = s1 = 1, it can be shown (see
Exercise 4.12) that the exponential generating function of (sn ) is
 
sn x n x2
∑ = exp x +
2
.
n≥0 n!

This is an example of an exponential principle, which we will discuss later. Ba-


sically, any involution can be uniquely decomposed into ‘indecomposable’ involu-
tions, namely 1-cycles and 2-cycles. There is one of each type of indecomposable,
so the e.g.f. for indecomposable involutions is simply x + x2 /2. Then the e.g.f. for
arbitrary involutions is the exponential of this.
Another simple example of the exponential principle concerns arbitrary permu-
tations. The ‘indecomposable’ permutations are cycles; there are (n − 1)! cycles
of length n, and so the e.g.f. is
(n − 1)!xn
∑ n! = − log(1 − x);
n≥1

the exponential of this is


n!xn
(1 − x)−1 = ∑ ,
n≥0 n!
the e.g.f. for the sequence (n!) counting all permutations.

4.2.4 Bell numbers


We already calculated the exponential generating function for the Bell numbers.
Here is how to do it using the recurrence relation
n  
n−1
B(n) = ∑ B(n − k).
k=1 k − 1

Multiply by xn /n! and sum over n: the e.g.f F(x) is given by


 
xn n n − 1
F(x) = ∑ ∑ B(n − k).
n≥0 n! k=1 k − 1

20:10:19, subject to the Cambridge


.005
4.2 Linear recurrence relations with polynomial coefficients 81

Differentiating with respect to x we obtain


 
d xn−1 n n − 1
F(x) = ∑ ∑ B(n − k)
dx n≥1 (n − 1)! k=1 k − 1
xl B(m)xm
= ∑ l! ∑ m!
.
l≥0 m≥0

Here we use new variables l = k − 1 and m = n − k; the constraints of the original


sum mean that l and m independently take all natural number values. Hence

d
F(x) = exp(x)F(x).
dx
This first-order differential equation can be solved in the usual way with the initial
condition F(0) = 1 to give

F(x) = exp(exp(x) − 1),

in agreement with our earlier result.

4.2.5 A general method


There is a general approach to linear recurrences with polynomial factors,
which we outline next. This approach leads to a differential equation satisfied
by the generating function. Often this equation cannot be solved; even when it
can, it usually does not lead directly to a formula for the terms in the sequence.
Nevertheless, it can be useful in finding asymptotics.
The approach depends on the following facts. Let (an ) be a sequence and
∑ anxn its generating function.
n≥0

(a) x f (x) = ∑ an−1xn is the generating function of the shifted sequence.


n≥1
(b) x(d/dx) f (x) = ∑n≥0 nan xn (see Exercise 2.1). More generally, writing Dx
for d/dx, for any polynomial p, the generating function for the sequence
p(n)an is p(xDx ) f (x).

(We have to be careful since the operations of differentiating and multiplying by x


do not commute. For example, (xDx )2 means: differentiate, multiply by x, differ-
entiate, multiply by x. This is not the same as differentiating twice and multiplying
by x2 .)
Consider a recurrence relation of the form

p(n)an + q(n)an−1 + r(n)an−2 = 0,

20:10:19, subject to the Cambridge


.005
82 Recurrence relations

for example, where p, q, r are polynomials. If f (x) is the generating function of


the sequence (an ), we see that the coefficient of xn in

p(xDx ) f (x) + q(xDx )(x f (x)) + r(xDx )(x2 f (x))

is equal to zero for n ≥ 2. Hence

p(xDx ) f (x) + q(xDx )(x f (x)) + r(xDx )(x2 f (x)) = Ax + B

for some constants A, B which can be deduced from the initial conditions. With
luck, the solutions of this differential equation will lead to the generating function
f for our problem. See Exercise 4.15 for an example of what can go wrong.

4.2.6 Frobenius numbers


We use the above method on the following problem: How many permutations
π ∈ Sn satisfy π m = 1, for given n, m?
(m)
Let sn be this number. The required permutations have the property that every
cycle has length dividing m. Suppose that the cycle containing the point n has
length d. We can regard n as being the first point in the cycle, and can choose the
remaining points in the cycle in (n − 1)(n − 2) · · · (n − d + 1) ways. Then we have
(m)
to choose a permutation of the remaining n − d points, in sn−d ways. Hence we
have
(m) (m)
sn = ∑ (n − 1) · · · (n − d + 1)sn−d .
d|m

(m) (m)
By convention, we take s0 = 1 and sn = 0 for n < 0, so the recurrence relation
holds for all n > 0.
Since we are counting permutations, we let f (x) be the exponential generating
(m)
function for the sequence; let f (x) = ∑ an xn , where an = sn /n!. Dividing the
above recurrence relation by n!, we find that a factor of (n − 1)! can be cancelled,
giving
nan = ∑ ad .
d|m

By the general method, we have




xDx f (x) = ∑x d
f (x),
d|m

so

d
dx
f (x) = ∑ xd−1 f (x),
d|m

20:10:19, subject to the Cambridge


.005
4.3 Some non-linear recurrence relations 83

which can be solved by standard methods to yield




xd
f (x) = A exp ∑ ,
d|m
d

and the initial condition gives A = 1.


This agrees with our earlier result for m = 2 (counting involutions in Sn ).

4.3 Some non-linear recurrence relations


Our treatment here is even less systematic; no general methods exist for solving
arbitrary recurrence relations. However, the first example, Catalan numbers, is of
very great importance.

4.3.1 Catalan numbers


It is sometimes possible to use a recurrence relation to derive an algebraic or
differential equation for a generating function for the sequence. If we are lucky,
this equation can be solved, and the resulting function used to find the terms in the
sequence.
The nth Catalan number Cn is the number of ways of bracketing a product of
n terms, where we are not allowed to assume that the operation is associative or
commutative. For example, for n = 4, there are five bracketings

(a ◦ (b ◦ (c ◦ d))), (a ◦ ((b ◦ c) ◦ d)), ((a ◦ b) ◦ (c ◦ d)), ((a ◦ (b ◦ c)) ◦ d), (((a ◦ b) ◦ c) ◦ d),

so C4 = 5.
Any bracketed product of n terms is of the form (A ◦ B), where A and B are
bracketed products of i and n − i terms respectively. So
n−1
Cn = ∑ CiCn−i for n ≥ 2.
i=1

Putting F(x) = ∑n≥1 Cn xn , the recurrence relation shows that F and F 2 agree in all
coefficients except n = 1. Since C1 = 1 we have F = F 2 + x, or F 2 − F + x = 0.
Solving this equation gives

F(x) = 12 (1 ± 1 − 4x).

Since C0 = 0 by definition, we must take the negative sign here.


This expression gives us a rough estimate for Cn : the nearest singularity to the
origin is a branchpoint at 1/4, so Cn grows ‘like’ 4n . However, we can get the
solution explicitly.

20:10:19, subject to the Cambridge


.005
84 Recurrence relations

From the Binomial Theorem, we have



 
1/2
F(x) = 1
2 1− ∑ (−4) .
n
n≥0 n

Hence
 
1 1/2
Cn = − (−4)n
2 n
1 1 1 3 2n − 3 22n
= · · · ··· ·
2 2 2 2 2 n!
1 (2n − 2)! 22n
= · ·
2n+1 2n−1 (n − 1)! n · (n − 1)!
 
1 2n − 2
= .
n n−1
In an appendix to this chapter, we will have more to say about Catalan numbers.
Sometimes we cannot get an explicit solution, but can obtain some information
about the growth rate of the sequence.

4.3.2 Wedderburn–Etherington numbers


Another interpretation of the Catalan number Cn , as we will see in the Ap-
pendix, is the number of rooted binary trees with n leaves, where ‘left’ and ‘right’
are distinguished.
If we do not distinguish left and right, we obtain the Wedderburn–Etherington
numbers Wn .
Such a tree is determined by the choice of trees with i and n − i leaves, but the
order of the choice is unimportant. Thus by Theorem 3.6, if i = n/2, the number
of trees is only Wi (Wi + 1)/2, rather than Wi2 . For i = n/2, we simply halve the
number. This gives the recurrence



n−1

⎨ 2 ∑ WiWn−i
1
⎪ if n is odd,
Wn =

i=1


n−1
⎩ 2 ∑ WiWn−i +Wn/2

⎪ 1
if n is even.
i=1

Thus, F(x) = ∑ Wn xn satisfies

F(x) = x + 12 (F(x)2 + F(x2 )).

This cannot be solved explicitly. We will obtain a rough estimate for the rate of
growth. Later, we find more precise asymptotics.

20:10:19, subject to the Cambridge


.005
4.4 Appendix: Euler’s Pentagonal Numbers Theorem 85

We seek the nearest singularity to the origin. Since all coefficients are real and
positive, this will be on the positive real axis. (If a power series with positive real
coefficients converges at z = r, then it converges absolutely at any z with |z| = r.)
Let s be the required point. Then s < 1, so s2 < s; so F(z2 ) is analytic at z = s.
Now write the equation as
F(z)2 − 2F(z) + (F(z2 ) + 2z) = 0,
with ‘solution’ 
F(z) = 1 − 1 − 2z − F(z2 )
(taking the negative sign as before). Thus, s is the real positive solution of
F(s2 ) = 1 − 2s.
Solving this equation numerically (using the fact that F(s2 ) is the sum of a con-
vergent Taylor series and can be estimated from knowledge of a finite number of
terms), we find that s ≈ 0.403 . . ., so that Wn grows ‘like’ (2.483 . . .)n .
We will find more precise asymptotics for Wn in the final chapter of the book.

4.4 Appendix: Euler’s Pentagonal Numbers Theorem


A pentagonal number is a number of the form k(3k − 1)/2 or k(3k + 1)/2 for
some non-negative number k. Alternatively, it is a number of the form k(3k −
1)/2 for some (positive, negative, or zero) integer k. The second description is
preferable, since it generates zero once only, whereas the first produces zero twice.
The reason for the name is shown by the pictures of pentagonal numbers for small
positive k.
u
u u u
u u u u u u

u u u u u

u u u

Figure 4.1: Small pentagonal numbers

The next theorem, due to Euler, is quite unexpected, as is its application: it will
enable us to derive an efficient recurrence relation for the partition numbers.
Theorem 4.12 (Euler’s Pentagonal Numbers Theorem) (a) If n is not a pen-
tagonal number, then the numbers of partitions of n into an even and an odd
number of distinct parts are equal.

20:10:19, subject to the Cambridge


.005
86 Recurrence relations

(b) If n = k(3k − 1)/2 for some k ∈ Z, then the number of partitions of n into an
even number of distinct parts exceeds the number of partitions into an odd
number of distinct parts by one if k is even, and vice versa if k is odd.

For example, if there are four partitions of n = 6 into distinct parts, viz. 6 =
5 + 1 = 4 + 2 = 3 + 2 + 1, two of each parity; while if n = 7, there are five such
partitions, viz. 7 = 6 + 1 = 5 + 2 = 4 + 3 = 4 + 2 + 1, three with an even and two
with an odd number of parts.

Proof To demonstrate Euler’s Theorem, we try to produce a bijection between


partitions with an even and an odd number of distinct parts; we succeed unless n
is a pentagonal number, in which case a unique partition is left out.
We represent a partition λ : n = a1 + a2 + · · ·, with a1 ≥ a2 ≥ · · ·, by a diagram
D(λ ), whose ith row has i dots aligned on the left. See Figure 4.2 below for the
diagram of the partition 17 = 6 + 5 + 4 + 2. Such a diagram is essentially the same
as a Ferrers diagram or Young diagram: we discuss these diagrams further in the
next section. The only difference is that, instead of dots, these diagrams have boxes
into which positive integers can be put.
Let λ be any partition of n into distinct parts. We define two subsets of the
diagram D(λ ) as follows:

• The base is the bottom row of the diagram (the smallest part).
• The slope is the set of cells starting at the east end of the top row and pro-
ceeding in a south-westerly direction for as long as possible.

Note that any cell in the slope is the last in its row, since the row lengths are all
distinct. See Figure 4.2.

u u u u u u

u u u u u

u u u u

u u

Figure 4.2: Base and slope

Now we divide the set of partitions of n with distinct parts into three classes, as
follows:

• Class 1 consists of the partitions for which either the base is longer than the
slope and they don’t intersect, or the base exceeds the slope by at least 2;

20:10:19, subject to the Cambridge


.005
4.4 Appendix: Euler’s Pentagonal Numbers Theorem 87

• Class 2 consists of the partitions for which either the slope is at least as long
as the base and they don’t intersect, or the slope is strictly longer than the
base;
• Class 3 consists of all other partitions with distinct parts.

Given a partition λ in Class 1, we create a new partition λ  by removing the


slope of λ  and installing it as a new base, to the south of the existing diagram. In
other words, if the slope of λ contains k cells, we remove one from each of the
largest k parts, and add a new (smallest) part of size k. This is a legal partition with
all parts distinct. Moreover, the base of λ  is the slope of λ , while the slope of λ 
is at least as large as the slope of λ , and strictly larger if it meets the base. So λ  is
in Class 2.
In the other direction, let λ  be in Class 2. We define λ by removing the base
of λ  and installing it as a new slope. Again, we have a partition with all parts
distinct, and it lies in Class 1. (If the base and slope of λ meet, the base is one
greater than the second-last row of λ  , which is itself greater than the base of λ  ,
which has become the slope of λ . If they don’t meet, the argument is similar.)
The partition shown in Figure 4.2 is in Class 2; the corresponding Class 1
partition is shown in Figure 4.3.

u u u u u u u

u u u u u u

u u u u

Figure 4.3: A Class 1 partition

These bijections are mutually inverse. Thus, the numbers of Class 1 and Class 2
partitions are equal. Moreover, these bijections change the number of parts by 1,
and hence change its parity. So, in the union of Classes 1 and 2, the numbers of
partitions with even and odd numbers of parts are equal.
Now we turn to Class 3. A partition in this class has the property that its base
and slope intersect, and either their lengths are equal, or the base exceeds the
slope by 1. So, if there are k parts, then n = k2 + k(k − 1)/2 = k(3k − 1)/2 or
n = k(k + 1) + k(k − 1)/2 = k(3k + 1)/2. Figure 4.4 shows the two possibilities.
So, if n is not pentagonal, then Class 3 is empty; and, if n = k(3k − 1)/2, for
some k ∈ Z, then it contains a single partition with |k| parts. Euler’s Theorem
follows.

Corollary 4.13 ∏ (1 − xn) = ∑ (−1)k xk(3k−1)/2 .
n≥1 k=−∞

20:10:19, subject to the Cambridge


.005
88 Recurrence relations

u u u u u u u u u u u

u u u u u u u u u

u u u u u u u

Figure 4.4: Two Class 3 partitions

Proof By Euler’s Pentagonal Numbers Theorem, the right-hand side is the gen-
erating function for even(n) − odd(n), where even(n) and odd(n) are the numbers
of partitions having all parts distinct and having an even or odd number of parts
respectively. We must show that the same is true for the left-hand side.
The coefficient of t n is made up of contributions from factors of the form
(1 − xn1 ), . . . , (1 − xnk ), where n1 + . . . + nk = n and n1 , . . . , nk are distinct; the
contribution from this choice of factors is (−1)k . So each term counted by even(n)
contributes 1, and each term counted by odd(n) contributes −1. So the theorem is
proved.
The right-hand side can be written as
 
1 + ∑ (−1)k xk(3k−1)/2 + xk(3k+1)/2 ,
k>0

using the first ‘definition’ of the pentagonal numbers. From this, we deduce the
promised recurrence for the partition numbers. This illustrates the general princi-
ple that finding a linear recurrence relation for a sequence is equivalent to finding
the inverse of its generating function.

Corollary 4.14 For n > 0,


p(n) = ∑ (−1)k−1(p(n − 12 k(3k − 1)) + p(n − 12 k(3k + 1)))
k>0
= p(n − 1) + p(n − 2) − p(n − 5) − p(n − 7) + p(n − 12) + . . . ,

with the convention that p(n) = 0 for n < 0.

Proof Since
∑ p(n)xn = ∏ (1 − xn)−1,
n≥0 n>0
we have



∑ p(n)x n
· 1 + ∑ (−1) (x k k(3k−1)/2
+x k(3k+1)/2
) = 1.
n≥0 k>0

20:10:19, subject to the Cambridge


.005
4.5 Appendix: Some Catalan objects 89

For n > 0, the coefficient of xn in the product is zero. Thus,

0 = p(n) + ∑ (−1)k (p(n − 12 k(3k − 1)) + p(n − 12 k(3k + 1))),


k>0

from which the result follows.


This is a linear recurrence relation in which
the number of terms grows with
n, but relatively slowly: there are about 8n/3 pentagonal numbers below n.
Thus, it permits efficient calculation: p(n) can be evaluated with cn3/2 additions
or subtractions.

4.5 Appendix: Some Catalan objects


One of the remarkable features of the Catalan numbers is the very wide range
of areas in which they arise. In this section we will look at a few of these. Not all
details of proofs are given; filling these in is an exercise.
In particular, we will see several different classes of objects counted by Catalan
numbers; there must therefore be bijections between these classes. In some cases,
I will show, or outline, bijections; in other cases, it is an exercise (which can
sometimes be solved by composing known bijections).
We begin by recalling that the Catalan number Cn is the number of ways of
bracketing a non-associative product of n terms; it satisfies the recurrence
n−1
C1 = 1, Cn = ∑ CkCn−k for n ≥ 2.
k=1

The ordinary generating fuction is



∑ Cnxn = 1 − 1 − 4x,
n≥1

and the formula for the Catalan numbers is


 
1 2n − 2
Cn = .
n n−1

4.5.1 Binary trees


Binary trees are always regarded as having a distinguished root; every vertex
is either a leaf or has two descendants, which we distinguish as the left and right
descendants. Thus, the following is a recursive specification:
• there is a binary tree consisting only of a root;
• any other binary tree T consists of an ordered pair (L, R) of binary trees
(with their roots joined to the root of T ).

20:10:19, subject to the Cambridge


.005
90 Recurrence relations

Let Tn be the number of binary trees with n leaves. Then the first specification
gives T1 = 1, and the second gives
n−1
Tn = ∑ Tk Tn−k
k=1

for n ≥ 2. Clearly it follows that Tn = Cn for all n.


In this case it is quite straightforward to match up the Catalan objects. Each
bracketing of a product of n symbols has a ‘parse tree’. We can regard this tree as
being a machine for computing the product: at the leaves we input the elements
to be multiplied; at each internal vertex we put a black box which performs the
multiplication of two elements. Figure 4.5 shows the five binary trees with four
leaves and the corresponding bracketed expressions.

r r r r r r r r
r \\r \
\r  r r r r r r \\r  \\ r r
 \ 
r \\r r \r  LLr LLr \
\r r \r r
\\r \\r \\ r r
\ \r
(a ◦ (b ◦ (c ◦ d))) (a ◦ ((b ◦ c) ◦ d)) ((a ◦ b) ◦ (c ◦ d)) ((a ◦ (b ◦ c)) ◦ d) (((a ◦ b) ◦ c) ◦ d)

Figure 4.5: Binary trees and bracketed products

4.5.2 Rooted plane trees


Curiously, the Catalan numbers also count a much larger collection of trees!
These are rooted plane trees which are not restricted to be binary. That is, a ver-
tex of such a tree can have any number of descendants, these descendants being
ordered. So the recursive specification is:
• there is a rooted plane tree consisting only of a root;
• any other rooted plane tree T consists of an ordered list of rooted plane trees
T1 , . . . , Tk such that the roots of T1 , . . . , Tk are the descendants of the root of
T.
Figure 4.6 gives the rooted plane trees with three edges.
Let Rn be the number of rooted plane trees with n edges. The first statement of
the recursive specification shows that R0 = 1. We divide trees T with at least one
edge into two classes:
• those in which the root has only one descendant (clearly there are Rn−1 of
these, since each is just a rooted plane tree with n − 1 edges on top of a
single-edge trunk);

20:10:19, subject to the Cambridge


.005
4.5 Appendix: Some Catalan objects 91
r
r r r r r
@
r @r r r r r r r r
@ @ @
r r @r @r @r

Figure 4.6: Rooted plane trees

• those in which the root has more than one descendant. Suppose that the
left-most descendant is a tree with k edges. There are Rk such trees. Each
accounts for k + 1 edges of the tree T (one of these is the edge through the
root of T ). Now deleting the left-most descendant gives an arbitrary rooted
plane tree with n − k − 1 edges. Here k runs between 0 and n − 1.

So we have
n−1
Rn = ∑ Rk Rn−k−1
k=0

for n ≥ 1. Now it is easily proved by induction that Rn = Cn+1 for all n.

4.5.3 Dissections of polygons


A convex polygon with n sides can be dissected into triangles by drawing in
n − 2 non-crossing diagonals. In how many ways can this be done? Figure 4.7
shows the five possible dissections of a pentagon.

q q q q q
Z Z Z Z Z
q  Zq
 q
 BB Zq q
 Zq q BB Zq
 q
 Zq
B   Z
B ZB  B  B  B  BZZ 
B
q q Bq ZBq Bq q Bq Bq Bq Zq

Figure 4.7: Dissections of a polygon

Let Dn be the number of ways of dissecting an n-gon (with vertices numbered


0, 1, . . . , n − 1) into triangles.
Some of these dissections have the property that there is no diagonal containing
the vertex 0. In this case, there must be a diagonal joining 1 to n − 1, and we have
a dissection of the polygon with vertices 1, . . . , n − 1, with an extra triangle stuck
on to the edge from 1 to n − 1. There are Dn−1 ways to do this.
For any other dissection, suppose that k is minimal subject to the condition
that there is a diagonal from 0 to k. This diagonal splits the given polygon into a
(k + 1)-gon with vertices 0, 1, . . . , k, and an (n − k + 1)-gon with vertices 0, k, k +
1, . . . , n − 1. The dissection of the first polygon has no diagonal containing 0, so

20:10:19, subject to the Cambridge


.005
92 Recurrence relations

there are Dk of these (using the preceding paragraph). The dissection of the second
polygon is arbitrary, so there are Dn−k+1 of these. Thus we have
n−2
Dn = Dn−1 + ∑ Dk Dn−k+1 ,
k=2

where we take D2 = 1.
From this it is an easy exercise to deduce that Dn = Cn−1 for n ≥ 2.

4.5.4 Dyck paths


Catalan numbers also count certain types of paths joining lattice points in the
plane. A Dyck path satisfies the following specifications:
• the path starts at the origin and ends at the point (2n, 0);
• each step is either in the north-easterly direction (adding (1, 1)) or in the
south-easterly direction (adding (1, −1));
• the path never goes below the x-axis: that is, the y-coordinate is always non-
negative.
Note that an even number of steps is required to return to the x-axis, since each
step either increases or decreases the y-coordinate by 1. Figure 4.8 shows the paths
for n = 3.

q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q
q q q @
q@q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q
q q q q q@q q q q @
q q @
q q q q q q@ q q q q q q q q @
q@q q q q q q q q q
q q q q q q@q q q q q q @
q@q q q q @q@q @
q q q @
q q q q q@q q q@ q q@ q @
q q

Figure 4.8: Dyck paths

Now we have the following result.

Proposition 4.15 The number of Dyck paths from (0, 0) to (2n, 0) is the Catalan
number Cn+1 . Of these, the number which meet the x-axis only at their endpoints
(0, 0) and (2n, 0) is Cn .

Proof Let Fn be the total number of paths satisfying the specification, and Gn be
the number which meet the axis only at the endpoints. By convention we take
F0 = 1. Figure 4.8 demonstrates that F3 = 5 and G3 = 2.
First we claim that Gn+1 = Fn . For take any path satisfying the specification;
translate it one step north-east, so that it goes from (1, 1) to (2n + 1, 1); then extend
it by a north-east step at the beginning and a south-east step at the end. The result-
ing path goes from (0, 0) to (2n + 2, 0), and meets the axis only at its endpoints.

20:10:19, subject to the Cambridge


.005
4.5 Appendix: Some Catalan objects 93

Conversely, given such a path, if we cut off its first and last steps and translate it
by (−1, −1), we obtain a path from (0, 0) to (2n, 0) satisfying the original spec-
ification. So we have established a bijection between the sets counted by Fn and
Gn+1 .
Now take an arbitrary path counted by Fn , and suppose that its first return to
the x-axis is at the point (2k, 0). There are Gk ways to choose the part of the path
before the point (2k, 0), since it meets the axis only at its endpoints. Then there
are Fn−k ways to choose the remaining part of the path, since it is just a path from
(0, 0) to (2n − 2k, 0) satisfying the original specifications and moved east by 2k.
So
n
Fn = ∑ Gk Fn−k
k=1
for n ≥ 1.
From this it is easily deduced that Fn = Cn+1 and Gn = Cn .

4.5.5 A ballot problem


Here is another interpretation of Dyck paths.
Suppose that an election is held with two candidates, each of whom receives
exactly n votes, so that the election is tied. In how many ways can the votes be
counted so that candidate A is never behind? In how many ways is candidate A
always strictly ahead except at the beginning and end of the count?
Given any way of counting the votes, we can represent it as a Dyck path in
which a vote for A corresponds to a north-east step and a vote for B to a south-east
step. The x-coordinate of the current point is the number of votes so far counted,
and the y-coordinate is the number of votes by which A is ahead of B (so that
negative y-coordinate corresponds to B being ahead in the count). The condition
that the result is tied and A is never behind corresponds to the specification of
Dyck paths in the last subsection, while counts where A is always ahead except
at the beginning and end correspond to paths which meet the x-axis only at their
ends. So the answers to the two questions above are the Catalan numbers Cn+1 and
Cn respectively.
For example, the counts corresponding to the five Dyck paths of Figure 4.8 are
AAABBB, AABABB, AABBAB, ABAABB, and ABABAB respectively.
We will meet another class of Catalan objects in the last section of this chapter.

4.5.6 Tableaux

This analysis can be translated into a different language again, one of great
importance in algebraic combinatorics.
Let us record the results of the count in the last subsection in a different way:
take two rows corresponding to the two candidates, and as each vote is counted,

20:10:19, subject to the Cambridge


.005
94 Recurrence relations

enter its number in the row corresponding to the candidate for whom that vote is
cast. The representations of the five counts above are shown in Figure 4.9.

1 2 3 1 2 4 1 2 5 1 3 4 1 3 5
4 5 6 3 5 6 3 4 6 2 5 6 2 4 6
AAABBB AABABB AABBAB ABAABB ABABAB
Figure 4.9: Tableaux

We see that Figure 4.9 shows all possible ways of putting the numbers 1, . . . , 6
into six boxes in a 2 × 3 array such that
• the numbers in each row are increasing (this corresponds to the fact that the
votes are entered in order);
• the numbers in each column are increasing (this corresponds to the fact that
B is never ahead of A in the count).
Such an arrangement is called a tableau. We can generalise by asking for arbitrary
arrangements of boxes.
Let λ be a partition of the integer n: that is, λ is a sequence of positive integers,
arranged in non-increasing order, with sum n. (The number of partitions of n is the
partition function p(n) we met earlier in this chapter.)
The Young diagram, or Ferrers diagram, associated with λ is an arrangement
of boxes or cells in rows, the number of boxes in the ith row being the ith part of
λ . Figure 4.10 shows the Young diagrams corresponding to the five partitions of
4.
(4) (3, 1) (2, 2) (2, 1, 1) (1, 1, 1, 1)

Figure 4.10: Young diagrams

In general, let λ be a partition of n, and D(λ ) the corresponding Young dia-


gram. Because the parts are non-increasing, each row and column is a continuous
run of boxes starting at the left or top edge. A tableau, or Young tableau, of shape
λ , is an assignment of the numbers 1, . . . , n to the cells of D(λ ) in such a way that
the numbers in any row or column are increasing from the left or top edge of the
diagram to the end of the row or column. We denote by fλ the number of tableaux
with shape λ .

20:10:19, subject to the Cambridge


.005
4.5 Appendix: Some Catalan objects 95

Thus, the figures recording the results of a vote count of the type described
in the preceding subsection, with two candidates obtaining m votes each, are pre-
cisely the tableaux of shape (m, m); so we have
 
1 2m
f(m,m) = Cm+1 = .
m+1 m
Arbitrary tableaux have also an interpretation in terms of ballots. Suppose that
there are r candidates in an election with n voters, where the ith candidate receives
mi votes for i = 1, . . . , r; we may arrange the candidates so that their totals are
in non-increasing order (so that λ = (m1 , . . . , mr ) is a partition of n). Then fλ is
the number of ways of counting the votes if the candidates’ totals at any stage are
(non-strictly) in the order of the final result.
The numbers fλ are of very great importance in algebra. Their most important
interpretation is as follows. Let G be the symmetric group Sn of all permutations
of {1, . . . , n}. A representation of G is a homomorphism ρ from G to the group of
non-singular linear transformations of a vector space V over the complex numbers.
A representation is irreducible if the only subspaces of V mapped to themselves by
all the matrices ρ(g) are V itself and the zero space. Two representations are equiv-
alent if they are related by a change of basis of V ; that is, if ρ2 (g) = T −1 ρ1 (g)T
for some invertible transformation T .
It is known that any finite group has only finitely many irreducible representa-
tions up to equivalence; indeed, the number of irreducible representations is equal
to the number of conjugacy classes of the group. Moreover, the degree of any such
representation (the dimension of the vector space) divides the order of the group,
and the sum of squares of the degrees of all irreducible representations is equal to
the order of the group.
In the case where G = Sn , we have seen that two permutations are conjugate if
and only if they have the same cycle structure. So the number of conjugacy classes,
and hence the number of irreducible representations, is equal to p(n). More is true
in this case. The irreducible representations can be indexed by partitions of n; the
degree of the representation indexed by λ is fλ . Hence we conclude that
• fλ divides n!;
• ∑ fλ2 = n!.
Both of these facts have a combinatorial interpretation. The first is the remark-
able hook length formula for fλ . For each cell in a Young diagram, the correspond-
ing hook consists of this cell together with all cells to the right in the same row, or
below in the same column. The hook length is equal to the number of cells in the
hook.

Proposition 4.16 Let λ be a partition of n. Then fλ is equal to n! divided by the


product of the hook lengths of all the cells in D(λ ).

20:10:19, subject to the Cambridge


.005
96 Recurrence relations

For example, consider the partition (m, m) of n = 2m. The hook lengths of the
cells in the first row of the diagram are m + 1, m, m − 1, . . . , 2, while those for the
cells in the bottom row are m, m − 1, . . . , 1. So the Proposition gives
(2m)!
f(m,m) = ,
(m + 1)! m!
in agreement with the fact that f(m,m) = Cm+1 and our earlier formula for Catalan
numbers.
The second fact is explained by the Robinson–Schensted–Knuth algorithm:
Theorem 4.17 There is a bijection between the set of permutations of {1, . . . , n},
and the set of ordered pairs of tableaux of the same shape with n cells. Under this
bijection, if π corresponds to the pair (S, T ) of tableaux, then π −1 corresponds
to (T, S). Furthermore, the number of cells in the first row of the tableaux corre-
sponding to g is equal to the length of the longest increasing subsequence of g.

The last part of the theorem has a ‘dual’ statement: The number of cells in the
first column of the tableaux (that is, the number of rows) is equal to the length of
the longest decreasing subsequence of g.
We will outline the proof of this theorem in the next section. The theorem
immediately gives us the following counting results:
Corollary 4.18 (a) ∑ fλ2 = n!, where the sum is over the set of all partitions of
λ
n.
(b) ∑ fλ = sn is equal to the number of permutations π of {1, . . . , n} for which
λ
π 2 is the identity, with the same range of summation as in (a).
(c) The number of permutations of {1, . . . , n} with largest increasing subse-
quence of length m is equal to ∑ fλ , where the sum is over all partitions
λ
of n with largest part m.
Proof (a) The number of pairs of tableaux of the same shape is ∑ fλ2 .
(b) A permutation π satisfies π 2 = 1 (that is, π = π −1 ) if and only if it corre-
sponds to a pair (S, S) of tableaux with its entries equal.
(c) This is clear for the same reason as (a).
Note that we found a recurrence relation for the sequence (sn ) in Section 4.2.
For example, the numbers of tableaux of the three possible shapes with n = 3
are 1, 2 and 1 respectively. So S3 contains 12 + 22 + 12 = 3! elements, of which
1 + 2 + 1 = 4 satisfy g2 = 1; and the numbers with longest increasing subsequence
of length 1, 2, 3 are 1, 4, 1 respectively. All this is easily checked by listing the
permutations.

20:10:19, subject to the Cambridge


.005
4.6 Appendix: The RSK algorithm 97

4.5.7 Permutation patterns


For this application, we regard a permutation as simply an ordered list contain-
ing the numbers 1, 2, . . . , n each once, rather than a bijective mapping on the set
{1, 2, . . . , n}.
For m ≤ n, let σ and π be permutations of length m and n respectively. We say
that π contains the pattern σ if there are m elements in π whose relative order is
the same as that of the elements of σ . For example, the underlined elements show
that 216453 contains the pattern 132: the first underlined element is the smallest
of the three, and the second is the largest.
A lot of attention has been paid to the question: how many permutations of
length n avoid (that is, do not contain) a fixed pattern? Two permutations are
called Wilf-equivalent if the numbers of permutations of length n avoiding each
of them are equal, for all n. Two transformations on permutations are easily seen
to preserve Wilf equivalence: writing the permutation in reverse order (so that ai
is replaced by an+1−i , or reflecting the permutation in a horizontal axis (so that
j is replaced by n + 1 − j). For example, these transformations replace 132 by
231 and 312 respectively; the second transformation applied to 231 gives 213. So
these four permutations of {1, 2, 3} are Wilf-equivalent. Similarly the other two
permutations, 123 and 321, are Wilf-equivalent.
Early on, a surprising fact was discovered:

Proposition 4.19 All six permutations of {1, 2, 3} are Wilf-equivalent; the number
of permutations of length n avoiding any one of them is the Catalan number Cn .

Proving this, and finding bijections between the corresponding sets of permu-
tations, is a challenging exercise.
However, the difficulty of the problem increases very rapidly. It is not known
how many permutations of length n avoid 1324; even asymptotic estimates for this
number are unknown.

4.6 Appendix: The RSK algorithm


In this section, we outline a constructive proof of Theorem 4.17. We build
a pair (S, T ) of tableaux from a permutation π, which we take in ‘passive form’
(a1 , . . . , an ), where ai is the image of i under π.
The construction proceeds step by step. Before the first step, S and T are empty.
At the start of the ith step, S is a ‘partial tableau’ with i cells (this means that its
entries are distinct but not necessarily the first i natural numbers, and the rows and
columns are strictly increasing); and T is a tableau with the same shape as S.
In step i, we add a new cell to the shape, and add entries ai to S and i to T , in a
manner to be described. We define a recursive subroutine INSERT, which puts an
integer a in the jth row of a partial tableau T .

20:10:19, subject to the Cambridge


.005
98 Recurrence relations

If a is greater than the last element of the jth row, then simply ap-
pend it to this row. (If the jth row is empty, put a in the first position.)
Otherwise, let x be the smallest element of the jth row for which
a > x. (Work from right to left until an element smaller than a is first
reached; then we have gone one step too far.) ‘Bump’ x out of the jth
row, replacing it with a; then INSERT x into the ( j + 1)st row.

Now we can describe the RSK algorithm.

Start with S and T empty.


For i = 1, . . . , n, do the following:
• INSERT ai into the first row of S. This causes a cascade of
‘bumps’, ending with a new cell being created and a number (not
less than ai ) written into it.
• Now create a new cell in the same position in T and write i into
it.

To verify this algorithm, there are several things to check. We must show that
the property that S is a partial tableau and T a tableau of the same shape holds after
each step in the algorithm. The fact that rows and columns are increasing is, for
S, a consequence of the way INSERT works; for T , it is because i is greater than
any element previously in the tableau. The key point is that the newly created cell
doesn’t violate the condition that the row lengths are non-increasing; that is, there
should be a cell immediately above it. This is because the element ‘bumped’ is
smaller than the element to the right of the position it is ‘bumped’ out of, and so it
comes to rest to the left of this position.
At the end of the algorithm, we have two tableaux of the same shape.
We illustrate the algorithm with the permutation (2, 3, 1).

• In the first stage, put 2 into the first row of S, and 1 into the first row of T :

S = 2, T = 1.

• In the second stage, put 3 at the end of the first row of s, and 2 in the same
position in T :
S = 2 3, T = 1 2.

• At stage 3, 2 is ‘bumped’ by 1 into the second row, giving S and T as shown:

1 3 1 2
S= , T= .
2 3

20:10:19, subject to the Cambridge


.005
4.7 Appendix: Some inverse semigroups 99

The procedure can be reversed, to construct a permutation from a pair of stan-


dard tableaux of the same shape. To see this, note that we can locate n in the
tableau T , and then reconstruct the cascade of ‘bumps’ required to move the cor-
responding element of S to that position; the insertion triggering this cascade is an .
Working back in the same way, we recover the entire permutation. (A few worked
examples make this clearer than a written explanation.)
The proofs of the statements about inverse permutations and longest increasing
subsequences require careful analysis of the algorithm, and will not be given here.
There is a more general form of the RSK algorithm, which gives a bijection
between matrices of non-negative integers with elements summing to n and pairs of
‘semi-standard’ Young tableaux of the same shape. (A tableau is semi-standard if
its rows are non-decreasing – repetitions are allowed – and its columns are strictly
increasing. The tableaux we defined earlier are called standard.)
Further information can be found in the books by Macdonald or Stanley in the
bibliography.

4.7 Appendix: Some inverse semigroups


The material in this section was communicated to me by Abdullahi Umar.
A partial permutation on a set X is a bijection between subsets of X. We allow
the subsets to be empty or to be the whole of X. We denote the domain and range
of the partial permutation f by Dom( f ) and Ran( f ) respectively.
Partial permutations can be composed by defining the product wherever possi-
ble; that is,

( f ◦ g)(x) = f (g(x)) if x ∈ Dom(g) and g(x) ∈ Dom( f ),
undefined otherwise.
A set of partial permutations which is closed under composition and contains
the identity permutation on X is an inverse semigroup.
Consider the following three conditions on a partial permutation f of {1, . . . , n}:

Monotonic: if x, y ∈ Dom( f ) and x < y, then f (x) < f (y);

Decreasing: if x ∈ Dom( f ) then f (x) ≤ x;

Strictly decreasing: if x ∈ Dom( f ) then f (x) < x.

The set of partial permutations satisfying any collection of these conditions is an


inverse semigroup. We proceed to find the number of elements in each of these
inverse semigroups.
Let P(n) be the number of partial permutations on {1, . . . , n}. Denote the num-
bers of permutations which are respectively monotonic, decreasing, or strictly de-
creasing by a subscript m, d or s; we also allow combinations of subscripts. There

20:10:19, subject to the Cambridge


.005
100 Recurrence relations

is no known closed formula for P(n); but all the other numbers are familiar com-
binatorial coefficients:
n  2
n
Theorem 4.20 (a) P(n) = ∑ · k!.
k=0 k
 
2n
(b) Pm (n) = .
n
(c) Pd (n) = Bn+1 and Ps (n) = Bn , where Bn is the nth Bell number.
(d) Pmd (n) = Cn+1 and Pms (n) = Cn , where Cn is the nth Catalan number.
 
Proof (a) There are nk choices for the domain and nk choices for the range of a
partial permutation of cardinality k. Once the domain and range are chosen, there
are k! bijections between them. The formula follows.
(b) Argue as above. Once the domain and range are chosen, there is a unique
monotonic bijection between them. So
n  2  
n 2n
Pm (n) = ∑ = ,
k=0 k n
by Proposition 3.5 (putting m = k = n).
(c) We show first that Pd (n) = Ps (n + 1). If f is a decreasing partial permutation
on {1, . . . , n}, then the map g given by g(x + 1) = f (x) whenever this is defined is
a strictly decreasing partial permutation on {1, . . . , n + 1}. The argument reverses.
This correspondence preserves the property of being monotonic, so also Pmd (n) =
Pms (n + 1).
Now we select a decreasing bijection by first choosing its fixed points, and then
choosing a strictly decreasing bijection on the remaining points. If there are k fixed
points, then there are Ps (n − k) ways to choose the strictly decreasing bijection. So
n  
we have
n
Ps (n + 1) = Pd (n) = ∑ Ps (n − k).
k=0 k
Thus, Ps (n) satisfies the same recurrence as the Bell number Bn (see Sec-
tion 4.2.4), and we have
Ps (n) = Bn , Pd (n) = Bn+1 .

(d) The preceding proof fails for monotonic decreasing maps, since such a map
cannot jump over a fixed point. Instead, we encode a strictly decreasing map by a
Catalan object.
Let f be monotonic and strictly decreasing on {1, . . . , n}. We encode f by
a sequence of length 2n in the alphabet consisting of two symbols A and B as
follows. In positions 2i − 1 and 2i, we put

20:10:19, subject to the Cambridge


.005
4.8 Exercises 101

AB, if i ∈
/ Dom( f ) and i ∈
/ Ran( f ),
AA, if i ∈
/ Dom( f ) and i ∈ Ran( f ),
BB, if i ∈ Dom( f ) and i ∈
/ Ran( f ),
BA, if i ∈ Dom( f ) and i ∈ Ran( f ).

It can be shown that this gives a bijective correspondence between the set of such
functions and the set of solutions to the ballot problem in Section 4.5.5 above.
The proof is an exercise. (It is necessary to show that the resulting string has
equally many As and Bs, but each initial substring has at least as many As as
Bs; and that every string with these properties can be decoded to give a strictly
decreasing monotone function. The proof that the correspondence is bijective is
then straightforward.)
It follows that Pms (n) = Cn (the nth Catalan number), and from the remark in
part (c), also Pmd (n) = Cn+1 .

Remark Abdullahi Umar has found that many other interesting counting se-
quences arise in calculating the orders of various inverse semigroups of partial
permutations. Among these are Fibonacci, Stirling, Schröder, Euler, Lah and
Narayana numbers. Details are given in a sequence of papers by A. Laradji and
A. Umar.

4.8 Exercises
4.1 Show directly that, with the hypotheses of Theorem 4.4, the sequence un =
n j αin satisfies the recurrence (4.1) for 0 ≤ j ≤ mi − 1. Deduce the statement of the
Theorem.

4.2 Solve the recurrence relation un = un−2

(a) directly;
(b) using the method of Theorem 4.4.

4.3 Let A be a finite set of positive integers. Suppose that the currency of a certain
country has A as the set of denominations. Prove that the number f (n) of ways of
paying a bill of n units, where coins are paid in order (as in putting them into a
vending machine), has generating function 1/(1 − ∑a∈A xa ).
Suppose that A = {1, 2, 5, 10}. Prove that f (n) ∼ c α n for some constants c
and α, and estimate α.
What is the generating function for the number in the case when the order of
the coins is not significant (as in tendering a handful of coins in a shop)?

20:10:19, subject to the Cambridge


.005
102 Recurrence relations

4.4 Let a be a binary string of length k with correlation polynomial Ca (x). A


random binary sequence is obtained by tossing a fair coin, recording 1 for heads
and 0 for tails. Let Ea be the expected number of coin tosses until the first oc-
currence of a as a consecutive substring. Prove that Ea is the sum, over n, of the
probability that a doesn’t occur in the first n terms of the sequence. Deduce that
Ea = 2k Ca (1/2).

4.5 This exercise is due to Wilf, and illustrates his ‘snake oil’ method.

(a) Prove that  


n + k n+k x2k
∑ 2k
x =
(1 − x)2k+1
.
n≥0

(b) Let  
n
n + k n−k
an = ∑ 2k
2
k=0

for n ≥ 0. Prove that the ordinary generating function for (an ) is

1 − 2x
∑ anxn = (1 − x)(1 − 4x) ,
n≥0

and deduce that an = (22n+1 + 1)/3 for n ≥ 0.


(c) Write down a linear recurrence relation with constant coefficients satisfied
by the numbers an .

4.6 Find an asymptotic formula for the number of horizontally convex polyomi-
noes with n cells.

4.7 (a) Let f (n) be the number of expressions for the natural number n as an
ordered sum of 2’s and 3’s. Prove that

f (0) = 1, f (1) = 0, f (2) = 1, and


f (n) = f (n − 2) + f (n − 3) for n ≥ 3.

Hence or otherwise show that


1
∑ f (n)xn = 1 − x2 − x3 .
n≥0

Prove that the polynomial equation 1 − x2 − x3 = 0 has no repeated roots,


and deduce that f (n) ∼ cα n for some c, α > 0. Calculate these constants to
four decimal places.

20:10:19, subject to the Cambridge


.005
4.8 Exercises 103

(b) Let g(n) be the number of expressions for the natural number n as an un-
ordered sum of 2’s and 3’s. Prove that
1
∑ g(n)xn = (1 − x2)(1 − x3) ,
n≥0

and deduce that g(n) = g(n − 2) + g(n − 3) − g(n − 5) for n ≥ 5. Hence or


otherwise prove that
g(n) ∼ n/6.

4.8 According to Proposition 4.9(b), the sequence whose nth term is Fn2 (the
square of the nth Fibonacci number) satisfies a four-term recurrence relation. Find
such a relation.

4.9 Prove Proposition 4.9(c).

4.10 Prove that the number of permutations of {1, . . . , n} which have exactly k
fixed points is equal to (n!/k!)d(n − k), where d denotes the derangement number.

4.11 Let an be the number of strings that can be formed from n distinct letters
(using each letter at most once, and including the empty string). Prove that

a0 = 1, an = nan−1 + 1 for n ≥ 1,

and deduce that an = e n! . What is the exponential generating function for this
sequence?

4.12 Prove from the recurrence relation for the number sn of involutions in Sn that
its exponential generating function is exp(x + x2 /2).

Hint: Let S(x) = ∑ sn xn /n!. Show that


d
S(x) = (1 + x)S(x)
dx
and deduce that
S(x) = A exp(x + x2 /2);
use the initial value s0 = 1 to show that A = 1.

4.13 Let tn = s2n , where sn is as in the preceding question. Prove that

tn = ntn−1 + n(n − 1)tn−2 + (n − 1)(n − 2)2tn−3 .

Remark sn is the number of homomorphisms from the cyclic group C2 to Sn .


Hence tn is the number of homomorphisms from the free product C2 ∗ C2 to Sn ,
since such a homomorphism may be defined independently on the two generators.

20:10:19, subject to the Cambridge


.005
104 Recurrence relations

4.14 Recall that the parity of a permutation π of {1, . . . , n} is the parity of n −


c(π), where c(π) is the number of cycles of π. Let un be the number of even
permutations π of {1, . . . , n} which satisfy π 2 = 1. Prove that

un = un−1 + (n − 1)(sn−2 − un−2 )

for n ≥ 2.
Let U(x) be the exponential generating function of (un ). Prove that
d
U(x) = (1 − x)U(x) + xS(x),
dx
where S(x) is as in Exercise 4.12, and deduce that

U(x) = 12 (exp(x + x2 /2) + exp(x − x2 /2)).

4.15 Consider the recurrence relation

an = nan−1 , a0 = 1.

Clearly the unique solution is an = n!. What goes wrong if we try to apply the
method of Section 4.2.5 to this example?

4.16 Show that the number of tableaux of shape (n − k, k) for 1 ≤ k ≤ n/2 is


   
n n
− .
k k−1

4.17 (a) Prove that the inverse of the RSK algorithm produces a permutation π
from each pair (S, T ) of tableaux of the same shape.
(b) Prove that, if π is produced by (S, T ), then π −1 is produced by (T, S).
(c) Prove that, if the RSK algorithm adds a new element a in position i at the end
of the first row of S, then a is the smallest element which lies at the end of
an increasing subsequence of length i of the permutation π, and conversely.
Deduce that, on conclusion of the algorithm, the length of the first row of S
(and T ) is equal to the length of the longest increasing subsequence of π.

4.18 (a) Let π be a permutation of {1, . . . , n}. Suppose that the length of the
longest increasing subsequence of π is m. For i = 1, . . . , m, let Ai be the
subset of {1, . . . , n} consisting of positions for which the longest increasing
subsequence of π ending in that position is i. Show that each Ai carries a
decreasing subsequence of {1, . . . , n}. Deduce that the longest decreasing
subsequence of π has size at least n/m.

20:10:19, subject to the Cambridge


.005
4.8 Exercises 105

(b) Hence show that√π has either an increasing or a decreasing subsequence of


length at least  n.
(c) Using the fact that the lengths of the longest increasing and decreasing sub-
sequences of π are respectively the number of columns and number of rows
of the Young tableaux corresponding to π under the RSK algorithm, give an
alternative proof of the above facts.

4.19 Let k and l be positive integers, and n = kl. How many permutations of
{1, . . . , n} have the property that the longest increasing subsequence has length k
and the longest decreasing subsequence has length l?
Find all such permutations in the case k = l = 2.

4.20 Let P(n) be the number of partial permutations of the set {1, . . . , n}. Prove
that P(n)/n! tends to infinity faster than any polynomial in n.

20:10:19, subject to the Cambridge


.005
CHAPTER 5

The permanent

The permanent of a square matrix is defined by the same sum of products as the
determinant, but omitting the signs. Much of enumerative combinatorics involves
calculating or estimating the permanent. However, there are no simple techniques
for this. In this chapter we define the permanent and prove some of the main results
about it (except for the proof of van der Waerden’s conjecture), and apply them to
the enumeration of Latin squares.

5.1 Permanents and SDRs


There is a well-known formula for the determinant of an n × n matrix A = (ai j ):

det(A) = ∑ sgn(π)a1 1π a2 2π · · · an nπ ,
π∈Sn

where Sn is the symmetric group of degree n, and sgn(π) is the sign of the permu-
tation π. This is a beautiful theoretical formula, but very inefficient for calculating
determinants in practice, since it is a sum of n! terms; a matrix can be reduced to
upper triangular form (and its determinant calculated) with at most n3 arithmetic
operations by Gaussian elimination.
A very similar formula defines the permanent of A:

per(A) = ∑ a1 1π a2 2π · · · an nπ .
π∈Sn

This looks simpler since the signs are not present. Unfortunately, there are no
short-cuts for calculating the permanent. No method substantially faster than eval-
uating the formula is known.

106
20:10:36, subject to the Cambridge
.006
5.2 Hall’s Theorem 107

However, a great deal of enumerative combinatorics is concerned with evalu-


ating, or estimating, permanents of matrices with entries zero and one. We now
explain the connection.
Let (A1 , . . . , An ) be an n-tuple of subsets of a set X. A system of distinct repre-
sentatives, or SDR, is an n-tuple (a1 , . . . , an ) of elements of X such that

(a) ai = a j for i = j;
(b) ai ∈ Ai for all i.

(The first condition says that the elements are distinct; the second, that they are
representatives of the corresponding sets.)
Now suppose that |X| = n, say X = {1, 2, . . . , n}. The sets A1 , . . . , An can be
represented by an n × n incidence matrix P = (pi j ), where

1 if j ∈ Ai ,
pi j =
0 otherwise.

Proposition 5.1 Let P be the incidence matrix of (A1 , . . . , An ). Then per(P) is


equal to the number of SDRs of (A1 , . . . , An ).

Proof Each non-zero term in the permanent of P has the form p1 1π · · · pn nπ ,


where iπ ∈ Ai for i = 1, . . . , n; thus (1π, . . . , nπ) is an SDR for the family. Con-
versely, each SDR gives a non-zero term (with value 1) in the sum.

5.2 Hall’s Theorem


In this section, we suppose that (A1 , . . . , An ) is a family of subsets of a set X.
Suppose that the family has an SDR (a1 , . . . , an ). For any subset I of {1, . . . , n},
the |I| elements ai (for i ∈ I) are all distinct and belong to the set

A(I) = Ai .
i∈I

So we have
|A(I)| ≥ |I| for all i ⊆ {1, . . . , n}.
This is known as Hall’s condition, after Philip Hall, who proved that it is also
sufficient:

Theorem 5.2 (Hall’s Theorem) The family (A1 , . . . , An ) of subsets of X has a


SDR if and only if |A(I)| ≥ |I| for all I ⊆ {1, . . . , n}.

20:10:36, subject to the Cambridge


.006
108 The permanent

Proof We have seen the necessity of the condition; now we prove its sufficiency.
There are several proofs, of which the one given here is one of the simplest.
The proof is by induction on n. For n = 1, Hall’s condition says |A1 | ≥ 1, so
certainly an SDR exists. So suppose, inductively, that any family with fewer than
n sets which satisfies Hall’s condition has an SDR.
We say that a subset of {1, . . . , n} is critical if |A(I)| = |I|. We divide the proof
into two cases.

Case 1 No subset of {1, . . . , n} except 0/ and possibly {1, . . . , n} is critical. This


means that |A(I)| > |I| for any such set I. Choose any element an ∈ An , and let
Ai = Ai \ {an } for i = 1, . . . , n − 1. For any non-empty I ⊆ {1, . . . , n − 1}, we have

|A (I)| ≥ |A(I)| − 1 ≥ |I|,

since I is not critical. By induction, the family (A1 , . . . , An−1 ) has an SDR, say
(a1 , . . . , an−1 ). Clearly ai = an for i < n, so (a1 , . . . , an ) is an SDR for the original
family.

Case 2 There is a critical set J = 0, / {1, . . . , n}. By induction, there is an SDR


(a j : j ∈ J) for the family (A j : j ∈ J); it uses all the |J| elements of A(J). For
k∈/ J, set A∗k = Ak \ A(J). Then for K ⊆ {1, . . . , n} \ J, we have

|A∗ (K)| = |A(K ∪ J)| − |A(J)|


≥ |K ∪ J| − |J|
= |J|,

where the second inequality holds because |A(J)| = |J|. Combining the two SDRs
gives an SDR for the whole family.

5.3 The van der Waerden conjecture


A square matrix P is said to be doubly stochastic if its entries are non-negative
real numbers and all its row and column sums are 1.
If a matrix of real numbers has all entries non-negative and all row and column
sums equal to k > 0, then it can be converted to a doubly stochastic matrix by
dividing it by k. We will exploit this in the next section.
Why are such matrices called ‘doubly stochastic’? Suppose that the entries pi j
of an n × n matrix are non-negative and all the row sums are equal to 1. Then
we can regard P as describing a stochastic system which can be in any one of n
possible states; at a given instant, it makes a transition between states, and its prob-
ability of jumping from state i to state j is Pi j . (The row sum condition just says
that the probabilities of all outcomes sum to 1.) Such a matrix is called stochastic.

20:10:36, subject to the Cambridge


.006
5.3 The van der Waerden conjecture 109

The condition of being doubly stochastic requires the same condition for column
sums, though its probabilistic interpretation is less clear.

Proposition 5.3 The permanent of a doubly stochastic matrix is non-zero.

Proof Let X = {1, . . . , n}, and for i = 1, . . . , n, let

Ai = { j ∈ X : pi j > 0}.

We claim that (A1 , . . . , An ) satisfies Hall’s condition.


Take I ⊆ {1, . . . , n} and let |I| = i. Then the sum of all entries in the rows with
index in I is precisely i. But, for every j ∈ A(I), the sum of entries with row index
in I and column index j is at most 1, since the sum of all entries in column j is 1.
So we must have |A(I)| ≥ i = |I|.
By Hall’s Theorem, there is an SDR, say (a1 , . . . , an ), for (A1 , . . . , An ). Now
p1a1 p2a2 · · · pnan is a non-zero term in the permanent of P; since all terms are non-
negative, we have per(P) > 0.

The argument can be used to show a little more, a theorem of Birkhoff. A


permutation matrix is a matrix of zeros and ones with exactly one 1 in each row or
column. A permutation π is represented by a permutation matrix P(π) with (i, j)
entry 
1 if iπ = j,
pi j =
0 otherwise;
and every permutation matrix represents a unique permutation.

Proposition 5.4 A doubly stochastic matrix is a linear combination of permuta-


tion matrices with positive coefficients summing to 1.

Proof The proof is by induction on the number of non-zero entries in P. The


smallest possible number of entries is n, with equality if and only if P is a permu-
tation matrix.
So suppose that the proposition holds for doubly stochastic matrices with fewer
non-zero elements than P. Choose an SDR as in the preceding proof, let us say
(a1 , . . . , an ), and let
q = min{P1 a1 , . . . , Pn an }.
Then 0 < q ≤ 1; and we may assume that 0 < q < 1, since q = 1 only if P is a
permutation matrix.
Let B be the permutation matrix corresponding to the permutation π with iπ =
ai for i = 1, . . . , n. Then
P = (P − qB)/(1 − q)

20:10:36, subject to the Cambridge


.006
110 The permanent

is a doubly stochastic matrix with fewer non-zero entries than P; so by induction,


we have P = ∑ xi Bi , where xi > 0 and ∑ xi = 1. But then

P = qB + (1 − q) ∑ xi Bi ,

and (1 − q) + q ∑ xi = 1, as required.

Can we improve the lower bound of zero for the permanent?


The matrix (1/n)J, where J has every entry 1, is doubly stochastic, and has
permanent n!/nn . It was conjectured by van der Waerden that this matrix is ex-
tremal; that is, any doubly stochastic matrix P of order n satisfies per(P) ≥ n!/nn ,
with equality if and only if P = (1/n)J.
The conjecture was proved independently by Egorychev and Falikman in 1981.
The proof is just a little too long to be given here. You will find an accessible
account of it in the book by van Lint and Wilson (see the bibliography).

Theorem 5.5 (Egorychev–Falikman Theorem) If P is a doubly stochastic ma-


trix of order n, then per(P) ≥ n!/nn , with equality if and only if P = (1/n)J.

5.4 Latin squares

A Latin square of order n is an n × n array with entries taken from the set
{1, . . . , n} of symbols, such that each symbol occurs once in each row and once in
each column.
For example, the following are the two Latin squares of order 3 with first row
(1, 2, 3). Since the first row is arbitrary, there are 2 × 6 = 12 Latin squares of
order 3 altogether.

1 2 3 1 2 3
2 3 1 3 1 2
3 1 2 2 3 1

Let L(n) be the number of Latin squares of order n. As hinted in the Preface,
the problem of calculating L(n) exactly seems to be intractible. Values are known
for n ≤ 11, as a result of extensive computation. The first ten are given in the
following table. (The last entry was found by Brendan McKay and Ian Wanless in
2005.)

20:10:36, subject to the Cambridge


.006
5.4 Latin squares 111

n L(n)
1 1
2 2
3 12
4 576
5 161280
6 812851200
7 61479419904000
8 108776032459082956800
9 5524751496156892842531225600
10 9982437658213039871725064756920320000
11 776966836171770144107444346734230682311065600000

Can we find estimates for L(n), perhaps upper and lower bounds which are not
too far apart?
The number of ways of placing symbols into an n × n array without restriction
2 2
is nn ; so clearly L(n) ≤ nn . We can improve this by observing that each row is
a permutation of {1, . . . , n}, so that L(n) ≤ (n!)n . By Stirling’s formula, the right-
2
hand side is about (2πn)n/2 (n/e)n . So, roughly speaking, we have knocked off a
2
factor of en .
This bound can be further improved by noting that the second, . . . , nth rows are
derangements of the first; so L(n) ≤ n! d(n)n−1 . The improvement is only a factor
of about en−1 .
We can find a lower bound by building Latin squares row by row. We define a
k × n Latin rectangle for k ≤ n to be a k × n array containing the symbols {1, . . . , n}
so that each symbol occurs once in each row and at most once in each column.
Note that a 1 × n Latin rectangle is simply a permutation; there are n! of these. A
2 × n Latin rectangle consists of two permutations, the second a derangement of
the first; the number of these is n! d(n) ∼ (n!)2 /e.

Proposition 5.6 For k < n, any k × n Latin rectangle can be extended to a (k +


1)×n Latin rectangle; the number of such extensions is the permanent of a suitable
n × n matrix of zeros and ones with row and column sums n − k.

Proof Given a k × n Latin rectangle L, let Ai be the set of symbols which do not
occur in the ith column. Then the ith entry in the (k + 1)st row must be chosen
from Ai ; and these entries must all be distinct, so the row is a SDR for the sets
(A1 , . . . , An ). Thus the number of ways to extend the array to one of size (k + 1) × n
is the number of SDRs of (A1 , . . . , An ), which is equal to the permanent of its
incidence matrix P.

20:10:36, subject to the Cambridge


.006
112 The permanent

We claim that P has all row and column sums n − k. For the rows this is clear,
since |Ai | = n − k for all i. The jth column sum is the number of columns in
which j does not occur in the array. But j occurs k times in the array, in k distinct
columns, so fails to appear in (n − k) columns.

The matrix (1/(n − k))P in the above proof is doubly stochastic. By the theo-
rem of Egorychev and Falikman, per((1/(n − k))P) ≥ n!/nn ; so we have

per(P) ≥ n! (n − k)n /nn .

In the case k = 1, assuming that the first row is the identity permutation, we
have P = J − I, where I is the matrix with every entry 1. A permutation contributes
to the permanent of P if and only if it is a derangement; so per(P) = d(n) ∼ n!/e.
The estimate from the Egorychev–Falikman Theorem is

n! (1 − 1/n)n ∼ n!/e.

since (1 − 1/n) → e as n → ∞.
For n = 10, we have (9/10)10 = 0.3486784401, while 1/e = 0.367879441 . . .;
so our estimate from van der Waerden’s conjecture is about 5% too low. The
approximation gets better for larger n.
Now the total number of Latin squares satisfies

n−1
n! (n − k)n (n!)2n
L(n) ≥ ∏ = n2 .
k=0 nn n

2
The number on the right is about (2πn)n (n/e2 )n , by Stirling’s formula.
2
We have obtained upper and lower bounds for L(n) which are roughly (cn)n ,
where c = 1/e for the lower bound and 1/e for the upper. Existing exact results
2

are not adequate for making guesses about which bound is closer to the truth!

Remark For k ≥ 2, the number of extensions of a k × n Latin rectangle to a


(k + 1) × n Latin rectangle is not constant. For example, the two Latin rectangles

1 2 3 4 1 2 3 4
and
2 3 4 1 2 1 4 3

have 2 and 4 extensions respectively. However, it is conjectured that the number of


extensions of a 2 × n Latin rectangle to a Latin square is approximately constant, in
the sense that the ratio of the largest to the smallest tends (rapidly) to 1 as n → ∞.

20:10:36, subject to the Cambridge


.006
5.5 Latin rectangles 113

5.5 Latin rectangles


The number of 1 × n Latin rectangles is n! (these are simply the permutations),
and the number of 2 × n Latin rectangles is n! d(n), where d(n) is the derangement
number.
It is more difficult to count 3 × n rectangles; some special types have been enu-
merated. Consider the case where the second row is a cyclic shift of the first. We
may assume that the first row is (1, 2, . . . , n) (to get the total, we simply multiply the
number of rectangles with this first row by n!), and the second row (2, 3, . . . , n, 1).
We need to count the number of ways of adding the third row.
This problem is known as the problème des ménages, and can be formulated as
follows. A number n of couples are to be seated at 2n places round a circular table.
The gentlemen take alternate seats. In how many ways can the ladies be seated so
that no lady is seated next to her partner? If we number the couples from 1 to n so
that the gentlemen are seated in the order (1, . . . , n) around the table, then the lady
ai who sits in the place between gentlemen numbers i and i + 1 should not be the
partner of either of these; that is, ai ∈
/ {i, i + 1} for i = 1, . . . , n (where the indices
are taken modulo n).
We will solve this counting problem in Chapter 8, using the Inclusion–Exclusion
Principle.

5.6 Exercises
Let d(n) denote the number of derangements of {1, . . . , n}.

5.1 Show that the permanent of the n × n matrix with diagonal entries 0 and off-
diagonal entries 1 is equal to d(n).

5.2 Show that the number of 2 × n Latin rectangles is equal to n! d(n).

5.3 Show that it is not possible to construct Latin squares by placing elements
from {1, . . . , n} into an n × n grid arbitrarily subject to the constraint that no el-
ement occurs more than once in the same row or column. What is the smallest
number of elements which have to be added in order to reach a situation where
completion to a Latin square is impossible?

20:10:36, subject to the Cambridge


.006
CHAPTER 6

q-analogues

Much of the enumerative combinatorics of sets and functions can be generalised


in a manner which, at first sight, seems a bit unmotivated. We introduce a new
parameter q and construct functions which, in the limit as q tends to 1, become
familiar combinatorial numbers such as factorials and binomial coefficients.
In this chapter, we develop a small amount of this large body of theory.

6.1 Motivation
We can look at q-analogues in several ways:
• The q-analogues are, typically, formulae which tend to the classical ones as
q → 1. Most basic is the fact that
qa − 1
lim =a
q→1 q − 1
for any real number a (this is immediate from l’Hôpital’s rule).
• There is a formal similarity between statements about subsets of a set and
subspaces of a vector space, with cardinality replaced by dimension. For
example, the Inclusion–Exclusion rule
|U ∪V | + |U ∩V | = |U| + |V |
for sets becomes
dim(U +V ) + dim(U ∩V ) = dim(U) + dim(V )
for vector spaces. Now, if the underlying field has q elements, then the
number of 1-dimensional subspaces of an n-dimensional vector space is
(qn − 1)/(q − 1), which is exactly the q-analogue of n.

114
20:20:19, subject to the Cambridge
.007
6.1 Motivation 115

• Sometimes, replacing a simple count of objects with summing the weights


of objects weighted in a certain way can translate binomial coefficients into
Gaussian coefficients. We see an example involving lattice paths shortly.
• There is a notion of ‘quantum calculus’ or ‘q-calculus’, which is described
briefly in the last section of this chapter.
• The simplest example of non-commutative geometry involves an algebra
generated by two indeterminates x and y satisfying yx = qxy. In such an
algebra, we can rearrange any monomial of degree n in x and y to the form
xn−i yi , and so there will be an expression
n
(x + y)n = ∑ cq (n, i)xn−i yi .
i=0

The coefficients cq (n, i) will be q-analogues of binomial coefficients.


• There are applications in algebra, where for example it is easier to find the
irreducible representations of an algebra depending on a parameter q and
study them as q → 1 than to find the representations of the limit algebra
directly.
• The analogy can be interpreted at a much higher level, in the language of
braided categories. I will not pursue this here. You can read more in various
papers of Shahn Majid, for example Braided Groups, J. Pure Appl. Algebra
86 (1993), 187–221; Free braided differential calculus, braided binomial
theorem and the braided exponential map, J. Math. Phys. 34 (1993), 4843–
4856.

In connection with the second interpretation, note the theorem of Galois:

Theorem 6.1 The cardinality of any finite field is a prime power. Moreover, for
any prime power q, there is a unique field with q elements, up to isomorphism.

To commemorate Galois, finite fields are called Galois fields, and the field
with q elements is denoted by GF(q).
Here is an example where Gaussian coefficients arise in a weighted counting
problem.
A lattice path in the first quadrant of the plane is a path starting at the origin,
each step being either one unit to the right, or one  unit upwards.
 The number of
m+n
lattice paths from the origin to the point (m, n) is . For to move from the
m
origin to (m, n), we must take m + n steps, and exactly m of these steps must be to
the right; we can choose which m of the m + n steps are to the right arbitrarily.
This fact can also be proved by means of a recurrence relation. Let P(m, n) be
the number of lattice paths from the origin to (m, n). Clearly P(0, n) = P(m, 0) = 0.

20:20:19, subject to the Cambridge


.007
116 q-analogues

If m, n > 0, then any path to (m, n) must pass either through (m − 1, n) or through
(m, n − 1); so we have

P(m, n) = P(m − 1, n) + P(m, n − 1) for m, n > 0.

This recurrence relation determines


 P(m,  n) for all m, n ≥ 0; and an easy induction
m+n
on m + n shows that P(m, n) = .
m
Now suppose that we give a ‘weight’ of qA to a lattice path if the area under the
path is A (see Figure 6.1). What is the sum of the weights of the lattice paths? Let
Q(m, n) be this number. Again we have Q(m, 0) = Q(0, n) = 1. If m, n > 0, then
the sum of the weights of lattice paths from the origin to (m − 1, n) is Q(m − 1, n),
and the last step to (m, n) adds n to the area, and so multiplies the sum of weights
by qn . On the other hand, the sum of the weights of the paths to (m, n − 1) is
Q(m, n − 1), and the final vertical step to (m, n) adds no extra area to such paths.
So
Q(m, n) = qn Q(m − 1, n) + Q(m, n − 1) for m, n > 0.
Again, Q(m, n) is determined for all m, n ≥ 0, and the same induction (using
 Propo-

sition 6.3 in place of the binomial recurrence) shows that Q(m, n) = m+n m q for
m, n ≥ 0.
r r r r r

r r r r r

r r r r r

r r r r r

Figure 6.1: A lattice path of weight q5

6.2 q-integers
We define the q-integer [n]q to be

qn − 1
[n]q = .
q−1

We make two observations:

(a) We have limq→1 [n]q = n, by l’Hôpital’s rule (as noted above).

20:20:19, subject to the Cambridge


.007
6.2 q-integers 117

(b) [n]q is the number of 1-dimensional subspaces of the n-dimensional vector


space over GF(q), for a prime power q. For such a vector space is isomor-
phic to the space GF(q)n of all n-tuples over GF(q), and so has cardinal-
ity qn . Any non-zero vector spans a 1-dimensional subspace, and any 1-
dimensional subspace contains q − 1 non-zero vectors, each of which spans
it.

In terms of q-integers, we can define q-analogues of other combinatorial func-


tions. For example, we define the q-factorial to be

[n]!q = [n]q · [n − 1]q · [1]q ,

and the q-binomial coefficient or Gaussian coefficient to be


 
n [n]!q
= .
k q [k]!q [n − k]!q

These have the property that they tend to the usual factorials and binomial coeffi-
cients as q → 1. However, they will not always be the most appropriate definitions.
Indeed, it is not clear that there should always be a most appropriate definition. We
should proceed with caution!
It can be shown that the Gaussian coefficient is a polynomial in q, if we regard
q as an indeterminate. If instead we regard q as a complex number, it has a well-
defined value as long as q is not a dth root of unity for some d dividing k. (In the
excluded cases, the denominator is zero, but the limit still exists.)
Fortunately, in the case of q-binomial coefficients, the proposed definition works
without problems:

Proposition 6.2 If q is a prime power, then the number of k-dimensional sub-
n
spaces of an n-dimensional vector space over GF(q) is .
k q

Proof The number of choices of k linearly independent vectors in GF(q)n is

(qn − 1)(qn − q) · · · (qn − qk−1 ),

since the ith vector must be chosen outside the span of its predecessors. Any such
choice is the basis of a unique k-dimensional subspace. Putting n = k, we see that
the number of bases of a k-dimensional space is

(qk − 1)(qk − q) · · · (qk − qk−1 ).

Dividing and cancelling powers of q gives the result.

20:20:19, subject to the Cambridge


.007
118 q-analogues

6.3 The q-Binomial Theorem


The q-binomial coefficients satisfy an analogue of the recurrence relation for
binomial coefficients.
         
n n n n−1 k n−1
Proposition 6.3 = = 1, = +q for 0 < k < n.
0 q n q k q k−1 q k q

Proof This comes straight from the definition. Suppose that 0 < k < n. Then
     n  
n n−1 q −1 n−1
− = − 1
k q k−1 q qk − 1 k−1 q
 n−k  
k q −1 n−1
= q
qk − 1 k−1 q
 
n
= qk .
k−1 q

The array of Gaussian coefficients has the same symmetry as that of binomial
coefficients. From this we can deduce another recurrence relation.

Proposition 6.4 (a) For 0 ≤ k ≤ n,


   
n n
= .
k q n−k q

(b) For 0 < k < n,      


n n−1 n−1
= qn−k + .
k q k−1 q k q

Proof (a) is immediate from the definition. For (b),


   
n n
=
k q n−k q
   
n−1 n−1
= + qn−k
n−k−1 q n−k q
   
n−1 n−k n − 1
= +q .
k q k−1 q

We come now to the q-analogue of the Binomial Theorem, which states the
following.

20:20:19, subject to the Cambridge


.007
6.4 Elementary symmetric functions 119

Theorem 6.5 For a positive integer n, a real number q = 1, and an indetermi-


nate z, we have  
n n
k(k−1)/2 k n
∏ (1 + qi−1
z) = ∑ q z
k q
.
i=1 k=0

Proof The proof is by induction on n; starting the induction at n = 1 is trivial.


Suppose that the result is true for n − 1. For the inductive step, we must compute

 
n−1
n − 1  
∑ qk(k−1)/2zk k 1 + qn−1 z .
k=0 q

The coefficient of zk in this expression is


   
k(k−1)/2 n − 1 (k−1)(k−2)/2+n−1 n − 1
q +q
k q k−1 q

   
n−1 n−1
= qk(k−1)/2 + qn−k
k q k−1 q
 
n
= qk(k−1)/2
k q
by Proposition 6.4(b).
Remark The usual binomial formula appears unexpectedly in a different, though
related, context, that of non-commutative geometry mentioned earlier. Suppose
that, instead of being real or complex numbers, x and y are indeterminates (ele-
ments of some real algebra) which satisfy the commutation relation
yx = qxy.
Then  
n
n
(x + y) = ∑
n
xk yn−k .
k=0 k q
(See Exercise 6.9.)

6.4 Elementary symmetric functions


In this section we touch briefly on the theory of elementary symmetric func-
tions.
Let x1 , . . . , xn be n indeterminates. For 1 ≤ k ≤ n, the kth elementary symmet-
ric function ek (x1 , . . . , xn ) is the sum of all monomials which  can be formed by
multiplying together k distinct indeterminates. Thus, ek has nk terms, and
 
n
ek (1, 1, . . . , 1) = .
k

20:20:19, subject to the Cambridge


.007
120 q-analogues

For example, if n = 3, the elementary symmetric functions are

e1 = x1 + x2 + x3 , e2 = x1 x2 + x2 x3 + x3 x1 , e3 = x1 x2 x3 .

We adopt the convention that e0 = 1.


Newton observed that the coefficients of a polynomial of degree n are the ele-
mentary symmetric functions of its roots, with appropriate signs:

n n
Proposition 6.6 ∏(z − xi) = ∑ (−1)k ek (x1, . . . , xn)zn−k .
i=1 k=0

Consider the generating function for the ek :


n
E(z) = ∑ ek (x1, . . . , xn)zk .
k=0

A slight rewriting of Newton’s Theorem shows that


n
E(z) = ∏(1 + xi z).
i=1

Hence the Binomial Theorem and its q-analogue give the following specialisations:

Proposition 6.7 (a) If x1 = . . . = xn = 1, then


 
n
n
E(z) = (1 + z)n = ∑ k zk ,
k=0

so  
n
ek (1, 1, . . . , 1) = .
k

(b) If xi = qi−1 for i = 1, . . . , n, then


n n  
n
E(z) = ∏(1 + qi−1 z) = ∑ qk(k−1)/2zk k q
,
i=1 k=0

so  
n
ek (1, q, . . . , qn−1 ) = qk(k−1)/2 .
k q

20:20:19, subject to the Cambridge


.007
6.5 Partitions and permutations 121

6.5 Partitions and permutations


The number of permutations of an n-set is n!. The linear analogue of this is the
number of linear isomorphisms from an n-dimensional vector space to itself; this
is equal to the number of choices of basis for the n-dimensional space, which is

(qn − 1)(qn − q) · · · (qn − qn−1 ).

These linear maps form a group, the general linear group GL(n, q).
To an algebraist, the general linear group might seem to be a q-analogue of the
symmetric group, but its order is not the q-factorial defined earlier!
Using the q-Binomial Theorem, we can transform the multiplicative formula
for the order of GL(n, q) into an additive formula:

Proposition 6.8
n  
n
| GL(n, q)| = (−1)n qn(n−1)/2 ∑ (−1)k qk(k+1)/2 .
i=0 k q

Proof We have
n
| GL(n, q)| = (−1)n qn(n−1)/2 ∏(1 − qi ),
i=1

and the right-hand side is obtained by substituting z = −q in the q-Binomial The-


orem.
2
The total number of n × n matrices is qn , so the probability that a random
matrix is invertible is
n
pn (q) = ∏(1 − q−i ).
i=1

As n → ∞, we have
pn (q) → p(q) = ∏(1 − q−i ). (6.1)
i≥1

According to Euler’s Pentagonal Numbers Theorem (Proposition 4.11), we have

p(q) = ∑ (−1)k q−k(3k−1)/2 = 1 − q−1 − q−2 + q−5 + q−7 − q−12 − · · · (6.2)


k∈Z

So, for example, p(2) = 0.2887 . . . is the limiting probability that a large random
matrix over GF(2) is invertible.

20:20:19, subject to the Cambridge


.007
122 q-analogues

What is the q-analogue of the Stirling number S(n, k), the number of partitions
of an n-set into k parts? This is a philosophical, not a mathematical question; I
argue that the q-analogue is the Gaussian coefficient nk q .
The number of surjective maps from an n-set to a k-set is k!S(n, k), since the
preimages of the points in the k-set form a partition of the n-set whose k parts can
be mapped to the k-set in any order. The q-analogue is the number of surjective
linear maps from an n-space V to a k-space W . Such a map is determined by its
kernel U, an (n − k)-dimensional subspace of V , and a linear isomorphism from
V /U to W . So the analogue of S(n, k) is the number of choices of U, which is
   
n n
= .
n−k q k q

6.6 Irreducible polynomials


Though it is not really a q-analogue of a classical result, the following theorem
comes up in various places. Recall that a polynomial of degree n is monic if the
coefficient of xn is equal to 1.

Theorem 6.9 The number fq (n) of monic irreducible polynomials of degree n


over GF(q) satisfies
∑ k fq(k) = qn.
k|n

Proof We give two proofs, one depending on some algebra, and the other a rather
nice exercise in manipulating formal power series.

First proof: We use the fact that the roots of an irreducible polynomial of
degree k over GF(q) lie in the unique field GF(qk ) of degree k over GF(q). More-
over, GF(qk ) ⊆ GF(qn ) if and only if k | n; and every element of GF(qn ) generates
some subfield over GF(q), which has the form GF(qk ) for some k dividing n.
Now each of the qn elements of GF(qn ) satisfies a unique minimal polynomial
of degree k for some k; and every irreducible polynomial arises in this way, and
has k distinct roots. So the result holds.

Second proof: All the algebra we use in this proof is that each monic poly-
nomial of degree n can be factorised uniquely into monic irreducible factors. If the
number of monic irreducibles of degree k is mk , then we obtain all monic polyno-
mials of degree n by the following procedure:

• Express n = ∑ ak k, where ak are non-negative integers;

20:20:19, subject to the Cambridge


.007
6.6 Irreducible polynomials 123

• Choose ak monic irreducibles of degree k from the set of all mk such, with
repetitions allowed and order not important;
• Multiply the chosen polynomials together.
Altogether there are qn monic polynomials xn + c1 xn−1 + · · · + cn of degree n,
since there are q choices for each of the n coefficients. Hence
 
mk + ak − 1
q = ∑∏
n
, (6.3)
k ak

where the sum is over all sequences a1 , a2 , . . . of natural numbers which satisfy
∑ kak = n.
Multiplying by xn and summing over n, we get
1
1 − qx
= ∑ qnxn
n≥0
 
mk + ak − 1 kak
= ∑ ∏ ak
x
a1 ,a2 ,... k≥1
 
mk + a − 1
= ∏∑ (xk )a
k≥1 a≥0 a
= ∏ (1 − xk )−mk .
k≥1

Here the manipulations are similar to those for the sum of cycle indices which we
will meet in the next chapter; we use the fact that the number of choices of a things
from a set of m, with repetition allowed and order unimportant, is
   
m+a−1 −m
= (−1)a
a a
(see Theorem 3.6), and in the fourth line we invoke the Binomial Theorem with
negative exponent.
Taking logarithms of both sides, we obtain
qn x n
∑ = − log(1 − qx)
n≥1 n
= ∑ −mk log(1 − xk )
k≥1
xkr
= ∑ mk ∑ .
k≥1 r≥1 r

The coefficient of xn in the last expression is the sum, over all divisors k of n,
of mk /r = kmk /n. This must be equal to the coefficient on the left, which is qn /n.

20:20:19, subject to the Cambridge


.007
124 q-analogues

We conclude that
qn = ∑ kmk , (6.4)
k|n

as required.

Note how the very complicated recurrence relation (6.3) for the numbers mk
changes into the much simpler recurrence relation (6.4) after taking logarithms!
We will see how to solve such a recurrence in the chapter on Möbius inversion.

6.7 Quantum calculus


The q-analogues of combinatorial formulae arise naturally in the so-called q-
calculus, which we now describe. For further details and a wealth of examples
from classical mathematics, we refer to the book Quantum Calculus by Victor Kac
and Pokman Cheung, listed in the bibliography.
Given an arbitrary real function f (x), and a real number q = 1, we define the
q-differential to be
dq f (x) = f (qx) − f (x).
Clearly we have dq x = (q − 1)x. Then we define the q-derivative of f (x) by

dq f (x)
Dq f (x) = .
dq x

Note that, unlike ordinary calculus, the differentials are defined directly, and the
derivative is their quotient. If f (x) is differentiable, with derivative f  (x), then we
have
lim Dq f (x) = f  (x).
q→1

Now it is easy to see that

Dq xn = [n]q xn−1

for positive integers n, where


qn − 1
[n]q =
q−1
is the q-analogue of n.
The chain rule does not hold for the q-calculus; it is not true that Dq (x +
a)n = [n]q (x + a)n−1 . We need a q-analogue of (x + a)n , which turns out to be the
following function:

(x + a)nq = (x + a)(x + qa) · · · (x + qn−1 a).

20:20:19, subject to the Cambridge


.007
6.8 Exercises 125

Then we do indeed have

Dq (x + a)nq = [n]q (x + a)n−1


q .

Now define the q-analogues of factorials and binomial coefficients by

[n]!q = [1]q · [2]q · · · [n]q ,


 
n [n]!q
= .
k q [k]!q [n − k]!q

Then the q-Binomial Theorem can be stated in the form


n  
n
(x + y)nq = ∑ qk(k−1)/2 xk yn−k .
k=0 k q

Remark There is another type of quantum calculus, namely the h-calculus, de-
fined as follows: we have

dh f (x) = f (x + h) − f (x),

so that dh x = h, and then


dh f (x)
Dh f (x) = .
dh x
Clearly limh→0 Dh f (x) = f  (x) if f is differentiable. The h-calculus is connected
with the Bernoulli numbers and the Euler–Maclaurin sum formula, which we will
discuss in a later chapter. For further details of these two quantum calculi and a
generalisation, see the book by Kac and Cheung.

6.8 Exercises
 
n
6.1 Prove that is a polynomial of degree k(n − k) in the indeterminate q.
k q
 
n
6.2 Prove that, for fixed n, the Gaussian coefficients for k = 0, 1, . . . , n form
k q
a log-concave sequence.

6.3 (a) Prove that, for 0 < k < n,


       
n n−1 n−1 n−2
= + + (qn−1 − 1) .
k q k−1 q k q k−1 q

20:20:19, subject to the Cambridge


.007
126 q-analogues

(b) Let  
n
n
Fq (n) = ∑ k ,
k=0 q
so that, if q is a prime power, then Fq (n) is the total number of subspaces of
an n-dimensional vector space over GF(q). Prove that
Fq (0) = 1, Fq (1) = 2, Fq (n) = 2Fq (n − 1) + (qn−1 − 1)Fq (n − 2) for n ≥ 2.
2 /4
(c) Deduce that, if q > 1, then Fq (n) ≥ c qn for some constant c (depending
on q).

6.4 This exercise shows that the Gaussian coefficients have a counting interpreta-
tion for all positive integer values of q (not just prime powers).
Suppose that q is an integer greater than 1. Let Q be a finite set of cardinality q
containing two distinguished elements 0 and 1. We say that a k × n matrix with
entries from Q is in reduced echelon form if the following conditions hold:
• If a row has any non-zero entries, then the first such entry is 1 (such entries
are called ‘leading 1’);
• if i < j and row j is non-zero, then row i is also non-zero, and its leading 1
occurs to the left of the leading 1 in row j;
• if a column contains the leading 1 of some row, then all other entries in that
column are 0.
 
n
Prove that is the number of k × n matrices in reduced echelon form with no
k q
rows of zeros.

6.5 A matrix is said to be in echelon form if it satisfies the first two conditions in
the definition of reduced echelon form. Show that, if q is an integer greater than 2,
the right-hand side of the q-Binomial Theorem with x = 1 counts the number of
n × n matrices in echelon form.
How many n × n matrices in reduced echelon form are there?

6.6 Let hk (x1 , . . . , xn ) be the complete symmetric function of degree k in the in-
determinates x1 , . . . , xn (the sum of all monomials of degree k that can be formed
using these indeterminates). For example,
h2 (x1 , x2 , x3 ) = x12 + x22 + x32 + x1 x2 + x2 x3 + x3 x1 .
Prove that
∞ n
∑ hk (x1, . . . , xn)zk = ∏(1 − xiz)−1.
k=0 i=1
Deduce that

20:20:19, subject to the Cambridge


.007
6.8 Exercises 127
 
n+k−1
(a) hk (1, 1, . . . , 1) = ;
k
 
n+k−1
(b) hk (1, q, . . . , q ) =
n−1
for q = 1.
k q

Hint for (b): show that


  
k
n+i−2 n+k−1
∑q i
i
=
k
.
i=0 q q

6.7 The second proof of Theorem 6.9 shows that the number of irreducible poly-
nomials over GF(q) is exactly what is required if every element of GF(qn ) is the
root of a unique irreducible of degree dividing n over GF(q). Turn the argument
around to give a counting proof of the existence and uniqueness of GF(qn ), given
that of GF(q).
 
n
6.8 Let ω be a primitive dth root of unity. Express in terms of binomial
k ω
coefficients (whenever you can).

Solution by Pablo Spiga Let d be a natural number, and let ω be a primitive dth
root of unity in C, i.e. ω d = 1. Then, if 0 ≤ a, b ≤ d − 1, we have
    
nd + a n a
= .
kd + b ω k b ω

Note that we are assuming that ab ω = 0 whenever a < b.

Solution By induction on a. We have


d
1−ξd = ∏(ω i−1 − ξ )
i=1
d
= ∏(ω i−1 · (1 − ω −i+1ξ ))
i=1
d d
= ∏ ω i−1 · ∏(1 − ω i−1ξ ).
i=1 i=1

Thus, we get
nd nd  
nd
∏(1 + ω i−1
(−ξ )) = ∑ω j( j−1)/2
(−1)
j
j
ξ j, (6.5)
i=1 j=0 ω

20:20:19, subject to the Cambridge


.007
128 q-analogues

but  
nd n
n
∏(1 + ω (−ξ )) = (1 − ξ ) = ∑ k (−1)k ξ kd .
i−1 d n
(6.6)
i=1 k=0
 
We have proved that ndj = 0 if d does not divide j. Assume j = dk. By (6.5)
ω
and (6.6), as
ω dk(dk−1)/2 (−1)k(d+1) = 1, (6.7)
we get    
nd n
= .
kd ω k
(For (6.7), note that if d is odd then (−1)d+1 = 1, while if d is even then we can
2
write −1 as ω d/2 , and we find ω dk(dk+d)/2 = ω d k(k+1)/2 .) This proves the result
for a = 0.
Assume a ≥ 1. If b = 0 then, by induction hypothesis and by the usual recur-
rence relation, we get
     
nd + a nd + a − 1 nd + a − 1
= + ω kd+b
kd + b ω kd + b − 1 ω kd + b ω
     
n a−1 n a −1
= + ωb
k b−1 ω k b ω
  
n a
= .
k b ω
Finally, if b = 0, then, as a − 1 < d − 1,
     
nd + a nd + a − 1 kd nd + a − 1
= +ω
kd ω (k − 1)d + d − 1 ω kd ω
   
n a − 1
= ω0
k 0 ω
  
n a
= .
k b ω
Remark Compare Lucas’ formula
    
np + a n a
≡ (mod p)
kp + b k b
if p is prime and 0 ≤ a, b < p.
6.9 Prove that, if the indetermintes x and y satisfy yx = qxy, then
n  
n n−k k
(x + y)n = ∑ x y.
k=0 k q

20:20:19, subject to the Cambridge


.007
6.8 Exercises 129

6.10 (a) Prove that

Dq ( f (x)g(x)) = f (qx)Dq (g(x)) + g(x)Dq ( f (x)).

(b) Find a formula for Dq ( f (x)/g(x)).

(c) Prove that, if g(x) = axn , then

Dq ( f (g(x))) = (Dqn f )(g(x)) · Dq (g(x)).

6.11 Prove Heine’s formula, the q-analogue of the negative Binomial Theorem:
∞  
1 n+ j−1
=∑ x j.
(1 − x)nq j=0 j q

6.12 Prove Euler’s formulae


∞ ∞
xj
∏(1 + xqi) = ∑ q j( j−1)/2 (1 − q)(1 − q2) · · · (1 − q j ) ,
i=0 j=0
∞ ∞
xj
∏(1 − xqi)−1 = ∑ (1 − q)(1 − q2) · · · (1 − q j ) ,
i=0 j=0

Hint: Let n → ∞ in the q-Binomial Theorems.

6.13 Define the q-exponential by



xn
expq (x) = ∑ [n]!q .
n=0

Prove that, if yx = qxy, then expq (x + y) = expq (x) expq (y).

6.14 Using each of the formulae (6.1) and (6.2), estimate the probability that a
large matrix over GF(2) is invertible. Compare the rate of convergence of the two
formulae.

6.15 (a) Let W be a k-dimensional subspace of an n-dimensional vector space


over GF(q). Prove that the number of complements of W in V is qk(n−k) .
(b) Hence show that the number of linear bijections between pairs of k-dimensional
subspaces of V is equal to the number of linear maps from V to V of rank k.
(c) Deduce that the total number of linear bijections between subspaces of V is
equal to the total number of linear maps from V to V .

20:20:19, subject to the Cambridge


.007
130 q-analogues

Remark The result of this exercise can be expressed as the identity


n  2
n
∑ k | GL(k, q)| = qn .
2

k=0 q

This is a true analogue of a ‘false theorem’ about sets and functions. The number
of partial permutations of an n-set is
n  2
n
∑ k |Sk |
k=0

(see Theorem 4.20), whereas the number of maps from an n-set to itself is nn ; these
numbers are definitely not equal!

20:20:19, subject to the Cambridge


.007
CHAPTER 7

Group actions and the cycle index

There are many situations in combinatorics where we want to count the number
of arrangements of some kind, not in total, but up to some symmetry of the prob-
lem concerned. The branch of mathematics which deals with symmetry is group
theory, in particular the theory of group actions. In this chapter we consider how
to use information about a group action (specifically, a polynomial known as the
cycle index) to solve problems of this kind.
Here is an example.
A cube has six faces, so if we paint each face red, white or blue, the total
numbers of ways that we can apply the colours is 36 = 729. However, if we can
pick up the cube and move it around, it is natural to count in a different way,
where two coloured cubes differing only by a rotation are counted as ‘the same’.
There are 24 rotations of the cube into itself, but the answer to our question is not
obtained just by dividing 729 by 24. The purpose of this section is to develop tools
for answering such questions.
The theory of permutation groups has many connections to combinatorics other
than its use in enumeration. To choose one example, a number of the ‘sporadic’
finite simple groups were first constructed as groups of automorphisms of combi-
natorial structures such as graphs or designs.

7.1 Group actions


Let X be a set, and G a set of permutations of X. We write the image of x ∈ X
under the permutation g as xg . We denote the identity permutation (leaving every
element of X where it is) by 1, and the inverse of a permutation g (the permutation
h with xg = y ⇔ xh = x) by g−1 . The composition of two permutations g and h,

131
20:17:49, subject to the Cambridge
.008
132 Group actions and the cycle index

denoted by gh, is defined by the rule that

xgh = (xg )h

(in other words, apply first g, then h).


We say that G is a permutation group if the following conditions hold:

• G contains the identity permutation;


• G contains the inverse of each of its elements;
• G contains the composition of any two of its elements.

For example, the 24 rotational symmetries of a cube form a permutation group


on the set of points of the cube.
Until the middle of the nineteenth century, what we have just defined would
have simply been called a group. Now the definition of a group is more abstract.
We don’t go into abstract group theory here, but note some terminology arising
from this. If G is an abstract group in the modern sense, an action of G on the set
X is a function associating a permutation of X with each group element, in such a
way that the identity, inverse, and composition of permutations correspond to the
same concepts in the abstract group.
In particular, if G is a permutation group on a set X, then we can construct
actions of G on various auxiliary sets built from X: for example, the set of ordered
pairs of elements of X, the set of subsets of X, the set of functions from X to
another set (or from another set to X).
For example, G acts on the set X × X of ordered pairs of elements of X by the
rule
(x, y)g = (xg , yg )
for x, y ∈ X, g ∈ G; that is, the permutation g acts coordinate-wise on ordered pairs,
mapping (x, y) to (xg , yg ).
Thus, the phrases ‘G is a permutation group on X’ and ‘G acts on X’ are al-
most synonymous; the difference is of less interest to a combinatorialist than to an
algebraist.

Suppose that G acts on X. We define a relation ∼ on X by the rule that x ∼ y if


y = xg for some g ∈ G.

Proposition 7.1 ∼ is an equivalence relation.

Proof We check the three conditions.

• x = x1 , so x ∼ x: ∼ is reflexive.
−1
• Let x ∼ y. Then y = xg , so x = yg , so y ∼ x: ∼ is symmetric.

20:17:49, subject to the Cambridge


.008
7.2 The Orbit-counting Lemma 133

• Let x ∼ y and y ∼ z. Then x = xg and z = yh , for some g, h ∈ G. Thus,


z = (xg )h = xgh , so x ∼ z: ∼ is transitive.

Note that the three conditions in the definition of a permutation group translate
precisely into the three conditions of an equivalence relation.

The equivalence classes of this relation are the orbits of G on X.


In our coloured cube example, the group of 24 rotations of the cube acts on the
set of 729 colourings of the faces of the cube. Two colourings count ‘the same’ if
and only if they are in the same orbit. So our task is to count orbits.

7.2 The Orbit-counting Lemma


For any permutation g of X, we let fix(g) denote the number of fixed points of
g (elements x ∈ X such that xg = x).

Theorem 7.2 (Orbit-counting Lemma) Let G be a permutation group on the finite


set X. Then the number of orbits of G on X is given by the formula
1
∑ fix(g).
|G| g∈G

Remark In the literature, this result is often referred to as Burnside’s Lemma; see
Neumann’s paper in the bibliography to see why this name came about and why it
is inappropriate.

Proof We count in two different ways the number N of pairs (x, g), with x ∈ X,
g ∈ G, and xg = x.
On the one hand, clearly
N = ∑ fix(g).
g∈G

On the other hand, we claim that if the point x lies in an orbit {x = x1 , . . . , xn },


then the number of permutations g ∈ G with xg = x is |G|/n. More generally, for
any i with 1 ≤ i ≤ n, the number of permutations g ∈ G with xg = xi is independent
of i (the proof is an exercise), and so is |G|/n.
Hence the number of pairs (y, g) with yg = y for which y lies in a fixed orbit of
size n is n · |G|/n = |G|. So each orbit contributes |G| to the sum, and so N = |G|k,
where k is the number of orbits.
Equating the two values gives the result.

Using this, we can count our coloured cubes. We have to examine the 24 rota-
tions and find the number of colourings fixed by each.

20:17:49, subject to the Cambridge


.008
134 Group actions and the cycle index

• The identity fixes all 36 = 729 colourings.


• There are three axes of rotation through the mid-points of opposite faces.
A rotation through a half-turn about such an axis fixes 34 = 81 colourings:
we can choose arbitrarily the colour for the top face, the bottom face, the
east and west faces, and the north and south faces (assuming that the axis is
vertical). A rotation about a quarter turn fixes 33 = 27 colourings, since all
four faces except top and bottom must have the same colour. There are three
half-turns and six quarter-turns.
• A half-turn about the axis joining the midpoints of opposite edges fixes 33 =
27 colourings. There are six such rotations.
• A third-turn about the axis joining opposite vertices fixes 32 = 9 colourings.
There are eight such rotations.
By Theorem 7.2, the number of orbits is
1
(1 · 729 + 3 · 81 + 6 · 27 + 6 · 27 + 8 · 9) = 57,
24
so there are 57 different colourings up to rotation.

At this point, we can give a more combinatorial proof of the formula


n
x(x − 1) · · · (x − n + 1) = ∑ s(n, k)xk
k=1

from Proposition 3.18. We prove the equivalent form


n
x(x + 1) · · · (x + n − 1) = ∑ u(n, k)xk
k=1

for the unsigned Stirling numbers of the first kind, from which the required equa-
tion is obtained by substituting −x for x and multiplying by (−1)n . Suppose first
that x is a positive integer. Consider the set of functions from {1, . . . , n} to a set X
of cardinality x. There are xn such functions. Now the symmetric group Sn acts on
these functions: the permutation g maps the function f to f g , where
f g (i) = f (ig−1 ).
A function f selects n elements of X with order important and repetitions allowed:
the selections are just f (1), . . . , f (n). So the orbit of f under Sn is simply a selec-
tion of n things from X, where repetitions are allowed and order is not important
(since Sn allows all reorderings). So the number of orbits is the number of such
selections, which is
 
x+n−1
= x(x + 1) · · · (x + n − 1)/n!
n

20:17:49, subject to the Cambridge


.008
7.3 The cycle index 135

(see Theorem 3.6).


We can also count the orbits using the Orbit-counting Lemma. Let g be a per-
mutation in Sn having k cycles. How many functions are fixed by g? Clearly a
function f is fixed if and only if it is constant on each cycle of g (for we have
f (i) = f g (i) = f (ig−1 ) = f (ig−2 ) = · · ·). The values of f on different cycles can
be chosen arbitrarily. So there are xk fixed functions. Since the number of permu-
tations with k cycles is u(n, k), the Orbit-counting Lemma shows that the number
of orbits is
1 n
∑ u(n, k)xk .
n! k=1
Equating the two expressions and multiplying by n! gives the result.
Now the required equation holds for all positive integer values of x, and so it is
a polynomial identity.

7.3 The cycle index


It is possible to develop a method for solving the coloured cubes problem which
doesn’t require extensive recalculation when small changes are made (such as
changing the number of colours).
Suppose that we have a set F of objects called ‘figures’, each of which (say f )
has a non-negative integer ‘weight’ w( f ) associated with it. The number of figures
may be infinite, but we assume that there are only a finite number of any given
weight: say an figures of weight n. The figure-counting series is the (ordinary)
generating function for these numbers:
A(x) = ∑ anxn.
n≥0

We attach a figure to each point of a finite set X. (Equivalently, we take a


function φ from X to the set F of figures.) The weight of the function φ is just
w(φ ) = ∑ w(φ (x)).
x∈X

Finally, we have a group G of permutations of X. Then G acts on the set of


functions by the rule that
φ g (x) = φ (xg−1 ).
Clearly w(φ g ) = w(φ ) for any function φ .
We want to find the generating function for the number of functions of each
possible weight, but counting two functions as ‘the same’ if they lie in the same
orbit of G with the above action. In other words, we want to calculate the function-
counting series
B(x) = ∑ bn xn ,
n≥0

20:17:49, subject to the Cambridge


.008
136 Group actions and the cycle index

where bn is the number of orbits consisting of functions of weight n.


In the coloured cubes example, if we take three figures Red, White and Blue,
each of weight 0, the figure-counting series is simply 3, and the function-counting
series is 57. We could, say, change the weight of Red to 1, so that the figure-
counting series is 2+x; then the function-counting series is the generating function
for the numbers of colourings with 0, 1, 2, . . . , 6 red faces (up to rotations).
The gadget that does this job is the cycle index of G. Each element g ∈ G can
be decomposed into disjoint cycles; let ci (g) be the number of cycles of length i,
for i = 1, . . . , n = |X|. Now put
c (g) c2 (g) c (g)
z(g) = s11 s2 · · · snn ,

where s1 , . . . , sn are indeterminates. Then the cycle index of G is defined to be


1
Z(G) = ∑ z(g).
|G| g∈G

For example, our analysis of the rotations of the cube shows that the cycle index
of this group (acting on faces) is
1 6
(s + 3s21 s22 + 6s21 s4 + 6s32 + 8s23 ).
24 1
We use the notation

Z(G; si ← fi for i = 1, . . . , n)

for the result of substituting the expression fi for the indeterminate si for i =
1, . . . , n.

Theorem 7.3 If G acts on X, and we attach figures to the points of X with figure-
counting series A(x), then the function-counting series is given by

B(x) = Z(G; si ← A(xi ) for i = 1, . . . , n).

For example, in the coloured cubes, let Red have weight 1 and the other colours
weight 0. Then A(x) = 2 + x, and the function-counting series is
1
B(x) = ((2 + x)6 + 3(2 + x)2 (2 + x2 )2 + 6(2 + x)2 (2 + x4 )
24
+6(2 + x2 )3 + 8(2 + x3 )2 )
= 10 + 12x + 16x2 + 10x3 + 6x4 + 2x5 + x6 .

Note that putting x = 1 recovers the value 57.

20:17:49, subject to the Cambridge


.008
7.4 Labelled and unlabelled 137

Proof The first step is to note that, if we ignore the group action and simply count
all the functions, the function-counting series is B(x) = A(x)n , where n = |X|. For
the term in xm in A(x)n is obtained by taking all expressions m = m1 + · · · + mn for
m as a sum of n non-negative integers, multiplying the corresponding terms am i
mi in
A(x), and summing the result. The indicated product counts the number of choices
of functions of weights m1 , . . . , mn to attach at the points 1, . . . , n of X, so the result
is indeed the function-counting series.
Note that this proves the theorem in the case where G is the trivial group.
Next, we have to count the functions of given weight fixed by a permutation g ∈
G. As we have seen, a function is fixed by g if and only if it is constant on the cycles
of g. Now if we choose a function of weight r to attach to the points of a particular
i-cycle of g, the number of choices is ar but the contribution to the weight is ir.
Arguing as above, the generating function for the number of fixed functions is
A(x)c1 (g) A(x2 )c2 (g) · · · A(xn )cn (g) = z(g; si ← A(xi ) for i = 1, . . . , n).
Finally, by the Orbit-counting Lemma, if we sum over g ∈ G and divide by |G|,
we find that the function-counting series is
B(x) = Z(G; si ← A(xi ) for i = 1, . . . , n).

7.4 Labelled and unlabelled


Group actions can be used to clarify the difference between two types of count-
ing of combinatorial objects, namely counting labelled and unlabelled objects.
Typically, we are counting structures ‘based on’ a set of n points: these may be
partitions or permutations, or more elaborate relational structures such as graphs,
trees, partially ordered sets, etc. An isomorphism between two such objects is a
bijection between their base sets which preserves the structure.
A labelled object is simply an object whose base set is {1, 2, . . . , n}. Two ob-
jects count as different unless they are identical. On the other hand, for unla-
belled objects, we wish to count them as the same obtain one from the other by
re-labelling the points of the base set. In other words, an unlabelled object is an
isomorphism class of objects.
For example, for graphs on three vertices, there are eight labelled objects, but
four unlabelled ones. Figure 7.1 shows the four unlabelled graphs; check that the
numbers of different labellings (assignments of the numbers 1, 2, 3 to the vertices)
are 1, 3, 3, 1 respectively.
Now the symmetric group Sn acts on the set of all labelled objects on the set
{1, . . . , n}; its orbits are the unlabelled objects. So counting unlabelled objects is
equivalent to counting orbits of Sn in an appropriate action.
A given object A has an automorphism group Aut(A), consisting of all permu-
tations of the set of points which map the object to itself. The number of different

20:17:49, subject to the Cambridge


.008
138 Group actions and the cycle index

r r r r
T T
 T  T
r
 Tr r
 Tr r r r r

Figure 7.1: Unlabelled graphs on 3 vertices

labellings of A is n!/| Aut(A)|, since of the n! labellings, two are the same if and
only if they are related by an automorphism of A. (More formally, labellings cor-
respond bijectively to cosets of Aut(A) in the symmetric group Sn .) So the number
of labelled objects is
n!
∑ | Aut(A)| ,
A
where the sum is over the unlabelled objects on n points.
The cycle index method can be applied to give more sophisticated counts. For
example, let us count graphs on 4 vertices. The number of pairs of vertices is 6,
and each pair is either an edge or a non-edge. So the number  of labelled graphs is
26 = 64, and the number of labelled graphs with k edges is 6k for k = 0, . . . , 6.
In order to count orbits, we must
  let S4 act on the set of 64 graphs. But we
can think of a graph as the set of 42 = 6 pairs of vertices with a figure (either an
edge or a non-edge) attached to each. So we must compute the cycle index of S4
acting on pairs of vertices. Table 7.1 gives details. The notation 12 21 , for example,
means ‘two fixed points and one 2-cycle’. Such an element, say the transposition
(1, 2), fixes the two pairs {1, 2} and {3, 4}, and permutes the other four pairs in
two 2-cycles; so its cycle structure on pairs is 12 22 .

Cycles on Cycles on Number


vertices pairs
14 16 1
2
1 2 1 2
1 2 2 6
22 12 22 3
13 32 8
4 24 6

Table 7.1: Cycle index of S4

So the cycle index of the permutation group G induced on pairs by S4 is

1 6
Z(G) = (s + 9s21 s22 + 8s23 + 6s2 s4 ).
24 1
Now if we take edges to have weight 1 and non-edges to have weight 0 (that is,

20:17:49, subject to the Cambridge


.008
7.5 Exercises 139

figure-counting series A(x) = 1 + x), the function-counting series is


B(x) = 1 + x + 2x2 + 3x3 + 2x4 + x5 + x6 ,
the generating function for unlabelled graphs on four vertices by number of edges.
We conclude by summarising some of our earlier results on counting labelled
and unlabelled structures. Table 7.2 gives the numbers of labelled and unlabelled
structures on n points; B(n) and p(n) are the Bell and partition numbers.

Structure Labelled Unlabelled


Subsets 2n n+1
Partitions B(n) p(n)
Permutations n! p(n)
Total orders n! 1

Table 7.2: Labelled and unlabelled


We see from the table that it is possible, even in very natural cases, to have the
same number of labelled objects but different numbers of unlabelled ones, or vice
versa.

7.5 Exercises
7.1 Use the Cycle Index Theorem to write down a polynomial in two variables x
and y in which the coefficient of xi y j is the number of cubes in which the faces are
coloured red, white and blue, having i red and j blue faces, up to rotations of the
cube.
7.2 Find a formula for the number of ways of colouring the faces of the cube
with r colours, up to rotations of the cube. Repeat this exercise for the other four
Platonic solids.
7.3 A necklace has ten beads, each of which is either black or white, arranged on
a loop of string. A cyclic permutation of the beads counts as the same necklace.
How many necklaces are there? How many are there if the necklace obtained by
turning over the given one is regarded as the same?
7.4 Repeat this question for necklaces with n beads of r possible colours.
7.5 Let G act transitively on X, where |X| = n > 1.
(a) By considering the action of G on ordered pairs of elements of X, show that
1
∑ fix(g)2 ≥ 2.
|G| g∈G

20:17:49, subject to the Cambridge


.008
140 Group actions and the cycle index

(b) Hence show that


1
∑ (fix(g) − 1)(fix(g) − n) ≥ 1.
|G| g∈G

(c) Deduce that the proportion of elements of G with no fixed points is at least
1/n.

(This result is due to Cameron and Cohen.)

7.6 Let G be a permutation group on a set X, where |X| = n.


For 0 ≤ i ≤ n, let pi be the proportion of elements of G which have exactly
i fixed points on X, and let p(x) = ∑ pi xi be the generating function for these
numbers (the probability generating function for fixed points).
For 0 ≤ i ≤ n, let Fi be the number of orbits of G in its action on the set of
i-tuples of distinct elements of X, and let F(x) = ∑ Fi xi /i! be the e.g.f. for these
numbers.
Use the Orbit-counting Lemma to show that

F(x) = P(x + 1)

and deduce that the proportion of fixed-point-free elements in G is p0 = F(−1).


Taking G to be the symmetric group Sn , deduce the formula for the derange-
ment number dn (see Section 4.2.1).
(This result is due to Boston et al.)

7.7 A necklace is made with two different colours of beads; there are N beads
altogether. We specify that there are to be k points on the necklace where the
colours change (that is, k maximal runs of beads of the same colour), where k
is even. Show that, if the two colours are interchangeable, then the number of
different necklaces which can be produced is the coefficient of xN in

Z(G; si ← xi /(1 − xi ), 1 ≤ i ≤ k),

where G is the dihedral group of order 2k.

20:17:49, subject to the Cambridge


.008
CHAPTER 8

Möbius inversion

Often we are in the situation where we have a number of conditions of varying


strength, and we have information about the number of objects which satisfy vari-
ous combinations of conditions (inclusion); we want to count the objects satisfying
none of the conditions (exclusion), or perhaps satisfying some but not others. Of
course, the conditions may not all be independent; this is what makes the prob-
lem hard. The Principle of Inclusion and Exclusion solves this problem. A more
general form of this principle, known as Möbius inversion, can be used for a much
more general class of problems of this type.

8.1 The Principle of Inclusion and Exclusion


Let A1 , . . . , An be subsets of a finite set X. For any non-empty subset J of the
index set {1, . . . , n}, we put 
AJ = A j;
j∈J

by convention, we take A0/ = X. The Principle of Inclusion and Exclusion (PIE,


for short) asserts the following.

Theorem 8.1 The number of elements of X lying in none of the sets Ai is equal to

∑ (−1)|J| |AJ |.
J⊆{1,...,n}

Proof The expression in the theorem is a linear combination of the cardinalities


of the sets AJ , and so we can calculate it by working out, for each x ∈ X, the
contribution of x to the sum. If K is the set of all indices j for which x ∈ A j , then

141
20:17:29, subject to the Cambridge
.009
142 Möbius inversion

x contributes to the terms involving sets J ⊆ K, and the contribution is

∑ (−1)|J|.
J⊆K

k 
If |K| = k > 0, then there are j sets of size j in the sum, which is

k  
k
∑ j (−1) j = (1 − 1)k = 0,
j=0

whereas if K = 0/ then the sum is 1. So the points with K = 0/ (those lying in no set
Ai ) each contribute 1 to the sum, and the remaining points contribute nothing. So
the theorem is proved.

There is a more general form of Inclusion–Exclusion, where the elements of the


set X have weights, and cardinalities of sets are replaced by the sums of the weights
of their elements. We must be able to add and subtract weights, and multiply them
by integers; in other words, we can take the weights from an arbitrary abelian
group.
If there are numbers m0 , . . . , mn such that |AJ | = m j whenever |J| = j, then PIE
can be written in the simpler form
n  
n
∑ (−1) m j j .j
j=0

Here are a couple of applications.

Example: Surjections The number of functions from an m-set onto an n-set is


given by the formula
n  
n
∑ (−1) j (n − j)m.
j
j=0

For let M and N be the sets, with N = {1, . . . , n}. Let X be the set of all functions
f : M → N, and Ai the set of functions whose range does not include the point i.
Then AJ is the set of functions whose range includes none of the points of J (that
is, functions from M to N \ J); so |AJ | = (n − j)m when |J| = j. A function is a
surjection if and only if it lies in none of the sets Ai . The result follows.
In particular, if m = n, then surjections are permutations, and we have
n  
n
∑ (−1) j (n − j)n = n!.
j
j=0

20:17:29, subject to the Cambridge


.009
8.1 The Principle of Inclusion and Exclusion 143

Example: Derangements This time, let X be the set of all permutations of


{1, . . . , n}, and Ai the set of permutations fixing i. Then A j is the set of permu-
tations fixing every point in J; so |AJ | = (n − j)! when |J| = j. The permutations
lying in none of the sets Ai are the derangements, and so we have
n  
j n
d(n) = ∑ (−1) (n − j)!
j=0 j
n
(−1) j
= n! ∑ ,
j=0 j!

in agreement with our earlier result.

Example: the problème des ménages We have some unfinished business from
Chapter 5: how many possible third rows of Latin rectangles which have first row
(1, 2, . . . , n) and second row (2, 3, . . . , n, 1) are there? In other words, we require a
permutation (a1 , . . . , an ) so that ai does not belong to the ith column of the array
 
1 2 ... n−1 n
.
2 3 ··· n 1
We will proceed slightly differently with the count: for r = 0, . . . , n, let Br be
the number of permutations (a1 , . . . , an ) for which ai ∈ {i, i + 1} holds for at least
a prescribed set of r values of i.
Now B1 = 2n(n − 1)!; for we can choose in n ways a position i for which
ai ∈ {i, i + 1} holds, in two ways which value of ai to take, and in (n − 1)! ways
the completion of the permutation.
To compute Br for r > 1, note that we may assume that either a1 = 1 or an = 1.
In the first case, we consider the list

(2, 2, 3, 3, . . . , n − 1, n − 1, n)

consisting of the elements after the one chosen written column by column and
claim that the remaining r − 1 positions satisfying the condition form a selection of
r − 1 from this list of 2n − 3 with no two consecutive. (Two consecutive numbers
either correspond to two entries from
 the same column, or two entries with the
same value.) This can be done in 2n−r−1 r−1 ways (Exercise 1.1). The other choice
would give the same value, using the sequence (1,2, 2, . . ., n − 1, n − 1) instead.
So there are 2n choices of starting point and 2n−r−1 r−1 ways to choose the re-
maining values; but we must divide by r since we arbitrarily chose one of the
distinguished r points to be the start. Finally, there are (n − r)! ways to choose the
remaining n − r entries in the permutation. So
 
2n 2n − r − 1
Br = .
r r−1

20:17:29, subject to the Cambridge


.009
144 Möbius inversion

Finally, applying PIE shows that the number of solutions of the problème des
ménages is  
r−1 2n 2n − r − 1
n
Mn = n! − ∑ (−1) (n − r)!.
r=1 r r−1
The statement of PIE can be generalised to give a formula for the number of el-
ements of X which lie in a given collection of sets Ai and not in the remaining ones
(see Exercise 8.2). Indeed, the same formula applies if the numbers concerned are
arbitrary real numbers rather than cardinalities of sets:

Theorem 8.2 Let real numbers aJ and bJ be given for each subset J of N =
{1, . . . , n}. Then the following are equivalent:

(a) aJ = ∑ bI for all J ⊆ N;


J⊆I⊆N

(b) bJ = ∑ (−1)|J\I| aI for all J ⊆ N.


J⊆I⊆N

Proof The theorem asserts the form of the solution to a system of linear equa-
tions; in other words, the inverse of a certain matrix. However, the same matrix
occurs in the original form of PIE.

The theorem as stated involves sums over supersets of the given index set.
However, it is easily transformed to involve sums over subsets (see Exercise 8.3).
In this form, it is a generalisation of the inverse relationship between the triangular
matrix of binomial coefficients and the signed version (see Exercise 8.4).

8.2 Partially ordered sets


In this section, we formalise the kind of lower-triangular matrices which oc-
curred in the last.
A partial order on a set X is a binary relation ≤ on X which satisfies the fol-
lowing conditions:

• x ≤ x (reflexivity);
• if x ≤ y and y ≤ x then x = y (antisymmetry);
• if x ≤ y and y ≤ z then x ≤ z (transitivity).

It is a total order if it satisfies the further condition

• for any x, y, exactly one of x < y, x = y, y < x holds (trichotomy),

20:17:29, subject to the Cambridge


.009
8.2 Partially ordered sets 145

where x < y is short for x ≤ y and x = y. (Note that antisymmetry implies that at
most one of these three conditions holds.)
The usual order relations on the natural numbers, integers, and real numbers are
total orders. An important example of a partial order is the relation of inclusion on
the set of all subsets of a given set. Other important examples of partially ordered
sets include

• the positive integers ordered by divisibility (that is, x ≤ y if and only if x | y);
• the subspaces of a finite vector space, ordered by inclusion. (This is known
as a projective space.)

Any finite totally ordered set can be written as {x1 , x2 , . . . , xn }, where xi ≤ x j if


and only if i ≤ j.
A set carrying a partial order relation is called a partially ordered set, or poset
for short.
We need to use the following result. A relation σ is an extension of a relation
ρ if x ρ y ⇒ x σ y; that is, regarding a relation in the usual way as a set of ordered
pairs, ρ is a subset of σ .

Theorem 8.3 Any partial order on a set X can be extended to a total order on X.

This theorem is easily proved for finite sets: take any pair of elements x, y which
are incomparable in the given relation; set x ≤ y, and include all consequences of
transitivity (show that no conflicts arise from this); and repeat until all pairs are
comparable. It is more problematic for infinite sets; it cannot be proved from the
Zermelo–Fraenkel axioms, but requires an additional principle such as the Axiom
of Choice.
The upshot of the theorem for finite sets is that any finite partially ordered set
can be written as X = {x1 , . . . , xn } so that, if xi ≤ x j , then i ≤ j (but not necessarily
conversely). This is often possible in many ways. For example, the subsets of
{a, b, c}, ordered by inclusion, can be written as

X1 = 0,
/ X2 = {a}, X3 = {b}, X4 = {c},
X5 = {a, b}, X6 = {a, c}, X7 = {b, c}, X8 = {a, b, c}.

Now any function f from X × X to the real numbers can be written as an n × n


matrix A f , whose (i, j) entry is f (xi , x j ).
Our results extend to some infinite partially ordered sets, namely, those which
are locally finite. (A partially ordered set X is locally finite if, for any x, y ∈ X, the
interval
[x, y] = {z ∈ X : x ≤ z ≤ y}
is finite.)
Examples of infinite, locally finite posets include:

20:17:29, subject to the Cambridge


.009
146 Möbius inversion

• The natural numbers; the integers (with the usual order).


• All finite subsets of an infinite set (ordered by inclusion).
• All finite-dimensional subspaces of an infinite-dimensional vector space over
a finite field (ordered by inclusion).
• The positive integers (ordered by divisibility).

8.3 The incidence algebra of a poset


Let X be a partially ordered set. We can suppose that there is a total order on
X extending the partial order, so that, if X is finite, then X = {x1 , . . . , xn }, so that
if xi ≤ x j , then i ≤ j. Now we can represent a function α : X × X → R as a matrix
Aα with rows and columns indexed by X (or by {1, . . . , n}), so that the (i, j) entry
of Aα is α(xi , x j ).
The incidence algebra of the partially ordered set X is defined to be the set
of all functions α : X × X → R which have the property that α(x, y) = 0 unless
x ≤ y. Note that, for such a function α, the matrix Aα is lower triangular. The
algebra operations of addition and multiplication are defined to be the usual matrix
operations on the corresponding matrices; that is,

(α + β )(x, y) = α(x, y) + β (x, y),


(αβ )(x, y) = ∑ α(x, z)β (z, y).
x≤z≤y

(These equations show that the way in which we extend the partial order to a total
order does not affect the definitions.)
The definitions of addition and multiplication work equally well for an infinite
locally finite poset (since the sum in the formula for multiplication is finite). So
the incidence algebra of a locally finite poset is defined.
The incidence algebra has an identity, the function ι given by

1 if x = y,
ι(x, y) =
0 otherwise.
(The matrix Aι is the usual identity matrix.) Another important algebra element is
the zeta function ζ , defined by

1 if x ≤ y,
ζ (x, y) =
0 otherwise.
Thus ζ is the characteristic function of the partial order, and an arbitrary function
α belongs to the incidence algebra if and only if

ζ (x, y) = 0 ⇒ α(x, y) = 0.

20:17:29, subject to the Cambridge


.009
8.4 Some Möbius functions 147

A lower triangular matrix with ones on the diagonal has an inverse. The Möbius
function μ of a poset is the inverse of the zeta function. In other words, it satisfies

1 if x = y,
∑ μ(x, y) = 0 otherwise.
x≤z≤y

In particular, μ(x, x) = 1 for all x. Moreover, if we know μ(x, z) for x ≤ z < y, then
we can calculate
μ(x, y) = − ∑ μ(x, z).
x≤z<y

In particular, we see that the values of the Möbius function are all integers.

8.4 Some Möbius functions


By definition, the Möbius function of a poset satisfies the following:

Proposition 8.4 Let f and g be elements of the incidence algebra of a poset X


(that is, functions on X × X satisfying f (x, y) = g(x, y) = 0 unless x ≤ y). Then the
following conditions are equivalent:

(a) g(x, y) = ∑ f (x, z);


x≤z≤y

(b) f (x, y) = ∑ g(x, z)μ(z, y).


x≤z≤y

This result is referred to as Möbius inversion. In order to use it, we have to


compute the Möbius functions of various posets. Note that the Möbius function
is local, in the sense that the value of μ(x, y) is determined by the structure of the
interval [x, y] = {z : x ≤ z ≤ y}.
One important result is the following. Let X1 , . . . , Xr be posets. The direct
product X1 × · · · × Xr is the poset whose elements are all r-tuples (x1 , . . . , xr ) with
xi ∈ Xi for 1 ≤ i ≤ r; the order is given by

(x1 , . . . , xr ) ≤ (y1 , . . . , yr ) ⇔ xi ≤ yi for 1 ≤ i ≤ r,

where the order xi ≤ yi is that in the poset Xi .

Proposition 8.5 The Möbius function of the direct product X1 × · · · × Xr is given


by
r
μ((x1 , . . . , xr ), (y1 , . . . , yr )) = ∏ μi (xi , yi ),
i=1
where μi is the Möbius function of Xi .

20:17:29, subject to the Cambridge


.009
148 Möbius inversion

Proof It is enough to show that


r
∑ ∏ μi(xi, zi) = 0.
x ≤z ≤y
i i i i=1
1≤i≤r

Now the left-hand side of this expression factorises as


r
∏ ∑ μi (xi , zi ),
i=1 xi ≤zi ≤yi

and the inner sum is zero by definition of the Möbius function μi .

Example: The integers In the poset of integers, with the usual order, the Möbius
function is given by
1 if y = x;
μ(x, y) = −1 if y = x + 1;
0 otherwise.

Example: Finite subsets of a set In this case, the Möbius function is


μ(X,Y ) = (−1)|Y \X| = (−1)|Y |−|X| for X ⊆ Y,
and of course μ(X,Y ) = 0 otherwise. For let X ⊆ Y , and let Y \ X = {z1 , . . . , zn }.
We claim that the interval [X,Y ] is isomorphic to {0, 1}n , the direct product of n
copies of {0, 1} ⊆ Z. The isomorphism takes a set Z with X ≤ Z ≤ Y to the n-tuple
(e1 , . . . , en ), where 
1 if zi ∈ Z,
ei =
0 otherwise.
So μ(X,Y ) is equal to μ((0, . . . , 0), (1, . . . , 1)) calculated in {0, 1}n ; by Proposi-
tion 8.5 this is μ(0, 1)n , and μ(0, 1) = −1 by the preceding example.

Example: Positive integers ordered by divisibility Suppose that m divides n.


Let n/m = pa11 pa22 · · · par r , where p1 , . . . , pr are distinct primes and a1 , . . . , ar posi-
tive integers. Then the interval [m, n] is isomorphic to the direct product
[0, a1 ] × · · · × [0, ar ]
of intervals [0, ai ] in Z. The correspondence is given by
(b1 , . . . , br ) ↔ mpb11 · · · pbr r .
By the first example, we see that μ(m, n) = 0 if any ai > 1, that is, if n/m is
divisible by the square of a prime. If n/m is the product of s distinct primes, then
μ(m, n) = (−1)s . To summarise:

(−1)s if n/m is the product of s distinct primes;
μ(m, n) =
0 if m doesn’t divide n or if n/m is not squarefree.

20:17:29, subject to the Cambridge


.009
8.5 Classical Möbius inversion 149

Example: Subspaces of a finite vector space By the Second Isomorphism The-


orem, if U and W are subspaces of V with U ⊆ W , then the interval [U,W ] is
isomorphic to the poset of subspaces of W /U, and in particular depends only on
dim(W ) − dim(U). It suffices to calculate μ({0},V ), where V is an n-dimensional
vector space over GF(q).
Now putting x = −1 in the q-binomial theorem, we obtain
n  
n
∑ (−1) q k k(k−1)/2
k q
=0
k=0

for n > 0. This is exactly the inductive step in the proof that

μ({0},V ) = (−1)n qn(n−1)/2


n
for n > 0. For there are k q k-dimensional subspaces of V , and the induction
hypothesis asserts that μ({0},W ) = (−1)k qk(k−1)/2 for each such subspace; then
the identity shows that μ({0},V ) must have the claimed value.
So, in general, μ(U,W ) = (−1)n qn(n−1)/2 if U ⊆ W and dim(W /U) = n; and
of course, μ(U,W ) = 0 if U ⊆ W .

8.5 Classical Möbius inversion


All our examples in the preceding section have the special property that each
interval [x, y] is isomorphic to [e, z], where e is a fixed element of the poset, and z
depends on x and y. Thus, for the integers, e = 0 and z = y − x; for subsets of a set,
e = 0/ and z = y \ x; for positive integers ordered by divisibility, e = 1 and z = y/x;
and for subspaces of a vector space, e = {0} and z = y/x (the quotient space).
Thus, in these cases, the Möbius function satisfies μ(x, y) = μ(e, z), so it can be
written as a function of one variable z. Abusing notation, we use the same symbol
μ. In the four cases, we have:

• μ(0) = 1, μ(1) = −1, μ(z) = 0 for z ≥ 2;


• μ(Z) = (−1)|Z| ;
• μ(z) = (−1)s if z is the product of s distinct primes, μ(z) = 0 if z is not
squarefree;
• μ(Z) = (−1)k qk(k−1)/2 , where k = dim(Z).

The third of these is the ‘classical’ Möbius function, and plays an important
role in number theory. If you see μ(z) without any further explanation, it probably
means the classical Möbius function. In this case, Möbius inversion can be stated
as follows:

20:17:29, subject to the Cambridge


.009
150 Möbius inversion

Proposition 8.6 Let f and g be functions on the positive integers. Then the fol-
lowing are equivalent:
(a) g(n) = ∑ f (m);
m|n

(b) f (n) = ∑ g(m)μ(n/m).


m|n

Here are two applications of this result.

Example: Euler’s function Euler’s φ -function (sometimes called the totient


function) is the function φ defined on the positive integers by the rule that φ (n)
is the number of integers x with 1 ≤ x < n coprime to n.
If gcd(x, n) = d, then gcd(x/d, n/d) = 1. So the number of x in this range with
gcd(x, n) = d is φ (n/d), and we have

∑ φ (n/d) = n,
d|n

or, putting m = n/d,


∑ φ (m) = n.
m|n
Now Möbius inversion gives
φ (n) = ∑ mμ(n/m).
m|n

From this it is easy to deduce that, if n = pa11 · · · par r , where pi are distinct primes
and ai > 0, then
φ (n) = p1a1 −1 (p1 − 1) · · · par r −1 (pr − 1).

Example: Irreducible polynomials Let fq (n) be the number of monic irre-


ducible polynomials of degree n over GF(q). By Theorem 6.9,

∑ m fq(m) = qn.
m|n

So, by Möbius inversion, we have a formula for fq (n):


1
fq (n) = ∑ qm μ(n/m).
n m|n

For example, the number of irreducible polynomials of degree 6 over GF(2) is


1 6
(2 − 23 − 22 + 21 ) = 9.
6
(Why is the word ‘monic’ not needed here?)

20:17:29, subject to the Cambridge


.009
8.6 The general linear group 151

8.6 The general linear group


The set of all permutations of {1, . . . , n} forms a group, the symmetric group,
with order n!. We saw in Chapter 6 that the q-analogue of this group is the general
linear group GL(n, q), the group of all bijective linear transformations of a vector
space V of dimension n over GF(q) (where q is a prime power).
We saw in Proposition 6.8 that the order of GL(n, q) is given by the two formu-
lae
n  
k k(k+1)/2 n
(q − 1)(q − q) · · · (q − q ) = (−1) q
n n n n−1 n n(n−1)/2
∑ (−1) q k q
.
k=0

Here is a different proof based on Möbius inversion.


Let V be an n-dimensional vector space over GF(q). For any subspace W of V
of dimension n − k, the number of linear maps on V whose range is contained in
W is equal to qn(n−k) . For such a map is uniquely determined by the images of the
n vectors of a basis for q; each of these images can be any of the qn−k vectors of
W ; so there are altogether (qn−k )n choices of the linear map.
Let a(W ) be the number of linear maps whose image is precisely W . Clearly if
dim(W ) = n − k, then we have

∑ a(X) = qn(n−k) ,
X⊆W

since if the image of a map is contained in W then it is equal to some unique


subspace of W . So the principle of Möbius inversion gives

∑ qn(n−l) μ(X,W ) = a(W ),


X⊆W

where l = dim(X). Taking W = V , and replacing the dummy variables X and l by


W and k we obtain
a(V ) = ∑ qn(n−k) (−1)k qk(k−1)/2 ,
W ⊆V
n  
n
= ∑q n(n−k)
(−1)k qk(k−1)/2 ,
k=0 k q
n  
n
= ∑ qnk (−1)n−k q(n−k)(n−k−1)/2 ,
k=0 k q

since μ(W,V
n ) = (−1)
k qk(k−1)/2 if dim(V ) − dim(W ) = k. (We have also used the
n 
fact that k q = n−k q .) Now a(V ) is the required number of bijective linear maps;
a little manipulation gives the required formula. The exponent of q in the kth term
is
(n − k)(n − k − 1) n(n − 1) k(k + 1)
nk + = + .
2 2 2

20:17:29, subject to the Cambridge


.009
152 Möbius inversion

8.7 Exercises
8.1 Before doing this exercise, you should review Exercise 3.12.

(a) In how many ways can k identical sweets be given to n children if we require
that the number xi of sweets given to the ith child should satisfy xi ≤ bi , for
some numbers b1 , . . . , bn ?
(b) In how many ways can k identical sweets be given to n children if we require
that the number xi of sweets given to the ith child should satisfy ai ≤ xi ≤ bi ,
for some numbers a1 , b1 , . . . , an , bn ?

(In this exercise, you are not required to write down an explicit formula; descrip-
tion of a method for calculating the number will suffice.)

8.2 Let A1 , . . . , An be subsets of X. For J ⊆ N = {1, . . . , n}, let A j consist of the


points of X lying in Ai for all i ∈ J, and B j the points lying in Ai if i ∈ J and not if
i∈
/ J. Show that
|BJ | = ∑ (−1)|K\J| |AK |.
J⊆K⊆N

8.3 Prove that, with the hypotheses of Theorem 8.2, the following conditions are
equivalent:

(a) aJ = ∑ bI for all J ⊆ N;


I⊆J

(b) bJ = ∑ (−1)|J\I|aI for all J ⊆ N.


I⊆J

8.4 By taking the numbers aJ and bJ of the preceding exercise to depend only on
the cardinality j of J, show that the following statements are equivalent for two
sequences (xi ) and (yi ):
j  
j
(a) x j = ∑ yi ;
i=0 i

j  
j
(b) y j = ∑ (−1) j−i
yi .
i=0 i

8.5 Prove that  


k
1 k
S(n, k) =
k! ∑ (−1) j (k − j)n.
j
j=0

20:17:29, subject to the Cambridge


.009
8.7 Exercises 153

8.6 Prove that the solution Mn to the problème des ménages satisfies the recur-
rence
(n − 2)Mn = n(n − 2)Mn−1 + nMn−2 + 4(−1)n−1
for n ≥ 4.

8.7 Let x and y be elements of a poset X, with x ≤ y. A chain from x to y is a


sequence x = x0 , x1 , . . . , xl = y with xi−1 < xi for i = 1, . . . , l; its length is l. Show
that
μ(x, y) = ∑ (−1)l(c) ,
c∈C

where C is the set of all chains from x to y, and l(c) is the length of c.

8.8 Let d(n) be the number of divisors of the positive integer n. Prove that

∑ d(m)μ(n/m) = 1
m|n

for n > 1.

8.9 Let P(X) denote the poset whose elements are the partitions of the set X,
with P ≤ Q if P refines Q (that is, every part of P is contained in a part of Q). Let
E be the partition into sets of size 1.

(a) Show that, if the parts of P have sizes a1 , . . . , ar , then

μ(E, P) = (a1 − 1)! · · · (ar − 1)! .

(b) Show that any interval [P, Q] is isomorphic to a product of posets of the form
P(X j ), and hence calculate μ(P, Q).

8.10 Let G be the cyclic group consisting of all powers of the permutation

g : 1 → 2 → · · · → n → 1.

Show that the cycle index of G is

1
Z(G) = ∑ φ (n/m)smn/m,
n m|n

where φ is Euler’s function.

20:17:29, subject to the Cambridge


.009
154 Möbius inversion

8.11 A necklace is made of n beads of q different colours. Necklaces which differ


only by a rotation are regarded as the same. Show that the number of different
necklaces is
1
∑ qmφ (n/m),
n m|n
while the number which have no rotational symmetry is
1
∑ qm μ(n/m).
n m|n

(Notice that, if q is a prime power, the second expression is equal to the number of
monic irreducible polynomials of degree n over GF(q). Finding a bijective proof
of this fact is much harder!)

8.12 A function F on the natural numbers is said to be multiplicative if

gcd(m, n) = 1 ⇒ F(mn) = F(m)F(n).

(a) Suppose that F and G are multiplicative. Show that the function H defined by

H(n) = ∑ F(k)G(n/k)
k|n

is multiplicative.
(b) Show that the Möbius and Euler functions are multiplicative.
(c) Let d(n) be the number of divisors of n, and σ (n) the sum of the divisors of n.
Show that d and σ are multiplicative.

8.13 The following problem, based on the children’s game ‘Screaming Toes’, was
suggested to me by Julian Gilbey.
n people stand in a circle. Each player looks down at someone else’s
feet (i.e., not at their own feet). At a given signal, everyone looks up
from the feet to the eyes of the person they were looking at. If two
people make eye contact, they scream. What is the probability of at
least one pair of people screaming?
Prove that the required probability is
n/2
(−1)k−1 (n)2k
∑ 2k k!(n − 1)2k
,
k=1

where (n) j = n(n − 1) · · · (n − j + 1).


How does this function behave as n → ∞?

20:17:29, subject to the Cambridge


.009
8.7 Exercises 155

8.14 Prove the following ‘approximate version’ of PIE:

Let A1 , . . . , An , A1 , . . . , An be subsets of a set X. For I ⊆ N = {1, . . . , n},


let    
   
    
aI =  Ai  , aI =  A i  .
i∈I  i∈I 

If aI = aI for all proper subsets I of N, then |aN − aN | ≤ |X|/2n−1 .

Remark For more general approximate versions of PIE, see the paper by Linial
and Nisan in the bibliography.

8.15 Let n = k1 + k2 + · · · + kr , where k1 , . . . , kr are positive integers, and suppose


that the poset P on {1, . . . , n} consists of r disjoint chains of lengths k1 , . . . , kr .
Show
 that thenumber of total orders extending P is the multinomial coefficient
n
.
k1 , k2 , . . . , kr

20:17:29, subject to the Cambridge


.009
CHAPTER 9

The Tutte polynomial

In this chapter, we examine a polynomial associated with a graph, or more gen-


erally with a matroid, which encodes a great deal of counting information. This
polynomial, the Tutte polynomial, also has close connections with statistical me-
chanics: it is, up to a trivial transformation, the partition function of the Potts
model on the graph in question. We also look at the problem of producing an
‘orbit-counting’ version of the Tutte polynomial.

9.1 The chromatic polynomial


In combinatorics, the first question we ask is whether a certain arrangement
is possible; if it is, then we ask in how many ways it can be done. In the case
of the chromatic polynomial, the procedure was reversed; Birkhoff hoped that by
counting the number of arrangements and proving that it is non-zero, he could
show that the required arrangement exists.
The famous Four Colour Conjecture asked whether every map drawn in the
plane can be coloured with four colours in such a way that countries sharing a bor-
der are given different colours. It is straightforward to convert this into a problem
about planar graphs (those which can be drawn in the plane without edges cross-
ing) and vertex-colourings: simply represent each country by a vertex, and if two
countries share a border, draw an edge joining their vertices crossing this border.
Then the requirement is that vertices joined by an edge should have two different
colours.
Let Γ be any graph, and let PΓ (q) denote the number of ways of colouring the
vertices of Γ with q colours c1 , . . . , cq in such a way that adjacent vertices have
different colours. (Such a colouring is called proper.) If Γ has a loop (an edge

156
20:16:44, subject to the Cambridge
.010
9.1 The chromatic polynomial 157

joining a vertex to itself), then clearly no proper colouring exists.

Proposition 9.1 For a fixed (finite) loopless graph Γ with n vertices, the function
q → PΓ (q) is a monic polynomial of degree n.

Proof We can prove this, and find a formula for the polynomial, using the Princi-
ple of Inclusion and Exclusion, which we discussed in Chapter 8. Let E be the set
of edges, and X the set of all colourings (proper or not) of the vertices of the graph
with a fixed set of q colours. If f is a colouring, call an edge bad if its two vertices
have the same colour. In how many colourings does a given subset F of E consist
of bad edges?
Let Γ(F) be the graph with the same vertex set as Γ and with edge set F.
In any colouring in which the edges of F are bad, then any two vertices in the
same connected component of Γ(F) have the same colour; so the number of such
colourings is qc(F) , where c(F) denotes the number of connected components of
Γ(F).
So by PIE, the number of colourings with no bad edges is

PΓ (q) = ∑ (−1)|F|qc(F). (9.1)


F⊆E

Now the maximum number of connected components of Γ(F) is n (the number of


vertices of Γ), occurring only in the case where F = 0.
/ So the displayed formula
n
is a polynomial with leading term q .

The polynomial PΓ is called the chromatic polynomial of Γ.


The more common approach to the chromatic polynomial uses the operations
of deletion and contraction of a graph. Let Γ be a graph, and e = {v, w} an edge
of Γ.
• The graph Γ\e obtained by deletion of e is simply the graph obtained by
removing e from the edge set of Γ.
• The graph Γ/e obtained by contraction of e is the graph obtained by remov-
ing the edge e and then identifying the vertices v and w. (If there is a vertex
x joined to both v and w, this results in a double edge from x to the new
vertex.)

Lemma 9.2 If e is an edge of the graph Γ, then

PΓ (q) = PΓ\e (q) − PΓ/e (q).

Proof Let e = {v, w}. Consider the set of colourings of Γ\e, and partition this set
into two subsets:

20:16:44, subject to the Cambridge


.010
158 The Tutte polynomial

• colourings f with f (v) = f (w): each of these induces, in a natural way, a


colouring of Γ/e.
• colourings f with f (v) = f (w): these are proper colourings of Γ.
So PΓ\e (q) = PΓ/e (q) + PΓ (q), as required.
By successive deletion and contraction (together with the removal of multiple
edges if they occur – this does not affect the number of proper colourings) we are
reduced to a collection of graphs with no edges. The number of proper colourings
of a graph with n vertices and no edges is qn .
This gives a method of computing the chromatic polynomial (not very efficient,
since exponentially many steps are required), and also shows that, if the chromatic
polynomial is computed by deletion and contraction, the result is independent of
the order in which the edges are chosen in the algorithm. It gives another proof
that the result is a polynomial in q.
Birkhoff hoped that it would be possible to show that the chromatic polynomial
PΓ (x) of a planar graph Γ cannot have a root at x = 4. This would show that the
number of colourings of such a graph with four colours could not be zero, and
prove the Four Colour Conjecture. However, nobody has succeeded in doing this,
and the proof of the conjecture by Appel and Haken used completely different
techniques.
Richard Stanley gave a counting interpretation of the values of the chromatic
polynomial at negative integers. Here is an example. An acyclic orientation of
a graph Γ is an assignment of directions to the edges of Γ in such a way that no
directed cycles are created. For example, there are 2n orientations of an n-cycle,
of which just two fail to be acyclic.
Theorem 9.3 The number of acyclic orientations of a graph Γ on n vertices is
(−1)n PΓ (−1).

Proof We use the deletion-contraction formula. Choose an edge e, and consider


the set S of acyclic orientations of Γ\e.
Observe that every acyclic orientation of Γ\e can be extended to an acyclic
orientation of Γ. This could only fail if both choices of orientation of e lead to
directed cycles. But, as the figure shows, this would mean that there was a directed
cycle in Γ\e:
u -u
>




u
 e
}
Z Z
Z
Z
Z ?
Zu u

20:16:44, subject to the Cambridge


.010
9.2 The Tutte polynomial 159

Let S be the set of acyclic orientations of Γ\e. We divide S into two classes:

• S1 is the set of orientations which force the direction of e, because there is a


directed path in some direction between its endpoints.
• S2 consists of orientations in which either ordering of S will be admissible
(will create no directed cycle).

Thus the number of acyclic orientations of Γ is |S1 | + 2|S2 |.


Moreover, any orientation in the class S2 gives rise to an acyclic orientation
of Γ/e, since by assumption, identifying the ends of e does not create a directed
cycle. Also |S1 | + |S2 | is the number of acyclic orientations of Γ\e.
By induction, we may assume that |S1 | + |S2 | = (−1)n PΓ\e (−1) and |S2 | =
(−1)n−1 PΓ/e (−1). So the number of acyclic orientations of Γ is given by

|S1 | + 2|S2 | = (|S1 | + |S2 |) + |S2 |


= (−1)n PΓ\e (−1) + (−1)n−1 PΓ/e (−1)
= (−1)n PΓ (−1),

and the proof is complete. (In the penultimate line we use the deletion-contraction
formula for the chromatic polynomial of Γ, namely PΓ = PΓ\e − PΓ/e .)
The induction is on the number of edges, so we start the induction with null
graphs. The null graph on n vertices has chromatic polynomial qn and has a single
acyclic orientation, and (−1)n (−1)n = 1 as required.

9.2 The Tutte polynomial


Tutte generalised the notion of the chromatic polynomial to a two-variable
polynomial which is now called the Tutte polynomial. Sokal considered a more
general polynomial which has one local variable associated with each edge of the
graph, together with one global variable. In statistical mechanics, the local vari-
ables represent some measures of the strength of interaction associated with each
edge, while the global variable is something like the temperature of the system.
The usual Tutte polynomial is obtained when all the local variables are equal.
Sokal’s paper contains much more detailed and accurate information about this.
Sokal has given convincing reasons for using the multivariate polynomial where
possible. However, for reasons that will appear in the next section, I will stick to
the usual two-variable polynomial. Also, both the two-variable and the multi-
variable forms extend naturally to matroids, which provide the correct level of
generality; but it would take us too far afield to consider this, so I will deal only
with graphs.
The following definition is due to Whitney; Tutte’s definition was more com-
plicated, though equivalent. Let Γ be a graph with n vertices having edge set E.

20:16:44, subject to the Cambridge


.010
160 The Tutte polynomial

For any subset F of E, define the rank of F to be r(F) = n − c(F), where as before
c(F) is the number of connected components of the graph with edge set F. Said
otherwise, r(F) is the size of the largest subgraph of Γ(F) which is a forest (that
is, contains no cycles). Then the Tutte polynomial of Γ is

T (Γ; x, y) = ∑ (x − 1)r(E)−r(F)(y − 1)|F|−r(F).


F⊆E

The next theorem gives some specialisations of the Tutte polynomial. A span-
ning subgraph of Γ is a graph having all the vertices and some of the edges of Γ;
that is, of the form Γ(F) for some F ⊆ E. It is called a spanning tree or spanning
forest if it is a tree or forest respectively.

Proposition 9.4 Let Γ be a connected graph.

(a) T (Γ; 1, 1) is the number of spanning trees of Γ.


(b) T (Γ; 2, 1) is the number of spanning forests of Γ.
(c) T (Γ; 1, 2) is the number of connected spanning subgraphs of Γ.
(d) T (Γ; 2, 2) = 2|E| .
(e) qT (Γ; 1 − q, 0) is the chromatic polynomial of Γ.

Proof (a) Putting x = y = 1 selects only those terms in which the exponent of both
x − 1 and y − 1 is zero, that is, corresponding to subsets F for which |F| = r(F) =
r(E). The second inequality asserts that Γ(F) is connected and the first that it is a
forest; so only trees are selected. Each tree contributes 1 to the evaluation.
(b) and (c) Similarly, putting x = 2 and y = 1 selects forests, while putting x = 1
and y = 2 selects connected graphs.
(d) is trivial since every term in the sum is 1.
(e) If x = 1 − q and y = 0, then the term corresponding to F in the sum is

(−q)r(E)−r(F) (−1)|F|−r(F) = qn−1−r(F) (−1)|F| = qc(F)−1 (−1)|F| ,

using the fact that r(F) = n − c(F). Comparing with the Inclusion-Exclusion for-
mula (9.1) gives the result.

We need to define a couple more notions. Let A be an abelian group, written


additively. Choose an arbitrary orientation of the edges of Γ. A function f from
oriented edges to A is called a flow if, for any vertex v, the sum of the values of f
on edges entering v is equal to the sum of the values on edges leaving v (calculated
in the group A). In other words, the algebraic sum of f over all the edges incident
with v is zero, where the values on edges leaving v are given a − sign. Dually, a
function f from oriented edges to A is a tension if the algebraic sum of the values

20:16:44, subject to the Cambridge


.010
9.3 Orbit counting and the Tutte polynomial 161

of f around any circuit in Γ is zero (where edges in the opposite direction to the
circuit are given a − sign). Note that, if we reverse the orientation of an edge, and
change the sign of the function f on that edge, the properties of being a flow or a
tension are unaltered. So the numbers of flows and tensions are independent of the
chosen orientation of the edges.
A flow or tension is nowhere-zero if it does not take the zero value (the identity
of the group A).

Proposition 9.5 Let A be an abelian group of order q. Then the number of nowhere-
zero tensions in a graph Γ with values in A is T (Γ; 1 − q, 0), while the number of
nowhere-zero flows in Γ with values in A is T (Γ; 0, 1 − q).

Remark Note that these numbers do not depend on the structure of the group A,
but only on its order.

Proof Both facts can be proved by an Inclusion-Exclusion argument similar to


that used in Proposition 9.1. But here is an alternative proof of the result about
tensions. This argument ‘explains’ why the number of nowhere-zero tensions does
not depend on the structure of A.
Orient the edges of Γ. First, choose any colouring f of Γ with q colours. Iden-
tify the set of colours with the abelian group A. Now let ∂ f be the function from
oriented edges of Γ to A given by ∂ f (e) = f (v) − f (w) if e is directed from w to v.
It is easy to see that this is a tension; it is nowhere-zero if and only if the colouring
is proper.
Conversely, given a nowhere-zero tension g, and two vertices v0 and v, the
algebraic sum of the values of g along any path from v0 to v is the same. Now
choose one vertex in each connected component of Γ, and define the function f
arbitrarily at these vertices. For any vertex v, let v0 be the chosen vertex in its
component, and let f (v) be the sum of f (v0 ) and the algebraic sum of the values
of g on any path from v0 to v. Then f is a proper colouring and ∂ f = g.
So the number of proper colourings is qc(E) times the number of nowhere-zero
tensions.

There are many other counts associated with a graph, whose values are evalua-
tions of the Tutte polynomial. For example, Stanley’s Theorem 9.3 shows that the
number of acyclic orientations of a graph Γ is equal to T (Γ; 0, 2).

9.3 Orbit counting and the Tutte polynomial


Let us return briefly to the table in Chapter 3 of the number of ways of choosing
k objects from a set of n, under different sampling protocols. Here I have rewritten
the table to describe choosing n objects from a set of q, for reasons which will

20:16:44, subject to the Cambridge


.010
162 The Tutte polynomial

appear below.

Order Order
significant not
 significant

q+n−1
With replacement qn
n
q
Without replacement (q)n
n
We can regard such a sample in which order is significant as a colouring of a graph
on n vertices with a set of q colours: for the first, second, . . . , nth vertex, we have to
choose a colour. Sampling with replacement gives an arbitrary colouring, which is
of course a proper colouring of the null graph (the graph with no edges). Sampling
without replacement gives a colouring in which all colours are distinct; this is a
proper colouring of the complete graph (in which all pairs of vertices are joined by
an edge).
A sample in which order is not significant gives rise to a colouring of the null or
complete graph, where we count two colourings as the same if some permutation
of the vertices carries the first to the second. In other words, for sampling with
order not significant, we are counting orbits of the symmetric group on proper
colourings of the null or complete graph.
Noting that the automorphism group of either of these graphs is the symmetric
group, we can now ask:
Given a graph Γ and a group G consisting of automorphisms of Γ,
what is the number of orbits of G on proper colourings of Γ with q
colours?
This question was considered in the paper by Cameron, Jackson and Rudd in the
bibliography, in which further details are given. Here we first consider the orbital
chromatic polynomial, which solves the question as stated, and then turn briefly to
the (more general) orbital Tutte polynomial.
Let Γ be a graph and G a group of automorphisms of Γ (a subgroup of Aut(Γ)).
Let PΓ,G (q) be the number of G-orbits on proper colourings of Γ with q colours.
By the Orbit-counting Lemma, we have
1
PΓ,G (q) = ∑ φ (Γ, g, q),
|G| g∈G

where φ (Γ, g, q) is the number of proper colourings of Γ with q colours fixed by


the automorphism g. Now a colouring of Γ is fixed by g if and only if it is constant
on the cycles of g (in its action on vertices). So, if any cycle of g contains an edge
of Γ, there are no such colourings; otherwise the number is PΓ/g (q), where Γ/g
denotes the graph obtained by shrinking every cycle of g to a single vertex. If we

20:16:44, subject to the Cambridge


.010
9.3 Orbit counting and the Tutte polynomial 163

make the convention that, if a cycle of g contains an edge, then Γ/g has a loop on
the vertex resulting from shrinking this cycle, we conclude the following:

Proposition 9.6 Let G be a group of automorphisms of the graph Γ. Then


1
PΓ,G (q) = ∑ PΓ/g(q).
|G| g∈G

In particular, if Γ is loopless, then the function q → PΓ,G (q) is a polynomial of


degree n (the number of vertices of Γ) with leading coefficient 1/|G|.

The orbital chromatic polynomial is a specialisation of an object called the


orbital Tutte polynomial. Its definition requires some algebraic background, which
I now outline.
An integral domain is a commutative ring with identity, in which there are no
zero-divisors; that is, if ab = 0, then a = 0 or b = 0. A principal ideal domain is
an integral domain in which every ideal is generated by a single element; that is,
every set of elements has a greatest common divisor which can be expressed as a
linear combination of elements of the set. Readers unfamiliar with these notions
will lose nothing by replacing the words ‘a principal ideal domain’ by ‘the ring Z
of integers’ in everything that follows. However, the generality is useful for other
applications such as coding theory, where the ring is a Galois field.
As usual, we say that a divides b if b = ac for some element c, and write this
as a | b.
In an integral domain, a unit is an element which has a multiplicative inverse;
two elements a and b are associates if b = ua for some unit u. Being associates
is an equivalence relation on the ring: two elements are associates if and only if
each divides the other. In the ring of integers, the only units are 1 and −1; so the
associate classes have the form {n, −n} for non-negative integers n.
The next theorem talks about row and column operations on a matrix over a
ring. These are similar to the familiar operations over a field, but with one change.
We are permitted to add any multiple of a row (or column) to another; to multiply
a row (or column) by a unit; and to interchange two rows (or columns). The rea-
son for the restriction to units is that each operation should be undone by another
operation of the same kind.

Theorem 9.7 Let A be a matrix over a principal ideal domain R, and suppose
that A has rank r. Then A can be converted, by row and column operations, into a
matrix D in which the first r elements d1 , . . . , dr on the main diagonal are non-zero
and satisfy di | di+1 for i = 1, . . . , r − 1; all other entries in the matrix are zero. The
elements d1 , . . . , dr are unique up to being replaced by associates.

The Smith normal form of A is the matrix D of the above theorem. The elements
d1 , . . . , dr and 0 (n − r times) are the invariant factors of A.

20:16:44, subject to the Cambridge


.010
164 The Tutte polynomial

We can represent an m × n matrix A of rank r by an indicator monomial x(A),


as follows. Let F be an index set for the set of associate classes in R. (If R = Z, we
can choose I to be the set of non-negative integers, where the integer i represents
the class {i, −i}.) We take a family (xi : i ∈ I) of indeterminates indexed by I. Now
if the non-zero elements of the Smith normal form of A belong to associate classes
with indices i1 , . . . , ir , then x(A) is the monomial xi1 · · · xir x0n−r , where 0 indexes
the associate class {0}. We need also the indicator monomial y(A) in variables
(yi : i ∈ I), defined in the same way.
Now we begin constructing the orbital Tutte polynomial of a graph Γ. Choose
arbitrarily a direction of each edge of Γ, and a cyclic orientation of each circuit
in Γ (independent of the directions of its edges). These orientations are required
to define the polynomial, but the result is independent of the choices. The signed
vertex-edge incidence matrix of Γ is the matrix M with rows indexed by vertices
and columns by edges, with (v, e) entry

+1 if directed edge e enters vertex v,
Mve = −1 if directed edge e leaves vertex v,
0 if v is not incident with e.
Similarly, we define the signed circuit-edge incidence matrix M ∗ , with rows in-
dexed by circuits and columns by edges, with (C, e) entry

+1 if e ∈ C and the orientations agree,

MCe = −1 if e ∈ C and the orientations disagree,
0 if e ∈
/ C.
Finally, if g is an automorphism of Γ, then we define a signed edge-permutation
matrix Pg with rows and columns indexed by edges, with
+1 if eg = f and the orientations of eg and f agree,
(Pg )e f = −1 if eg = f and the orientations of eg and f disagree,
0 if eg = f .
We let Mg and Mg∗ be the matrices (in block form)
   ∗ 
M M
Mg = , Mg∗ = .
Pg − I Pg − I
We need one more piece of notation. If M is a matrix with columns indexed
by E, and F ⊆ E, then M(F) denotes the matrix obtained by selecting just the
columns with index in F.
Now the orbital Tutte polynomial is defined as follows. Let Γ be a graph with
edge set E, and G a group of automorphisms of Γ. Let (xi ) and (yi ) be two families
of variables indexed by the non-negative integers. Set
1
OT (Γ, G; xi , yi ) = ∑ ∑ x(Mg(F))y(M∗(E \ F)),
|G| g∈G F⊆E

20:16:44, subject to the Cambridge


.010
9.3 Orbit counting and the Tutte polynomial 165

a polynomial in the variables xi and yi for i ≥ 0.


Of course, since it is a polynomial, only finitely many of the variables occur.
The following can be shown:

Proposition 9.8 Let G be a group of automorphisms of the graph Γ. If either xi or


yi is present in the polynomial OT (Γ, G), then either i = 0 or there is an element
of order i in the group G.

We now show that suitable specialisations of the orbital Tutte polynomial count
orbits of G on nowhere-zero flows and tensions, as well as on proper colourings.
If A is a finite abelian group and m a non-negative integer, we let αm (A) denote the
number of solutions of mx = 0 in A. Note that α0 (A) = |A| and α1 (A) = 1.

Theorem 9.9 Let Γ be a graph, and G a group of automorphisms of Γ; let A be


an abelian group of order q.

(a) If Γ is connected, then the number PΓ,G (q) of G-orbits on proper colourings
of Γ with q colours is obtained from OT (Γ, G) by substituting xi ← −1,
y0 ← q, yi ← 1 for i > 0, and multiplying by q.
(b) The number of G-orbits on nowhere-zero tensions with values in A is ob-
tained from OT (Γ, G) by substituting xi ← −1, yi ← αi (A).
(c) The number of G-orbits on nowhere-zero flows with values in A is obtained
from OT (Γ, G) by substituting xi ← αi (A), yi ← −1.

Remark The substitutions in (a) and (b) are not the same; that in (b) depends on
the structure of A, so the numbers of orbits on nowhere-zero flows or tensions do
depend on the structure of A if the group G is not the identity.

Proof We give a sketch of the proof for flows. (The version for colourings follows
from our earlier formula for the orbital chromatic polynomial, while the version
for tensions is very similar to that for flows.)
First, let f be a column vector of elements of A, of length equal to the number m
of columns of the integer matrix C. How many solutions of C f = 0 are there? Row
and column operations don’t change the number of solutions, so we can assume
that C is in Smith normal form, with non-zero elements d1 , . . . , dr . Then the equa-
tions become d1 f1 = 0, . . . , dr fr = 0, with dr+1 , . . . , dm arbitrary. So the number of
solutions is αd1 (A) · · · αdr (A)α0 (A)m−r , which is just the indicator monomial x(C)
with αi (A) substituted for xi for all i (which we write xi ← αi (A)).
The equations M f = 0 assert that f is a flow, while the equations (Pg − I) f = 0
assert that f is fixed by g. So the number of flows fixed by g is x(Mg ), with
xi ← αi (A) for all i.

20:16:44, subject to the Cambridge


.010
166 The Tutte polynomial

Inclusion-Exclusion shows that the number of fixed nowhere-zero flows is

∑ (−1)|E\F|x(Mg(F)) : xi ← αi(A)).
F⊆E

This is the polynomial

∑ x(Mg(F))y(Mg∗(E \ F))
F⊆E

with the substitution xi ← αi (A), yi ← −1 for all i.


Averaging over g ∈ G and using the Orbit-counting Lemma gives the result.

It is known that the matrix M is totally unimodular; this means that any sub-
determinant is equal to 0 or ±1. It follows that all the invariant factors are 0 or
1, so that x(M) = x0m−r x1r (where r is the rank of M). Since the row space of M ∗
is the null space of M, and vice versa, a similar assertion holds for M ∗ . So, if G
is the trivial group, the orbital Tutte polynomial OT (Γ, G) involves the variables
x0 , x1 , y0 , y1 only. This is also an immediate consequence of Proposition 9.8.
It is now not difficult to show that the substitution x1 ← 1, y1 ← 1, x0 ← y − 1,
y0 ← x − 1 produces the usual Tutte polynomial of Γ.
Since the substitutions in parts (b) and (c) of Theorem 9.9 replace each of the
variables x0 , x1 , y0 , y1 by ±1 or |A|, we see again that the number of nowhere-zero
flows or tensions on Γ with values in A depends only on the order of A and not its
structure.

9.4 The Matrix-Tree Theorem


It is known that evaluation of the Tutte polynomial in general is hard. But
there are some specific points (x, y) in the plane for which it is easy to calculate
T (Γ; x, y). For a trivial example, T (Γ; 2, 2) = 2m , where m is the number of edges
of Γ.
A less trivial example is T (Γ; 1, 1) which, as we have seen, is the number of
spanning trees of Γ (if Γ is connected). This can be computed by linear algebra.
The following result, known as the Matrix-Tree Theorem, was essentially proved
by Kirchhoff in 1847. Kirchhoff, a physicist, was studying properties of electrical
networks.
First we need a definition. Let Γ be a graph with vertex set {v1 , . . . , vn }. (Mul-
tiple edges but not loops are permitted.) The Laplacian matrix of Γ is the n × n
matrix L(Γ) whose (i, j) entry is equal to the number of edges incident with vertex
i if i = j, and the negative of the number of edges joining i to j if i = j. Note that
L(Γ) is symmetric, and every row or column sum is zero (since, in the ith row, ev-
ery edge incident with vi contributes +1 to the diagonal entry and −1 to the (i, j)
entry if its other end is v j . So L(Γ) is singular, and has determinant 0.

20:16:44, subject to the Cambridge


.010
9.4 The Matrix-Tree Theorem 167

Theorem 9.10 (Matrix-Tree Theorem) Let Γ be a connected graph. Then the


following three quantities are equal:
(a) the number of spanning trees of Γ;
(b) (λ2 · · · λn )/n, where λ1 = 0, λ2 , . . . , λn are the eigenvalues of L(Γ);
(c) any cofactor of L(Γ) (that is, the determinant of the matrix obtained by delet-
ing row i and column j, multiplied by (−1)i+ j ).

Example If Γ is the complete graph on 3 vertices, then Γ has three spanning


trees (each obtained by deleting one edge). We have
⎛ ⎞
2 −1 −1
L(Γ) = ⎝ −1 2 −1 ⎠ ,
−1 −1 2
with eigenvalues 0, 3, 3. A diagonal cofactor of L(Γ) is
 
 2 −1 
 
 −1 2  = 3,
while a typical off-diagonal cofactor is
 
 −1 −1 
−  = 3.
−1 2 
Proof The proof depends on the Cauchy–Binet formula , which says the follow-
ing. Let A be an m × n matrix, and B an n × m matrix, where m < n. Then
det(AB) = ∑ det(A(X)) det(B(X)),
X
where X ranges over all m-element subsets of {1, . . . , n}. Here A(X) is the m × m
matrix whose columns are the columns of A with index in X (as in the last section),
and B(X) is the m × m matrix whose rows are the rows of B with index in X.
Now choose an arbitrary orientation of the edges of Γ, and let M be the signed
vertex-edge incidence matrix of Γ, as defined on page 164. It is straightforward to
show that MM  = L(Γ). Let v be any vertex of Γ, and let N = Mv be the matrix
obtained by deleting the row of M indexed by e. It can be shown that, if X is a set
of n − 1 edges, then

±1 if X is the edge set of a spanning tree,
det(N(X)) = (9.2)
0 otherwise.
By the Cauchy–Binet formula, det(NN  ) is equal to the number of spanning trees.
But NN  is the principal cofactor of L(Γ) obtained by deleting the row and column
indexed by v.
The fact that all cofactors are equal, and the expression in terms of eigenvalues,
are proved by linear algebra; the proof is outlined in Exercise 9.6.

20:16:44, subject to the Cambridge


.010
168 The Tutte polynomial

Example Let Γ be the complete graph on n vertices. Then L(Γ) has diagonal
entries n − 1 and off-diagonal entries −1. Thus, L(Γ) = nI − J, where j denotes
the all-1 matrix. We compute the eigenvalues of this matrix.
As we noted in general, the all-1 vector is an eigenvector of L(Γ) with eigen-
value 0. We claim that the other n − 1 eigenvalues are all equal to n. To see this,
let v = (v1 , . . . , vn ) be any vector orthogonal to the all-1 vector, that is, satisfying
v1 + · · · + vn = 0. Then vJ = 0, and so v(nI + J) = nv. So the claim is proved.
Now the formula in part (c) of the Matrix-Tree Theorem shows that the number
of spanning trees is (nn−1 )/n = nn−2 .
The fact that the number of trees on n vertices is nn−2 is Cayley’s Theorem.
We return to this theorem in the next chapter, where we will see several different
proofs of it.

9.5 Exercises
9.1 Calculate the chromatic polynomials of the path and the cycle on n vertices.
9.2 Calculate the orbital chromatic polynomial PΓ,G (q), where
(a) Γ is a path with n vertices and G consists of the identity and the reflection;
(b) Γ is a cycle with n vertices and G is the cyclic group of order n consisting of
rotations of the cycle.
9.3 Show that, if G is any group of automorphisms of a graph Γ, and q a positive
integer, then PΓ,G (q) = 0 if and only if PΓ (q) = 0. Show that this is false if q is not
assumed to be a positive integer.
9.4 Compute the Tutte polynomial of the complete graph K4 on four vertices.
9.5 (a) Prove that, for an arbitrary graph Γ, the chromatic polynomial of Γ is
equal to qc T (Γ; 1 − q, 0), where c is the number of connected components of
Γ.
(b) Modify the other parts of Proposition 9.4 so that they work for arbitrary
graphs (not necesssarily connected).
9.6 Let A be a real symmetric matrix with all row and column sums zero. Let J
denote the all-1 matrix. In this exercise we evaluate the determinant of B = A + J.
(a) Replace the first row by the sum of all the rows; this makes the entries in
the first row n and doesn’t change the other entries; the determinant is un-
changed.
(b) Replace the first column by the sum of all the columns. This makes the first
entry n2 , and the other entries in this column n, and doesn’t change the other
entries of the matrix; the determinant is unchanged.

20:16:44, subject to the Cambridge


.010
9.5 Exercises 169

(c) Subtract 1/n times the first row from each other row. The elements of the
first column, other than the first, become 0; we subtract 1 from all elements
not in the first row or column of B, leaving the entries of A; and the determi-
nant is unchanged.

Conclude that det(B) is n2 times the (1, 1) cofactor of A.


Check that this argument works for any cofactor of A.
Finally show that the all-1 vector is an eigenvector of B with eigenvalue n,
while its other eigenvalues are the same as those of A. So det(B) = nλ2 · · · λn .

9.7 Prove equation (9.2).

20:16:44, subject to the Cambridge


.010
CHAPTER 10

Species

Species, invented by André Joyal in 1981, provide an attempt to unify some of


the many structures and techniques which appear in combinatorial enumeration. I
don’t attempt to be too precise about what a species is. Think of it as a rule for
building structures of some kind (graphs, posets, permutations, etc.) on any given
finite set of points. We can ask for the number of labelled or unlabelled structures
on n points in a given species.

10.1 Cayley’s Theorem


We begin with a particular species where there is a simple but unexpected for-
mula for the labelled counting problem. A tree is a connected graph with no cycles.
It is straightforward to show that a tree on n vertices contains n − 1 edges, and that
any connected graph has a spanning tree (that is, some set of n − 1 of its edges
forms a tree). Moreover, any tree has a vertex lying on only one edge (since the
average number of edges per vertex is 2(n − 1)/n < 2). Such a vertex is called a
leaf. If we remove from a tree a leaf and its incident edge, the result is still a tree.
Cayley’s Theorem states:

Theorem 10.1 The number of labelled trees on n vertices is nn−2 .

Remark A labelled tree on n vertices is just a spanning tree in the complete


graph Kn . So, according to the last chapter, Cayley’s Theorem is an evaluation of
the Tutte polynomial of Kn . Moreover, in the last section, we deduced Cayley’s
Theorem from the Matrix-Tree Theorem.

170
20:16:22, subject to the Cambridge
.011
10.2 Species and counting 171

There are many different proofs of Cayley’s Theorem. Below, we will see two
proofs which are made clearer by means of the concept of species. But first, one
of the classics:

Prüfer’s proof of Cayley’s Theorem We construct a bijection between the set


of all trees on the vertex set {1, . . . , n} and the set of all (n − 2)-tuples of elements
from this set. The tuple associated with a tree is called its Prüfer code.
First we describe the map from trees to Prüfer codes. Start with the empty
code. Repeat the following procedure until only two vertices remain: select the
leaf with smallest label; append the label of its unique neighbour to the code; and
then remove the leaf and its incident edge.
Next, the construction of a tree from a Prüfer code P. We use an auxiliary list
L of vertices added as leaves, which is initially empty. Now, while P is not empty,
we join the first element of P to the smallest-numbered vertex v which is not in
either P or L, and then add v to L and remove the first element of P. When P is
empty, two vertices have not been put into L; the final edge of the tree joins these
two vertices.
I leave to the reader the task of showing that these two constructions define
inverse bijections. The method actually gives much more information:

Proposition 10.2 In the tree with Prüfer code P, the valency of the vertex i is one
more than the number of occurrences of i in P.

For, at the conclusion of the second algorithm, if we add in the last two vertices
to L, then L contains each vertex precisely once; and edges join each of the first
n − 2 vertices of L to the corresponding vertex in P, together with an edge joining
the last two vertices of L.
Using this, one can count labelled trees with any prescribed degree sequence
(see Exercise 10.10).

10.2 Species and counting


Almost the only thing we assume about a species G is that, for each n, there are
only a finite number of G -objects on a fixed base set of n points (so that we can
count them). The only property we use of the objects in a species is that we ‘know’
whether a bijective map between the point sets of two objects is an isomorphism
between them (and hence we know the automorphism group of each object).
We make one further (inessential but convenient) assumption, namely that there
is a unique object on the empty set of points.
Joyal’s view is that, just as a sequence of numbers can be represented by a for-
mal power series, so a sequence of sets of mathematical objects can be represented
by a ‘combinatorial formal power series’ (where the coefficient of xn is the set of

20:16:22, subject to the Cambridge


.011
172 Species

objects on the set {1, . . . , n}). By replacing the set of objects by the number of
labelled or unlabelled objects in the set, we obtain the usual generating functions
for such objects.
We say that two species are equivalent (written G ∼ H ) if there is a bijection
between the objects of the two species on a given point set such that the automor-
phism groups of corresponding objects are equal.
The most important formal power series associated with a species is its cycle
index, which is defined by the rule

Z̃(G ) = ∑ Z(Aut(A)),
A∈G

where Aut(A) is the automorphism group of A. Clearly, equivalent objects have


the same cycle index.
The cycle index is well-defined since a monomial sa11 · · · sar r arises only from cy-
cle indices involving n = ∑ri=1 iai points, and by assumption there are only finitely
many of these.
There are two important specialisations of the cycle index of a species G ; these
are the exponential generating function
Gn x n
G(x) = ∑
n≥0 n!

for the number Gn of labelled n-element G -objects (that is, objects on the point set
{1, . . . , n}); and the ordinary generating function

g(x) = ∑ gn x n
n≥0

for the number gn of unlabelled n-element G -objects (that is, isomorphism classes).

Theorem 10.3 Let G be a species. Then


(a) G(x) = Z̃(G ; s1 ← x, si ← 0 for i > 1);

(b) g(x) = Z̃(G ; si ← xi ).

Proof The number of different labellings of an object A on n points is clearly


n!/| Aut(A)|. So it is enough to show that, for any permutation group G, we have

Z(G; s1 ← x, si ← 0 for i > 1) = xn /|G|,


Z(G; si ← xi ) = xn .

The first equation holds because putting si = 0 for all i > 1 kills all permutations
except the identity. The second holds because, with this substitution, each group
element contributes xn , and the result is 1/|G| ∑g∈G xn = xn .

20:16:22, subject to the Cambridge


.011
10.3 Examples of species 173

10.3 Examples of species


There are a few simple species for which we can do all the sums explicitly.

Example: Sets The species S has as its objects the finite sets, with one set of
each cardinality up to isomorphism. Its cycle index was calculated in Chapter 7:


s 
Z̃(S ) = ∑ (Sn ) = exp ∑
i
.
n≥0 i≥1 i

Hence we find that

S(x) = exp(x),


xi
s(x) = exp ∑
i≥1 i
= exp(− log(1 − x))
1
= ,
1−x
in agreement with the fact that Sn = sn = 1 for all n ≥ 0.

Example: Total orders Let L be the species of total (or linear) orders. Each
n-set can be totally ordered in n! ways, all of which are isomorphic, and each of
which is rigid (that is, has the trivial automorphism group).
We have
1
Z̃(L ) = ∑ sn1 = ,
n≥0 1 − s1
so that
1
L(x) = l(x) = .
1−x

Example: Circular orders The species C consists of circular orders. An ele-


ment of this species corresponds to placing the points of the object around a circle,
where only the relative positions are considered, and there is no distinguished start-
ing point. Thus, there is just one unlabelled n-element object in C for all n, and the
number of labelled objects is equal to the number (n − 1)! of cyclic permutations
for n ≥ 1. The unique n-element structure has φ (m) automorphisms each with n/m
cycles of length m for all m dividing n, where φ is Euler’s function. Hence (see
Exercise 7.2),
φ (m)
Z̃(C ) = 1 − ∑ log(1 − sm ),
m≥1 m

20:16:22, subject to the Cambridge


.011
174 Species

xn
C(x) = 1 + ∑ = 1 − log(1 − x),
n≥1 n
1
c(x) = ∑ xn = 1 − x .
Example: Permutations An object of the species P consists of a set carrying
a permutation. We will see later how P can be expressed as a composition, from
which its cycle index can be deduced (Exercise 7.2). We have
Z̃(P) = ∏ (1 − sn)−1,
n≥1
1
P(x) = ,
1−x
p(x) = ∏ (1 − xn )−1 .
n≥1

The function p(x) is the generating function for number partitions. For, as
we saw earlier, an unlabelled permutation is the same as a conjugacy class of
permutations; and conjugacy classes are determined by their cycle structure.

10.4 Operations on species


There are several ways of building new species from old; only a few important
ones are discussed here.

10.4.1 Products
Let G and H be species. We define the product K = G × H as follows: an
object of K on a set X consists of a distinguished subset Y of X, a G -object on Y ,
and a H -object on X \Y .
Since these objects are chosen independently, it is easy to check that
Z̃(G × H ) = Z̃(G )Z̃(H ).
Since the generating functions for labelled and unlabelled structures are speciali-
sations of the cycle index, we have similar multiplicative formulae for them.
For example, if S , G and G ◦ are the species of sets, graphs, and graphs with
no isolated vertices respectively, then
G ∼ S × G ◦.

10.4.2 Substitution
Let G and H be species. We define the substitution K = G [H ] as follows:
an object of K on a set X consists of a partition of X, an H -object on each part

20:16:22, subject to the Cambridge


.011
10.4 Operations on species 175

of the partition, and a G -object on the set of parts of the partition.


Alternatively, we may regard it as a G -object in which every point is replaced
by a non-empty H -object.
The cycle index is obtained from that of G by the substitution

si ← Z̃(H ; s j ← si j ) − 1

for all i. (The −1 in the formula corresponds to removing the empty H -structure
before substituting.)
From this, we see that the exponential generating functions for labelled struc-
tures obey the simple substitution law:

K(x) = G(H(x) − 1).

The situation for unlabelled structures is more complicated, and k(x) cannot be
obtained from g(x) and h(x) alone. Instead, we have

k(x) = Z̃(G ; si ← h(xi ) − 1).

This equation also follows from the Cycle Index Theorem, since we are count-
ing functions on G -structures where the figures are non-empty H -structures with
weight equal to cardinality.
For example, if S , P and C are the species of sets permutations, and circular
orders, then the standard decomposition of a permutation into disjoint cycles can
be written
P ∼ S [C ].
The counting series for labelled structures are given by
xn
S(x) = ∑ n! = exp(x),
n≥0
n!xn 1
P(x) = ∑ =
1−x
,
n≥0 n!
(n − 1)!xn
C(x) = 1 + ∑ = 1 − log(1 − x);
n≥0 n!

so the equation above becomes


1
= exp(− log(1 − x)).
1−x
So the decomposition of a permutation into cycles is the combinatorial equivalent
of the fact that exp and log are inverse functions!
More generally, for any species G , if H = S [G ], then H(x) = exp(G(x)). A
typical situation for this is when every structure in H can be written in a unique

20:16:22, subject to the Cambridge


.011
176 Species

way as a disjoint union of structures in G , that is, G consists of the indecomposable


structures in H and there is a nice decomposition theorem.
For example, this situation occurs if G is the species of connected graphs and
H the species of all graphs.
This is the exponential principle that we met in Chapter 4. For an abstract
treatment of the principle, see the paper of Dress and Müller in the bibliography.

10.4.3 Rooted (or pointed) structures


Given a species G , let G ∗ be the species of rooted G -structures: such a structure
consists of a G -structure with a distinguished point.
We have

Z̃(G ∗ ) = s1 Z̃(G ),
∂ s1
and so
d
G∗ (x) = x G(x).
dx
Sometimes it is convenient to remove the distinguished point. This just removes
the factors s1 and x in the above formulae, so that this operation corresponds to
differentiation. As a result, we denote the result by G  .
For example, if C is the class of cycles, then C  corresponds to the class L of
total (linear) orders. We have
d d 1
L(x) = C(x) = (1 − log(1 − x)) = ,
dx dx 1−x
in agreement with the preceding example.

10.5 Cayley’s Theorem revisited


The notion of species can be used to give two further proofs of Cayley’s Theo-
rem.

First proof Let L and P be the species of total (or linear) orders and permuta-
tions, respectively. These species are quite different, but have the property that the
numbers of labelled objects on n points are the same (namely n!).
Hence the numbers of labelled objects in the two species L [T ∗ ] and P[T ∗ ]
are equal. (Here T ∗ is the species of rooted trees.)
Consider an object in L [T ∗ ]. This consists of a linear order (x1 , . . . , xr ), with
a rooted tree Ti at xi for all i. I claim that this is equivalent to a tree with two
distinguished vertices. Take edges {xi , xi+1 } for i = 1, . . . , r − 1, and identify xi
with the root of Ti for all i. The resulting graph is a tree. Conversely, given a tree
with two distinguished vertices x and y, there is a unique path from x to y in the

20:16:22, subject to the Cambridge


.011
10.6 What is a species? 177

tree, and the remainder of the tree consists of rooted trees attached to the vertices
of the path.
Now consider an object in P[T ∗ ]. Identify the root of each tree with a point
of the set on which the permutation acts, and orient each edge of this tree towards
the root. The resulting structure defines a function f on the point set, where

• if v is a root, then f (v) is the image of v under the permutation;

• if v is not a root, then f (v) is the unique vertex for which (v, f (v)) is a
directed edge of one of the trees.

Conversely, given a function f : X → X, the set Y of periodic points of f has the


property that f induces a permutation on it; the pairs (v, f (v)) for which v is not
a periodic point have the structure of a family of rooted trees, attached to Y at the
point for which the iterated images of v under f first enter Y .
So the number of trees with two distinguished points is equal to the number of
functions from the vertex set to itself. Thus, if there are F(n) labelled trees, we see
that
n2 F(n) = nn ,
from which Cayley’s Theorem follows.

Second proof As in the preceding proof, let T ∗ denote the species of rooted
trees. If we remove the root from a rooted tree, the result consists of an unordered
collection of trees, each of which has a natural root (at the neighbour of the root of
the original tree). Conversely, given a collection of rooted trees, add a new root,
joined to the roots of all the trees in the collection, to obtain a single rooted tree.
So, if E denotes the species consisting of a single 1-vertex structure, and S the
species of sets, we have
T ∗ ∼ E × S [T ∗ ].
Hence, for the exponential generating functions for labelled structures, we have

T ∗ (x) = x exp(T ∗ (x)).

This is, formally, a recurrence relation for the coefficients of T ∗ (x), and we need
to show that the nth coefficient is nn−1 . This can be done most easily with the
technique of Lagrange inversion, which is discussed in the next chapter.

10.6 What is a species?


We have proceeded this far without ever giving a precise definition of a species.
The informal idea is that an object of a species is constructed from a finite set, and
bijections between finite sets induce isomorphisms of the objects built on them.

20:16:22, subject to the Cambridge


.011
178 Species

It turns out that mathematics does provide a language to describe this, namely
category theory. It would take us too far afield to give all the definitions here. In
essence, a category consists of a collection of objects with a collection of mor-
phisms between them. In the only case with which we deal, objects are sets and
morphisms are set mappings. In particular, the class S whose objects are all finite
sets and whose morphisms are all bijections between them satisfies the axioms for
a category.
Now a species is simply a functor F from S to itself. This means that F as-
sociates to each finite set S a set F(S), and to each bijection f : S → S a bijec-
tion F( f ) : F(S) → F(S ), such that F respects composition and identity (that is,
F( f1 f2 ) = F( f1 )F( f2 ) and F(1S ) = 1F(S) , where 1S is the identity map on S).
The standard reference on species (apart from Joyal’s original paper) is the
book by Bergeron, Labelle and Leroux.

10.7 Oligomorphic permutation groups


Species are extremely general; while there are enumeration results about par-
ticular species or constructions, it is unlikely that there will be general results for
all species. The species to be considered in this section have considerably stronger
properties, and yet are general enough to include a wide range of examples. Also,
the counting problems are clearly defined; there is no need to wonder what is the
correct definition of the objects to be counted. For more details, see a recent survey
in the ISI’s Prospects in Mathematical Sciences series, given in the bibliography.
Let G be a permutation group on a set X, usually assumed infinite. There are
several related actions of G: on X n (the set of all n-tuples of elements of X, with
coordinatewise action); on the set of n-tuples of distinct elements of X; and on
the set of n-element subsets of X. We say that the group G is oligomorphic if
the number of orbits in each of these actions is finite, for every natural number
n. Indeed, for fixed n, finiteness of the number of orbits in one of these actions
implies finiteness in each of the others, and also on m-tuples or m-sets for every
m < n.
Now we have something to count: let Fn∗ (G) be the number of orbits of G on
X n ; let Fn (G) be the number of orbits on ordered n-tuples of distinct elements; and
let fn (G) be the number of orbits on n-element subsets of X. Now the statements
about finiteness can be quantified:

Proposition 10.4 Let G be an oligomorphic permutation group.


n
(a) Fn∗ (G) = ∑ S(n, k)Fk (G) for n > 0, where S(n, k) is the Stirling number of
k=1
the second kind.
(b) fn (G) ≤ Fn (G) ≤ n! fn (G).

20:16:22, subject to the Cambridge


.011
10.7 Oligomorphic permutation groups 179

(c) Fn (G) ≤ Fn+1 (G), with equality if and only if Fn+1 (G) = 1.
(d) fn (G) ≤ fn+1 (G).

What does this have to do with combinatorics? Given a permutation group G


on X, each orbit of G on X n can be regarded as an n-ary relation on X which is
invariant under G. Thus, G is a group of automorphisms of a relational structure.
The finite induced substructures of this structure can be regarded as a species, if we
so desire. (The term relational structure simply means a set carrying a collection
of relations of various arities.) The age of a relational structure M is the collection
of finite structures which are isomorphic to substructures of M.
The crucial definition is as follows. Let M be a relational structure on a set
X. We say that M is homogeneous if the following holds: for every isomorphism
f : A → B between finite induced substructures of M, there is an automorphism
of M whose restriction to A is f . Now it can be shown that, for any permutation
group G on X, the relational structure whose relations are all the orbits of G on
n-tuples is homogeneous. In the other direction, the following holds:

Proposition 10.5 Let M be a homogeneous relational structure, and G its auto-


morphism group. Then
(a) Fn (G) is equal to the number of labelled n-element structures in the age of
M;
(b) fn (G) is equal to the number of unlabelled n-element structures in the age
of M.

This result is supplemented by a remarkable theorem of Fraı̈ssé, which tells


us how to recognise the age of a homogeneous relational structure. A class C of
finite structures has the amalgamation property if, whenever A, B1 , B2 ∈ C and
f1 : A → B1 and f2 : A → B2 are embeddings (as induced substructures), there is a
structure C ∈ C and embeddings g1 : B1 → C and g2 : B2 → C such that f1 g1 = f2 g2
(with composition from left to right). In other words, if two members of C have
isomorphic substructures, they can be amalgamated or ‘glued together’ according
to this isomorphism inside a larger structure in C .

Theorem 10.6 Let C be a class of finite relational structures. Suppose that the
following conditions hold:
(a) C is closed under isomorphism;
(b) C is closed under taking induced substructures;
(c) C contains only countably many members up to isomorphism;
(d) C has the amalgamation property.

20:16:22, subject to the Cambridge


.011
180 Species

Then there is a countable homogeneous structure M whose age is C . Moreover,


M is unique up to isomorphism with these properties. Conversely, the age of a
countable homogeneous relational structure satisfies (a)–(d).

So now we know exactly which species arise in this way, and which have enu-
meration problems equivalent to orbit-counting problems for oligomorphic groups:
they are precisely the Fraı̈ssé classes, those which satisfy the conditions (a)–(d) of
Fraı̈ssé’s Theorem.
Many classes satisfy these conditions: among them are the classes of finite
partitions, graphs, directed graphs, tournaments, partially ordered sets, and so on.
For a slightly different example, consider finite sets which are partitioned into
sets of size at most 2, the parts being totally ordered. This can be shown to be a
Fraı̈ssé class. An n-element structure is specified up to isomorphism by an ordered
sequence of 1s and 2s with sum n; so the number of n-element unlabelled structures
in the class is the Fibonacci number Fn .
Investigations on enumeration of Fraı̈ssé classes (that is, counting orbits of
oligomorphic permutation groups) suggest that the counting sequences for such
classes should grow rapidly and smoothly. There are some general results pointing
in this direction. Here is just one such result, due to Francesca Merola (improving
a result of Dugald Macpherson). A permutation group G on a set X is said to
be primitive if there is no non-trivial partition of X which is invariant under G.
(The trivial partitions are the partition with a single part and the partition into
singletons.)

Theorem 10.7 There is a universal constant c > 1 (in fact, c > 1.324) with the
following property. Let G be a primtive oligomorphic permutation group, and
assume that fn (G) > 1 for some n. Then fn (G) ≥ cn /p(n) and Fn (G) ≥ n! cn /q(n),
where p and q are polynomials depending on G.

It is conjectured that the ‘correct’ constant c in the theorem is c = 2.


There is far more to the rich theory of oligomorphic permutation groups. I
mention here briefly some of the highlights, referring to the article cited in the
bibliography for more details.

• It is possible to define a version of the cycle index for an oligomorphic per-


mutation group G. Both the exponential generating function of the sequence
(Fn (G)) and the ordinary generating function of the sequence ( fn (G)) arise
as specialisations of this cycle index.

• There is a graded algebra AG associated with the oligomorphic group G,


with the property that the dimension of the nth homogeneous component of
AG is fn (G) (so that the Hilbert series of the algebra is equal to the ordi-
nary generating function of the sequence ( fn (G))). Maurice Pouzet recently

20:16:22, subject to the Cambridge


.011
10.8 Weights 181

proved a long-standing conjecture asserting that, if G has no finite orbits,


then AG is an integral domain. This has implications for the smoothness of
the sequence ( fn (G)): in particular, fm+n (G) ≥ fm (G) + fn (G) − 1 for all
m, n.

• There are group-theoretic constructions (direct product, wreath product, and


point stabiliser) which mirror the operations of product, substitution, and
rooting of species.

• A remarkable theorem of first-order logic, proved independently by Engeler,


Ryll-Nardzewski and Svenonius in 1959, asserts that a countable structure
over a first-order language is countably categorical (that is, determined up
to isomorphism by its first-order theory and the assumption of countability)
if and only if its automorphism group is oligomorphic. For such structures
M, the sequence (Fn∗ (Aut(M)) counts the number of n-types over the theory
of M. This remarkable result asserts the equivalence of axiomatisability
(the structure is uniquely determined by first-order properties together with
countability) and symmetry (the oligomorphic property of the automorphism
group is a very strong symmetry condition).

Remark The prototype of a structure to which the theorem of Engeler et al. ap-
plies is the ordered set (Q, <) of rational numbers. A famous theorem of Cantor
asserts that Q is, up to isomorphism, the unique countable totally ordered set which
is
• dense, that is, given x < y, we can find z with x < z < y; and
• without least or greatest element, that is, for any x we can find y and z with
y < x and x < z.
The definition of a total order, together with the two conditions in the above bullet
points, are first-order; so (Q, <) is countably categorical. You are invited to prove
that its automorphism group is oligomorphic.

10.8 Weights
The theory of species allows us to interpret the statement
‘Every graph is uniquely expressible as the disjoint union of connected
graphs’
as the relation G ∼ S [C ], where S , G and C are the species of sets, graphs and
connected graphs respectively.
We can get extra information if the objects in our species carry weights. The
weights must satisfy some restrictions to make the process work nicely. Rather

20:16:22, subject to the Cambridge


.011
182 Species

than describe these in general, I consider one special case. We give each edge a
weight (which, in general, may differ from edge to edge, but in the special case
here will be the same for each edge). Now the weight of a graph, or connected
graph, is just the product of its edge weights; and so the weight of a graph is the
product of the weights of its connected components. This means that

Gw ∼ S [Cw ],

where Gw and Cw are the species of weighted graphs and weighted connected
graphs respectively.
Now specialise further, to the case where w = −1, and consider the exponential
generating function for labelled objects. For graphs on n vertices, if n > 1, the
generating function is

(n2) n
= (1 − 1)(2) = 0.
n
∑ (−1) |E|
= ∑ (−1)i 2
i
E⊆({1,...,n}
2 )
i=0

So Gw (x) = 1+x. If cn,k is the number of connected labelled graphs with n vertices
and k edges, then
(n2)
(−1)k cn,k n
Cw (x) = ∑ ∑ x .
n k=0 n!
And as we saw earlier, S(x) = exp(x).
So we have ⎛ ⎞
(n2)
(−1)kc
1 + x = exp ∑ ⎝ ∑ ⎠ xn ,
n,k

n k=0 n!

or in other words,
⎛ ⎞
(n2)
(−1)k c (−1)n−1 n
∑⎝∑
n,k ⎠ n
x = log(1 + x) = ∑ x .
n k=0 n! n n

Equating coefficients, we find the pretty formula for the alternating sum of the
numbers of connected graphs:

(n2)
∑ (−1)k cn,k = (−1)n−1(n − 1)!.
k=0

(The lower limit in the sum can be taken to be n − 1, since this is the smallest
number of edges in a connected graph.)
Note that the terms in the alternating sum are much larger than the final value.

20:16:22, subject to the Cambridge


.011
10.9 Exercises 183

Example For n = 4, there are 42 = 16 trees (connected graphs with 3 edges), by


Cayley’s Theorem. Any graph   with at least
 four edges
  is necessarily connected, so
the numbers of graphs are 64 = 15, 65 = 6 and 66 = 1 for 4, 5 and 6 edges. So
the alternating sum in the theorem is −16 + 15 − 6 + 1 = −6 = −3!.
This argument was taken from a talk by Stephen Tate, who also had a formula
for the alternating sum of numbers of 2-connected graphs (blocks), based on a
slightly more complicated species equation.
The use of weights in this way is important in the connections between combi-
natorics and statistical mechanics, where typically the vertices of a graph represent
particles, and edge weights carry information about the strengths of their interac-
tions.

10.9 Exercises
10.1 Count the labelled trees in which the vertex i has valency ai for 1 ≤ i ≤ n,
where a1 , . . . , an are positive integers with sum 2n − 2.

10.2 Let π be a permutation on {1, . . . , n} consisting of a single n-cycle. Show


that the minimum number of transpositions whose product is π is n − 1, and that a
product of n − 1 transpositions is an n-cycle if and only if the cycles of the trans-
positions are the edges of a tree. Hence show that the number of ways of writing
π as a product of n − 1 transpositions is nn−2 . (Hint: count pairs consisting of a
tree with the edges ordered and an n-cycle, where the product of the transpositions
corresponding to edges of the tree, in the given order, is the n-cycle.)

10.3 Show that the cycle index for the species C of circular structures is

φ (m)
Z̃(C ) = 1 − ∑ log(1 − sm ).
m≥1 m

Use the fact that


P ∼ S [C ]
to show that
Z̃(P) = ∏ (1 − sn )−1 .
n≥1

Can you give a direct proof of this?

10.4 Use the result of the preceding exercise, and the fact that cn = 1 for all n
(where cn is the number of unlabelled n-element structures in C ) to prove the
identity
∏ (1 − xm)−φ (m)/m = exp(x/(1 − x)).
m≥1

20:16:22, subject to the Cambridge


.011
184 Species

10.5 Suppose that gn is the number of unlabelled n-element objects in the species G .
Show that the generating function for unlabelled structures in S [G ] is

∏ (1 − xn)−gn .
n≥1

Verify this combinatorially in the case G = S . How would you describe the ob-
jects of S [S ]?

10.6 Let S , P and D be the species of sets, permutations and derangements


respectively. By ‘decomposing’ a permutation as a set of fixed points and a de-
rangement of the remaining points, show that

P ∼ S × D.

Use this to deduce the exponential generating function for the number of derange-
ments of an n-set.

10.7 Let G be a species. The Stirling numbers of G are the numbers S(G )(n, k),
defined to be the number of partitions of an n-set into k parts with a G -object on
each part.

(a) Prove that, for G = S , C and L respectively, the Stirling numbers are respec-
tively the Stirling numbers S(n, k) of the second kind, the unsigned Stirling
numbers |s(n, k)| of the first kind, and the Lah numbers L(n, k) respectively.

(b) Let S(G ) be the lower triangular matrix of Stirling numbers of G . Prove that

S(G )S(H ) = S(H [G ]).

(c) Let (an ) and (bn ) be sequences of positive integers with exponential gener-
ating functions A(x) and B(x) respectively. Prove that the following two
conditions are equivalent:
n
• a0 = b0 and bn = ∑ S(G )(n, k)ak for n ≥ 1;
k=1
• B(x) = A(G(x) − 1).

10.8 A forest is a graph whose connected components are trees. Show that there
is a bijection between labelled forests of rooted trees on n vertices, and labelled
rooted trees on n + 1 vertices with root n + 1.
Hence show that, if a forest of rooted trees on n vertices is chosen at random,
then the probability that it is connected tends to the limit 1/e as n → ∞.

20:16:22, subject to the Cambridge


.011
10.9 Exercises 185

√ It is true but harder to prove that the analogous limit for unrooted trees
Remark
is 1/ e.

10.9 Let U be the subset species: a U -object consists of a distinguished subset


of its ground set. Calculate the cycle index of U . Hence or otherwise prove that
the enumeration functions of U are

U(x) = exp(2x),
u(x) = (1 − x)−2 .

10.10 Count the labelled trees in which the vertex i has valency ai for 1 ≤ i ≤ n,
where a1 , . . . , an are positive integers with sum 2n − 2.

10.11 A forest is a graph whose connected components are trees. Show that there
is a bijection between labelled forests of rooted trees on n vertices, and labelled
rooted trees on n + 1 vertices with root n + 1.
Hence show that, if a forest of rooted trees on n vertices is chosen at random,
then the probability that it is connected tends to the limit 1/e as n → ∞.

10.12 Let L and E denote the species of linear orders and of sets of size at most 2
respectively. Prove that the number of labelled n-element structures in L [E ] is the
Fibonacci number Fn .

10.13 (a) Prove the first three parts of Proposition 10.4. (The fourth part is
more difficult.)
(b) Prove Proposition 10.5.
(c) Prove that the relational structure on X whose relations are the orbits on
n-tuples of a permutation group G on X is homogeneous.

10.14 (a) Prove that the class of finite graphs is a Fraı̈ssé class.
(b) Prove that the class of finite posets is a Fraı̈ssé class.
(c) Prove that the class of structures consisting of a finite set partitioned into
parts of size at most 2 with the set of parts totally ordered (mentioned in the
text in connection with Fibonacci numbers) is a Fraı̈ssé class.

10.15 Let (a1 , . . . , an ) and (b1 , . . . , bn ) be two n-tuples of rational numbers, both
in strictly increasing order. Show that there exists an order-preserving permutation
of Q carrying ai to bi for i = 1, . . . , n. Deduce that, for G = Aut(Q, <), we have
n
fn (G) = 1, Fn (G) = n!, Fn∗ (G) = ∑ S(n, k)k!.
k=1

20:16:22, subject to the Cambridge


.011
186 Species

10.16 (a) Let G and H be oligomorphic permutation groups on sets X and Y


respectively. There is a natural action of the direct product G × H on the
Cartesian product X ×Y , given by the rule

(x, y)(g,h) = (xg , yh ).

Prove that G × H, with this action, is oligomorphic, and that

Fn∗ (G × H) = Fn∗ (G)Fn∗ (H).

(b) Now let G be the group of order-preserving permutations of Q, as defined


in the preceding question. Write down a formula for Fn (G × G) (with the
product action defined in the first part of this question). Show also that
fn (G × G) = Fn (G × G)/n!.
(c) Show that fn (G × G) is equal to the number of matrices (of any size) of zeros
and ones having precisely n ones and having no row or column consisting
entirely of zeros.
(This result is due to Cameron, Gewurz and Merola; the asymptotics of the
numbers fn (G) were calculated by Cameron, Prellberg and Stark.)

20:16:22, subject to the Cambridge


.011
CHAPTER 11

Analytic methods: a first look

In this chapter, we say a bit more about asymptotics, prove Stirling’s formula,
consider the use of complex analysis in combinatorics, and finally describe sub-
additive and submultiplicative functions, for which the shape of the asymptotics is
easy to establish, although precise details may be more difficult.

11.1 The language of asymptotics


We introduce the notation for describing the asymptotic behaviour of functions
here.
Let F and G be functions of the natural number n. For convenience we assume
that G does not vanish. We write
• F = O(G) if F(n)/G(n) is bounded above as n → ∞;
• F = Ω(G) if F(n)/G(n) is bounded below as n → ∞;
• F = Θ(G) if F(n)/G(n) is bounded above and below as n → ∞;
• F = o(G) if F(n)/G(n) → 0 as n → ∞;
• F ∼ G if F/G → 1 as n → ∞.
If F ∼ G, then the difference satisfies F − G = o(G). This might be accompa-
nied by an asymptotic estimate for F(n) − G(n), and so on; we obtain an asymp-
totic series for F.
More precisely, the series G0 (n) + G1 (n) + G2 (n) + · · · is an asymptotic series
for F(n) if
i−1
F(n) − ∑ G j (n) ∼ Gi (n)
j=0

187
20:15:45, subject to the Cambridge
.012
188 Analytic methods: a first look

for i ≥ 0. (So in particular F(n) ∼ G0 (n), F(n) − G0 (n) ∼ G1 (n), and so on. Note
that Gi (n) = o(Gi−1 (n)) for all i.)
The definition comes with a couple of warnings:
• an asymptotic series is not necessarily convergent;
• it is not necessarily the case that taking more terms in the series gives a better
approximation to F(n) for a fixed n.
Typically, F is a combinatorial enumeration function, and G a combination of
standard functions of analysis. In the next section, we prove Stirling’s formula as
an example.

11.2 Stirling’s formula


Stirling’s formula gives the asymptotics of the number n! of permutations of
{1, . . . , n}. We give the proof as an illustration.
Theorem 11.1
√  n n
n! ∼ 2πn .
e
Proof Consider the graph of the function y = log x between x = 1 and x = n,
together with the piecewise linear functions shown in Figure 11.1.

...
.......
.......
........
.......
..
...
........
.
.......
.......
.......
......
......
...
........
....
......
.....
.....
.....
...
.......
.
....
........
.......
........
........
...........
.
....
....
....
.....
.....
.. .......
.
......
... ..
.. ...
......
.........
.. ...
......
......
......
..........
..
...

Figure 11.1: Stirling’s formula

Let f (x) = log x, let g(x) be the function whose value is log m for m ≤ x < m+1,
and let h(x) be the function defined by the polygon with vertices (m, log m), for

20:15:45, subject to the Cambridge


.012
11.2 Stirling’s formula 189

1 ≤ m ≤ n. Clearly
n
g(x) dx = log 2 + · · · + log n = log n! .
1

The difference between the integrals of g and h is the sum of the areas of trian-
gles with base 1 and total height log n; that is, 12 log n.
Some calculus (given at the end of this proof) shows that the difference between
the integrals of f and h tends to a finite limit c as n → ∞.
Finally, a simple integration shows that
n
f (x) dx = n log n − n + 1.
1

We conclude that

log n! = n log n − n + 12 log n + (1 − c) + o(1),

so that
Cnn+1/2
n! ∼ .
en
To identify the constant C, we can proceed as follows. Consider the integral
π/2
In = sinn x dx.
0

Integration by parts shows that


n−1
In = In−2 ,
n
and hence
(2n)! π
I2n = ,
22n+1 (n!)2
22n (n!)2
I2n+1 = .
(2n + 1)!
On the other hand,
I2n+2 ≤ I2n+1 ≤ I2n ,
from which we get

(2n + 1)π 24n (n!)4 π


≤ ≤ ,
4(n + 1) (2n)!(2n + 1)! 2
and so
24n (n!)4 π
lim = .
n→∞ (2n)!(2n + 1)! 2

20:15:45, subject to the Cambridge


.012
190 Analytic methods: a first look

Putting n! ∼ Cnn+1/2 /en in this result, we find that


 
C2 e 1 −(2n+3/2) π
lim 1 + = ,
4 n→∞ 2n 2

so that C = 2π.
The last part of this proof is taken from Alan Slomson’s An Introduction to
Combinatorics (see the bibliography). It is more-or-less the same as the proof of
Wallis’ product formula for π.
Here for completeness is the argument we skipped over in the proof.
Let F(x) = f (x) − h(x). The convexity of log x shows that F(x) ≥ 0 for all
x ∈ [m, m + 1]. For an upper bound we use the fact, a consequence of Taylor’s
Theorem, that
x−m 1
log x ≤ log m + ≤ log m +
m m
for x ∈ [m, m + 1]. Then
   
1 1 1 1
F(x) = log x − log m − log 1 + (x − m) ≤ − log 1 + ≤ ,
m m m 2m2

where the last inequality comes from another application of Taylor’s Theorem
which yields log(1 + x) ≥ x − x2 /2 for x ∈ [0, 1]. Now ∑(1/m2 ) converges, so
the integral is bounded.

11.3 Complex analysis


Regarding a generating function for a sequence as a function of a real or com-
plex variable is a powerful method for studying the asymptotic behaviour of the
sequence. We will see examples of this later. The simplest applications are based
on the following fundamental theorem about the behaviour of power series in com-
plex analysis. Here, we reiterate the application of complex power series to asymp-
totics, and give an example, finding the asymptotic number of partial preorders.
Recall that, if xn is a sequence of real numbers, then the limit superior (for
short, lim sup) of the sequence is the real number r (if it exists) with the property
that, for any ε > 0,

• infinitely many terms of the sequence are greater than r − ε;


• only finitely many terms are greater than r + ε.

A sequence has a lim sup if and only if it is bounded. (Take r to be the infimum of
the set of values y for which only finitely many terms xn are greater than x. This set
is non-empty (it contains any upper bound for the sequence) and bounded below (a

20:15:45, subject to the Cambridge


.012
11.3 Complex analysis 191

lower bound for the sequence is also a lower bound for the set), and so the infimum
exists; it clearly has the required property.)
There is an analogous dual notion of limit inferior or lim inf.
Theorem 11.2 Suppose that A(z) = ∑ an zn defines a function which is analytic in
some neighbourhood of the origin in the complex plane. Suppose that the smallest
modulus of a singularity of A(z) is R. Then lim sup |an |1/n = 1/R.
This shows that all but finitely many an are bounded by (c + ε)n , but infinitely
many are not bounded by (c − ε)n , where c = 1/R. We conclude that the series is
‘roughly’ cn . (However, it is not true to say that an ∼ cn : why?)
On the other hand, if A(z) is analytic everywhere, then an ≤ ε n for n > n0 (ε),
for any positive ε. Indeed, an = o(ε n ) for any positive ε.
For example, if B(n) is the nth Bell number, then
B(n)zn
∑ n! = ee −1,
z

n≥0

which is analytic everywhere. So B(n) = o(ε n n!), for any positive ε.


Here is an example. In Exercise 3.23, we defined a total preorder to be a
reflexive and transitive relation on a set X which satisfies the trichotomy law, that
is, for any x, y ∈ X, either R(x, y) or R(y, x) holds.
We showed that the number P(n) of total preorders on the set {1, . . . , n} has
exponential generating function given by
P(n)zn 1
p(z) = ∑ n!
=
2 − exp(z)
.
n≥0

We use this to find a very good asymptotic estimate for P(n).


The generating function has a simple pole at z = log 2 with residue
   
z − log 2 1 1
lim = lim =− ,
z→log 2 2−e z z→log 2 −e z 2
by l’Hôpital’s rule. So the function
1
p(z) +
2(z − log 2)
is analytic in a circle with centre at the origin and the next singularities of p(z) (at
log 2 ± 2πi) on the boundary. Thus
 n+1
n! 1
P(n) ∼ ,
2 log 2
and indeed the difference between the two sides is n! o((r − ε)−n ), where r =
| log 2 + 2πi|; that is, exponentially smaller than either expression.
For n = 10, the number of preorders is 102247563, while the asymptotic esti-
mate is 102247563.005271042 . . ..

20:15:45, subject to the Cambridge


.012
192 Analytic methods: a first look

11.4 Subadditive and submultiplicative functions


This section describes a simple but quite powerful idea for estimating the asymp-
totics of a function on the natural numbers from a condition on its behaviour.
Let f be a function from the natural numbers to (say) the positive real numbers.
We assume for simplicity that f (0) = 0. Then f is said to be subadditive if, for all
positive integers m, n, we have

f (m + n) ≤ f (m) + f (n).

Since f (0) = 0, we can phrase this a different way:


f (m + n) − f (n) f (m) − f (0)
≤ .
m m
This says that the slope of the secant from (n, f (n)) to (m + n, f (m + n)) is less
than or equal to the slope of the secant from (0, 0) to (m, f (m)): see Figure 11.2.


..........
.............
 ..............
.............
.
....
...........
..
...
...
..
.............
............
...........
...........
...........
...........
..
...
...........
.
..
.........
........
........
........
.......
.
...
.......
.
......
....
....
...
...
.....
..
..
..

Figure 11.2: A subadditive function

Proposition 11.3 Let f be a subadditive function. Then


f (n)
c = lim
n→∞ n
exists; if c > 0 then we have f (n) ∼ cn.

Proof An easy induction shows that f (m1 + · · · + ms ) ≤ f (m1 ) + · · · + f (ms ) for


any m1 , . . . , ms . In particular, if n = mq + r, with 0 ≤ r < m, then f (n) ≤ q f (m) +
f (r), and so
f (n) q f (m) f (r) f (m) P
≤ + ≤ + ,
n mq + r mq + r m n
where P = max{ f (0), . . . , f (m − 1)}.
Fixing m and letting n → ∞, we see that
f (n) f (m)
lim sup ≤
n→∞ n m

20:15:45, subject to the Cambridge


.012
11.4 Subadditive and submultiplicative functions 193

for any value of m.


Choose a sequence m1 , m2 , . . . for which
f (mi ) f (n)
lim = lim inf .
i→∞ mi n→∞ n
We see that lim sup f (n)/n ≤ lim inf f (n)/n, and so the limit exists, as claimed.

Note that the final conclusion requires that c > 0. The function f (n) = na is
subadditive for any positive real number a < 1; we have limn→∞ f (n)/n = 0, but
the asymptotics of f are not determined by this fact.
We do not meet many subadditive functions in enumerative combinatorics. A
much more common situation is that we have a function which is submultiplica-
tive, in the following sense.
Let f be a function from the natural numbers to the positive reals; assume that
f (0) = 1. We say that f is submultiplicative if, for all positive integers m, n we
have
f (m + n) ≤ f (m) f (n).

Proposition 11.4 Let f be a submultiplicative function. Then

c = lim f (n)1/n
n→∞

exists; if c > 1 then we have log f (n) ∼ n log c.

Proof Apply Proposition 11.3 to the function g(n) = log f (n).

The final statement of the proposition asserts that f (n) is ‘roughly’ cn , that
is, f (n) grows exponentially with n; but it is not correct to conclude from our
hypothesis that f (n) ∼ cn , as we will see.
Here is a very simple example. Let f (n) be the number of strings of zeros
and ones of length n containing no two consecutive ones. We claim that f is
submultiplicative. For consider the strings of length m+n satisfying the constraint.
The first m positions form a string of length m with no two consecutive ones; there
are f (m) possibilities for this. The last n positions form a string of length n with no
two consecutive ones; there are f (n) possibilities. So there are f (m) f (n) possible
concatenations of such strings; not all pass the test, since we have to rule out the
possibility that the first string ends with 1 while the second begins with 1. So
certainly f (m + n) ≤ f (m) f (n). √
√in Chapter 2, we have f (n) ∼ Ac , where c = (1 + 5)/2
In fact, as √
we saw n

and A = (1 + 5)/2 5.
The result obtained using submultiplicativity is of course much less precise,
but much more general; it holds for the number of binary strings with an arbitrary
finite collection of forbidden substrings, for example.

20:15:45, subject to the Cambridge


.012
194 Analytic methods: a first look

11.5 Exercises
11.1 Prove that nk = o(cn ) for any constants k > 0 and c > 1, and that log n =
o(nε ) for any ε > 0.

11.2 Let R be a preorder on X.


(a) Define a relation ≡ on X by the rule that x ≡ y if R(x, y) and R(y, x) both hold.
Prove that ≡ is an equivalence relation.

(b) Define a relation ≤ on the set of equivalence classes of ≡ by the rule that
[x] ≤ [y] if R(x, y) holds. Show that this relation is well-defined (independent
of the choice of representatives of the equivalence classes) and is a total
order.

(c) Show that, given any equivalence relation on X and any total order on the set
of equivalence classes, there is a unique preorder on X which gives rise to
them in the manner just described.
(Hence P(n) is the number of ways of choosing a partition of the set {1, . . . , n} and
a total order of the set of parts.)

11.3 A self-avoiding walk of length n on the square lattice in the plane is a se-
quence of n + 1 points P0 , . . . , Pn with integer coordinates, such that
• P0 = (0, 0);
• for i = 1, . . . , n, we have Pi − Pi−1 ∈ {(1, 0), (0, 1), (−1, 0), (0, −1)};
• the points P0 , . . . , Pn are all distinct.
In other words, start at the origin, take n steps each one unit east, north, west or
south, such that no point is ever revisited.
Let f (n) be the number of self-avoiding walks of order n. Prove that
(a) 4 · 2n−1 ≤ f (n) ≤ 4 · 3n−1 ;
(b) f is submultiplicative.
Deduce that c = limn→∞ f (n)1/n exists, and that 2 ≤ c ≤ 3.

Remark The problem of actually finding the value of the limit c is extremely
difficult!

11.4 Define superadditive and supermultiplicative functions by reversing the in-


equalities in the definition of subadditive and submultiplicative functions, and
prove the analogues of Propositions 11.3 and 11.4.

20:15:45, subject to the Cambridge


.012
CHAPTER 12

Further topics

In this section we consider some further topics, in rather less detail: Lagrange in-
version, Bernoulli numbers, the Euler–Maclaurin sum formula, and analytic tech-
niques due to Hayman, Meir and Moon, and Bender.

12.1 Lagrange inversion


A formal power series over a field, with zero constant term and non-zero term
in x, has an inverse with respect to composition. Indeed, the set of all such formal
power series is a group, which has recently become known as the Nottingham
group. However, the basic facts are much older. The associative, closure, and
identity laws are obvious, and the rule for finding the inverse in characteristic zero
is known as Lagrange inversion.

12.1.1 The theorem


The basic fact can be stated as follows.
Proposition 12.1 Let f be a formal power series over R, with f (0) = 0 and
f  (0) = 0. Then there is a unique formal power series g such that g( f (x)) = x;
the coefficient of yn in g(y) is
 n−1  n  
d x
n!.
dxn−1 f (x) x=0
This can be expressed in a more convenient way for our purpose. Let
x
φ (x) = .
f (x)

195
20:15:10, subject to the Cambridge
.013
196 Further topics

Then the inverse function g is given by the functional equation

g(y) = yφ (g(y)).

Then Lagrange inversion has the form


bn y n
g(y) = ∑ ,
n≥1 n!

where  
dn−1
bn = φ (x)n .
dxn−1 x=0

Example: Cayley’s Theorem The exponential generating function for rooted


trees satisfies the equation

T ∗ (x) = x exp(T ∗ (x)).

With φ (x) = exp(x), we find that the coefficient of yn /n! in T ∗ (y) is


 n−1 
d
exp(nx) = nn−1 ,
dxn−1 x=0

proving Cayley’s Theorem once again.

12.1.2 Proof of the theorem


The proof of Lagrange’s inversion formula involves a considerable detour. The
treatment here follows the book by Goulden and Jackson. Throughout this sub-
section, we assume that the coefficients form a field of characteristic zero; for
convenience, we assume that the coefficient ring is R.
First, we extend the notion of formal power series to formal Laurent series,
defined to be a series of the form

f (x) = ∑ an x n ,
n≥m

where m may be positive or negative. If the series is not identically zero, we may
assume without loss of generality that am = 0, in which case m is the valuation of
f , written
m = val( f ).
We define addition, multiplication, composition, differentiation, etc., for formal
Laurent series as for formal power series. In particular, f (g(x)) is defined for any
formal Laurent series f , g with val(g) > 0. (This is less trivial than the analogous
result for formal power series.) In particular, we need to know that g(x)−m exists

20:15:10, subject to the Cambridge


.013
12.1 Lagrange inversion 197

as a formal Laurent series for m > 0. It is enough to deal with the case m = 1,
since certainly g(x)m exists. If val(g) = r, then g(x) = xr g1 (x), and so g(x)−1 =
x−r g1 (x)−1 , and we have seen that g1 (x)−1 exists as a formal power series, since
g1 (0) is invertible.
We denote the derivative of the formal Laurent series f (x) by f  (x).
We also introduce the following notation: [xn ] f (x) denotes the coefficient of
xn in the formal power series (or formal Laurent series) f (x). The case n = −1 is
especially important, as we learn from complex analysis. The value of [x−1 ] f (x)
is called the residue of f (x), and is also written as Res f (x).
Everything below hinges on the following simple observation, which is too
trivial to need a proof.

Proposition 12.2 For any formal Laurent series f (x), we have Res f  (x) = 0.

Now the following result describes the residue of the composition of two formal
Laurent series.

Theorem 12.3 (Residue Composition Theorem) Let f (x), g(x) be formal Lau-
rent series satisfying val(g) = r > 0. Then

Res( f (g(x))g (x)) = r Res( f (x)).

Proof It is enough to consider the case where f (x) = xn , since Res is a linear
function.
Suppose that n = −1, so that the right-hand side is zero. Then
 
 1 d n+1
Res(g (x)g (x)) =
n
Res g (x) = 0.
n+1 dx

So consider the case where n = −1. Let g(x) = axr h(x), where a = 0 and
h(0) = 1. Then

g (x) = raxr−1 h(x) + axr h (x),


g (x) r h (x)
= + ,
g(x) x h(x)
so
Res g (x)g(x)−1 = r = r Res x−1 ,
since h (x)/h(x) = (d/dx) log h(x), and log h(x) = log(1 + k(x)) is a formal power
series since k(x) is a f.p.s. with constant term zero.

20:15:10, subject to the Cambridge


.013
198 Further topics

It is tempting to say
d
g (x)g(x)−1 = log g(x)
dx
d
= (log a + r log x + log h(x))
dx
r d
= + log h(x),
x dx
but this is not valid; log g(x) may not exist as a formal Laurent series. Con-
sider this point carefully; an error here would lead to the incorrect conclusion
that Res(g (x)/g(x)) = 0.

From the Residue Composition Theorem, we can prove a more general version
of Lagrange Inversion.

Theorem 12.4 (Lagrange Inversion) Let φ be a formal power series satisfying


val(φ ) = 0. Then the equation

g(x) = xφ (g(x))

has a unique formal power solution g(x). Moreover, for any Laurent series f , we
have
 1 n−1 
[x ]( f (x)φ (x)n ) if n ≥ val( f ) and n = 0,
[x ] f (g(x)) = n
n
f (0) + Res( f  (x) log(φ (0)−1 φ (x))) if n = 0.

Proof Let Φ(x) = x/φ (x), so that Φ(g(x)) = x and val(Φ(x)) = 1. Then g is the
inverse function of Φ.
We have

[xn ] f (g(x)) = Res x−n−1 f (g(x))


= Res Φ(y)−n−1 Φ (y) f (y),

where we have made the substitution x = Φ(y) (so that y = g(x)) and used the
Residue Composition Theorem.
For n = 0, we have
1  
[xn ] f (g(x)) = − [y−1 ] f (y) Φ(y)−n
n
1 −1 
= [y ] f (y)Φ(y)−n
n
1 n−1 
= [y ] f (y)φ n (y).
n

20:15:10, subject to the Cambridge


.013
12.1 Lagrange inversion 199

Here, in the second line, we have used the fact that


Res( f  (x)g(x)) = − Res( f (x)g (x)),
a consequence of the fact that Res( f (x)g(x)) = 0; in the third line we use the fact
that Φ(x) = x/φ (x).
For n = 0, we have
[x0 ] f (g(x)) = [y0 ] f (y) − [y−1 ] f (y)φ  (y)φ (y)−1
= f (0) + Res( f  (y) log(φ (y)φ −1 (0))),
using the same principle as before and the fact that
(log(φ (y)φ −1 (0))) = φ  (y)φ (y)−1 .
Taking f (x) = x in this result gives the form of Lagrange Inversion quoted
earlier.
We proceed to an application, also taken from Goulden and Jackson, of the
Residue Composition Theorem.

Example: a binomial identity We use the Residue Composition Theorem to


prove that
n     
2n + 1 j+k 2j
∑ 2k + 1 2n = 2n .
k=0
We begin with the sum of the odd terms in (1 + x)2n+1 :
n  
2n + 1 2k 1  
∑ 2k + 1 x = 2x (1 + x)2n+1 − (1 − x)2n+1 .
k=0

Call the right-hand side of this equation f (x). Now, if S is the sum that we want to
evaluate, then
n  
2n + 1
S = [y2n ](1 + y) j ∑ (1 + y)k
k=0 2k + 1
= Res y−(2n+1) (1 + y) j f ((1 + y)1/2 ).
Now we do the following rather strange thing: make the substitution y = z2 (z2 −
2). Then val(y(z)) = 2, and (1 + y)1/2 = 1 − z2 . So the Residue Composition
Theorem gives
 
1 1
S = Res(z2 − 1)2 j − z
(z2 − 2)2n+1 z4n+2
= Res(z2 − 1)2 j z−(4n+1)
= [z4n ](z2 − 1)2 j
 
2j
= ,
2n

20:15:10, subject to the Cambridge


.013
200 Further topics

as required. (In the second line we have used the fact that (z2 − 2)−(2n+1) is a
formal power series and so its residue is zero.)

12.2 Bernoulli numbers


We saw in Chapter# 1 an asymptotic estimate for n! which began by comparing
log n! = ∑ni=1 log i to 1n log x dx. Obviously the comparison is not exact, but the
approximation can often be improved by the Euler–Maclaurin sum formula. This
formula involves the somewhat mysterious Bernoulli numbers, which crop up in a
wide variety of other situations too.
The Bernoulli numbers Bn can be defined by the recurrence relation
n  
n+1
B0 = 1, ∑ Bk = 0 for n ≥ 1.
k=0 k

Note that we can write the recurrence as


n+1  
n+1
∑ k Bk = Bn+1,
k=0

since the term Bn+1 cancels from this equation (which expresses Bn in terms of
earlier terms).
Conway and Guy, in The Book of Numbers, have a typically elegant presenta-
tion of the Bernoulli numbers. They write this relation as

(B + 1)n+1 = Bn+1

for n ≥ 1, where Bk is to be interpreted as Bk after the left-hand expression has


been evaluated using the Binomial Theorem.
Thus,
1
B2 + 2B1 + 1 = B2 , whence B1 = − ,
2
1
B3 + 3B2 + 3B1 + 1 = B3 , whence B2 = ,
6
and so on. Note that, unlike most of the sequences we have considered before, the
Bernoulli numbers are not integers.

Theorem 12.5 The exponential generating function for the Bernoulli numbers is
Bn xn x
∑ =
exp(x) − 1
.
n≥0 n!

20:15:10, subject to the Cambridge


.013
12.2 Bernoulli numbers 201

Proof Let F(x) be the e.g.f., and consider F(x)(exp(x) − 1). The coefficient of
xn+1 /(n + 1)! is
n    n  
Bk 1 n+1
(n + 1)! ∑ =∑ Bk = 0
k=0 k! (n + 1 − k)! k=0 k

for n ≥ 1. (Note that the sum runs from 0 to n rather than n + 1 because we
subtracted the constant term from the exponential.) The coefficient of x, however,
is clearly 1. So the product is x.

Corollary 12.6 Bn = 0 for all odd n > 1.


Proof
x x exp(x/2) + exp(−x/2) x x
F(x) + = · = coth
2 2 exp(x/2) − exp(−x/2) 2 2
which is an even function of x; so the coefficients of the odd powers of x are zero.
Corollary 12.7
n
(−1)k k!S(n, k)
Bn = ∑ k+1
.
k=1

Proof Let f (x) = log(1 + x)/x = ∑ an xn /n!, where

(−1)n n!
an = .
(n + 1)

By Theorem 3.12, f (exp(x) − 1) = x/(exp(x) − 1) = ∑ Bn xn /n!, where


n
Bn = ∑ S(n, k)ak .
k=1

One application of the Bernoulli numbers is in Faulhaber’s formula for the sum
of the kth powers of the first n natural numbers. Everyone knows that
n
∑i = n(n + 1)/2,
i=1
n
∑i 2
= n(n + 1)(2n + 1)/6,
i=1
n
∑ i3 = n2 (n + 1)2 /4,
i=1

but how does the sequence continue?

20:15:10, subject to the Cambridge


.013
202 Further topics

Theorem 12.8
 
n
1 k
k+1
∑i = k+1
k
∑ j
B j (n + 1)k+1− j .
i=1 j=0

So, for example,


n  
1 5 5 1
∑ i4 = 5
(n + 1)5 − (n + 1)4 + (n + 1)3 − (n + 1)
2 3 6
i=1
= n(n + 1)(6n3 + 9n2 + n − 1)/30.

Proof This argument is written out in the shorthand notation of Conway and Guy.
Check that you can turn it into a more conventional proof!
We calculate
k+1  
k + 1 k− j
(n + 1 + B) k+1
− (n + B) k+1
= ∑ j
n ((B + 1) j − B j ).
j=1

Now (B + 1) j = B j for all j ≥ 2, so the only surviving term in this expression is

(k + 1)nk ((B + 1)1 − B1 ) = (k + 1)nk .

Thus we have
1
((n + 1 + B)k+1 − (n + B)k+1 ) = nk ,
k+1
from which by induction we obtain
n
1
((n + 1 + B)k+1 − Bk+1 ) = ∑ ik .
k+1 i=1

The left-hand side of this expression is


 
1 k
k+1
k+1 ∑ j
B j (n + 1)k+1− j ,
j=0

as required.

Warning Conway and Guy use a non-standard definition of the Bernoulli num-
bers, as a result of which they have B1 = 1/2 rather than −1/2. As a result, their
formulae look a bit different.

20:15:10, subject to the Cambridge


.013
12.2 Bernoulli numbers 203

How large are the Bernoulli numbers? The generating function x/(exp(x) − 1)
has a removable singularity at the origin; apart from this, the nearest singularities
are at ±2πi, and so Bn is about n!(2π)−n ; in fact, it can be shown that

2 n! ζ (n)
|Bn | =
(2π)n

for n even, where ζ (n) = ∑k≥1 k−n . Of course, Bn = 0 if n is odd and n > 1.
Another curious formula for Bn is due to von Staudt and Clausen:
1
B2n = N − ∑ p
p−1|2n

for some integer N, where the sum is over the primes p for which p − 1 divides 2n.

12.2.1 Bernoulli polynomials


The Bernoulli polynomials Bn (t) are defined by the formula

x exp(tx) Bn (t)xn
=∑ .
exp(x) − 1 n≥0 n!

Proposition 12.9 The Bernoulli polynomials satisfy the following conditions:

(a) Bn (0) = Bn (1) = Bn for n = 1, and B1 (0) = −1/2, B1 (1) = 1/2..

(b) Bn (t + 1) − Bn (t) = nt n−1 .

(c) Bn (t) = nBn−1 (t).


n  
n
(d) Bn (t) = ∑ Bn−kt k .
k=0 k

Proof All parts are easy exercises. Let F(t) = x exp(tx)/(exp(x) − 1).
(a) F(0) is the e.g.f. for the regular Bernoulli numbers, and F(1) = x + F(0).
(b) F(t + 1) − F(t) = x exp(tx).
(c) F  (t) = xF(t).
(d) F(t) = F(0) exp(xt): use the rule for multiplying e.g.f.s.

The first few Bernoulli polynomials are

B0 (t) = 1, B1 (t) = t − 12 , B2 (t) = t 2 − t + 16 ,


B3 (t) = t 3 − 32 t 2 + 12 t, B4 (t) = t 4 − 2t 3 + t 2 − 30
1
.

20:15:10, subject to the Cambridge


.013
204 Further topics

12.3 The Euler–Maclaurin sum formula


Faulhaber’s formula gives us an exact value for the sum of the values of a poly-
nomial over the first n natural numbers. The Euler–Maclaurin formula generalises
this to arbitrary well-behaved functions; instead of an exact value, we must be con-
tent with error estimates, which in some cases enable us to show that we have an
asymptotic series.
The Euler–Maclaurin sum formula connects the sum
n
∑ f (i)
i=1

with the series


n
1 B2i  (2i−1) 
f (t) dt + ( f (1) + f (n)) + ∑ f (n) − f (2i−1) (1) ,
1 2 (2i)!
where f is a ‘sufficiently nice’ function.
Here is a precise formulation due to de Bruijn.
Theorem 12.10 Let f be a real function with continuous (2k)th derivative. Let
n
1 k
B2i  (2i−1) 
Sk = f (t) dt + ( f (1) + f (n)) + ∑ f (n) − f (2i−1) (1) .
1 2 i=1 (2i)!

Then
n
∑ f (i) = Sk − Rk ,
i=1
where the error term is
n
B2k ({t})
Rk = f (2k) (t) dt,
1 (2k)!
with B2k (t) the Bernoulli polynomial and {t} = t − t the fractional part of t.
Proof First let g be any function with continuous (2k)th derivative on [0, 1]. We
claim that
1
1
(g(0) + g(1)) − g(t) dt
2 0
k
B2i  (2i−1)  1 B2k (t)
=∑ g (1) − g(2i−1) (0) − g(2k) (t) dt.
i=1 (2i)! 0 (2k)!
The proof is by induction: both the start of the induction (at k = 1) and the induc-
tive step are done by integrating the last term by parts twice, using the fact that
Bn (t) = nBn−1 (t) (see Proposition 12.9).
Now the result is obtained by applying this claim successively to the functions
g(x) = f (x + 1), g(x) = f (x + 2), . . . , g(x) = f (x + n), and adding.

20:15:10, subject to the Cambridge


.013
12.4 Poly-Bernoulli numbers 205

If f is a polynomial, then f (2k) (x) = 0 for sufficiently large k, and the remain-
der term vanishes, giving Faulhaber’s formula. For other applications, we must
estimate the size of the remainder term.
There are various analytic conditions which guarantee a bound on the size
of Rk , so that it can be shown that we have an asymptotic series for the sum. I
will not give precise conditions here.

Let f (x) = log x. Then f (k) (x) = (−1)


k−1 (k−1)!
Example: Stirling’s formula xk
. We
obtain the asymptotic series

1 B2k
c + n log n − n + log n + ∑
2 2k(2k − 1)n2k−1

for
n
∑ log i = log n! .
i=1

The series begins 1/(12n) − 1/(360n3 ) + 1/(1260n5 ) + · · · . Exponentiating term-


by-term (using the fact that, if log X = logY + o(n−k ) then X = Y (1 + o(n−k ))),
we obtain  
√ nn+1/2 1 1
n! ∼ 2π 1+ + +··· .
en 12n 288n2
Note in passing that, for fixed n, this asymptotic series is divergent (see our
earlier estimate for Bk ).

Example: The harmonic series Applying Euler–Maclaurin to f (x) = 1/x, we


get
n
1 B
∑ i ∼ log n + γ − ∑ knkk ,
i=1

where the sum begins 1/(2n)−1/(12n2 )+1/(120n4 )+· · · . Here γ is Euler’s con-
stant, a somewhat mysterious constant with value approximately 0.5772157 . . . .
Again the series is divergent for fixed n.

12.4 Poly-Bernoulli numbers


This is only a very brief introduction to these numbers, which were introduced
by Masanobu Kaneko in 1997.
Kaneko gave the following definitions. Let

zm
Lik (z) = ∑ k
,
m=1 m

20:15:10, subject to the Cambridge


.013
206 Further topics

and let

Lik (1 − e−x ) (k) x
n

1 − e−x
= ∑ n! .
B n
n=0
(k)
The numbers Bn are the poly-Bernoulli numbers of order k.
Kaneko gave a couple of nice formulae for the poly-Bernoulli numbers of neg-
ative order, of which one is relevant here:
Theorem 12.11 (Kaneko)
min(n,k)
(−k)
Bn = ∑ ( j!)2 S(n + 1, j + 1)S(k + 1, j + 1).
j=0
This formula has the (entirely non-obvious) corollary that these numbers have
(−k) (−n)
a symmetry property: Bn = Bk for all non-negative integers n and k.
Now we have a somewhat unexpected connection with a counting problem:
the poly-Bernoulli numbers of negative order evaluate the chromatic polynomial
of complete bipartite graphs at −1 (see Theorem 9.3). This application is taken
from an unpublished paper of the author with Celia Glass and Robert Schumacher.
(−n2 )
Theorem 12.12 The number of acyclic orientations of Kn1 ,n2 is Bn1 .

Proof We verify Kaneko’s formula above.


Let A and B be the two bipartite blocks; we will imagine their vertices as
coloured amber and blue respectively. Now any acyclic orientation of the graph
can be obtained by ordering the vertices and making the edges point from smaller
to greater. If we do this, we will have alternating amber and blue intervals; the
ordering within each interval is irrelevant, but the ordering of the intervals them-
selves matters.
In terms of structure, call two points a1 , a2 ∈ A equivalent if the orientations
of {a1 , b} and {a2 , b} are the same for all b ∈ B. Points are equivalent if and
only if they are not separated by a point of B in any ordering giving rise to the
acyclic orientation. Similarly for B. This gives us the intervals, and clearly they
are interleaved.
To get around the problem that the first point in the ordering might be in either
A or B, and similarly for the last point, we use the following trick. Add a dummy
amber point a0 to A and a dummy blue point b0 to B. Now partition A ∪ {a0 }
and B ∪ {b0 } into the same number, say k, of parts. This can be done in S(n1 +
1, k)S(n2 + 1, k) ways. Now we order the parts so that
• the part containing a0 is first;
• the colours alternate;
• the part containing b0 is last.
This can be done in (k − 1)!2 ways. Finally, delete the dummy points.
Summing over k gives the total number claimed.

20:15:10, subject to the Cambridge


.013
12.5 Hayman’s Theorem 207

12.5 Hayman’s Theorem


A number of non-trivial analytic results have been proved for the purpose of ob-
taining asymptotic formulae for combinatorially defined numbers. These include
theorems of Hayman, Meir and Moon, and Bender. I will not give proofs of these
theorems, but treat them as black boxes and give examples to illustrate their use.
Hayman’s Theorem is an important result on the asymptotic behaviour of the
coefficients of certain entire functions (i.e., functions which are analytic in the
entire complex plane).
The theorem applies only to a special class of such functions, the so-called H-
admissible or Hayman-admissible functions. Rather than attempt to give a general
definition of this class, I will state a theorem of Hayman showing that it is closed
under certain operations, which suffice to show that any function in which we are
interested is H-admissible. See Hayman’s paper in the bibliography, or Odlyzko’s
survey.

Theorem 12.13 (a) If f is H-admissible and p is a polynomial with real coeffi-


cients, then f + p is H-admissible.

(b) If p is a non-constant polynomial with real coefficients such that exp(p(x)) =


∑ qn xn with qn > 0 for n ≥ n0 , then exp(p(x)) is H-admissible.
(c) If p is a non-constant real polynomial with leading term positive, and f is
H-admissible, then p( f (x)) is H-admissible.

(d) If f and g are H-admissible, then exp( f (x)) and f (x)g(x) are H-admissible.

Corollary 12.14 The exponential function is H-admissible.

Now Hayman’s Theorem is the following.

Theorem 12.15 Let f (x) = ∑n≥0 fn xn be H-admissible. Let a(x) = x f  (x)/ f (x)
and b(x) = xa (x), and let rn be the smallest positive root of the equation a(x) = n.
Then
1
fn ∼ √ f (rn )rn−n .
2πbn

Example: Stirling’s formula Take f (x) = exp(x) (we have noted that this func-
tion is admissible), so that fn = 1/n!. Now a(x) = x = b(x), and rn = n. Thus
1 1
=√ en n−n ,
n! 2πn
which is just Stirling’s formula the other way up!

20:15:10, subject to the Cambridge


.013
208 Further topics

Example: Bell numbers Let f (x) = exp(exp(x) − 1), so that fn = B(n)/n!,


where B(n) is the number of partitions of an n-set. This function is H-admissible.
Now a(x) = xex and b(x) = (x + x2 )ex .
The number rn is the smallest positive solution of xex = n. In terms of this, we
have
B(n) 1
∼ en/rn −1 rn−n ,
n! 2πn(1 + rn )
and so by Stirling’s formula,
 n
1 n
B(n) ∼ √ en/rn −1 .
1 + rn ern
Of course, this is not much use without a good estimate for rn . However, for
n = 100, the right-hand side is within 0.4% of B(100).
In fact, it can be shown that
 
log log n
rn = log n − log log n + O ,
log n
from which it can be deduced that
log B(n) ∼ n log n − n log log n − n.

12.6 Theorems of Meir and Moon and of Bender


The theorem of Meir and Moon (which has been generalised by Bender) gives
the asymptotics of the coefficients of a power series defined by Lagrange inversion.
Typically we have to find the inverse function of f . Setting φ (x) = x/ f (x), the
inverse function g is given by the functional equation g(y) = yφ (g(y)). Replacing
y by x and g by f , the theorem is as follows.
Theorem 12.16 Let y = f (x) = ∑ fn xn satisfy the equation
y = xΦ(y),
where Φ is analytic in some neighbourhood of the origin, with Φ(x) = ∑ an xn .
Suppose that the following conditions hold:
(a) a0 = 1 and an ≥ 0 for n ≥ 0.
(b) gcd{n : an > 0} = 1.
(c) There is a positive real number α, inside the circle of convergence of Φ,
satisfying
αΦ (α) = Φ(α).
Then
fn ∼ Cn−3/2 β n ,

where C = Φ(α)/2πΦ (α) and β = Φ(α)/α = Φ (α).

20:15:10, subject to the Cambridge


.013
12.6 Theorems of Meir and Moon and of Bender 209

Example: Rooted trees The generating function y = T ∗ (x) for labelled rooted
trees satisfies
y = x exp(y).

The exponential function converges everywhere, and the solution of α exp(α) =


exp(α) is clearly α = 1, so that β = e and C = 1/2π. Hence the number Tn∗ of
labelled rooted trees on n vertices satisfies

Tn∗ 1
= √ n−3/2 en .
n! 2π

Since Tn∗ = nn−1 by Cayley’s Theorem, we obtain

√ nn+1/2
n! ∼ 2π ,
en

in other words, Stirling’s formula.


Bender’s Theorem generalises the theorem of Meir and Moon by treating a very
much more general class of implicitly defined functions. Thus, y will be defined
as a function of x by the equation F(x, y) = 0. In the case of Meir and Moon, we
have F(x, y) = y − xΦ(y).

Theorem 12.17 Suppose that the function y = f (x) is defined implicitly by the
equation F(x, y) = 0, and let f (x) = ∑n≥0 fn xn . Suppose that there exist real num-
bers ξ and η such that

(a) F is analytic in a neighbourhood of (ξ , η);

(b) F(ξ , η) = 0 and Fy (ξ , η) = 0, but Fx (ξ , η) = 0 and Fyy (ξ , η) = 0 (subscripts


denote partial derivatives);

(c) the only solution of F(x, y) = Fy (x, y) = 0 with |x| ≤ ξ and |y| ≤ η is (x, y) =
(ξ , η).

Then
fn ∼ Cn−3/2 ξ −n ,

where $
ξ Fx (ξ , η)
C= .
2πFyy (ξ , η)

20:15:10, subject to the Cambridge


.013
210 Further topics

Example: Wedderburn–Etherington numbers Recall from Chapter 4 that the


generating function for these numbers satisfies
1
f (x) = x + ( f (x)2 + f (x2 )).
2
Here we have F(x, y) = y−x−(y2 +g(x))/2, where g(x) = f (x2 ), which we regard
as a ‘known’ function (using a truncation of its Taylor series to approximate it).
The equation Fy (ξ , η) = 0 gives us that η = 1; the equation F(ξ , η) = 0 then
gives g(ξ ) = 1 − 2ξ . This equation can be solved numerically (it is the same one
we solved in Chapter 4 to find the radius of convergence of f (x)). The remaining
conditions of the theorem can then be verified.
We obtain ξ −1 = 2.483 . . ., and hence
fn ∼ Cn−3/2 ξ −n ,
where C can also be found numerically if desired.
Remark This asymptotic formula illustrates a common occurrence both in enu-
merative combinatorics and in related areas such as statistical mechanics. We have
an asymptotic formula of the shape cn−r α n , where the exponent r is known pre-
cisely, but the exponential constant α (which has a much greater effect on the
asymptotics) is known only approximately.

12.7 Exercises
12.1 (a) Let f be a formal power series with constant term zero and coefficient
of x equal to 1. Suppose that all coefficients of f are integers. Show that the
unique formal power series g such that g( f (x)) = x has all its coefficients
integers.
(b) Show that the preceding statement holds if we replace the integers by an
arbitrary commutative ring with identity.
(c) Let R be a commutative ring with identity, and let N (R) denote the set of
formal power series ∑ an xn in R[[x]] with a0 = 0 and a1 = 1. Show that
N (R), with the operation of composition, is a group.
(d) Let R = Z. Find the inverse of x − x2 in N (R).
Remark The group N (R) is known to group theorists as the Nottingham group
over R.
12.2 Let sn be the number of involutions in Sn (permutations of {1, . . . , n} whose
square is the identity). We showed in Chapter 4 that
 
sn x n x2
∑ = exp x +
2
.
n≥0 n!

20:15:10, subject to the Cambridge


.013
12.7 Exercises 211

Use Hayman’s Theorem to show that

1  n n/2 √n−1/4
sn ∼ √ e .
2 e

12.3 Let W (x) be the generating function for the Catalan numbers, shifted back
one place:
W (x) = ∑ Cn+1 xn .
n≥0

Put W (x) = 1 + u(x). Show that

u(x) = x(1 + u(x))2 .

Apply Lagrange inversion to show that


 
1 2n
Cn+1 =
n n−1

for n ≥ 1. Reconcile this with the formula for Catalan numbers found in Chapter 4.

20:15:10, subject to the Cambridge


.013
CHAPTER 13

Bibliography and further directions

In this chapter I list a few books, papers and websites which may be useful if you
would like to follow up some of the things I have discussed.

13.1 The On-line Encyclopedia of Integer Sequences


The On-line Encyclopedia of Integer Sequences, available at the URL
https://oeis.org/,
is an essential resource for anyone doing research in combinatorics. For example,
suppose you are trying to count the number of arrangements of n zeros and ones
around a circle in which no two ones are consecutive (Exercise 2.8(b)). You might
reasonably assume that n ≥ 3, and calculate that for n = 3, 4, 5 there are respec-
tively 4, 7 and 11 such arrangements. If you type these three numbers into the
Encyclopedia, you find many matches (I found 521 when I tried it on 24 October
2016), but near the top (indeed, at the top when I did the experiment) is an entry
for the Lucas numbers. The entry gives a recurrence relation (identical to that for
Fibonacci numbers), congruences modulo primes, representation in terms of hy-
perbolic functions, and much more, including (most importantly) ten references to
the literature, short programs for computing the numbers in various programming
languages, further web links, open problems, and cross-references to related se-
quences. Now you can either prove directly that the numbers you are interested
in satisfy the Fibonacci recurrence (and hence coincide with the Lucas numbers),
or check in the literature for further information which will help you make the
identification.
On the Encyclopedia’s website, you will find different ways of viewing the se-
quence and information about it, pointers to interesting or mysterious sequences,

212
20:14:47, subject to the Cambridge
.014
13.2 Books on combinatorial enumeration 213

a formula for the terms of the sequence or its generating function if known, and
several articles by the editor Neil Sloane and others describing uses of the Ency-
clopedia in research. I have used it myself on a number of occasions.

13.2 Books on combinatorial enumeration


Here are the books referred to in the text.

F. Bergeron, G. Labelle and P. Leroux, Combinatorial Species and Tree-like


Structures, Encyclopedia of Mathematics and its Applications 67, Cam-
bridge University Press, Cambridge, 1998.
This is the standard reference on species.
P. J. Cameron, Oligomorphic Permutation Groups, London Math. Soc. Lecture
Notes 152, Cambridge University Press, Cambridge, 1990.
The book that introduced oligomorphic permutation groups, and describes
their links with combinatorics and logic as well as group theory.
P. J. Cameron, Permutation Groups, London Math. Soc. Student Texts 45, Cam-
bridge University Press, Cambridge, 1999.
Background material for Chapters 7 and 10.
J. H. Conway and R. K. Guy, The Book of Numbers, Springer-Verlag, New York,
1996.
I followed the treatment of Bernoulli numbers in this book, but there is much
else here to delight the combinatorial enumerator.
P. Flajolet and R. Sedgewick, Analytic Combinatorics, Cambridge University
Press, Cambridge, 2009.
This is the most comprehensive modern account of recent developments in
analytic methods for studying combinatorial sequences via generating func-
tions.
R. Fraı̈ssé, Theory of Relations, North-Holland, Amsterdam, 1986.
A wide-ranging account of relational structures, including material on ho-
mogeneous structures relevant to Chapter 10.
M. R. Garey and D. S. Johnson, Computers and Intractability: An Introduction
to the Theory of NP-completeness, W. H. Freeman, San Francisco, 1979.
The standard reference on computational complexity.
I. P. Goulden and D. M. Jackson, Combinatorial Enumeration, Wiley-Interscience,
New York, 1983.
A very complete account of much of the material covered in this book.

20:14:47, subject to the Cambridge


.014
214 Bibliography and further directions

Wilfrid Hodges, A Shorter Model Theory, Cambridge University Press, Cam-


bridge, 1997.
Includes a good discussion of countably (and uncountably) categorical the-
ories, alluded to under oligomorphic permutation groups in Chapter 10.
V. Kac and P. Cheung, Quantum Calculus, Springer, New York, 2002.
Learn more about the q-calculus and h-calculus in this very accessible ac-
count.
Sergey Kitaev, Patterns in permutations and words, Monographs in Theoretical
Computer Science, Springer-Verlag, 2011.
Permutation patterns were discussed in connection with Catalan numbers in
Chapter 4. This is a recent survey.
J. H. van Lint and R. M. Wilson, A Course in Combinatorics, Cambridge Univer-
sity Press, Cambridge, 2001.
A good introduction to many topics in combinatorics. In particular, it con-
tains an accessible account of Egoritsjev’s proof of the van der Waerden
conjecture.
I. G. Macdonald, Symmetric functions and Hall polynomials, Oxford University
Press, Oxford, 1999.
The theory of symmetric functions, diagrams and Young tableaux is at the
centre of a beautiful area of mathematics ranging from orthogonal polyno-
mials to representations of algebraic groups. This book was awarded the
American Mathematical Society’s Steele Prize for Mathematical Exposition
in 2009.
Marko Petkovsek, Herbert S. Wilf and Doron Zeilberger, A = B, A. K. Peters
Ltd., Wellesley, MA, 1996.
This book describes a remarkable advance in the automated proving of bi-
nomial coefficient identities and similar results. You should look at the web
page http://www.math.upenn.edu/~wilf/AeqB.html where the book is
free to download.
A. Slomson, An Introduction to Combinatorics, Chapman and Hall, London,
1991.
An introductory textbook, not restricted to enumerative combinatorics; I
have based my account of Stirling’s formula on Slomson’s.
R. P. Stanley, Enumerative Combinatorics (2 volumes), Cambridge University
Press, Cambridge, 2000, 2001.
Particularly strong and detailed on the algebraic aspects of enumerative com-
binatorics, including the Robinson–Shensted–Knuth algorithm and its impli-
cations.

20:14:47, subject to the Cambridge


.014
13.3 Papers cited in the text 215

Another important source is the two-volume Handbook of Combinatorics (ed.


R. L. Graham, M. Grötschel and L. Lovasz), North-Holland, Amsterdam, 1995.
This book covers all aspects of combinatorics, not just enumeration; but the 167-
page article on Asymptotic Enumeration Methods by Andrew Odlyzko is essen-
tially a monograph in its own right. There is also a very relevant article on Alge-
braic Enumeration by Ira M. Gessel and Richard P. Stanley.

13.3 Papers cited in the text


E. A. Bender, Asymptotic methods in enumeration, SIAM Review 16 (1974), 485–
515.
A. T. Benjamin, G. M. Levin, K. Mahlburg and J. J. Quinn, Random approaches
to Fibonacci identities, Amer. Math. Monthly 107 (2000), 511–516.
N. Boston, W. Dabrowski, T. Foguel, P. J. Gies, J. Leavitt, D. T. Ose and D. A.
Jackson, The proportion of fixed-point-free elements of a transitive permu-
tation group, Commun. Algebra 21 (1993), 3259–3275.
P. J. Cameron, Oligomorphic permutation groups, in Perspectives in Mathemat-
ical Sciences II (ed. N. S. Narasimha Sastry, T. S. S. R. K. Rao, Mohan
Delampady and B. Rajeev), World Scientific, Singapore, 2009, pp. 37–61.
P. J. Cameron and A. M. Cohen, On the number of fixed point free elements of a
permutation group, Discrete Math. 106/107 (1992), 135–138.
P. J. Cameron, D. Gewurz and F. Merola, Product action, Discrete Math. 308
(2008), 386–394.
P. J. Cameron, B. Jackson and J. D. Rudd, An orbital Tutte polynomial for graphs
and matroids, Discrete Math. 308 (2008), 920–930.
P. J. Cameron, T. Prellberg and D. Stark, Asymptotic enumeration of incidence
matrices, Journal of Physics: Conference Series 42 (2006), 59–70.
A. Dress and T. Müller, Decomposable functors and the exponential principle,
Advances in Mathematics 129 (1997), 188–221.
S. Eberhard, K. Ford and B. Green, Permutations fixing a k-set, https://arxiv.
org/abs/1507.04465
W. T. Gowers, The two cultures of mathematics, pp. 65–78 in Mathematics:
Frontiers and Perspectives (ed. V. Arnold, M. Atiyah, P. Lax and B. Mazur),
American Math. Soc., Providence, 1999.
L. J. Guibas and A. M. Odlyzko, String overlaps, pattern matching, and nontran-
sitive games, J. Combinatorial Theory (A) 30 (1981), 183–208.
W. K. Hayman, A generalization of Stirling’s formula, J. Reine Angew. Math.
196 (1956), 67–95.

20:14:47, subject to the Cambridge


.014
216 Bibliography and further directions

A. Joyal, Une theorie combinatoire des séries formelles, Advances in Math. 42


(1981), 1–82.
M. Kaneko, Poly-Bernoulli numbers, Journal de Théorie des Nombres de Bor-
deaux 9 (1997), 221–228.
A. Laradji and A. Umar, Combinatorial results for the symmetric inverse semi-
group, Semigroup Forum 75 (2007), 221–236.
R. Lewis and S. P. Norton, On a problem raised by P. J. Cameron, Discrete Math-
ematics 138 (1995), 315–318.
N. Linial and N. Nisan, Approximate inclusion-exclusion, Combinatorica 10
(1990), 349–365.
S. Majid, Free braided differential calculus, braided binomial theorem and the
braided exponential map, J. Math. Phys. 34 (1993), 4843–4856.
F. Merola, Orbits on n-tuples for infinite permutation groups, Europ. J. Combi-
natorics 22 (2001), 225–241.
Peter M. Neumann, A lemma that is not Burnside’s, The Mathematical Scientist
4 (1979), 133–141.
Maurice Pouzet, When is the orbit algebra of a group an integral domain? Proof
of a conjecture of P. J. Cameron, Theor. Inform. Appl. 42 (2008), 83–103.
A. D. Sokal, The multivariate Tutte polynomial (alias Potts model) for graphs
and matroids, in Surveys in Combinatorics 2005 (ed. B. S. Webb), London
Math. Soc. Lecture Notes, 327, Cambridge Univ. Press, Cambridge, 2005,
pp. 173–226.
R. P. Stanley, Acyclic orientations of graphs, Discrete Math. 5 (1973), 171–178.
H. S. Wilf, The ‘Snake Oil’ method for proving combinatorial identities, in Sur-
veys in Combinatorics (ed. J. Siemons), London Math. Soc. Lecture Note
Series 141, Cambridge University Press, Cambridge, 1989, pp. 208–217.
Doron Zeilberger, Automatic counting of tilings of skinny plane regions, in Sur-
veys in Combinatorics 2013 (ed. Simon R. Blackburn, Stefanie Gerke and
Mark Wildon), London Math. Soc. Lecture Note Series 409, Cambridge
University Press, Cambridge, 2013, pp. 363–378.

20:14:47, subject to the Cambridge


.014
Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Index
More Information

Index

abelian group, 142, 160 Bezembinder, T., 60


active form, 42 bijective proof, x, 57, 59, 61, 89
acyclic orientations, 158, 206 binary tree, 89
addition binomial coefficients, 4, 24, 29
of formal power series, 17 signed, 31
age, 179 binomial series, 24
alternating group, 43, 59, 104 Binomial Theorem, 4, 24, 30, 33, 59, 68
amalgamation property, 179 Birkhoff’s Theorem, 109
Appel, K., 158 Birkhoff, G. D., 156
approximate Inclusion–Exclusion, 155 blocks, 183
associate, 163 Boston, N., 215
asymptotic estimate, 2, 187 braided categories, 115
for Bell numbers, 208
for factorials, 5, 188, 205, 207 C-finite, 73
for involutions, 210 Cantor’s theorem, 181
for partition numbers, 6 Catalan numbers, 83, 210, 211
for Wedderburn–Etherington categories, 178
numbers, 84, 210 braided, 115
asymptotic series, 188 Cauchy–Binet formula, 167
for factorials, 205 Cauchy–Schwarz inequality, 10
Atiyah, M., x Cayley’s Theorem, 168, 170, 176
Axiom of Choice, 145 Central Limit Theorem, 37, 58
characteristic polynomial, 66
ballot numbers, 93 Cheung, P., 214
Bell numbers, 6, 38, 80, 208 chromatic polynomial, 157
Bender’s Theorem, 209 clinical trials, 61
Bender, E. A., 209, 215 Cohen, A. M., 215
Benjamin, A. T., 215 colouring, proper, 157
Bergeron, F., 178, 213 commutation relation, 119
Bernoulli numbers, 125, 200 commutative ring with identity, 17
Bernoulli polynomials, 203 complete symmetric functions, 126

217

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Index
More Information

218 Index

composition, 27, 36, 55, 64 Euler’s constant, 205


computational complexity, 7 Euler’s function, 150, 153, 173
conjugacy, 44 Euler’s Pentagonal Numbers Theorem,
connected graphs, 181 77, 121
constant term, 16 Euler–Maclaurin sum formula, 125, 204
contraction, 157 Evans, T., xii
convolution, 17 exponent laws, 24
Conway, J. H., 28, 200, 213 exponential generating function, 2, 21
correlation polynomial, 69, 102 exponential principle, 80, 176
countably categorical, 181 exponential series, 23
critical set, 108
cycle, 42 Faà di Bruno’s rule, 49, 61
cycle decomposition, 43, 44, 46 factorial, 4, 44
cycle index, 46, 136, 153 Falikman, D. I., 110
of species, 172 Faulhaber’s formula, 201
Cycle Index Theorem, 136 Fermat’s Little Theorem, 57
cyclic group, 153 Ferrers diagram, 94
Fibonacci, 12
D-finite, 77 Fibonacci numbers, 13, 68, 180, 185
Dabrowski, W., 215 figure-counting series, 135
deletion, 157 Flajolet, P., x, 213
deletion-contraction formula, 157 flow, 160
derangements, 5, 77, 140, 143, 184 nowhere-zero, 161
determinant, 106 Foguel, T., 215
differentiation forbidden subwords, 69, 102
of formal power series, 19 Ford, K., 215
direct product, 147, 181 formal Laurent series, 196
dissection of polygon, 91 formal power series, 16
domino tiling, 75 formula, 1
doubly stochastic matrix, 108 Four Colour Conjecture, 156
Dress, A., 215 fractal, 56
Dyck path, 92 Fraı̈ssé class, 180
Fraı̈ssé’s Theorem, 180
e.g.f., 21 Fraı̈ssé, R., 179, 213
Eberhard, S., 215 free product, 103
echelon form, 126 Frobenius numbers, 82
reduced, 126 function-counting series, 136
Egorychev, G. P., 110 functor, 178
Egorychev–Falikman Theorem, 110
elementary symmetric functions, 120 Galois fields, 115, 127
Engeler, E., 181 Garey, M. R., 7, 213
entire functions, 207 Gauss, C. F., x
Euclid’s algorithm, 67 Gaussian coefficient, 117

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Index
More Information

Index 219

Gaussian elimination, 106 Hall’s Theorem, 107


general linear group, 121 harmonic series, 205
generating function, 1, 20 Hayman’s Theorem, 207
exponential, 2 Hayman, W. K., 207, 215
for Bell numbers, 41, 81 Hayman-admissible functions, 207
for Bernoulli numbers, 200 Hilbert series, 181
for binomial coefficients, 31 homomorphism, 103
for Catalan numbers, 83 hook length, 95
for central binomial coefficients, 60 horizontally convex polyomino, 71
for involutions, 80
for number of involutions, 103, 104 incidence algebra, 146
for partition numbers, 42 incidence matrix
for Stirling numbers, 45, 134 of graph, 164
ordinary, 2 Inclusion–Exclusion, 114, 141
generation, 2 approximate, 155
random, 2 indicator monomial, 164
Gessel, I. M., 215 infinite product
Gewurz, D., 215 of formal power series, 18
Gies, P. J., 215 integral domain, 163
Gilbey, J., 154 invariant factors, 163
Glass, C. A., 206 inverse semigroup, 99, 101
golden ratio, 14 involutions, 79, 210
Goulden, I. P., 213 irreducible polynomials, 122, 150
Gowers, W. T., x, 215
Jackson, B., 215
graded algebra, 181
Jackson, D. A., 215
Graham, R. L., 215 Jackson, D. M., 213
graphs, 138, 181 Johnson, D. S., 7, 213
Gray code, 9 Joyal, A., 170, 171, 216
Green, B., 215
Grötschel, M., 215 Kac, V., 214
group, 132 Kaneko, M., 205, 216
alternating, 43 Karamata–Knuth notation, 29, 38, 45
cyclic, 153 Kimberling, C., 28
symmetric, 42, 46, 137 Kirchhoff, G, 166
group action, 132
Guibas, L. J., 69, 215 l’Hôpital’s rule, 114
Guy, R. K., 200, 213 Labelle, G., 178, 213
labelled, 137
H-admissible functions, 207 Lagrange inversion, 195, 198, 208
h-calculus, 125 Lah numbers, 47, 60, 184
Haken, W., 158 Laplacian matrix, 166
Hall’s condition, 107 Laradji, A., 216

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Index
More Information

220 Index

Latin rectangle, 111 Multinomial Theorem, 59


Latin square, 110 multiplication
lattice path, 115, 116 of formal power series, 17
leaf, 170 multiplicative functions, 154
Leavitt, J., 215 multivariate generating function, 21
Leibniz’s rule, 48
Leroux, P., 178, 213 National Lottery, 8
Levin, G. M., 215 necklaces, 139, 154
Lewis, R., 61, 216 Neumann, P. M., 216
lexicographic order, 4 Nisan, N., 155, 216
lim sup, 190 Norton, S., 61, 216
Linial, N., 155, 216 Nottingham group, 210
Lint, J. H. van, 214 nowhere-zero flow, 161
logarithmic series, 25 nowhere-zero tension, 161
Lovász, L., 215 o.g.f., 21
Lucas numbers, 212 Odlyzko, A. M., 69, 207, 215
Lucas’ Theorem, 57 odometer principle, 3
oligomorphic permutation group, 178
Maassen, H., 60
On-line Encyclopedia of Integer
Macdonald, I. G., 214
Sequences, 16, 212
Macpherson, H. D., 180
Orbit-counting Lemma, 133, 162
Mahlburg, K, 215
orbital Tutte polynomial, 163, 165
Majid, S., 115, 216
orbits, 133
Mantel’s Theorem, 9 order
matrix partial, 144
invertible, 121 total, 144
triangular, 31 ordered by divisibility, 145, 146
Matrix-Tree Theorem, 167, 170 ordered by inclusion, 145, 146
matroid, 159 ordinary generating function, 2, 21
McKay, B. D., 110 Ose, D. T., 215
Meir, A., 208
Meir–Moon theorem, 208 parity, 43
Merola, F., 180, 215, 216 partial fractions, 14
Möbius function, 147 partial order, 144
classical, 149 partially ordered set, 145
Möbius inversion, 147 partition numbers, 6, 38, 41
Mohammed-Noori, M., xii partitions, 6, 37
Montmort, P. R. de, 5 Pascal’s triangle, 4, 31, 37
Moon, J. W., 208 passive form, 42
morphisms, 178 pattern avoidance, 97
Müller, T. W., xii, 71, 215 permanent, 106
multinomial coefficient, 58, 155 permutation group, 132

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Index
More Information

Index 221

oligomorphic, 178, 213 for Catalan numbers, 83


primitive, 180 for compositions, 64
permutation matrix, 109 for derangements, 77
permutation pattern, 97 for Fibonacci numbers, 68
permutations, 4, 42 for Gaussian coefficients, 118
Petkovsek, M., 214 for involutions, 80
Platonic solids, 139 for number of involutions, 103
poly-Bernoulli numbers, 206 for partition numbers, 77
polynomial, 17 for Stirling numbers, 38, 39, 45
polynomials for Wedderburn–Etherington
irreducible, 122 numbers, 84
polyomino, 71 linear with constant coefficients, 66
horizongally convex, 71 reduced echelon form, 126
poset, 145 relational structure, 179
Pouzet, M., 181, 216 residue, 197
Prellberg, T., xii Residue Composition Theorem, 197
preorders, 60 ring of formal power series, 18
primitive permutation group, 180 Robinson–Schensted–Knuth algorithm,
principal ideal domain, 163 96
Principle of Inclusion and Exclusion, 141 Rolle’s Theorem, 53
probability generating function, 46 rooted plane trees, 90
probability of connectedness, 184, 185 rooted trees, 209
problème des ménages, 113, 143, 153 rooting of species, 176
product of species, 174 rotations of the cube, 133
projective space, 145 RSK algorithm, 96, 97, 214
Prüfer code, 171 Rudd, J. D., 215
q-binomial coefficient, 117 Ryll-Nardzewski, C., 181
q-Binomial Theorem, 119, 125, 149
sampling, 34
q-calculus, 115
scalar multiplication
q-factorial, 117
of formal power series, 17
q-integer, 116
Schumacher, R. U., 206
quantum calculus, 115, 125
Screaming Toes, 154
Quinn, J. J., 215
SDR, 107
rabbits, 12 Sedgewick, R., x, 213
radius of convergence, 22 self-avoiding walk, 194
random generation, 2 sign, 43
rank, 160 signed binomial coefficients, 31
recurrence relation, 1, 64 Slomson, A., 190, 214
for Bell numbers, 39, 80 Smith normal form, 163
for Bernoulli numbers, 200 snake oil method, 102
for binomial coefficients, 30 Soares, M., 27

© in this web service Cambridge University Press www.cambridge.org


Cambridge University Press
978-1-108-41736-5 — Notes on Counting: An Introduction to Enumerative Combinatorics
Peter J. Cameron
Index
More Information

222 Index

Sokal, A. D., 159, 216 totally unimodular, 166


spanning forest, 160 transfer matrix method, 76
spanning subgraph, 160 transposition, 42
spanning tree, 160, 170 tree, 170
species, 171, 177 binary, 89
of circular orders, 173 labelled, 170
of permutations, 174 rooted plane, 90
of rooted trees, 176, 177 spanning, 170
of sets, 173 triangular matrix, 31
of subsets, 185 Turing machine, 7
of total orders, 173 Tutte polynomial, 160, 170
Spiga, P., xii, 127 Tutte, W. T., 159
stabiliser, 181
Umar, A., xii, 101, 216
Stanley, R. P., x, 158, 214–216
unit, 163
Stark, D., xii
unlabelled, 137
Stirling numbers, 38, 44, 178, 184
of species, 184 van der Waerden conjecture, 110
unsigned, 44, 184 Vandermonde convolution, 32
Stirling’s formula, 5, 7, 58, 188, 205, Virahanka, 13
207
subadditive, 192 Wallis’ product formula, 190
submultiplicative, 193, 194 Wanless, I. M., 110
subsets, 3, 29 Wedderburn–Etherington numbers, 84,
substitution 210
of formal power series, 18 weights, 181
substitution of species, 174 Whitehead, J. H. C., x
substitutions, 42 Whitney, H., 159
superadditive, 194 Wilf equivalence, 97
supermultiplicative, 194 Wilf, H. S., 102, 214, 216
surjections, 142 Wilson, R. M., 214
Svenonius, L., 181 Wilson, W., xii
symmetric functions wreath product, 181
complete, 126 Young diagram, 94
elementary, 120
symmetric group, 5, 42, 46, 82, 137 Zeilberger, D., 73, 214
system of distinct representatives, 107 Zermelo–Fraenkel axioms for set theory,
145
tableau, 93 zeta function, 146
semi-standard, 99 Zhu’s triangle, 31
tension, 161
nowhere-zero, 161
total order, 144

© in this web service Cambridge University Press www.cambridge.org

You might also like