PART TWO
Analytic
Combinatorics
EGFs
http://ac.cs.princeton.edu
A. SYMBOLIC METHOD
1. OGFs
■f 2. EGFs
3. MGFs
B. COMPLEX ASYMPTOTICS
specification
SYMBOLIC METHOD
5. Applications of R&M
6. Singularity Analysis
7. Applications of SA
8. Saddle point
Analytic
Combinatorics
GF
equation
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
• Labelled trees
• Mappings
http://ac.cs.princeton.edu
II.2a.EGFs.Basics
y 3 = 2
A. (/V-l)!
X 4 = 1 1
Def. A set of N atoms is said to be labelled if they can be distinguished from one
another.
Wlog, we use labels 1 through N to refer to them.
object name
a£A
aeA
r N
N> 0
N\
A. Am = N\[z n ]A(z)
With the symbolic method, we specify the class and at the same time characterize
the EGF
Ua= 1
U N = 1 e z
N>0
N\
e
Pi = 1
©
©
(TV
)© ©
(T)(
)© ©
@@ @(
)© ©
©® ©(
)© ©
P 2 = 2 © (
)© ©
©
® (
)® ©
Pb
6 ©
T
T
P 4 = 24
counting sequence
Pn = N\
N>0
N\z n
Nl
E z
N>0
ECF
1 - Z
" 1 -Z
10
1 -z
N> 1
(N — 1 )\z N
N!
N> 1
111
1 -Z
y 4 = 6
Def. Given two labelled combinatorial classes A and B, their labelled product A*B
is a set of
ordered pairs of copies of objects, one from A and one from B, relabelled in all
consistent ways.
12
Z+Z+Z+Z
Combinatorial construction for permutations: P= Z N
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
• Basics
• Labelled trees
• Mappings
http://ac.cs.princeton.edu
II.2a.EGFs.Basics
ANALYTIC COMBINATORICS
Analytic
Combinatorics
http://ac.cs.princeton.edu
PART TWO
• Labelled trees
• Mappings
II.2b.EGFs.Symbolic
construction
notation
semantics
disjoint union
A + B
labelled product
A* B
sequence
SEQ(A)
set
SET( A)
cycle
CYC (A)
A and B are
combinatorial classes
of labelled objects
16
Theorem. Let A and B be combinatorial classes of labelled objects with EGFs A(z )
and B(z). Then
construction
notation
semantics
ECF
disjoint union
A + B
A(z) + B(z)
labelled product
A* B
A(z)B(z)
SEQk(A) or A k
A(z) k
sequence
SEQ(A)
1 - A(z)
set
SETk(A)
A(z) k /k\
SET (A)
e A(z)
CYCk(A)
A(z) k /k
cycle
CYC (A)
In ’
1 -A( z)
17
In-class exercise
A(z) = lo|y = T2 = 5 ( z ) c ( z ) /
18
The symbolic method for labelled classes: basic constructions
urns
cycles permutations
EGF
U(z ) = e z
Y(z) = In ——
V ; 1 -z
counting
sequence
U N = 1
Y n = (N- 1)! P n = N!
construction
notation
EGF
disjoint
union
A + B
A(z) + B(z)
labelled
product
Air B
A( z )B(z)
SEQk (A )
Mzf
sequence
SEQ ( A )
1 -A(z)
set
SET* (A )
A(z) k /k\
SET(A)
e A(z)
CYCk (A )
A(z) k /k
cycle
CYC (A)
ln l -«Z)
19
Proofs of transfers
A + B
A(z) + B(z)
A* B
7 eAxB
aceA
=mm
20
Proofs of transfers
Z N Z N Z N
A(z) k = ^{#/c-sequences of size N} — = ^ cycles of size N} — = ^ ^ ! {#^' sets of
size N} —
A( 7 )k 7 N A(7) k 7 N
class
construction
EGF
k-sequence
SEQ k (A )
A(z) k
sequence
k-cycle
cycle
CYCki A )
1 + /\(z)+/\(z) 2 + /\(z) 3 + .
, . ^( z ) . ^( z ) 2 . A (z) 3 ,
"" 1 -*00
-In 1
1+ 1 + 2 + 3 +
1 -A(z)
k-set
SET k (A )
k\
set
, . >U Z ) , ^( z ) 2 , ^( z ) 3
1! 2! 3!
CD
II
21
Fundamental constructs
•elementary or trivial
•confirm intuition
Compound constructs
• many possibilities
•classical combinatorial objects
•expose underlying structure
Variations
•unlimited possibilities
• not easily analyzed otherwise
22
A combinatorial bijection
Standard representation
23
Enumerating permutations
Construction
EGF equation
II
Counting sequence
P N = N\[z n ]P(z) = N\
Construction
EGF equation
Counting sequence
= N![z n ]P*(z) = N!
24
Derangements
A group of N graduating seniors each throw their hats in the air akroom.
and each catch a random hat.
Q. What is the probability that nobody gets their own hat back ?
25
Enumerating derangements
Construction
EGF equation
Counting sequence
p*
P*(z)
p*
' N
z 7 1 -z
n*
Construction
EGF equation
D(z)
Expansion [ zN ]D( z ) =
D
N\
0<k<N
= exp (in - - z) = —
(—1 ) k 1
k\
26
Derangements
Q. What is the probability that nobody gets their own hat back ?
A. -= 0.36788
e
27
Construction
OGF equation
Z M +1 , Z M+2
D m (z) = e M +i + M + 2
1 -z
Construction
l = SET(CYQ a (Z))
OGF equation
l(z)
J+Z/2
28
Standard paradigm example: permutations
DERANGEMENTS
(no singleton cycle)
D = SET (CYC>i( Z ))
GENERALIZED DERANGEMENTS
(all cycle lengths > r)
e -z-J /2-...-Z/r
PERMUTATIONS
with M cycles
P m = SET m (CYC( Z ))
GENERALIZED INVOLUTIONS
(no cycle length > r)
PERMUTATIONS
with arbitrary
cycle length constraints
P n = SETq(CYC( Z ))
Pq ( z ) = ! k
Ml v 1
PERMUTATIONS
P= SET (CYC( Z ))
P(z) = e
In
= p 1 - z —
1
1 -z
INVOLUTIONS
(cycle lengths 1 or 2)
1= SET(CYCi, 2 (Z))
/(z) = e z+z2 / 2
29
ANALYTIC COMBINATORICS
Analytic
Combinatorics
http://ac.cs.princeton.edu
PART TWO
• Labelled trees
• Mappings
II.2b.EGFs.Symbolic
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
CAMBRIDGE
• Labelled trees
• Mappings
http://ac.cs.princeton.edu
II.2c.EGFs.Words
Correspondence
• For each / in the /<th set in the word set the /th char in the string to k.
• If the /th char in the string is k, put / into the /cth set in the word.
123456789
Typical string
2 4 2 4 5 5 1 2
Typical word
{7}{183}{}{24}{569
32
®©@®©©©©©
N= 9
1 2 3 4 5 «- M = 5
33
Words
Z M Z N
w^Wm N>0
Construction Wm = SEQm(SET(Z))
Atom
type
class
size
CF
labelled atom
Example {7}{183}{}{24}{569}
^ ® . C® ©
u © © 0 © © ©
34
Strings and Words (summary)
example
AC enumeration
prototypical
AofA application
STRING unlabelled
OGF
2 4 2 4 5 5 1 2 5
v ; 1 - Mz
Smn = M N
( 7 ) ® (b ® ®
® ®@ * @ ®®
{7}{183}{}{24}{569}
Wm = SEQm(SET(Z)
Wmn = M N
35
Variations on words: occupancy restrictions
9 7 1 3 4 8 6
Def. A coupon collector sequence is a word where every letter appears at least
once.
Birthday sequences (M-words with no duplicates)
Def. A birthday sequence is a word where no set has more than one element.
Example
{ 3 } { } { 5 } { 1 } { } { } { 4 } { 2 } { }
4 8 17 3
ECF B m (z) = ^2
w££>m
z\ w \
\w\\
E*
N> 0
r N
MN
N\
Construction B^ — SEQm(E + Z)
Counting sequence
N\[z n }B m (z) = N\
Ml
(M-N)l
M(M - 1)... (M - N + 1)
37
Z M Z N
w<eRm N> 0
Example ( M = 26 )
Example ( M = 5 )
2 4 2 4 5 5 1 5 3
{7}{13}{9}{24}{568}
38
Surjections
Def. An M-surjection is an M-word with no empty set.
EGF equation
Rm(z) = 0 Z - 1 )
Coefficients
MN
Construction
EGF equation
R(z)
1 - (e z - 1)
Coefficients
r N
N\[z N ]R(z)
N\
2(ln2) N + 1
R] = 1
1 1
1 2
2 1
R 2 = 3
1
2
13
(stay tuned)
39
M- SURJECTIONS
(M-word, all letters used)
Rm = SEQm(SET>o(Z)
R M (z) = (e z - 1) M
Generalized Birthday
MAX occupancy M-WORDS
(all letter counts < b)
= (E k < b z k /k\) M
SURJECTIONS
M-WORD
Wm = SEQm (SET(Z)
W M {z) = (e z ) M = e Mz
Wm = SEQm (SET>ti Z)
40
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
CAMBRIDGE
• Labelled trees
• Mappings
http://ac.cs.princeton.edu
II.2c.EGFs.Words
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
Philippe Flajolet and
Robert Sedgewick
CAMBRIDGE
• Labelled trees
• Mappings
http://ac.cs.princeton.edu
II.2d.EGFs.Trees
Labelled trees
Def. A labelled tree with N nodes is a tree whose nodes are labelled with the
integers 1 to N.
Q. Rooted?
Q. Binary?
43
Counting labelled trees
same trees
class
rooted ordered
unrooted unordered
increasing Cayley
increasing binary
reason
different trees
reason
order of
subtrees is
significant
order of
subtrees is not
significant
same labels on
middle node
root label
different labels
on middle node
different labels
on paths
order of
subtrees is
significant
44
Labelled trees
45
7 |/| yN
leL 11 ‘ N> o
Construction
EGF equation
Counting sequence
Ln = N\[z N ]L(z) = N![z N ]C(z) = N\Gm + - a/! ways to label a tree walk
_ 1 (2N-2\ _ (2N-2)!
'N\N- 1 ) (N — 1)!
Stirling's approximation
Cayley trees
T 4 = 64
4 ways to label
A. N N ~\ Proof. Stay tuned: Cayley trees are special cases of mappings (next
section)
47
48
Q. How many different binary trees of size N with increasing labels on every path ?
construction
boxed product
Example
notation
semantics
A = B D ★ C
50
Transfer theorem for the boxed product
construction
boxed product
notation
A= B a ★ C
semantics
ECF
A'(z) = B'(z)C(z)
Proof.
An —
= E
1 <k<N
(N — 1)!
- E
'N - 1
k- 1
B,
^C
k^N—k
N-k
1 <k<N
N>1
(N-1)!
E E
N>1 1 <k<N
Bi
^N-k N -1
B k C,
B, C
k> 1 N>0
(it - 1)! N!
N^n+/c-1 _
= E
/c>1 N>/c
B k
(it - 1)! (A/ — it)!
N-/c N-l
k-
’E
Qv AV
(it - 1)! ^ N!
fc>1 v ’ N> 0
^'(z)C(z)
51
In-class exercise
52
Increasing trees
Class Q, the class of Cayley trees whose labels increase on every path
Construction
Q = Z D ★ SET (Q)
EGF equation
Solution
Q( z ) - in 1 _ z
Counting sequence
Class B, the class of binary trees whose labels increase on every path
Construction
B=E+Z D +B+B
EGF equation
B'(z) = B(z) 2
Solution
e «=1-z
Counting sequence
B n = N\[z n ]B(z) = N\
53
A permutation is an increasing binary tree
Standard
representation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
54
BINARY
M-ARY
ROOTED ORDERED
L = Z ★ SEQ(L)
INCREASING CAYLEY
Q=Z n ★ SET(Q)
Q(z) = In
ROOTED UNORDERED
(Cayley)
C=Z ★ SET(C)
C(z) = ze C( ^
INCREASING BINARY
8= E+Z D + B+B
B(z)
^ -z
UNROOTED UNORDERED
55
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
CAMBRIDGE
• Labelled trees
• Mappings
http://ac.cs.princeton.edu
II.2d.EGFs.Trees
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
CAMBRIDGE
• Labelled trees
• Mappings
http://ac.cs.princeton.edu
II.2e.EGFs.Mappings
Mappings
Mi = 1
1 1
1 2
2 1
2 2
M 2 = 4
111 211 B 1 1
112 212 B 1 2
1 3 3 2 3 3 3 3 3
Mb = 27
A. N N
1111 2111
1112 2112
1113 2113
1114 2114
1121 2121
1122 2122
1123 2123
1124 2124
1131 2131
1132 2132
1133 2133
1134 2134
1141 2141
1142 2142
1143 2143
1144 2144
1211 2211
M 4 =
111 4111
112 4 112
113 4 113
114 4 114
12 1 4 12 1
1 2 2 4 1 2 2
1 2 3 4 1 2 3
1 2 4 4 1 2 4
13 1 4 13 1
1 3 2 4 1 3 2
1 3 3 4 1 3 3
1 3 4 4 1 3 4
14 1 4 14 1
1 4 2 4 1 4 2
1 4 3 4 1 4 3
1 4 4 4 1 4 4
2 11 4 2 11
3
3
64
Mappings
Def. A mapping is a function from the set of integers from 1 to N onto itself.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32 33 34 35 36 37
9 12 29 33 5 20 30 37 26 20 13 8 2 33 29 2 35 37 33 9 35 21 18 2 25 1 20 33 23 18
29 5 5 9 11 5 11
• N vertices, N edges
• Outdegrees: all 1
59
Mappings
(inn
12 3 to to to
113 ^
121 Q
122 V ft
133 A ^
2 2 3 O
3 2 3
n; ©0
2 11
212 /rCX
2 3 2 tob
311 y
3 3 1 A
3 3 2 ^
112 Q
1 3 1 Q
221 Y
2 3 3 O
3 13 f
322 n
ill K
Mb = 27
oaO
Lagrange inversion
w 1 -u 1 +z
n>i
n — 1
J(u)J ■
V(-1) n z" =
n> 1
1 +Z
Lagrange-Burmann inversion
n> 1
62
Class
Size
Construction T = Z + T x T
n —' 1 —i ( u \ n
Take M = N and k = N - 1 in
1 = + M ~ 1 ^ 7 k
(1 -z) M \ )
z = T(z) - T(z)‘
Extract coefficients
by Lagrange inversion
with f(u) = u - u 2
^)=
1 / 2N — 2\
N\N- 1 ) /
63
Cayley trees
Class
ECF
c ( z ) = 5Z
cec
Cn
N> 0
Example
6 2 11
Construction
C = Z*(SET(C))
EGF equation
C(z) = ze c( - z ' 1
Extract coefficients
by Lagrange inversion
with f(u) = u/e u
[z N }C(z) = l[u N -
”1 r N—
= N [U
C N = N![z n ]C
/ U \ N
n —i 1 _i / tr \ n
/-I
N\
/
64
N N y/n
V2N
112
13 1
2 2 1
2 3 3
3 13
3 2 2
2 11
2 12
2 3 2
3 11
3 3 1
3 3 2
1 1
2 2
3 3
2 3 1
3 12
y 3 = 17
65
Class
EGF
Construction
EGF equation
Extract coefficients
by Lagrange inversion
with f(u) = u/e u
and H(w) =ln (1/(1 -w))
Y(z)
= In
CYC(C)
1 - C(z)
n> 1
with f{ 0) = 0 and f ' (0) * 0 then, for any function H(u),
= E
0<k<N
N k ~ 1
= E
l</c<N
(N — k)\
1 <k<N
N\
N k (N-k)l
N n ~'Q(N) ~
vys
v'tn
66
Mappings
Class
Example
EGF
= E f
m£M
r\m
m |
1 Z N
T -E M ^ N!
N>0
1 2 13 1
Construction
M = SET(CYC(C))
EGF equation
Extract coefficients
by Lagrange-Burmann
with f(u) = u/e u
and H(u) = 1/(1 -w)
[z n ]M(z) =
C(z)
) = T
N [ J (1 -u) 2
N‘
V uN
= E ("-*)
k-^
0<k<N
k\
-C(z)
N k
T\
0<k<N
n> 1
- E
1 <k<N
N k ~ ]
W^y.
N N
XT
67
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
CAMBRIDGE
• Labelled trees
• Mappings
http://ac.cs.princeton.edu
II.2e.EGFs.Mappings
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
http://ac.cs.princeton.edu
• Labelled trees
• Mappings
• Summary
II. 2f.EGFs.Summary
Theorem. Let A and B be combinatorial classes of labelled objects with EGFs A(z )
and B(z). Then
construction
notation
semantics
ECF
disjoint union
A + B
A(z) + B(z)
labelled product
A* B
ordered pairs of copies of objects,
one from A and one from B
A(z)B( z)
SEQk(A) or A k
A(z) k
sequence
SEQ(A)
1 - A(z)
set
SETk(A)
A(z) k /k\
SET (A )
e A(z)
CYCk(A)
A(z) k /k
cycle
CYC (A)
In ’
1 — A(z)
boxed product
A= B a ★ C
A'( z) = B'(z)C(
class
construction
EGF
urns
U= SET(Z)
U(z) = e z
cycles
Y= CYC(Z)
Y( z ) - In l _ z
permutations
P = SEQ(Z)
derangements
D = SET (CYC>](Z))
D(z) = z
involutions
1 = SET (CYOAZ))
/(z) = e z+z2 / 2
words
Wm = SEQm(SET(Z))
W M (z) = e Mz
surjections
R = SEQ (SET>o(Z))
R(z) = 1
trees
L = Z+ SEQ(L)
L(z) - In 1 _ z
Cayley trees
C=Z+ SET(C)
C(z) = ze c ( z )
Q = Z° ★ SET ( Q )
Q'(z ) = e Q ^
mappings
M = SET (CYC(C))
71
Analytic
Combinatorics
Philippe Flajoletand
Robert Sedgewick
D(z)
1 -z
*(z) =
P(z) =
V(z) = In
1 -z
1 -z
M(z)
2 - e 2
2 /?!
/(z) = e
— p z +z 2 /2
l<r(z ) = e
L{z) = In
— p z +z 2 /2+...+z r /r
1
1
1 - C(z)
Wiw(z) = e
Mz
D>r(z) =
-z-z 2 /r
1 -Z
1 -Z
C(z) = ze c ^
72
specification
by Philippe Duchon, Philippe Flajolet, Guy Louchard and Gilles Schaefer (CPC 2004).
73
74
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
http://ac.cs.princeton.edu
• Labelled trees
• Mappings
• Summary
II. 2f.EGFs.Summary
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
http://ac.cs.princeton.edu
• Labelled trees
• Mappings
• Exercises
II.2g.EGFs.Exercises
Note 11.11
Ehrenfest model
Analytic
Combinatorics
chamber A contains them all. At any instant j, j ,..one ball is allowed to change
from one
chamber to the other. Let E„ 1 be the number of possible evolutions that lead to
chamber A
containing £ balls at instant n and E^{z) the corresponding EGF. Then
[Hint: the EGF enumerates mappings where each preimage has an even cardinality.] In
particular the probability that urn A is again full at time 2 n is
2 n N 2h
(N -2k) 2 ' 7 .
77
Note 11.31
Combinatorics of trigonometries
Analytic
Combinatorics
<1
78
Assignments
Analytic
Combinatorics
79
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
http://ac.cs.princeton.edu
2. Labelled structures and EGFs
• Labelled trees
• Mappings
• Exercises
II.2g.EGFs.Exercises
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
EGFs
http://ac.cs.princeton.edu