Vous êtes sur la page 1sur 91

ANALYTIC COMBINATORICS

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

http://ac.cs.princeton.edu

5. Applications of
Rational and Meromor

Asymptotics

PART TWO

Analytic combinatorics overview

A. SYMBOLIC METHOD

1. OGFs

2. EGFs

3. MGFs

B. COMPLEX ASYMPTOTICS

SYMBOLIC METHOD

specification

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

COMPLEX ASYMPTOTICS

asymptotic

estimate

desired
result !

Bottom line from last lecture

Analytic transfer for meromorphic GFs: f(z)/g(z ) ~ c $ N

• Compute the dominant pole cx (smallest real with g(z) = 0)

• Compute the residue h~] = -f(a)/g\a)

• Constant c is / 7-1 /cx.

• Exponential growth factor (3 is 1 /cx

Not order 1 if g\a) = 0.


Adjust to (slightly) more
complicated order M case.
This lecture: Numerous applications

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples

• Compositions

• Supercritical sequence schema

http://ac.cs.princeton.edu

II.5a.RMapps.Bitstrings

Warmup: Bitstrings

How many bitstrings of length N ?

000

0000
000 1
00 10
0011
0100
001

0101

00

0 10

0 110

0 1

Oil

0 111

10

100

1000

11

101

1001

110

10 10

03

l\j

ll

111

1011

B 3 = 8

1100

1101

1110

1111

Ba= 16
counting sequence

Bn = 2

Y,2 N z" = '£[2z) N

N >0 N >0

OGF

1 — 2z

~ 1 — 2z

Warmup: Bitstrings

Asymptotics

B, the class of all bitstrings


B = E + (Z 0 + Zi)xB

Dominant singularity: pole at a — 1/2

> f

[z n ]B(z) = 2 n

Residue:
Coefficient of z N :

h -1 =
h -1

rsj -

f(z) 1
g'O) 2

Example 1: Bitstrings with restrictions on consecutive Os

How many bitstrings of length N have no two consecutive Os ?

To = 1

Ti = 2

01

10

11

T 2 = 3

Oil
0 10
101
110
111

T 3 = 5

0 10 1
0 110
0111
10 11
10 10
1101
1110
1111

T 4 = 8

0 10 11
01010
0 110 1
oino
0 1111
10 10 1
10110
10111
110 11
11010
1110 1
11110
11111

T 5 =1B

Example 1: Bitstrings with restrictions on consecutive Os

Boo, the class of all bitstrings having no 00


Boo = i + Zo + (Zo + Zo xZi ) x Boo

= ] -^- Z 2

[z n ]B 00 (z) = ^=4> n

Dominant singularity: pole at <fr

Residue: /?_i =

g'(4>)

Coefficient of z N \
hi n\ N

V5

C 2 P 2 with

f3 2 = 1.61803
c 2 = 1.17082

y/5 — 1
2

a/5 + 1
2

_ 1 +3
~ 1 + 20

h—i~4, N

0 + 20 2

00 = 1
0 2 = 0 + 1

Example 1: Bitstrings with restrictions on consecutive Os

B 4 , the class of all bitstrings having no 0 4

B4 = Z<4 (E + 1 B4)

> f
B 4 {z) = (1 +z + z 2 +z 3 )( 1 + zB 4 (z))

1 + z + z 2 + z 3

> f

Dominant singularity: pole at a

. /"(z) 1 -\- oi “t - ol2 -(- or 1

Residue: n_i = —=--- -—3 -—r

g(z) a + 2a + 3a 2 + 4a 3

Coefficient of z N : [z N ]BAz ) ~ f

[z N ]B 4 (z) ~ c 4/ 3^

with

/3 4 = 1.9276
c 4 = 1.0917

Example 1: Bitstrings with restrictions on consecutive Os

1 + Z

10
Example 1: Bitstrings with restrictions on consecutive Os

Information on consecutive Os in GFs for strings

[from AC Part I Lecture 5]

