Anda di halaman 1dari 77

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

2. Labelled structures and

EGFs

http://ac.cs.princeton.edu

Analytic combinatorics overview

A. SYMBOLIC METHOD

1. OGFs
■f 2. EGFs
3. MGFs

B. COMPLEX ASYMPTOTICS

specification

SYMBOLIC METHOD

4. Rational & Meromorphic

5. Applications of R&M

6. Singularity Analysis

7. Applications of SA

8. Saddle point

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

GF

equation

Attention : Much of this lecture is a quick review of material in Analytic


Combinatorics, Part I

One consequence: it is a bit longer than usual

To: Students who took Analytic Combinatorics, Part I


Bored because you understand it all?

GREAT! Skip to the section on labelled trees and do the exercises.

To: Students starting with Analytic Combinatorics, Part II

Moving too fast? Want to see details and motivating applications?

No problem, watch Lectures 5, 7, and 9 in Part I.

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

2. Labelled structures and EGFs


• Basics

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

http://ac.cs.princeton.edu

II.2a.EGFs.Basics

Labelled combinatorial classes

have objects composed of N atoms, labelled with the integers 1 through N.


Ex. Different unlabelled objects

Ex. Different labelled objects

Labelled class example: cycles


Q. How many cycles of labelled atoms?

y 3 = 2

A. (/V-l)!

Labelled class example 2: pairs of cycles

Q. How many unordered pairs of labeled cycles of size N ?

X 4 = 1 1

stay tuned (next lecture)

Basic definitions (labelled classes)

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.

Def. A labelled combinatorial class is a set of combinatorial objects built from


labelled atoms
and an associated size function.

Def. The exponential generating function (EGF) associated


with a labelled class is the formal power series A(z) =

object name

a£A

^\a\ <—size function


class name

Fundamental (elementary) identity

aeA

r N

N> 0

N\

Q. How many objects of size N ?

A. Am = N\[z n ]A(z)

With the symbolic method, we specify the class and at the same time characterize
the EGF

Basic labelled class 1: urns

Def. An urn is a set of labelled atoms.

Ua= 1

counting sequence ECF

U N = 1 e z

N>0

N\
e

Basic labelled class 2: permutations

Def. A permutation is a sequence of labelled atoms.

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

Basic labelled class 3: cycles

Def. A cycle is a cyclic sequence of labelled atoms

counting sequence ECF

Y n = (N- 1)! In—!—

1 -z

N> 1

(N — 1 )\z N
N!

N> 1

111

1 -Z
y 4 = 6

Labelled ("star") product operation for labelled classes

is the analog to the Cartesian product for unlabelled classes

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

Labelled ("star") product operation for labelled classes

Ex. 2. A permutation of length N is a star product of N atoms

Z+Z+Z+Z
Combinatorial construction for permutations: P= Z N

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

2. Labelled structures and EGFs

• Basics

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

http://ac.cs.princeton.edu

II.2a.EGFs.Basics

ANALYTIC COMBINATORICS

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

http://ac.cs.princeton.edu

PART TWO

. Labelled structures and EGFs


• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

II.2b.EGFs.Symbolic

Combinatorial constructions for labelled classes

construction

notation

semantics

disjoint union

A + B

disjoint copies of objects from A and B

labelled product

A* B

ordered pairs of copies of objects,


one from A and one from B
relabelled in all consistent ways

sequence

SEQ(A)

sequences of objects from A

set

SET( A)

sets of objects from A

cycle

CYC (A)

cyclic sequences of objects from A

A and B are
combinatorial classes
of labelled objects

16

The symbolic method for labelled classes (transfer theorem)

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

disjoint copies of objects from A and 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

k- sequences of objects from A

A(z) k

sequence

SEQ(A)

sequences of objects from A

1 - A(z)

set
SETk(A)

/c-sets of objects from A

A(z) k /k\

SET (A)

sets of objects from A

e A(z)

CYCk(A)

/(-cycles of objects from A

A(z) k /k

cycle

CYC (A)

cycles of objects from A

In ’

1 -A( z)

17

In-class exercise

Check the star-product transfer theorem for a small example.

A(z) = lo|y = T2 = 5 ( z ) c ( z ) /

18
The symbolic method for labelled classes: basic constructions

urns

cycles permutations

construction U = SET(Z) Y=CYC(Z ) P=SEQ(Z)

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

are immediate from GF counting

A + B

A(z) + B(z)

A* B

7 eAxB

aceA

f\a\ 4- \/3\\ zl“l+l^l


V \ a \ ) (M + 1^1)!

=mm

20

Proofs of transfers

are immediate from CF counting

Z N Z N Z N
A(z) k = ^{#/c-sequences of size N} — = ^ cycles of size N} — = ^ ^ ! {#^' sets of
size N} —

n >o ' n>o ' N>0

A( 7 )k 7 N A(7) k 7 N

V cles of size N f JA. kl = X^ #/c ~ sets of size /syi

N> 0 ' ' iV>0

class

construction

EGF

k-sequence

SEQ k (A )

A(z) k

sequence

k-cycle

cycle

SEQ k (A ) = SEQo(A ) + SEQi (A ) + SEQ 2 (A ) + . . .

CYCki A )

CYC k (A ) = cyc 0 (a ) + crCiM) + crc 2 M) + ...

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

SETk(A ) = SETo(A ) + SETi (A ) + SET 2 (/\ ) + . . .

, . >U Z ) , ^( z ) 2 , ^( z ) 3

1! 2! 3!

CD

II

21

A standard paradigm for analytic combinatorics

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

[from AC Part I Lecture 5]

A permutation is a set of cycles.

Standard representation

Set of cycles representation

23

Enumerating permutations

[from AC Part I Lecture 5]

How many permutations of length N ?

Construction

P = SEQ(Z) “A permutation is a sequence of labelled atoms"

EGF equation

II

Counting sequence
P N = N\[z n ]P(z) = N\

How many sets of cycles of length N ?

Construction

p* _ SET (CYC (Z)) A P ermutation is a set of cycles"

EGF equation

P (z) exp (in 1 _ z ) - 1 _ z

Counting sequence

= N![z n ]P*(z) = N!

24

Derangements

[from AC Part I Lecture 5]

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 ?

Definition. A derangement is a permutation with no singleton cycles

25

Enumerating derangements

[from AC Part I Lecture 5]

How many permutations of length A/?

Construction
EGF equation
Counting sequence

p*

P*(z)

p*

' N

SET (CYC (Z))


exp (In--)

z 7 1 -z

N\[z N ]P* (z) = N\

n*

“A permutation is a set of cycles"

How many derangements of length N ?

Construction
EGF equation

o = 5£r(cyc >1 (z))

D(z)

lZ 2 /2+z 3 /3+z 4 /4+... _

“Derangements are permutations


with no singleton cycles"

Expansion [ zN ]D( z ) =
D

N\

0<k<N

= exp (in - - z) = —
(—1 ) k 1

k\

26

Derangements

[from AC Part I Lecture 5]

A group of N graduating seniors each throw their hats in the air


and each catch a random hat.

Q. What is the probability that nobody gets their own hat back ?

A. -= 0.36788
e

27

More variations on the theme

[from AC Part I Lectures 5 and 7]


How many permutations of length N have no cycles of length < M (generalized
derangements )?

Construction

OGF equation

D m = SET(CYC >m (Z))

“Derangements are permutations


whose cycle lengths are all > M "

Z M +1 , Z M+2

D m (z) = e M +i + M + 2

1 -z

How many permutations of length N have no cycles of length > 2 ( involutions )?

Construction

l = SET(CYQ a (Z))

“Involutions are permutations


whose cycle lengths are all 1 or 2"

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)

D> r = SET (CYC< r ( Z))

e -z-J /2-...-Z/r

PERMUTATIONS
with M cycles

P m = SET m (CYC( Z ))

GENERALIZED INVOLUTIONS
(no cycle length > r)

l< r = SET (CYC< r (Z))

l< r (z ) = e z+z2 /2+-+z f A

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