Bm(z ) = ^ z^ = ^{# of bitstrings of length N with no 0 M }z N

n> o

_ 1 +Z + Z 2 +...+z M -' _ 1 -Z M

- 1 - z - z 2 - ... z M “ 1 — 2z + z M+1

Bm(z/2) = ^ ({# of bitstrings of length N with no runs of M 0s}/2 N )z N

N> 0

Bm( 1/2) = ^{# of bitstrings of length N with no runs of M 0s}/2 N

N> 0
= ^ Pr {1 st N bits of a random bitstring have no runs of M Os}

N> 0

= ^ Pr (position of end of first 0 M is > N ] = Expected position of end of first 0


M

N> 0

Theorem. Probability that an A/-bit random bitstring has no 0 M : [z n ]Bm(z/ 2) ~


Cm(Pm/ 2) N
Theorem. Expected wait time for the first 0 M in a random bitstring: Bm( 1/2) = 2
m+1 -2

12

Autocorrelation

[from AC Part I Lecture 5]

The probability that an A/-bit random bitstring does not contain 0000 is ~1.091 7 x
. 96328^
The expected wait time for the first occurrence of 0000 in a random bitstring is
30.

Q. Do the same results hold for 0001?


A. NO!

0001 occurs much


earlier than 0000

10111110100101001100111000100111110110110100000111100001

Observation. Consider first occurrence of 000.

•0000 and 0001 equally likely, BUT

•mismatch for 0000 means 0001, so need to wait four more bits
•mismatch for 0001 means 0000, so next bit could give a match.

Q. What is the probability that an A/-bit random bitstring does not contain 0001?

Q. What is the expected wait time for the first occurrence of 0001 in a random
bitstring?

13
Constructions for strings without specified patterns

[from AC Part I Lecture 5]

Cast of characters:

p — a pattern p 101001010

S P — binary strings that do not contain p Sp 10111110101101001100110000011111

Tp binary strings that end in p 7 loinnoiOllOlOOllOOllOlOlOOlOlO

and have no other occurrence of p

First construction

• Sp and Tp are disjoint

• the empty string is in S P

• adding a bit to a string in S P gives a string in S P or T p

Sp + T p = E + Sp x {Zq + Zi }

14

Constructions for bitstrings without specified patterns

[from AC Part I Lecture 5]

Every pattern has an autocorrelation polynomial

• slide the pattern to the left over itself.

• for each match of / trailing bits with the leading bits include a term z \p\-'

101001010

101001010

101001010

101001010

101001010

101001010

101001010
101001010

101001010

101001010

autocorrelation

polynomial

Cioiooioio(z) — 1 + z 5 + z 7

15

Constructions for bitstrings without specified patterns

[from AC Part I Lecture 5]

Second construction

• for each 1 bit in the autocorrelation of any string in T P add a “tail”

• result is a string in S P followed by the pattern

p 101001010

a string in T p 10111110101101001100110101001010

f 10111110101101001100110 101001010
strings in S P ^—►1011111010110100110011010100101001010

l 10111110101101001100110 101001010 1001010

first tail
is null

101001010

101001010
101001010

101001010

101001010

101001010

10100101001010

101001010

1010010101001010

101001010

Sp x (pi — x

C/# 0

16

Bitstrings without specified patterns

[from AC Part I Lecture 5]

How many A/-bit strings do not contain a specified pattern pi

Sp — the class of binary strings with no

OCFs

s p ( z ) = Z z ' s|

sESp

Tp — the class of binary strings that end in p


and have no other occurence

M z ) = Z z ' s|

sETp

Constructions

OGF equations
Solution

Sp + T p — E + S p x {Zq + Zi}

5 p (z) + 7p(z) = 1 + 2 zSp(z)

Sp{z)

Sp x {p} — T p x N ' {t/}

c,/0

5 p (z)z p = Tp(z)c p (z)


c P (z)

z p + (1 -2 z)Cp(z)

„ w , ( 8 D is the dominant root of z p + (1 —2z)c D (z)

Extract cofficients z N S„(z) ~ Cd / 3" where { ^ p , , , , v ; pW

1 Jpw Pp Icp = [explicit formula available]

17

Bitstrings without specified patterns

Asymptotics

18

ANALYTIC COMBINATORICS

PART TWO

Analytic
Combinatorics

Philippe Flajolet and


Robert Sedgewick

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples

• Compositions

• Supercritical sequence schema

http://ac.cs.princeton.edu

II.5a.RMapps.Bitstrings

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples

• Compositions

• Supercritical sequence schema

CAMBRIDGE
http://ac.cs.princeton.edu

II. 5b.RMapps.Exam pies

Example 2: Derangements

How many permutations of size N have no singleton cycles ?

Di = 0

®©

Di = 1

©©©

Db = 2

©©©©

©©(

®@i

©© ( 2 )
© (4 s

©®
©

©J® ©IJ©

©^ ©

^ ©J® ©J©

©®

®®

®/®X ®/®\|

©J© ©J©

©s

©s

, ©I V ©^

©J© ©J®|

Da = 9

Example 2: Derangements

D, the class of all permutations


with no singleton cycles

D = SET(CYC>i(Z)
> f

D(z)

N\[z n ]D(z) ~

N\

Dominant singularity: pole at 1

Residue: h _i

m =e -i

g'O)

[z N ]D(z)

h ~^N = 1

1 e

N\/e

Dn

.7357...

2.2072...

8.8291...

9
5

44.1455...

44

estimates are extremely accurate


even for small N

22

Example 2: Derangements

Dm, the class of all permutations


with no cycles of length < M

Dm = SET(CYC>m(Z)

> f

D m (z)

> f

N\[z n ]D(z) ~

N\

Dominant singularity: pole at 1

Residue: /?_i

^0 ) _ e -H M
g'O) "

[ Z N ]D(Z)

h -^N = _L

1 e HM

23

24

Example 2: Derangements

e -z-z 2 /2-z 3 /3-z 4 /4-z 5 /5-z 6 /6-z 7 /7-z 8 /8-z 9 /9-z 10 /10

25
Example 3: Surjections

How many words of length N are M-surjections for some M ?

1 2

R} = 1 2 1

Ri = 3

12 1 13 2

1 2 2 2 1 3

2 11 2 3 1

2 12 3 12

2 2 1 3 2 1

Kb = 13

"coupon collector sequences"

For some M, each of the first M letters appears at least once.

1111

1112
112 1
12 11
2 111
112 2
12 12
2 112
2 12 1
2 2 11
12 2 1
12 2 2
2 12 2
2 2 12
2 2 2 1

Ra = 75

12 3 1

13 2 1
2 13 1

2 3 11
3 12 1
3 2 11

12 13

13 12

2 113

3 112

112 3

113 2

12 3 3

13 2 3
2 13 3

2 3 13

3 12 3
3 2 13
13 3 2

2 3 3 1

3 13 2
3 2 3 1
3 3 12
3 3 2 1

12 3 2

13 2 2
2 13 2

2 3 12

3 12 2
3 2 12
12 2 3
2 12 3

2 3 2 1

3 2 2 1
2 2 13
2 2 3 1

12 3 4

13 2 4
2 13 4
2 3 14

3 12 4
3 2 14

12 4 3

13 4 2
2 14 3

2 3 4 1

3 14 2
3 2 4 1

14 2 3
14 3 2
2 4 13

2 4 3 1

3 4 12

3 4 2 1

4 12 3
4 13 2
4 2 13
4 2 3 1
4 3 12
4 3 2 1

26

Example 3: Surjections

R, the class of all surjections

R = SEQ(SET> 0 (Z))

-+-

Dominant singularity: pole at z = In 2

[z n ]R(z)
1

2(ln2) N + 1

Residue:

1 1

in 2 )

A/!/2(ln 2) w+1

Rn

B.0027...

12.9962...

13

74.9987...

75

estimates are extremely accurate


even for small N

Example 3: Surjections
How many words of length N are double surjections for some M ?

11 111 1111 1122

12 12

Ri = 1 fh = 1 2 112

2 12 1
2 2 11
12 2 1

/? 4 = 7

"double coupon collector sequences"

For some M, each of the first M letters appears at least twice.

11111

1112 2
112 12
112 2 1
12 112
12 12 1
12 2 11
2 1112
2 112 1
2 12 11
2 2 111

112 2 2
12 2 12
2 12 2 1
2 2 112
1 2 2 2 1
2 2 2 1 1
2 12 12
12 12 2
2 112 2
2 2 12 1

R.5 = 21

28

Example 3: Surjections
R, the class of all double surjections
R = SEQ(SET>i(Z)

R{z)

1 — (e z — z — 1)

2 + z — e 2

1 N\

p + 1 p N+1

Singularities where e z = z + 2

Dominant singularity: pole at p =

i 1 1

Residue: =

g'(p) eP - 1

1.14619

" pTT

29
Example 3: Surjections

2 + z + z 2 / 2 — e z

2 + z + z 2 /2 + z 3 / 6 — e z

30

Example 3: Surjections
Example 4: Alignments

How many sequences of labelled cycles of size N ?

O i = 1

®©

©©

0 2 = B

©@©

©©©

©0®

©©©

©©©

@ §

@ 0

©@©

Ob = 14

OOOO x 24
x 12

°©>

32

Example 3: Alignments

O, the class of all alignments


O = SEQ(CYC(Z)

> f

O(z)

1 — In

Singularities where In--

1 - z

Dominant singularity: pole at

Residue: /?_! = ——-—

g'O - 1/e.

z = 1
1

On ~

N\

A/!/e(l -1 /e) N+1

On

e(1 — 1 /e) N+1

2.9129...

estimates are extremely accurate


even for small N

1 B.8247...

14

87.4816...

88

Example 4: Set partitions

Q. How many ways to partition an N-element set into r subsets ?


< - see Lecture 3

Sni = 2 W -1 ABC

S 33 = 1

only B B B... B
disallowed

Application: rhyming schemes

A B

A B

B
A

A B

A
A

A B

A A

B
B

A B

C
A

S 43

A
C

Ss3= 25

There was a small boy of Quebec A


Who was buried in snow to his neck A
When they said, "Are you friz?" B
He replied, " Yes, I is — B

But we don't call this cold in Quebec! A

TWO roads diverged in a yellow wood, a


And sorry I could not travel both b
And be one traveler, long I stood a
And looked down one as far as I could a
To where it bent in the undergrowth; g

34

Example 4: Set partitions

Sr, the class of all poems with r rhymes

Sr = Za x SEQ (Z A ) x Zb x SEQ(Za + Zb) x


Zc x SEQ ( Za + Zb + Zc) x ...

> f

(1 z) (1 — 2z)... (1 -rz)

> f

[z N ]S\z) ~

r!

Singularities at 1, 1/2, 1/3, ... ]/r

Dominant singularity: pole at ]/r

Residue: /7_i

fQA) _ i
g'OA) r ‘ r!

35

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics
Philippe Flajolet and
Robert Sedgewick

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples

• Compositions

• Supercritical sequence schema

CAMBRIDGE

http://ac.cs.princeton.edu

II. 5b.RMapps.Exam pies

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples

• Compositions

• Supercritical sequence schema

CAMBRIDGE
http://ac.cs.princeton.edu

II.5c.RMapps.Compositions

Example 5: Compositions

Q. How many ways to express N as a sum of positive integers?

/i = 1

l + l
2

li = 2

A. In =2 n-i

1 +

1
+

1 +

+ 1

+
3

+ 1

+ 1

1 +

2 +

1
2

k =

2
+

1
3

B + 2
4 + 1
5

Is = 16

38

Example 5: Compositions

/, the class of all positive integers


/ = SEQ> 0 (Z)

> f

In = 1 for N > 0

Singularity: pole at 1

Residue: /7_ n

f(1)

g'(1)

= 1

39
Example 5: Compositions

C, the class of all compositions

C= SEQ(/)

40

Example 5: Compositions

Q. How many ways to express N as a sum of 1 s and 2s ?

1 + 1

+ 1

1 +

1 +

+
= 1

1 +

+ 1

2 +

+ 2

f 2

+ 1

Fb =

3
2 +

f 4 =

A. Fibonacci numbers

2
+

2
+

Fs = 8

41

Example 5: Compositions

F, the class of all compositions


composed of 1 s and 2s

F = SEQ(Z + Z 2 )

F n ~

<j) N

7 !

— = .4472 and 6= 1.618

V5

Dominant singularity: pole at (f)

Residue: Ai_i =

Coefficient of z N \

f {4>) _ 1

1+20
/ j _! /'\\ N +1

lN

1 +20

00 = 1
0 ^ — 0+1
1 + 20 =

42

Example 5: Compositions

Q. How many ways to express N as a sum of primes ?

Pi = 1

2 + 2
P 4 = 1

P3 = 1
2 + 3
B + 2
5

Ps = 3

2 + 2

+ 2

3 +

2
2

Pe =

Pi = 6

+
2

2 +

+ 2

2
2

+
5

Ps

Pg = 10

43

Example 5: Compositions
P, the class of all compositions
composed of primes

P = SEQ(Z 2 + + Z5 + Z 7 + . . .)

"] _ ^2 _ ^3 _ ^5 _ ^7 _ 1 _

Dominant singularity: pole at 1 / (3 = .6774

> f

[z N ]P{z) ~ A/3 n with

P = 1.4762
A = .3037

Note: periodic oscillations are present in the next term

interesting
calculations
omitted
(see text)

pp. 298-299

44

Example 6: Denumerants (partitions from a fixed set)

Q. How many ways to make change for N cents?


l + l+ l + l + l + l + l + l + l+ l + l+ l + l
5 + 1 + 1+1 + 1+1 + 1 + 1 + 1 + 1
5 + 5+1 + 1 + 1 + 1
10 + 1 + 1 + 1 + 1

Qm = 4

l + l + l + l + l + l + l + l + l + l + l + l + l + l
5 + 1 + 1 + 1 + 1 + 1 + 1 + 1+1 + 1+1
5 + 5+1 + 1 + 1 + 1 + 1
5 + 5 + 5

10 + 1 + 1 + 1 + 1 + 1
10 + 5

Qi 5 = 6

45

Example 6: Denumerants (partitions from a fixed set)

Q, the class of all partitions


composed of]s, 5s, 10s, 25s

Q = MSET(Z+ Z5 + Z 1( > + Z25 )

Q ^ = (1 -z)(1 -z 5 )(1 -z 10 )( 1 -z 25 )

Dominant

na(z) ~

N 3

1 -5 • 10-25 - 3 !

N 3

7500

Residue:
singularity: po/e of order 5 1

4 = lim(1 — z) 4 Q(z)

“ 1 -5-10-25

Iim -- = -t t" = -

z->1 1 + Z + Z 2 + . . . + Z^ 1 f

46

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples

• Compositions
• Supercritical sequence schema

CAMBRIDGE

http://ac.cs.princeton.edu

II.5c.RMapps.Compositions

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

CAMBRIDGE

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples

• Restricted compositions

• Supercritical sequence schema

http://ac.cs.princeton.edu

II.5d.RMapps.SeqSchema

Sequence schema

Terminology. A schema is a treatment that unifies the analysis of a family of


classes.
Definition. A class that admits a construction of the form F = SEQ( G), where G is
any class
(labelled or unlabelled) is said to be a sequence class, which falls within the
sequence schema.

Enumeration:

F = SEQ( G)

A = 1 fN = [z N }F(z)

1 ~ C ( Z ) gN = [Z N ]C(Z)

unlabelled case: number of structures is fw


labelled case: number of structures is N ! f/v

Parameters: mark number of G components with u

F = SEQi u G) — F(z, u) = - - E—

1 — uG(z)

. f*(z, U )

mark number of Gk components with u


F = SEQ(u Gk + G\ Gk) —

1 - {C{z) + (u - ^g k z k )

49

Supercritical sequence classes

Supercriticality. A technical condition that enables us to unify the analysis of


sequence classes.
Definition. Supercritical sequence classes.

A sequence class F = SEQ(G) is said to be supercritical if G( p) > 1 where G(z) is


the
generating function associated with G and p>0 is the radius of convergence of C(z).
Example: GF for integers: /(z) = ^ Z

radius of convergence: P= 1—e for any e>0

supercriticality test: /(I - e) =-1 > 1 for e < 1/2

Therefore, the class of compositions C = SEQ(I) is supercritical.

Note: For simplicity, we ignore periodicities in GFs in this lecture:

Definition. Strong aperidoicity. A GF C(z) is said to be strongly aperiodic when


there does not exist an integer d> 1 such that G(z) = h(z d ) for some h(z)
analytic at 0.

50

Transfer theorem for supercritical sequence classes

Theorem. Asymptotics of supercritical sequences. If F = SEQ(G) is a strongly


aperiodic

supercritical sequence class, then l[z N ]F(z)

G'(A) A n +t

jwhere A is the root of C(A) = 1 in (0, p).

radius of

convergence of C(z)

Proof sketch:
• G(z) increases from C(0) = 0 to C(p)>l, so X is well defined.

• At X, G(z) admits the series expansion G(z) = 1 + G'(A)(z - A) + G // (A)(z - A)


2 /2! H-

1 1 1

• Therefore, F(z) = 1/(1 -G(z)) has a simple pole at X, andF(z) ~ ——

G'(A)(z - A) AG'(A) 1 -z/A

51

Transfer theorem for supercritical sequence classes

Theorem. Asymptotics of supercritical sequences. If F

1 1

supercritical sequence class, then [z N ]F(z)

G'(A) A N+1

construction

F(z)

surjections R = SEQ (SET> o( Z ))

2 - e 2

alignments O = SEQ (CYC( Z ))

1 — In

1 -z

compositions C = SEQ( I )
1-2

SEQ(G) is a strongly aperiodic


where A is the root of C(A) = 1 in (0, p).

G(z)

coefficient

asymptotics

e z — 1

In 2

N!

2(ln2) A/+1

In 1

1 -z

N!

e(1 - 1 /e) N+1

2^-i

1 -z

Analytic transfer
Parts in compositions

Q. How many parts in a random composition of size N ?

1 + 1
2

1.5

1 +

+
1

1 +

+ 1

2
1

+ 1

+
2

4
3

+
2

2.5

B + 2
4 + 1
5

53

Components in surjections
What is the expected value of M in a random surjection of size N ?

1 i
1 2

2 1

(1 + 2-2)/3 = 1.666

12 1
12 2
2 11
2 12
2 2 1

1 2 3

1 3 2

2 13

2 3 1

3 1 2
3 2 1

(1 +2-6 + 3-6)/l B = 2.B84

"coupon collector sequences"

For some M, each of the first M letters appears at least once.

1111

1112
112 1
12 11
2 111
112 2
12 12
2 112
2 12 1
2 2 11
12 2 1
12 2 2
2 12 2
2 2 12
2 2 2 1

12 3 1

13 2 1
2 13 1

2 3 11

3 12 1
3 2 11

12 13

13 12

2 113

3 112

112 3

113 2

12 3 3

13 2 3
2 13 3

2 3 13

3 12 3
3 2 13
13 3 2

2 3 3 1

3 13 2
3 2 3 1
3 3 12
3 3 2 1

12 3 2

13 2 2
2 13 2

2 3 12

3 12 2
3 2 12
12 2 3
2 12 3

2 3 2 1
3 2 2 1
2 2 13
2 2 3 1

(1 + 2-14 + 3-36 + 4- 24)/75 =

12 3 4

13 2 4
2 13 4

2 3 14

3 12 4
3 2 14

12 4 3

13 4 2
2 14 3

2 3 4 1

3 14 2
3 2 4 1

14 2 3
14 3 2
2 4 13

2 4 3 1

3 4 12

3 4 2 1

4 12 3
4 13 2
4 2 13
4 2 3 1
4 3 12
4 3 2 1

3.106

54

Components in alignments

How many cycles in a random alignment of size N ?


(1 + 2 • 2)/3 = 1.666

©@©

©8

nj

8 ©

nj

©©©

© 0 ®

©8

nT

(T)

nT

©©©

©@©

©8

(YJ

8 ©

(YJ

©@©

(1 -2 + 2-6 + 3 - 6)/14 = 2.286

OOOO x 24

OujO

x 6
( 1-12 + 2-16 + 3-36 + 4 - 24)/88 = 2.818

55

A poster child for analytic combinatorics

Parts in compositions

Q. How many parts in a random composition of size N ?

l+l+l+l+l

Components in surjections

l + l
2

1.5

What is the expected value of M in a random surjection of size N ?

1 i
1 2

2 1

(1 + 2-2)/3 = 1.666
12 1 13
1 2 2 2 1
2 11 2 3
2 12 3 1
2 2 1 3 2

(1 +2-6 + 3 • 6)/l 3 = 2

1111 17 3 1 1233 1 7 3 4

Components in alignments

How many cycles in a random alignment of size N ?

"coupon collector sequences"

For some M, each of the first M letters appears at le

(1 -2 + 2-6 + 3 * 6)/1 4 = 2.286

OOOO x 24

OO0 oQo Qoo X12

(1-12 + 2-16 + 3-36 + 4-24)/88 = 2.818

Such questions can be answered immediately via general transfer theorems

56

Number of components in supercritical sequence classes

Corollary. Number of components in supercritical sequence classes. If F = SEQ(G) is


a strongly aperiodic
supercritical sequence class, then the expected number of C -components in a random
F-component of

size N is

N + 1
AC'(A)

C"(A)

C'(A)2

with variance

AC"(A) + C'(A)-C'(A)\ ,

A 2 C'(A) 3

A is the root of
C( X) = 1 in (0, p)

Proof idea:

1 [ 7 Nl C ( z )
f N [ J (1-C(Z))2

[further details omitted]

57
Number of components in supercritical sequence classes

Corollary. Number of components in supercritical sequence classes. If F = SEQ(G) is


a strongly aperiodic

supercritical sequence class, then the expected number of G -components in a random


F-component of

N+1 G"( A) n 2 AG"(A) + G'(A) — G'(A) 2

slze N15 ~ xo(X) + cw ■ Wlth vanance ° N ~-Zcw- N ■

construction

F(z)

C(z)

expected number
of components

compositions

C = SEQ( I )

1 z

1 -z

surjections

R = SEQ (SET> o( Z ))

e z — 1

In 2

N
2 - e z

' 2 In 2

alignments

O = SEQ (CYC( Z ))

1 In 1 1

1 — z

In 1

1 -z

i-l

rsj -

e - 1

A is the root of
C( A) = 1 in (0, p)

Same idea extends to give profile of component sizes.

58

ANALYTIC COMBINATORICS

PART TWO
Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

CAMBRIDGE

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples

• Restricted compositions

• Supercritical sequence schema

http://ac.cs.princeton.edu

II.5d.RMapps.SeqSchema

ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

http://ac.cs.princeton.edu

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples


• Restricted compositions

• Supercritical sequence schema

• Summary

II.5e.RMapps.Summary

AC via meromophic asymptotics: summary of classic applications

class

specification

generating function

coefficient asymptotics

bitstrings

B = E + (Zo + Zi ) X B

1 — 2z

2 /v

derangements

D = SET(CYC>o( Z ))

e _z

1 -z

N\

rxj -

surjections

R = SEQ(SET>o(Z))

2 - e z

2(ln2) N+1
alignments

O = SEQ (CYC( Z ))

N\

e(1 — 1 /e) N+1

set partitions

Sr= ZxSEQ(Z)xZxSEQ(Z+Z)x...

z r

(1 - z)... (1 -rz)

r N

r!

integers

1 = SEQ> 0 ( Z ))

1 -z

compositions

C = SEQ(I)

1 z

1 1 -z

2^-i

61
AC via meromophic asymptotics: summary of classic applications (variants)

class

specification

generating function

coefficient

asymptotics

bitstrings

4 = z<4 ( + 2 l B 4 )

1 + z + z 2 + z 3

1.092(1 .928) n

with no 0000

1 — z — z 2 — z 3 — z 4

generalized

derangements

D = SET(CYC>m( Z ))

,2 7 3 7 M

0 Z 2 3 M

N\

1 -z

qHm

double

R = SEQ(SET>i(Z))

N\

400S

surjections

2 + z - e z
• 1 vJ U 9 . \ \ /

(1.146) N

compositions

F = SEQ(Z + Z2)

.4472(1.61 8) n

of 1 s and 2s

1 - z - z 2

compositions
of primes

P = SEQ(Z 2 + Z3 + Z5 + . . .)

.3037(1.476) n

1 — z 2 — z 3 — z 5 — z 7 — . . .

denumerants

Q = MSET(Z + Z5 + Z 10 + Z25)

(1 — z)(1 -z 5 )(1 -z 10 )(1 -z 25 )

N 3

7500

62

"If you can specify it, you can analyze it"


1. The transfer theorem for
meromorphic GFs enables
immediate analysis of a
variety of classes.

2. Variations are handled


just as easily.

class

specification

generating function

coefficient asymptotics

bitstrings

B = E + (Zo + Zi)xB

1 — 2z

2 n

derangements

D = SET(CYC>o( Z ))

e~ z

1 -z

N\

surjections

R = SEQ(SET>o(Z))

2 — e z

2(ln2) N+l

alignments

O = SEQ ( CYC( Z ))

’-■“rh

Nl
e(1 — 1 /e) N+1

class

specification

generating function

coefficient

asymptotics

bitstrings
with no 0000

B 4 = Z< 4 (E + ZiB 4 )

1 + z + z 2 + z 3

1 - z - z 2 - z 3 - z 4

1.092(1,928)~

generalized

derangements

D = SET(CYC>m( Z ))

0 z 2 i •- M

1 -z

N! L

double

R = SEQ(SET>i(Z))

1065 M

surjections

2 + z - e 7

' 1065 (1.146) n

compositions
of 1 s and 2s

F = SEQ(Z + Z 2 )

1 - z - z 2
.4472(1.61 8) n

compositions
of primes

P = SEQ(Z 2 + Z3 + Z5 + . . .)

1 - z 2 - z 3 - z 5 - z 7 - .. .

.3037(1.476) n

denumerants

Q = MSET(Z + Z* + Z'o + Z 2 5)

N 3

(1 -z)(1 -z 5 )(1 -z'0)(1 -z 25 )

7500

3. The supercritical sequence schema unifies the analysis for


an entire family of classes, including analysis of parameters.

Note: Several other schemas have been developed (see text).

Next: GFs that are not meromorphic (singularities are not poles).

63
ANALYTIC COMBINATORICS

PART TWO

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

http://ac.cs.princeton.edu

^Applications of

Rational and Meromorphic Asymptotics

• Bitstrings

• Other familiar examples

• Restricted compositions

• Supercritical sequence schema

• Summary

II.5e.RMapps.Summary

ANALYTIC COMBINATORICS

PART TWO

^Applications

Rational and Meromorphic Asymptotics

CAMBRIDGE

http://ac.cs.princeton.edu
• Bitstrings

• Other familiar examples

• Restricted compositions

• Supercritical sequence schema

• Exercises

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

II.5f.RMapps.Exercises

Web Exercise V.l

Patterns in strings.

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

Web Exercise V.l. Give an asymptotic expression for the number of


strings that do not contain the pattern 0000000001. Do the same for
0101010101 .

66

Web Exercise V.2

Variants of supercritical sequence classes.

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

Web Exercise V.2. Give asymptotic expressions for the number of


objects of size N and the number of parts in a random object of size
N for the following classes: compositions of 1 s, 2s, and Bs, triple
surjections, and alignments with no singleton cycles.

67

Assignments

1. Read pages 289-300 (Applications of R&M Asymptotics) in text. Skim pages 301-
375.
Usual caveat: Try to get a feeling for what's there, not understand every detail.

2. Write up solutions to Web exercises V.l and V.2.

3. Programming exercise.

Program V.l . In the style of the plots in the lectures slides, plot the
GFs for the set of bitstrings having no occurrence of the pattern
000000000. Do the same for 01 01 01 01 01. (See Web Exercise V.l).

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick

68

ANALYTIC COMBINATORICS

Analytic

Combinatorics

Philippe Flajolet and


Robert Sedgewick
http://ac.cs.princeton.edu

5. Applications of
Rational and Meromor

Asymptotics

PART TWO

Vous aimerez peut-être aussi