Philippe Flajolet and


Robert Sedgewick

http://ac.cs.princeton.edu

PART TWO

. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

II.2b.EGFs.Symbolic

ANALYTIC COMBINATORICS
PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

CAMBRIDGE

2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

http://ac.cs.princeton.edu

II.2c.EGFs.Words

Words and strings

A string is a sequence of N characters (from an M-char alphabet). There are M N


strings.

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.

Q. What is the difference between strings and words?

A word is a sequence of M labelled sets (having N objects in total). There are


M^words.

123456789
Typical string

2 4 2 4 5 5 1 2

Typical word

{7}{183}{}{24}{569

A. Only the point of view (sequence of characters vs. sets of indices).

32

Balls and urns

Throw N balls into M urns, one at a time.

®©@®©©©©©

N= 9

1 2 3 4 5 «- M = 5

Balls-and-urns sequences are equivalent to strings and words

Corresponding string 251511443

Corresponding word {356}{1}{9}{78}{24}

33
Words

Def. A word is a sequence of M urns holding N objects in total.


Q. How many words ?

“throw N balls into M urns”

Class Wm, the class of M -sequences of urns

Size | w\, the number of objects in w

Z M Z N

ECF W M (Z) = E ^7 = E Wmn W

w^Wm N>0

Construction Wm = SEQm(SET(Z))

OGF equation Wm(z) = (e z ) M = e Mz

Counting sequence N\[z n ]Wm(z) = M N

Atom

type

class

size

CF

labelled atom

Example {7}{183}{}{24}{569}

^ ® . C® ©

u © © 0 © © ©

34
Strings and Words (summary)

class type CF type

example

AC enumeration

prototypical
AofA application

S — SEQ(Zi + ... + Z/w)

STRING unlabelled

OGF

2 4 2 4 5 5 1 2 5

5(z) = - string search

v ; 1 - Mz

Smn = M N

( 7 ) ® (b ® ®

® ®@ * @ ®®
{7}{183}{}{24}{569}

Wm = SEQm(SET(Z)

WORD labelled EGF 242455125 W M (z) = e Mz hashing

Wmn = M N

35
Variations on words: occupancy restrictions

Def. A birthday sequence is a word where no letter appears twice.

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.

a string with no duplicate letters

Q. How many birthday sequences?

Example

{ 3 } { } { 5 } { 1 } { } { } { 4 } { 2 } { }
4 8 17 3

Class Bm, the class of birthday sequences

ECF B m (z) = ^2

w££>m

z\ w \

\w\\

E*

N> 0

r N

MN

N\

Construction B^ — SEQm(E + Z)

EGF equation Bm(z) = (1 + z)

Counting sequence

N\[z n }B m (z) = N\
Ml

(M-N)l

M(M - 1)... (M - N + 1)

37

Coupon collector sequences (M-words with no empty sets)

Def. A coupon collector sequence is an M-word with no empty set.

Q. How many coupon collector sequences?

a string that uses all the letters in the alphabet

Class Rm, the class of coupon collector sequences

Z M Z N

ECF Rm{z) = 2 ^ jZfT = 2 ? Rmn W

w<eRm N> 0

Example ( M = 26 )

the quick brown fox jumps over the lazy dog

Example ( M = 5 )

2 4 2 4 5 5 1 5 3

{7}{13}{9}{24}{568}

Construction R M = SEQ M (SET >0 (Z))

EGF equation ^/w( z ) = (c z — *\) M

38

Surjections
Def. An M-surjection is an M-word with no empty set.

Alt name for "coupon collector sequence"

Def. A surjection is a word that is an M-surjection for some M.

Q. How many surjections of length N ?

Class Rm, the class of M-surjections


Construction

R m = SEQ m (SET > 0 (Z))

EGF equation

Rm(z) = 0 Z - 1 )

Coefficients

MN

Class R, the class of surjections

Construction

R = SEQ(SET > 0 (Z))

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

Best handled with


complex asymptotics

(stay tuned)
39

Some variations on words

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)

Wm = SEQ M (SET< b (Z)

= (E k < b z k /k\) M

SURJECTIONS

(M-word for some M, all letters used)


R = SEQ(SET>o(Z)

M-WORD

Wm = SEQm (SET(Z)

W M {z) = (e z ) M = e Mz

Generalized Coupon Collector

MIN occupancy M-WORDS


(all letter counts > b)

Wm = SEQm (SET>ti Z)

wtf(z) = X k>b z k /k\)

OCCUPANCY CONSTRAINED M-WORDS


(arbitrary letter count constraints)
W M ci = SEQm (SETn(Z)

W M a(z) = (E teQ z*/«) M

40

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

CAMBRIDGE

2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

http://ac.cs.princeton.edu

II.2c.EGFs.Words

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics
Philippe Flajolet and
Robert Sedgewick

CAMBRIDGE

2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• 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. How many different labelled trees of size N ?


Q. Order of subtrees significant?

Q. Rooted?

Q. Binary?

Q. Labels increase along paths?

Some of these questions are trivial; others are classic.

All of them are easily answered with analytic combinatorics.

43
Counting labelled trees

same trees

class

rooted ordered

rooted unordered (Cayley)

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

A. N\ Cn . Proof. Label any canonical walk of every unlabelled tree N\ different


ways

45

Labeled rooted ordered trees

Q. How many different labelled rooted ordered trees of size N ?

Class L, the class of labelled rooted ordered trees

7 |/| yN

ecf 4z) = Ew=ES

leL 11 ‘ N> o

Construction
EGF equation

Counting sequence

L = Z'k SEQ{Z) “A tree is a root and a sequence of trees"

Liz) = -—— < - Same as OGF for unlabelled trees


K ’ 1 - L(z)

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

Q. How many different labelled rooted unordered trees of size N ?

< -24 ways to label

◄-1 2 ways to label

< -24 ways to label

T 4 = 64

4 ways to label

A. N N ~\ Proof. Stay tuned: Cayley trees are special cases of mappings (next
section)

47

Increasing Cayley trees


Q. How many different Cayley trees of size N with increasing labels on every path ?

"Cayley" = "rooted, labelled, unordered"

48

Increasing binary trees

Q. How many different binary trees of size N with increasing labels on every path ?

Boxed product construction for labelled classes

construction

boxed product

Example

notation

semantics

A = B D ★ C

subset of B^C where smallest


labelled element is from B

50
Transfer theorem for the boxed product

construction

boxed product

notation

A= B a ★ C

semantics

subset of B^C where smallest


labelled element is from B

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

(it- 1)! (N — k)\

A\z) = ttEttZ N -'

N>1

(N-1)!

E E

N>1 1 <k<N

Bi

^N-k N -1

(it - 1)! (N — /c)!

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

Check the boxed-product transfer theorem for a small example.

52
Increasing trees

Class Q, the class of Cayley trees whose labels increase on every path

Construction

Q = Z D ★ SET (Q)

EGF equation

Q'(z) = e Q < 2 >

Solution

Q( z ) - in 1 _ z

Counting sequence

Qn = N![z n ]Q(z) = (N - 1)! "Cayley"

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\

"Cayley" = "rooted, labelled, unordered"

binary" = "ordered, each node with 0 or 2 children

53
A permutation is an increasing binary tree

Increasing binary tree


representation

Standard

representation

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

54

Some variations on labelled trees

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

Philippe Flajolet and


Robert Sedgewick

CAMBRIDGE

2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

http://ac.cs.princeton.edu

II.2d.EGFs.Trees

ANALYTIC COMBINATORICS

PART TWO
Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

CAMBRIDGE

2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

http://ac.cs.princeton.edu

II.2e.EGFs.Mappings

Mappings

Q. How many A/-words of length N ?

Mi = 1

1 1
1 2
2 1
2 2

M 2 = 4

111 211 B 1 1

112 212 B 1 2

113 213 313


121 221 321

122 222 322

123 223 323

131 231 331

132 232 332

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

Every mapping corresponds to a digraph

• N vertices, N edges

• Outdegrees: all 1

• Indegrees: between 0 and N

Natural questions about random mappings

• Probability that the digraph is connected ?

• How many connected components ?

• How many nodes are on cycles ?

59

Mappings

Q. How many mappings of length N ?


M 2 = 4

(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

A. N N , by correspondence with A/-words, but internal structure is of interest.


60

oaO

Lagrange inversion

is a classic method for computing a functional inverse.

Def. The inverse of a function f(u) = z is the function u = g(z).

Ex. f(u) = -- g(z) = ———

w 1 -u 1 +z

Lagrange Inversion Theorem.

If a GF g(z) = ^g n z n satisfies the equation z= f(g(z ))

n>i

with f (0) = 0 and f' (0)^0 then g n = - [a

n — 1

J(u)J ■

Proof. Omitted (best understood via complex analysis).

Ex. f( u ) =—— g n = -[ u n '](1 — u) n = (—1 ) n_1


1—u n v 7

V(-1) n z" =

n> 1
1 +Z

Analytic combinatorics context: A widely applicable analytic transfer theorem

Lagrange-Burmann inversion

A more general (and more useful) formuation:

Lagrange Inversion Theorem (Burmann form).

If a GF g(z) = ^g n z n satisfies the equation z= f(g(z))

n> 1

with f( 0) = 0 and f ' (0) =£ 0 then, for any function H(u), *

[z"]H(g(z)) = l[ U "-']H'( U )(Z) n

/-/(w) = w gives the basic theorem

One important application: enumerating mappings

62

Lagrange inversion: classic application

How many binary trees with N external nodes?

Class
Size

Construction T = Z + T x T

OGF equation T(z) = z + T(zf


Lagrange Inversion Theorem.

If a CF g(z) = satisfies the equation z = f(g (z))

n —' 1 —i ( u \ n

with f(0) = 0 and f' (0) * 0 then gn = ~[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 ) /

T, the class of all binary trees


The number of external nodes

63

Cayley trees

Class

ECF

C, the class of labelled rooted unordered trees

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

"a tree is a root connected to a set of trees"

/ U \ N

' u/e u '

Lagrange Inversion Theorem.

If a CF g(z) = ^g„z n satisfies the equation z= f(g (z))

n —i 1 _i / tr \ n

with f(0) = 0 and f 1 (0) * 0 then gn = ~[u n ■

/-I

C N = N\[z n ]C(z) =(n^)

N\

/
64

Connected components in mappings

Q. How many different cycles of Cayley trees of size N ?

N N y/n

A. r ^ j — ■ (see next slide)

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

Connected components in mappings

Class

EGF

Y, the class of cycles of Cayley trees

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)

[z N ]Y(z) = ^[u N '}Y^e uN

"a component is a cycle of trees"

Lagrange Inversion Theorem (Burmann form).

If a CF g(z) = J2g n z n satisfies the equation z= f(g(z))

n> 1
with f{ 0) = 0 and f ' (0) * 0 then, for any function H(u),

[z"]H(g(z)) = l[u n - 1 ]H'(u)(^) n

= E

0<k<N

N k ~ 1

= E

l</c<N

(N — k)\

Y n = N\[z n ]Y(z) = N n ~'

1 <k<N

N\

N k (N-k)l

N n ~'Q(N) ~

vys

v'tn

66

Mappings
Class

M, the class of mappings

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) =

M(z) = exp (in -

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

Lagrange Inversion Theorem (Burmann form).

If a CF g(z) = £g n z" satisfies the equation z = f(g(z))

n> 1

with f (0) = 0 and f'(0) * 0 then, for any function H(u),

[z"]H(g(z)) = l[u"- 1 ]H'(u)(^) n

- E

1 <k<N

N k ~ ]

W^y.

N N
XT

67

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

CAMBRIDGE

2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

http://ac.cs.princeton.edu

II.2e.EGFs.Mappings

ANALYTIC COMBINATORICS

PART TWO
Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

http://ac.cs.princeton.edu

2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

• Summary

II. 2f.EGFs.Summary

The symbolic method for labelled classes (transfer theorem)

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

disjoint copies of objects from A and 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

k- sequences of objects from A

A(z) k

sequence

SEQ(A)

sequences of objects from A

1 - A(z)

set

SETk(A)

/c-sets of objects from A

A(z) k /k\

SET (A )

sets of objects from A

e A(z)

CYCk(A)

/(-cycles of objects from A

A(z) k /k

cycle

CYC (A)

cycles of objects from A

In ’

1 — A(z)

boxed product

A= B a ★ C

subset of B^C where smallest labelled


element is from B

A'( z) = B'(z)C(

Constructions for labelled objects (summary)

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 )

increasing Cayley trees

Q = Z° ★ SET ( Q )

Q'(z ) = e Q ^

mappings

M = SET (CYC(C))

M '< z > = , - C(z)

71

Analytic combinatorics overview

To analyze properties of a large combinatorial structure:

1. Use the symbolic method

• Define a class of combinatorial objects.

• Define a notion of size (and associated generating function)

• Use standard operations to develop a specification of the structure.


Result: A direct derivation of a GF equation (implicit or explicit).

Analytic

Combinatorics

Philippe Flajoletand
Robert Sedgewick

Important note: GF equations vary widely in nature

U{z ) = e z Q'(z) = e Q(z)


1

D(z)

1 -z

*(z) =

P(z) =

V(z) = In

1 -z

1 -z

M(z)

W^ b (z) = ( 1 + z + zV2! + ...+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 ^

2. Use complex asymptotics to estimate growth of coefficients (stay tuned).

72

Direct advantages of the symbolic method

We can automate the transfer from specifications to GFs.

Ref: Automatic average-case analysis of algorithms.

by Philippe Flajolet, Bruno Salvy, and Paul Zimmerman (TCS 1991).

specification

We can use specifications to generate random structures.

Approach 1: Use a recursive program based on the specification.


Drawback: Requires quadratic time (not useful for large structures).

Approach 2: Use a probabilistic recursive program based on the specification.


Need to settle for approximate size N.

Can generate large structures in linear time.

Ref: Boltzmann samplers for random generation of combinatorial structures.

by Philippe Duchon, Philippe Flajolet, Guy Louchard and Gilles Schaefer (CPC 2004).

73

French mathematicians on the utility of GFs (continued)

"This approach eliminates virtually all calculations."

— Dominique Foata & Marco Schutzenberger, 1970

74

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

http://ac.cs.princeton.edu

2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees
• Mappings

• Summary

II. 2f.EGFs.Summary

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

http://ac.cs.princeton.edu

2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

• Exercises

II.2g.EGFs.Exercises

Note 11.11

Ehrenfest model

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick
> 11.11. Balls switching chambers: the Ehrenfesi model. Consider a system of two
cham¬
bers A and B (also classically called “urns”). There are N distinguishable balls,
and, initially,

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

E^\z) = ^^(coshz)^(sinhz)^ -£ , E^\z) = (cosh z) N = 2~ N (e z + e~ z ) N .

[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

Philippe Flajolet and


Robert Sedgewick

t> 11 . 31 . Combinatorics of trigonometries. Interpret tan


combinatorial classes.

tan tan z, tan(e z — 1) as EGFs of

<1
78

Assignments

1. Read pages 95-1 49 (Labelled Structures and ECFs) in text.

2. Write up solutions to Notes II.1 1 and 11.31.

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

3. Programming exercise (Extra Credit).

Program II.1. Write a program to simulate the Ehrenfest mode


(see Note II.1 1) and use it to plot the distribution of the number of
balls in urn A after 1 0 3 , 1 0 4 and 1 0 5 steps when starting with 1 0 3
balls in urn A and none in urn B.

79

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

http://ac.cs.princeton.edu
2. Labelled structures and EGFs

• Symbolic method for labelled classes

• Words and strings

• Labelled trees

• Mappings

• Exercises

II.2g.EGFs.Exercises

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

2. Labelled structures and

EGFs

http://ac.cs.princeton.edu

Anda mungkin juga menyukai