19
23 11 Article 03.2.8 Journal of Integer Sequences, Vol. 6 (2003), 2 3 6 1 47 The Number of Inversions in Permutations: A Saddle Point Approach Guy Louchard epartement d’Informatique CP 212, Boulevard du Triomphe B-1050 Bruxelles Belgium [email protected] Helmut Prodinger University of the Witwatersrand The John Knopfmacher Centre for Applicable Analysis and Number Theory School of Mathematics P. O. Wits 2050 Johannesburg South Africa [email protected] Abstract Using the saddle point method, we obtain from the generating function of the inversion numbers of permutations and Cauchy’s integral formula asymptotic results in central and noncentral regions. 1 Introduction Let a 1 ··· a n be a permutation of the set {1,...,n}. If a i >a k and i<k, the pair (a i ,a k ) is called an inversion; I n (j ) is the number of permutations of length n with j inversions. In a recent paper [7], several facts about these numbers are nicely reviewed, and—as new results—asymptotic formulæ for the numbers I n+k (n) for fixed k and n →∞ are derived. This is done using Euler’s pentagonal theorem, which leads to a handy explicit formula for I n (j ), valid for j n only. 1

The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

23 11

Article 0328Journal of Integer Sequences Vol 6 (2003)2

3

6

1

47

The Number of Inversions in Permutations

A Saddle Point Approach

Guy LouchardDepartement drsquoInformatique

CP 212 Boulevard du TriompheB-1050 Bruxelles

Belgiumlouchardulbacbe

Helmut ProdingerUniversity of the Witwatersrand

The John Knopfmacher Centre for Applicable Analysis and Number TheorySchool of Mathematics

P O Wits2050 Johannesburg

South Africahelmutmathswitsacza

Abstract

Using the saddle point method we obtain from the generating function of the

inversion numbers of permutations and Cauchyrsquos integral formula asymptotic results

in central and noncentral regions

1 Introduction

Let a1 middot middot middot an be a permutation of the set 1 n If ai gt ak and i lt k the pair (ai ak)is called an inversion In(j) is the number of permutations of length n with j inversionsIn a recent paper [7] several facts about these numbers are nicely reviewed andmdashas newresultsmdashasymptotic formulaelig for the numbers In+k(n) for fixed k and n rarr infin are derivedThis is done using Eulerrsquos pentagonal theorem which leads to a handy explicit formula forIn(j) valid for j le n only

1

-06-04

-020

0204

0608

1

x

-06

-04

-02

0

02

04

06

y

0

05

1

15

Figure 1 |Φ10(z)z11| and the path of integration

Here we show how to extend these results using the saddle point method This leadse g to asymptotics for Iαn+β(γn+ δ) for integer constants α β γ δ and more general onesas well With this technique we will also show the known result that In(j) is asymptoticallynormal

The generating function for the numbers In(j) is given by

Φn(z) =sum

jge0In(j)z

j = (1minus z)minusn

nprod

i=1

(1minus zi)

By Cauchyrsquos theorem

In(j) =1

2πi

int

CΦn(z)

dz

zj+1

where C is say a circle around the origin passing (approximately) through the saddle pointIn Figure 1 the saddle point (near z = 1

2) is shown for n = j = 10

As general references for the application of the saddle point method in enumeration wecite [4 8]

Actually we obtain here local limit theorems with some corrections (=lower order terms)For other such theorems in large deviations of combinatorial distributions see for instanceHwang [5]

The paper is organized as follows Section 2 deals with the Gaussian limit In Section 3we analyze the case j = nminusk that we generalize in Section 4 to the case j = αnminusx α gt 0Section 5 is devoted to the moderate large deviation and Section 6 to the large deviationSection 7 concludes the paper

2

2 The Gaussian limit j = m + xσm = n(nminus 1)4

The Gaussian limit of In(j) is easily derived from the generating function Φn(z) (using theLindeberg-Levy conditions see for instance Feller [3]) this is also reviewed in Margoliusrsquopaper following Sachkovrsquos book [9] Another analysis is given in Bender [2] Indeed thisgenerating function corresponds to a sum for i = 1 n of independent uniform [0iminus 1]random variables As an exercise let us recover this result with the saddle point method

with an additional correction of order 1n We have with Jn = Inn

m = E(Jn) = n(nminus 1)4

σ2 = V(Jn) = n(2n+ 5)(nminus 1)72

We know that

In(j) =1

2πi

int

Ω

eS(z)

zj+1dz

where Ω is inside the analyticity domain of the integrand and encircles the origin SinceΦn(z) is just a polynomial the analyticity restriction can be ignored We split the exponentof the integrand S = ln(Φn(z))minus (j + 1) ln z as follows

S = S1 + S2 (1)

S1 =nsum

i=1

ln(1minus zi)

S2 = minusn ln(1minus z)minus (j + 1) ln z

Set

S(i) =diS

dzi

To use the saddle point method we must find the solution of

S(1)(z) = 0 (2)

Set z = zlowastminusε where here zlowast = 1 (This notation always means that zlowast is the approximatesaddle point and z is the exact saddle point they differ by a quantity that has to be computedto some degree of accuracy) This leads to first order to the equation

[(n+1)24minus3n4minus54minus j]+ [minus(n+1)336+7(n+1)224minus49n72minus9172minus j]ε = 0 (3)

Set j = m + xσ in (3) This shows that asymptotically ε is given by a Puiseux series ofpowers of nminus12 starting with minus6xn32 To obtain the next terms we compute the nextterms in the expansion of (2) ie we first obtain

[(n+ 1)24minus 3n4minus 54minus j] + [minus(n+ 1)336 + 7(n+ 1)224minus 49n72minus 9172minus j]ε

+ [minusj minus 6148minus (n+ 1)324 + 5(n+ 1)216minus 31n48]ε2 = 0 (4)

More generally even powers ε2k lead to a O(n2k+1) middot ε2k term and odd powers ε2k+1 lead to aO(n2k+3) middot ε2k+1 term Now we set j = m+xσ expand into powers of nminus12 and equate each

3

coefficient with 0 This leads successively to a full expansion of ε Note that to obtain a givenprecision of ε it is enough to compute a given finite number of terms in the generalizationof (4) We obtain

ε = minus6xn32 + (9x2minus 5425x3)n52 minus (18x2 + 36)n3

+ x[minus3094230625x4 + 2710x2 minus 20116]n72 +O(1n4) (5)

We have with z = zlowast minus ε

Jn(j) =1

n2πi

int

Ω

exp[

S(z) + S(2)(z)(z minus z)22 +infinsum

l=3

S(l)(z)(z minus z)ll]

dz

(note carefully that the linear term vanishes) Set z = z + iτ This gives

Jn(j) =1

n2πexp[S(z)]

int infin

minusinfinexp

[

S(2)(z)(iτ)22 +infinsum

l=3

S(l)(z)(iτ)ll]

dτ (6)

Let us first analyze S(z) We obtain

S1(z) =nsum

i=1

ln(i) + [minus32 ln(n) + ln(6) + ln(minusx)]n+ 32xradicn+ 4350x2 minus 34

+ [3x8 + 6x+ 2750x3]radicn+ [567912250x4 minus 950x2 + 17316]n+O(nminus32)

S2(z) = [32 ln(n)minus ln(6)minus ln(minusx)]nminus 32xradicnminus 3425x2 + 34

minus [3x8 + 6x+ 2750x3]radicnminus [567912250x4 minus 950x2 + 17316]n+O(nminus32)

and soS(z) = minusx22 + ln(n) +O(nminus32)

Also

S(2)(z) = n336 + (124minus 3100x2)n2 +O(n32)

S(3)(z) = O(n72)

S(4)(z) = minusn5600 +O(n4)

S(l)(z) = O(nl+1) l ge 5

We can now compute (6) for instance by using the classical trick of setting

S(2)(z)(iτ)22 +infinsum

l=3

S(l)(z)(iτ)ll = minusu22

computing τ as a truncated series in u setting dτ = dτdu

du expanding with respect to n andintegrating on [u = minusinfininfin] (This amounts to the reversion of a series) Finally (6) leadsto

Jn sim eminusx22 middot exp[(minus5150 + 2750x2)n+O(nminus32)](2πn336)12 (7)

4

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 2 Jn(j) (circle) and the asymptotics (7) (line) without the 1n term n = 60

Note that S(3)(z) does not contribute to the 1n correctionTo check the effect of the correction we first give in Figure 2 for n = 60 the comparison

between Jn(j) and the asymptotics (7) without the 1n term Figure 3 gives the samecomparison with the constant term minus51(50n) in the correction Figure 4 shows the quotientof Jn(j) and the asymptotics (7) with the constant term minus51(50n) The ldquohatrdquo behaviouralready noticed by Margolius is apparent Finally Figure 5 shows the quotient of Jn(j) andthe asymptotics (7) with the full correction

3 The case j = nminus k

Figure 6 shows the real part of S(z) as given by (1) together with a path Ω through thesaddle point

It is easy to see that here we have zlowast = 12 We obtain to first order

[C1n minus 2j minus 2 + 2n] + [C2n minus 4j minus 4minus 4n]ε = 0

with

C1n = C1 +O(2minusn)

C1 =infinsum

i=1

minus2i2i minus 1

= minus548806777751

C2n = C2 +O(2minusn)

C2 =infinsum

i=1

4i(i2i minus 2i + 1)

(2i minus 1)2= 243761367267

5

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 3 Jn(j) (circle) and the asymptotics (7) (line) with the constant in the 1n termn = 60

096

097

098

099

1

101

700 800 900 1000 1100

Figure 4 Quotient of Jn(j) and the asymptotics (7) with the constant in the 1n termn = 60

6

09

092

094

096

098

1

700 800 900 1000 1100

Figure 5 Quotient of Jn(j) and the asymptotics (7) with the full 1n term n = 60

ndash04 ndash02 0 02 04 06 08 1 12 14x

ndash04

ndash02

0

02

04

y

10

11

12

13

14

Figure 6 Real part of S(z) Saddle-point and path n = 10 k = 0

7

Set j = n minus k This shows that asymptotically ε is given by a Laurent series of powers ofnminus1 starting with (k minus 1 + C12)(4n) Next we obtain

[C1 minus 2j minus 2 + 2n] + [C2 minus 4j minus 4minus 4n]ε+ [C3 + 8nminus 8j minus 8]ε2 = 0

for some constant C3 More generally powers ε2k lead to a O(1) middotε2k term powers ε2k+1 leadto a O(n) middot ε2k+1 term This gives the estimate

ε = (k minus 1 + C12)(4n) + (2k minus 2 + C1)(4k minus 4 + C2)(64n2) +O(1n3)

Now we deriveS1(z) = ln(Q)minus C1(k minus 1 + C12)(4n) +O(1n2)

with Q =prodinfin

i=1(1minus 12i) = 288788095086 Similarly

S2(z) = 2 ln(2)n+ (1minus k) ln(2) + (minusk22 + k minus 12 + C218)(2n) +O(1n2)

and so

S(z) = ln(Q) + 2 ln(2)n+ (1minus k) ln(2) + (A0 + A1k minus k24)n+O(1n2)

with

A0 = minus(C1 minus 2)216

A1 = (minusC12 + 1)2

Now we turn to the derivatives of S We will analyze with some precision S (2) S(3) S(4)

(the exact number of needed terms is defined by the precision we want in the final result)

Note that from S(3) on only S(l)2 must be computed as S

(l)1 (z) = O(1) This leads to

S(2)(z) = 8n+ (minusC2 minus 4k + 4) +O(1n)

S(3)2 (z) = O(1)

S(4)2 (z) = 192n+O(1)

S(l)2 (z) = O(n) l ge 5

We denote by S(21) the dominant term of S(2)(z) ie S(21) = 8n We now compute (S(3)2 (z)

is not necessary here)

1

2πexp[S(z)]

int infin

minusinfinexp[S2(z)(iτ)22] exp[S4(z)(iτ)44 +O(nτ 5)]dτ

which gives

In(nminus k) sim e2 ln(2)n+(1minusk) ln(2) Q

(2πS(21))12middot

exp[

(A0 + 18 + C216) + (A1 + 14)k minus k24]

n+O(1n2)

(8)

8

To compare our result with Margoliusrsquo we replace n by n+ k and find

In+k(n) =22n+kminus1radicπn

(

q0 minusq0 + q2 minus 2q1

8n+

(q0 minus q1)k

4nminus q0k

2

n+O(nminus2)

)

We have

q0 = Q =infinprod

i=1

(1minus 2minusi)

and

q1 = minus2q0infinsum

i=1

i

2i minus 1

andq22q0

= minusinfinsum

i=1

i(iminus 1)

2i minus 1+(

infinsum

i=1

i

2i minus 1

)2

minusinfinsum

i=1

i2

(2i minus 1)2

Margoliusrsquo form of the constants follows from Eulerrsquos pentagonal theorem [1]

Q(z) =infinprod

i=1

(1minus zi) =sum

iisinZ

(minus1)iz i(3iminus1)2

and differentiationsq1 =

sum

iisinZ

(minus1)ii(3iminus 1)2minusi(3iminus1)

2

respectively

q2 =sum

iisinZ

(minus1)ii(3iminus 1)(i(3iminus 1)

2minus 1

)

2minusi(3iminus1)

2

In our formula k can be negative as well (which was excluded in Margoliusrsquo analysis)Figure 7 gives for n = 300 In(n minus k) normalized by the first two terms of (8) together

with the 1n correction in (8) the result is a bell shaped curve which is perhaps not toounexpected Figure 8 shows the quotient of In(nminus k) and the asymptotics (8)

4 The case j = αnminus x α gt 0

Of course we must have that αnminusx is an integer For instance we can choose α x integersBut this also covers more general cases for instance Iαn+β(γn+ δ) with α β γ δ integersWe have here zlowast = α(1 + α) We derive to first order

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε = 0

with setting ϕ(i α) = [α(1 + α)]i

C1n(α) = C1(α) +O([α(1 + α)]minusn)

9

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 2: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

-06-04

-020

0204

0608

1

x

-06

-04

-02

0

02

04

06

y

0

05

1

15

Figure 1 |Φ10(z)z11| and the path of integration

Here we show how to extend these results using the saddle point method This leadse g to asymptotics for Iαn+β(γn+ δ) for integer constants α β γ δ and more general onesas well With this technique we will also show the known result that In(j) is asymptoticallynormal

The generating function for the numbers In(j) is given by

Φn(z) =sum

jge0In(j)z

j = (1minus z)minusn

nprod

i=1

(1minus zi)

By Cauchyrsquos theorem

In(j) =1

2πi

int

CΦn(z)

dz

zj+1

where C is say a circle around the origin passing (approximately) through the saddle pointIn Figure 1 the saddle point (near z = 1

2) is shown for n = j = 10

As general references for the application of the saddle point method in enumeration wecite [4 8]

Actually we obtain here local limit theorems with some corrections (=lower order terms)For other such theorems in large deviations of combinatorial distributions see for instanceHwang [5]

The paper is organized as follows Section 2 deals with the Gaussian limit In Section 3we analyze the case j = nminusk that we generalize in Section 4 to the case j = αnminusx α gt 0Section 5 is devoted to the moderate large deviation and Section 6 to the large deviationSection 7 concludes the paper

2

2 The Gaussian limit j = m + xσm = n(nminus 1)4

The Gaussian limit of In(j) is easily derived from the generating function Φn(z) (using theLindeberg-Levy conditions see for instance Feller [3]) this is also reviewed in Margoliusrsquopaper following Sachkovrsquos book [9] Another analysis is given in Bender [2] Indeed thisgenerating function corresponds to a sum for i = 1 n of independent uniform [0iminus 1]random variables As an exercise let us recover this result with the saddle point method

with an additional correction of order 1n We have with Jn = Inn

m = E(Jn) = n(nminus 1)4

σ2 = V(Jn) = n(2n+ 5)(nminus 1)72

We know that

In(j) =1

2πi

int

Ω

eS(z)

zj+1dz

where Ω is inside the analyticity domain of the integrand and encircles the origin SinceΦn(z) is just a polynomial the analyticity restriction can be ignored We split the exponentof the integrand S = ln(Φn(z))minus (j + 1) ln z as follows

S = S1 + S2 (1)

S1 =nsum

i=1

ln(1minus zi)

S2 = minusn ln(1minus z)minus (j + 1) ln z

Set

S(i) =diS

dzi

To use the saddle point method we must find the solution of

S(1)(z) = 0 (2)

Set z = zlowastminusε where here zlowast = 1 (This notation always means that zlowast is the approximatesaddle point and z is the exact saddle point they differ by a quantity that has to be computedto some degree of accuracy) This leads to first order to the equation

[(n+1)24minus3n4minus54minus j]+ [minus(n+1)336+7(n+1)224minus49n72minus9172minus j]ε = 0 (3)

Set j = m + xσ in (3) This shows that asymptotically ε is given by a Puiseux series ofpowers of nminus12 starting with minus6xn32 To obtain the next terms we compute the nextterms in the expansion of (2) ie we first obtain

[(n+ 1)24minus 3n4minus 54minus j] + [minus(n+ 1)336 + 7(n+ 1)224minus 49n72minus 9172minus j]ε

+ [minusj minus 6148minus (n+ 1)324 + 5(n+ 1)216minus 31n48]ε2 = 0 (4)

More generally even powers ε2k lead to a O(n2k+1) middot ε2k term and odd powers ε2k+1 lead to aO(n2k+3) middot ε2k+1 term Now we set j = m+xσ expand into powers of nminus12 and equate each

3

coefficient with 0 This leads successively to a full expansion of ε Note that to obtain a givenprecision of ε it is enough to compute a given finite number of terms in the generalizationof (4) We obtain

ε = minus6xn32 + (9x2minus 5425x3)n52 minus (18x2 + 36)n3

+ x[minus3094230625x4 + 2710x2 minus 20116]n72 +O(1n4) (5)

We have with z = zlowast minus ε

Jn(j) =1

n2πi

int

Ω

exp[

S(z) + S(2)(z)(z minus z)22 +infinsum

l=3

S(l)(z)(z minus z)ll]

dz

(note carefully that the linear term vanishes) Set z = z + iτ This gives

Jn(j) =1

n2πexp[S(z)]

int infin

minusinfinexp

[

S(2)(z)(iτ)22 +infinsum

l=3

S(l)(z)(iτ)ll]

dτ (6)

Let us first analyze S(z) We obtain

S1(z) =nsum

i=1

ln(i) + [minus32 ln(n) + ln(6) + ln(minusx)]n+ 32xradicn+ 4350x2 minus 34

+ [3x8 + 6x+ 2750x3]radicn+ [567912250x4 minus 950x2 + 17316]n+O(nminus32)

S2(z) = [32 ln(n)minus ln(6)minus ln(minusx)]nminus 32xradicnminus 3425x2 + 34

minus [3x8 + 6x+ 2750x3]radicnminus [567912250x4 minus 950x2 + 17316]n+O(nminus32)

and soS(z) = minusx22 + ln(n) +O(nminus32)

Also

S(2)(z) = n336 + (124minus 3100x2)n2 +O(n32)

S(3)(z) = O(n72)

S(4)(z) = minusn5600 +O(n4)

S(l)(z) = O(nl+1) l ge 5

We can now compute (6) for instance by using the classical trick of setting

S(2)(z)(iτ)22 +infinsum

l=3

S(l)(z)(iτ)ll = minusu22

computing τ as a truncated series in u setting dτ = dτdu

du expanding with respect to n andintegrating on [u = minusinfininfin] (This amounts to the reversion of a series) Finally (6) leadsto

Jn sim eminusx22 middot exp[(minus5150 + 2750x2)n+O(nminus32)](2πn336)12 (7)

4

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 2 Jn(j) (circle) and the asymptotics (7) (line) without the 1n term n = 60

Note that S(3)(z) does not contribute to the 1n correctionTo check the effect of the correction we first give in Figure 2 for n = 60 the comparison

between Jn(j) and the asymptotics (7) without the 1n term Figure 3 gives the samecomparison with the constant term minus51(50n) in the correction Figure 4 shows the quotientof Jn(j) and the asymptotics (7) with the constant term minus51(50n) The ldquohatrdquo behaviouralready noticed by Margolius is apparent Finally Figure 5 shows the quotient of Jn(j) andthe asymptotics (7) with the full correction

3 The case j = nminus k

Figure 6 shows the real part of S(z) as given by (1) together with a path Ω through thesaddle point

It is easy to see that here we have zlowast = 12 We obtain to first order

[C1n minus 2j minus 2 + 2n] + [C2n minus 4j minus 4minus 4n]ε = 0

with

C1n = C1 +O(2minusn)

C1 =infinsum

i=1

minus2i2i minus 1

= minus548806777751

C2n = C2 +O(2minusn)

C2 =infinsum

i=1

4i(i2i minus 2i + 1)

(2i minus 1)2= 243761367267

5

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 3 Jn(j) (circle) and the asymptotics (7) (line) with the constant in the 1n termn = 60

096

097

098

099

1

101

700 800 900 1000 1100

Figure 4 Quotient of Jn(j) and the asymptotics (7) with the constant in the 1n termn = 60

6

09

092

094

096

098

1

700 800 900 1000 1100

Figure 5 Quotient of Jn(j) and the asymptotics (7) with the full 1n term n = 60

ndash04 ndash02 0 02 04 06 08 1 12 14x

ndash04

ndash02

0

02

04

y

10

11

12

13

14

Figure 6 Real part of S(z) Saddle-point and path n = 10 k = 0

7

Set j = n minus k This shows that asymptotically ε is given by a Laurent series of powers ofnminus1 starting with (k minus 1 + C12)(4n) Next we obtain

[C1 minus 2j minus 2 + 2n] + [C2 minus 4j minus 4minus 4n]ε+ [C3 + 8nminus 8j minus 8]ε2 = 0

for some constant C3 More generally powers ε2k lead to a O(1) middotε2k term powers ε2k+1 leadto a O(n) middot ε2k+1 term This gives the estimate

ε = (k minus 1 + C12)(4n) + (2k minus 2 + C1)(4k minus 4 + C2)(64n2) +O(1n3)

Now we deriveS1(z) = ln(Q)minus C1(k minus 1 + C12)(4n) +O(1n2)

with Q =prodinfin

i=1(1minus 12i) = 288788095086 Similarly

S2(z) = 2 ln(2)n+ (1minus k) ln(2) + (minusk22 + k minus 12 + C218)(2n) +O(1n2)

and so

S(z) = ln(Q) + 2 ln(2)n+ (1minus k) ln(2) + (A0 + A1k minus k24)n+O(1n2)

with

A0 = minus(C1 minus 2)216

A1 = (minusC12 + 1)2

Now we turn to the derivatives of S We will analyze with some precision S (2) S(3) S(4)

(the exact number of needed terms is defined by the precision we want in the final result)

Note that from S(3) on only S(l)2 must be computed as S

(l)1 (z) = O(1) This leads to

S(2)(z) = 8n+ (minusC2 minus 4k + 4) +O(1n)

S(3)2 (z) = O(1)

S(4)2 (z) = 192n+O(1)

S(l)2 (z) = O(n) l ge 5

We denote by S(21) the dominant term of S(2)(z) ie S(21) = 8n We now compute (S(3)2 (z)

is not necessary here)

1

2πexp[S(z)]

int infin

minusinfinexp[S2(z)(iτ)22] exp[S4(z)(iτ)44 +O(nτ 5)]dτ

which gives

In(nminus k) sim e2 ln(2)n+(1minusk) ln(2) Q

(2πS(21))12middot

exp[

(A0 + 18 + C216) + (A1 + 14)k minus k24]

n+O(1n2)

(8)

8

To compare our result with Margoliusrsquo we replace n by n+ k and find

In+k(n) =22n+kminus1radicπn

(

q0 minusq0 + q2 minus 2q1

8n+

(q0 minus q1)k

4nminus q0k

2

n+O(nminus2)

)

We have

q0 = Q =infinprod

i=1

(1minus 2minusi)

and

q1 = minus2q0infinsum

i=1

i

2i minus 1

andq22q0

= minusinfinsum

i=1

i(iminus 1)

2i minus 1+(

infinsum

i=1

i

2i minus 1

)2

minusinfinsum

i=1

i2

(2i minus 1)2

Margoliusrsquo form of the constants follows from Eulerrsquos pentagonal theorem [1]

Q(z) =infinprod

i=1

(1minus zi) =sum

iisinZ

(minus1)iz i(3iminus1)2

and differentiationsq1 =

sum

iisinZ

(minus1)ii(3iminus 1)2minusi(3iminus1)

2

respectively

q2 =sum

iisinZ

(minus1)ii(3iminus 1)(i(3iminus 1)

2minus 1

)

2minusi(3iminus1)

2

In our formula k can be negative as well (which was excluded in Margoliusrsquo analysis)Figure 7 gives for n = 300 In(n minus k) normalized by the first two terms of (8) together

with the 1n correction in (8) the result is a bell shaped curve which is perhaps not toounexpected Figure 8 shows the quotient of In(nminus k) and the asymptotics (8)

4 The case j = αnminus x α gt 0

Of course we must have that αnminusx is an integer For instance we can choose α x integersBut this also covers more general cases for instance Iαn+β(γn+ δ) with α β γ δ integersWe have here zlowast = α(1 + α) We derive to first order

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε = 0

with setting ϕ(i α) = [α(1 + α)]i

C1n(α) = C1(α) +O([α(1 + α)]minusn)

9

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 3: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

2 The Gaussian limit j = m + xσm = n(nminus 1)4

The Gaussian limit of In(j) is easily derived from the generating function Φn(z) (using theLindeberg-Levy conditions see for instance Feller [3]) this is also reviewed in Margoliusrsquopaper following Sachkovrsquos book [9] Another analysis is given in Bender [2] Indeed thisgenerating function corresponds to a sum for i = 1 n of independent uniform [0iminus 1]random variables As an exercise let us recover this result with the saddle point method

with an additional correction of order 1n We have with Jn = Inn

m = E(Jn) = n(nminus 1)4

σ2 = V(Jn) = n(2n+ 5)(nminus 1)72

We know that

In(j) =1

2πi

int

Ω

eS(z)

zj+1dz

where Ω is inside the analyticity domain of the integrand and encircles the origin SinceΦn(z) is just a polynomial the analyticity restriction can be ignored We split the exponentof the integrand S = ln(Φn(z))minus (j + 1) ln z as follows

S = S1 + S2 (1)

S1 =nsum

i=1

ln(1minus zi)

S2 = minusn ln(1minus z)minus (j + 1) ln z

Set

S(i) =diS

dzi

To use the saddle point method we must find the solution of

S(1)(z) = 0 (2)

Set z = zlowastminusε where here zlowast = 1 (This notation always means that zlowast is the approximatesaddle point and z is the exact saddle point they differ by a quantity that has to be computedto some degree of accuracy) This leads to first order to the equation

[(n+1)24minus3n4minus54minus j]+ [minus(n+1)336+7(n+1)224minus49n72minus9172minus j]ε = 0 (3)

Set j = m + xσ in (3) This shows that asymptotically ε is given by a Puiseux series ofpowers of nminus12 starting with minus6xn32 To obtain the next terms we compute the nextterms in the expansion of (2) ie we first obtain

[(n+ 1)24minus 3n4minus 54minus j] + [minus(n+ 1)336 + 7(n+ 1)224minus 49n72minus 9172minus j]ε

+ [minusj minus 6148minus (n+ 1)324 + 5(n+ 1)216minus 31n48]ε2 = 0 (4)

More generally even powers ε2k lead to a O(n2k+1) middot ε2k term and odd powers ε2k+1 lead to aO(n2k+3) middot ε2k+1 term Now we set j = m+xσ expand into powers of nminus12 and equate each

3

coefficient with 0 This leads successively to a full expansion of ε Note that to obtain a givenprecision of ε it is enough to compute a given finite number of terms in the generalizationof (4) We obtain

ε = minus6xn32 + (9x2minus 5425x3)n52 minus (18x2 + 36)n3

+ x[minus3094230625x4 + 2710x2 minus 20116]n72 +O(1n4) (5)

We have with z = zlowast minus ε

Jn(j) =1

n2πi

int

Ω

exp[

S(z) + S(2)(z)(z minus z)22 +infinsum

l=3

S(l)(z)(z minus z)ll]

dz

(note carefully that the linear term vanishes) Set z = z + iτ This gives

Jn(j) =1

n2πexp[S(z)]

int infin

minusinfinexp

[

S(2)(z)(iτ)22 +infinsum

l=3

S(l)(z)(iτ)ll]

dτ (6)

Let us first analyze S(z) We obtain

S1(z) =nsum

i=1

ln(i) + [minus32 ln(n) + ln(6) + ln(minusx)]n+ 32xradicn+ 4350x2 minus 34

+ [3x8 + 6x+ 2750x3]radicn+ [567912250x4 minus 950x2 + 17316]n+O(nminus32)

S2(z) = [32 ln(n)minus ln(6)minus ln(minusx)]nminus 32xradicnminus 3425x2 + 34

minus [3x8 + 6x+ 2750x3]radicnminus [567912250x4 minus 950x2 + 17316]n+O(nminus32)

and soS(z) = minusx22 + ln(n) +O(nminus32)

Also

S(2)(z) = n336 + (124minus 3100x2)n2 +O(n32)

S(3)(z) = O(n72)

S(4)(z) = minusn5600 +O(n4)

S(l)(z) = O(nl+1) l ge 5

We can now compute (6) for instance by using the classical trick of setting

S(2)(z)(iτ)22 +infinsum

l=3

S(l)(z)(iτ)ll = minusu22

computing τ as a truncated series in u setting dτ = dτdu

du expanding with respect to n andintegrating on [u = minusinfininfin] (This amounts to the reversion of a series) Finally (6) leadsto

Jn sim eminusx22 middot exp[(minus5150 + 2750x2)n+O(nminus32)](2πn336)12 (7)

4

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 2 Jn(j) (circle) and the asymptotics (7) (line) without the 1n term n = 60

Note that S(3)(z) does not contribute to the 1n correctionTo check the effect of the correction we first give in Figure 2 for n = 60 the comparison

between Jn(j) and the asymptotics (7) without the 1n term Figure 3 gives the samecomparison with the constant term minus51(50n) in the correction Figure 4 shows the quotientof Jn(j) and the asymptotics (7) with the constant term minus51(50n) The ldquohatrdquo behaviouralready noticed by Margolius is apparent Finally Figure 5 shows the quotient of Jn(j) andthe asymptotics (7) with the full correction

3 The case j = nminus k

Figure 6 shows the real part of S(z) as given by (1) together with a path Ω through thesaddle point

It is easy to see that here we have zlowast = 12 We obtain to first order

[C1n minus 2j minus 2 + 2n] + [C2n minus 4j minus 4minus 4n]ε = 0

with

C1n = C1 +O(2minusn)

C1 =infinsum

i=1

minus2i2i minus 1

= minus548806777751

C2n = C2 +O(2minusn)

C2 =infinsum

i=1

4i(i2i minus 2i + 1)

(2i minus 1)2= 243761367267

5

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 3 Jn(j) (circle) and the asymptotics (7) (line) with the constant in the 1n termn = 60

096

097

098

099

1

101

700 800 900 1000 1100

Figure 4 Quotient of Jn(j) and the asymptotics (7) with the constant in the 1n termn = 60

6

09

092

094

096

098

1

700 800 900 1000 1100

Figure 5 Quotient of Jn(j) and the asymptotics (7) with the full 1n term n = 60

ndash04 ndash02 0 02 04 06 08 1 12 14x

ndash04

ndash02

0

02

04

y

10

11

12

13

14

Figure 6 Real part of S(z) Saddle-point and path n = 10 k = 0

7

Set j = n minus k This shows that asymptotically ε is given by a Laurent series of powers ofnminus1 starting with (k minus 1 + C12)(4n) Next we obtain

[C1 minus 2j minus 2 + 2n] + [C2 minus 4j minus 4minus 4n]ε+ [C3 + 8nminus 8j minus 8]ε2 = 0

for some constant C3 More generally powers ε2k lead to a O(1) middotε2k term powers ε2k+1 leadto a O(n) middot ε2k+1 term This gives the estimate

ε = (k minus 1 + C12)(4n) + (2k minus 2 + C1)(4k minus 4 + C2)(64n2) +O(1n3)

Now we deriveS1(z) = ln(Q)minus C1(k minus 1 + C12)(4n) +O(1n2)

with Q =prodinfin

i=1(1minus 12i) = 288788095086 Similarly

S2(z) = 2 ln(2)n+ (1minus k) ln(2) + (minusk22 + k minus 12 + C218)(2n) +O(1n2)

and so

S(z) = ln(Q) + 2 ln(2)n+ (1minus k) ln(2) + (A0 + A1k minus k24)n+O(1n2)

with

A0 = minus(C1 minus 2)216

A1 = (minusC12 + 1)2

Now we turn to the derivatives of S We will analyze with some precision S (2) S(3) S(4)

(the exact number of needed terms is defined by the precision we want in the final result)

Note that from S(3) on only S(l)2 must be computed as S

(l)1 (z) = O(1) This leads to

S(2)(z) = 8n+ (minusC2 minus 4k + 4) +O(1n)

S(3)2 (z) = O(1)

S(4)2 (z) = 192n+O(1)

S(l)2 (z) = O(n) l ge 5

We denote by S(21) the dominant term of S(2)(z) ie S(21) = 8n We now compute (S(3)2 (z)

is not necessary here)

1

2πexp[S(z)]

int infin

minusinfinexp[S2(z)(iτ)22] exp[S4(z)(iτ)44 +O(nτ 5)]dτ

which gives

In(nminus k) sim e2 ln(2)n+(1minusk) ln(2) Q

(2πS(21))12middot

exp[

(A0 + 18 + C216) + (A1 + 14)k minus k24]

n+O(1n2)

(8)

8

To compare our result with Margoliusrsquo we replace n by n+ k and find

In+k(n) =22n+kminus1radicπn

(

q0 minusq0 + q2 minus 2q1

8n+

(q0 minus q1)k

4nminus q0k

2

n+O(nminus2)

)

We have

q0 = Q =infinprod

i=1

(1minus 2minusi)

and

q1 = minus2q0infinsum

i=1

i

2i minus 1

andq22q0

= minusinfinsum

i=1

i(iminus 1)

2i minus 1+(

infinsum

i=1

i

2i minus 1

)2

minusinfinsum

i=1

i2

(2i minus 1)2

Margoliusrsquo form of the constants follows from Eulerrsquos pentagonal theorem [1]

Q(z) =infinprod

i=1

(1minus zi) =sum

iisinZ

(minus1)iz i(3iminus1)2

and differentiationsq1 =

sum

iisinZ

(minus1)ii(3iminus 1)2minusi(3iminus1)

2

respectively

q2 =sum

iisinZ

(minus1)ii(3iminus 1)(i(3iminus 1)

2minus 1

)

2minusi(3iminus1)

2

In our formula k can be negative as well (which was excluded in Margoliusrsquo analysis)Figure 7 gives for n = 300 In(n minus k) normalized by the first two terms of (8) together

with the 1n correction in (8) the result is a bell shaped curve which is perhaps not toounexpected Figure 8 shows the quotient of In(nminus k) and the asymptotics (8)

4 The case j = αnminus x α gt 0

Of course we must have that αnminusx is an integer For instance we can choose α x integersBut this also covers more general cases for instance Iαn+β(γn+ δ) with α β γ δ integersWe have here zlowast = α(1 + α) We derive to first order

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε = 0

with setting ϕ(i α) = [α(1 + α)]i

C1n(α) = C1(α) +O([α(1 + α)]minusn)

9

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 4: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

coefficient with 0 This leads successively to a full expansion of ε Note that to obtain a givenprecision of ε it is enough to compute a given finite number of terms in the generalizationof (4) We obtain

ε = minus6xn32 + (9x2minus 5425x3)n52 minus (18x2 + 36)n3

+ x[minus3094230625x4 + 2710x2 minus 20116]n72 +O(1n4) (5)

We have with z = zlowast minus ε

Jn(j) =1

n2πi

int

Ω

exp[

S(z) + S(2)(z)(z minus z)22 +infinsum

l=3

S(l)(z)(z minus z)ll]

dz

(note carefully that the linear term vanishes) Set z = z + iτ This gives

Jn(j) =1

n2πexp[S(z)]

int infin

minusinfinexp

[

S(2)(z)(iτ)22 +infinsum

l=3

S(l)(z)(iτ)ll]

dτ (6)

Let us first analyze S(z) We obtain

S1(z) =nsum

i=1

ln(i) + [minus32 ln(n) + ln(6) + ln(minusx)]n+ 32xradicn+ 4350x2 minus 34

+ [3x8 + 6x+ 2750x3]radicn+ [567912250x4 minus 950x2 + 17316]n+O(nminus32)

S2(z) = [32 ln(n)minus ln(6)minus ln(minusx)]nminus 32xradicnminus 3425x2 + 34

minus [3x8 + 6x+ 2750x3]radicnminus [567912250x4 minus 950x2 + 17316]n+O(nminus32)

and soS(z) = minusx22 + ln(n) +O(nminus32)

Also

S(2)(z) = n336 + (124minus 3100x2)n2 +O(n32)

S(3)(z) = O(n72)

S(4)(z) = minusn5600 +O(n4)

S(l)(z) = O(nl+1) l ge 5

We can now compute (6) for instance by using the classical trick of setting

S(2)(z)(iτ)22 +infinsum

l=3

S(l)(z)(iτ)ll = minusu22

computing τ as a truncated series in u setting dτ = dτdu

du expanding with respect to n andintegrating on [u = minusinfininfin] (This amounts to the reversion of a series) Finally (6) leadsto

Jn sim eminusx22 middot exp[(minus5150 + 2750x2)n+O(nminus32)](2πn336)12 (7)

4

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 2 Jn(j) (circle) and the asymptotics (7) (line) without the 1n term n = 60

Note that S(3)(z) does not contribute to the 1n correctionTo check the effect of the correction we first give in Figure 2 for n = 60 the comparison

between Jn(j) and the asymptotics (7) without the 1n term Figure 3 gives the samecomparison with the constant term minus51(50n) in the correction Figure 4 shows the quotientof Jn(j) and the asymptotics (7) with the constant term minus51(50n) The ldquohatrdquo behaviouralready noticed by Margolius is apparent Finally Figure 5 shows the quotient of Jn(j) andthe asymptotics (7) with the full correction

3 The case j = nminus k

Figure 6 shows the real part of S(z) as given by (1) together with a path Ω through thesaddle point

It is easy to see that here we have zlowast = 12 We obtain to first order

[C1n minus 2j minus 2 + 2n] + [C2n minus 4j minus 4minus 4n]ε = 0

with

C1n = C1 +O(2minusn)

C1 =infinsum

i=1

minus2i2i minus 1

= minus548806777751

C2n = C2 +O(2minusn)

C2 =infinsum

i=1

4i(i2i minus 2i + 1)

(2i minus 1)2= 243761367267

5

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 3 Jn(j) (circle) and the asymptotics (7) (line) with the constant in the 1n termn = 60

096

097

098

099

1

101

700 800 900 1000 1100

Figure 4 Quotient of Jn(j) and the asymptotics (7) with the constant in the 1n termn = 60

6

09

092

094

096

098

1

700 800 900 1000 1100

Figure 5 Quotient of Jn(j) and the asymptotics (7) with the full 1n term n = 60

ndash04 ndash02 0 02 04 06 08 1 12 14x

ndash04

ndash02

0

02

04

y

10

11

12

13

14

Figure 6 Real part of S(z) Saddle-point and path n = 10 k = 0

7

Set j = n minus k This shows that asymptotically ε is given by a Laurent series of powers ofnminus1 starting with (k minus 1 + C12)(4n) Next we obtain

[C1 minus 2j minus 2 + 2n] + [C2 minus 4j minus 4minus 4n]ε+ [C3 + 8nminus 8j minus 8]ε2 = 0

for some constant C3 More generally powers ε2k lead to a O(1) middotε2k term powers ε2k+1 leadto a O(n) middot ε2k+1 term This gives the estimate

ε = (k minus 1 + C12)(4n) + (2k minus 2 + C1)(4k minus 4 + C2)(64n2) +O(1n3)

Now we deriveS1(z) = ln(Q)minus C1(k minus 1 + C12)(4n) +O(1n2)

with Q =prodinfin

i=1(1minus 12i) = 288788095086 Similarly

S2(z) = 2 ln(2)n+ (1minus k) ln(2) + (minusk22 + k minus 12 + C218)(2n) +O(1n2)

and so

S(z) = ln(Q) + 2 ln(2)n+ (1minus k) ln(2) + (A0 + A1k minus k24)n+O(1n2)

with

A0 = minus(C1 minus 2)216

A1 = (minusC12 + 1)2

Now we turn to the derivatives of S We will analyze with some precision S (2) S(3) S(4)

(the exact number of needed terms is defined by the precision we want in the final result)

Note that from S(3) on only S(l)2 must be computed as S

(l)1 (z) = O(1) This leads to

S(2)(z) = 8n+ (minusC2 minus 4k + 4) +O(1n)

S(3)2 (z) = O(1)

S(4)2 (z) = 192n+O(1)

S(l)2 (z) = O(n) l ge 5

We denote by S(21) the dominant term of S(2)(z) ie S(21) = 8n We now compute (S(3)2 (z)

is not necessary here)

1

2πexp[S(z)]

int infin

minusinfinexp[S2(z)(iτ)22] exp[S4(z)(iτ)44 +O(nτ 5)]dτ

which gives

In(nminus k) sim e2 ln(2)n+(1minusk) ln(2) Q

(2πS(21))12middot

exp[

(A0 + 18 + C216) + (A1 + 14)k minus k24]

n+O(1n2)

(8)

8

To compare our result with Margoliusrsquo we replace n by n+ k and find

In+k(n) =22n+kminus1radicπn

(

q0 minusq0 + q2 minus 2q1

8n+

(q0 minus q1)k

4nminus q0k

2

n+O(nminus2)

)

We have

q0 = Q =infinprod

i=1

(1minus 2minusi)

and

q1 = minus2q0infinsum

i=1

i

2i minus 1

andq22q0

= minusinfinsum

i=1

i(iminus 1)

2i minus 1+(

infinsum

i=1

i

2i minus 1

)2

minusinfinsum

i=1

i2

(2i minus 1)2

Margoliusrsquo form of the constants follows from Eulerrsquos pentagonal theorem [1]

Q(z) =infinprod

i=1

(1minus zi) =sum

iisinZ

(minus1)iz i(3iminus1)2

and differentiationsq1 =

sum

iisinZ

(minus1)ii(3iminus 1)2minusi(3iminus1)

2

respectively

q2 =sum

iisinZ

(minus1)ii(3iminus 1)(i(3iminus 1)

2minus 1

)

2minusi(3iminus1)

2

In our formula k can be negative as well (which was excluded in Margoliusrsquo analysis)Figure 7 gives for n = 300 In(n minus k) normalized by the first two terms of (8) together

with the 1n correction in (8) the result is a bell shaped curve which is perhaps not toounexpected Figure 8 shows the quotient of In(nminus k) and the asymptotics (8)

4 The case j = αnminus x α gt 0

Of course we must have that αnminusx is an integer For instance we can choose α x integersBut this also covers more general cases for instance Iαn+β(γn+ δ) with α β γ δ integersWe have here zlowast = α(1 + α) We derive to first order

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε = 0

with setting ϕ(i α) = [α(1 + α)]i

C1n(α) = C1(α) +O([α(1 + α)]minusn)

9

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 5: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 2 Jn(j) (circle) and the asymptotics (7) (line) without the 1n term n = 60

Note that S(3)(z) does not contribute to the 1n correctionTo check the effect of the correction we first give in Figure 2 for n = 60 the comparison

between Jn(j) and the asymptotics (7) without the 1n term Figure 3 gives the samecomparison with the constant term minus51(50n) in the correction Figure 4 shows the quotientof Jn(j) and the asymptotics (7) with the constant term minus51(50n) The ldquohatrdquo behaviouralready noticed by Margolius is apparent Finally Figure 5 shows the quotient of Jn(j) andthe asymptotics (7) with the full correction

3 The case j = nminus k

Figure 6 shows the real part of S(z) as given by (1) together with a path Ω through thesaddle point

It is easy to see that here we have zlowast = 12 We obtain to first order

[C1n minus 2j minus 2 + 2n] + [C2n minus 4j minus 4minus 4n]ε = 0

with

C1n = C1 +O(2minusn)

C1 =infinsum

i=1

minus2i2i minus 1

= minus548806777751

C2n = C2 +O(2minusn)

C2 =infinsum

i=1

4i(i2i minus 2i + 1)

(2i minus 1)2= 243761367267

5

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 3 Jn(j) (circle) and the asymptotics (7) (line) with the constant in the 1n termn = 60

096

097

098

099

1

101

700 800 900 1000 1100

Figure 4 Quotient of Jn(j) and the asymptotics (7) with the constant in the 1n termn = 60

6

09

092

094

096

098

1

700 800 900 1000 1100

Figure 5 Quotient of Jn(j) and the asymptotics (7) with the full 1n term n = 60

ndash04 ndash02 0 02 04 06 08 1 12 14x

ndash04

ndash02

0

02

04

y

10

11

12

13

14

Figure 6 Real part of S(z) Saddle-point and path n = 10 k = 0

7

Set j = n minus k This shows that asymptotically ε is given by a Laurent series of powers ofnminus1 starting with (k minus 1 + C12)(4n) Next we obtain

[C1 minus 2j minus 2 + 2n] + [C2 minus 4j minus 4minus 4n]ε+ [C3 + 8nminus 8j minus 8]ε2 = 0

for some constant C3 More generally powers ε2k lead to a O(1) middotε2k term powers ε2k+1 leadto a O(n) middot ε2k+1 term This gives the estimate

ε = (k minus 1 + C12)(4n) + (2k minus 2 + C1)(4k minus 4 + C2)(64n2) +O(1n3)

Now we deriveS1(z) = ln(Q)minus C1(k minus 1 + C12)(4n) +O(1n2)

with Q =prodinfin

i=1(1minus 12i) = 288788095086 Similarly

S2(z) = 2 ln(2)n+ (1minus k) ln(2) + (minusk22 + k minus 12 + C218)(2n) +O(1n2)

and so

S(z) = ln(Q) + 2 ln(2)n+ (1minus k) ln(2) + (A0 + A1k minus k24)n+O(1n2)

with

A0 = minus(C1 minus 2)216

A1 = (minusC12 + 1)2

Now we turn to the derivatives of S We will analyze with some precision S (2) S(3) S(4)

(the exact number of needed terms is defined by the precision we want in the final result)

Note that from S(3) on only S(l)2 must be computed as S

(l)1 (z) = O(1) This leads to

S(2)(z) = 8n+ (minusC2 minus 4k + 4) +O(1n)

S(3)2 (z) = O(1)

S(4)2 (z) = 192n+O(1)

S(l)2 (z) = O(n) l ge 5

We denote by S(21) the dominant term of S(2)(z) ie S(21) = 8n We now compute (S(3)2 (z)

is not necessary here)

1

2πexp[S(z)]

int infin

minusinfinexp[S2(z)(iτ)22] exp[S4(z)(iτ)44 +O(nτ 5)]dτ

which gives

In(nminus k) sim e2 ln(2)n+(1minusk) ln(2) Q

(2πS(21))12middot

exp[

(A0 + 18 + C216) + (A1 + 14)k minus k24]

n+O(1n2)

(8)

8

To compare our result with Margoliusrsquo we replace n by n+ k and find

In+k(n) =22n+kminus1radicπn

(

q0 minusq0 + q2 minus 2q1

8n+

(q0 minus q1)k

4nminus q0k

2

n+O(nminus2)

)

We have

q0 = Q =infinprod

i=1

(1minus 2minusi)

and

q1 = minus2q0infinsum

i=1

i

2i minus 1

andq22q0

= minusinfinsum

i=1

i(iminus 1)

2i minus 1+(

infinsum

i=1

i

2i minus 1

)2

minusinfinsum

i=1

i2

(2i minus 1)2

Margoliusrsquo form of the constants follows from Eulerrsquos pentagonal theorem [1]

Q(z) =infinprod

i=1

(1minus zi) =sum

iisinZ

(minus1)iz i(3iminus1)2

and differentiationsq1 =

sum

iisinZ

(minus1)ii(3iminus 1)2minusi(3iminus1)

2

respectively

q2 =sum

iisinZ

(minus1)ii(3iminus 1)(i(3iminus 1)

2minus 1

)

2minusi(3iminus1)

2

In our formula k can be negative as well (which was excluded in Margoliusrsquo analysis)Figure 7 gives for n = 300 In(n minus k) normalized by the first two terms of (8) together

with the 1n correction in (8) the result is a bell shaped curve which is perhaps not toounexpected Figure 8 shows the quotient of In(nminus k) and the asymptotics (8)

4 The case j = αnminus x α gt 0

Of course we must have that αnminusx is an integer For instance we can choose α x integersBut this also covers more general cases for instance Iαn+β(γn+ δ) with α β γ δ integersWe have here zlowast = α(1 + α) We derive to first order

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε = 0

with setting ϕ(i α) = [α(1 + α)]i

C1n(α) = C1(α) +O([α(1 + α)]minusn)

9

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 6: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

0

0001

0002

0003

0004

0005

700 800 900 1000 1100j

Figure 3 Jn(j) (circle) and the asymptotics (7) (line) with the constant in the 1n termn = 60

096

097

098

099

1

101

700 800 900 1000 1100

Figure 4 Quotient of Jn(j) and the asymptotics (7) with the constant in the 1n termn = 60

6

09

092

094

096

098

1

700 800 900 1000 1100

Figure 5 Quotient of Jn(j) and the asymptotics (7) with the full 1n term n = 60

ndash04 ndash02 0 02 04 06 08 1 12 14x

ndash04

ndash02

0

02

04

y

10

11

12

13

14

Figure 6 Real part of S(z) Saddle-point and path n = 10 k = 0

7

Set j = n minus k This shows that asymptotically ε is given by a Laurent series of powers ofnminus1 starting with (k minus 1 + C12)(4n) Next we obtain

[C1 minus 2j minus 2 + 2n] + [C2 minus 4j minus 4minus 4n]ε+ [C3 + 8nminus 8j minus 8]ε2 = 0

for some constant C3 More generally powers ε2k lead to a O(1) middotε2k term powers ε2k+1 leadto a O(n) middot ε2k+1 term This gives the estimate

ε = (k minus 1 + C12)(4n) + (2k minus 2 + C1)(4k minus 4 + C2)(64n2) +O(1n3)

Now we deriveS1(z) = ln(Q)minus C1(k minus 1 + C12)(4n) +O(1n2)

with Q =prodinfin

i=1(1minus 12i) = 288788095086 Similarly

S2(z) = 2 ln(2)n+ (1minus k) ln(2) + (minusk22 + k minus 12 + C218)(2n) +O(1n2)

and so

S(z) = ln(Q) + 2 ln(2)n+ (1minus k) ln(2) + (A0 + A1k minus k24)n+O(1n2)

with

A0 = minus(C1 minus 2)216

A1 = (minusC12 + 1)2

Now we turn to the derivatives of S We will analyze with some precision S (2) S(3) S(4)

(the exact number of needed terms is defined by the precision we want in the final result)

Note that from S(3) on only S(l)2 must be computed as S

(l)1 (z) = O(1) This leads to

S(2)(z) = 8n+ (minusC2 minus 4k + 4) +O(1n)

S(3)2 (z) = O(1)

S(4)2 (z) = 192n+O(1)

S(l)2 (z) = O(n) l ge 5

We denote by S(21) the dominant term of S(2)(z) ie S(21) = 8n We now compute (S(3)2 (z)

is not necessary here)

1

2πexp[S(z)]

int infin

minusinfinexp[S2(z)(iτ)22] exp[S4(z)(iτ)44 +O(nτ 5)]dτ

which gives

In(nminus k) sim e2 ln(2)n+(1minusk) ln(2) Q

(2πS(21))12middot

exp[

(A0 + 18 + C216) + (A1 + 14)k minus k24]

n+O(1n2)

(8)

8

To compare our result with Margoliusrsquo we replace n by n+ k and find

In+k(n) =22n+kminus1radicπn

(

q0 minusq0 + q2 minus 2q1

8n+

(q0 minus q1)k

4nminus q0k

2

n+O(nminus2)

)

We have

q0 = Q =infinprod

i=1

(1minus 2minusi)

and

q1 = minus2q0infinsum

i=1

i

2i minus 1

andq22q0

= minusinfinsum

i=1

i(iminus 1)

2i minus 1+(

infinsum

i=1

i

2i minus 1

)2

minusinfinsum

i=1

i2

(2i minus 1)2

Margoliusrsquo form of the constants follows from Eulerrsquos pentagonal theorem [1]

Q(z) =infinprod

i=1

(1minus zi) =sum

iisinZ

(minus1)iz i(3iminus1)2

and differentiationsq1 =

sum

iisinZ

(minus1)ii(3iminus 1)2minusi(3iminus1)

2

respectively

q2 =sum

iisinZ

(minus1)ii(3iminus 1)(i(3iminus 1)

2minus 1

)

2minusi(3iminus1)

2

In our formula k can be negative as well (which was excluded in Margoliusrsquo analysis)Figure 7 gives for n = 300 In(n minus k) normalized by the first two terms of (8) together

with the 1n correction in (8) the result is a bell shaped curve which is perhaps not toounexpected Figure 8 shows the quotient of In(nminus k) and the asymptotics (8)

4 The case j = αnminus x α gt 0

Of course we must have that αnminusx is an integer For instance we can choose α x integersBut this also covers more general cases for instance Iαn+β(γn+ δ) with α β γ δ integersWe have here zlowast = α(1 + α) We derive to first order

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε = 0

with setting ϕ(i α) = [α(1 + α)]i

C1n(α) = C1(α) +O([α(1 + α)]minusn)

9

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 7: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

09

092

094

096

098

1

700 800 900 1000 1100

Figure 5 Quotient of Jn(j) and the asymptotics (7) with the full 1n term n = 60

ndash04 ndash02 0 02 04 06 08 1 12 14x

ndash04

ndash02

0

02

04

y

10

11

12

13

14

Figure 6 Real part of S(z) Saddle-point and path n = 10 k = 0

7

Set j = n minus k This shows that asymptotically ε is given by a Laurent series of powers ofnminus1 starting with (k minus 1 + C12)(4n) Next we obtain

[C1 minus 2j minus 2 + 2n] + [C2 minus 4j minus 4minus 4n]ε+ [C3 + 8nminus 8j minus 8]ε2 = 0

for some constant C3 More generally powers ε2k lead to a O(1) middotε2k term powers ε2k+1 leadto a O(n) middot ε2k+1 term This gives the estimate

ε = (k minus 1 + C12)(4n) + (2k minus 2 + C1)(4k minus 4 + C2)(64n2) +O(1n3)

Now we deriveS1(z) = ln(Q)minus C1(k minus 1 + C12)(4n) +O(1n2)

with Q =prodinfin

i=1(1minus 12i) = 288788095086 Similarly

S2(z) = 2 ln(2)n+ (1minus k) ln(2) + (minusk22 + k minus 12 + C218)(2n) +O(1n2)

and so

S(z) = ln(Q) + 2 ln(2)n+ (1minus k) ln(2) + (A0 + A1k minus k24)n+O(1n2)

with

A0 = minus(C1 minus 2)216

A1 = (minusC12 + 1)2

Now we turn to the derivatives of S We will analyze with some precision S (2) S(3) S(4)

(the exact number of needed terms is defined by the precision we want in the final result)

Note that from S(3) on only S(l)2 must be computed as S

(l)1 (z) = O(1) This leads to

S(2)(z) = 8n+ (minusC2 minus 4k + 4) +O(1n)

S(3)2 (z) = O(1)

S(4)2 (z) = 192n+O(1)

S(l)2 (z) = O(n) l ge 5

We denote by S(21) the dominant term of S(2)(z) ie S(21) = 8n We now compute (S(3)2 (z)

is not necessary here)

1

2πexp[S(z)]

int infin

minusinfinexp[S2(z)(iτ)22] exp[S4(z)(iτ)44 +O(nτ 5)]dτ

which gives

In(nminus k) sim e2 ln(2)n+(1minusk) ln(2) Q

(2πS(21))12middot

exp[

(A0 + 18 + C216) + (A1 + 14)k minus k24]

n+O(1n2)

(8)

8

To compare our result with Margoliusrsquo we replace n by n+ k and find

In+k(n) =22n+kminus1radicπn

(

q0 minusq0 + q2 minus 2q1

8n+

(q0 minus q1)k

4nminus q0k

2

n+O(nminus2)

)

We have

q0 = Q =infinprod

i=1

(1minus 2minusi)

and

q1 = minus2q0infinsum

i=1

i

2i minus 1

andq22q0

= minusinfinsum

i=1

i(iminus 1)

2i minus 1+(

infinsum

i=1

i

2i minus 1

)2

minusinfinsum

i=1

i2

(2i minus 1)2

Margoliusrsquo form of the constants follows from Eulerrsquos pentagonal theorem [1]

Q(z) =infinprod

i=1

(1minus zi) =sum

iisinZ

(minus1)iz i(3iminus1)2

and differentiationsq1 =

sum

iisinZ

(minus1)ii(3iminus 1)2minusi(3iminus1)

2

respectively

q2 =sum

iisinZ

(minus1)ii(3iminus 1)(i(3iminus 1)

2minus 1

)

2minusi(3iminus1)

2

In our formula k can be negative as well (which was excluded in Margoliusrsquo analysis)Figure 7 gives for n = 300 In(n minus k) normalized by the first two terms of (8) together

with the 1n correction in (8) the result is a bell shaped curve which is perhaps not toounexpected Figure 8 shows the quotient of In(nminus k) and the asymptotics (8)

4 The case j = αnminus x α gt 0

Of course we must have that αnminusx is an integer For instance we can choose α x integersBut this also covers more general cases for instance Iαn+β(γn+ δ) with α β γ δ integersWe have here zlowast = α(1 + α) We derive to first order

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε = 0

with setting ϕ(i α) = [α(1 + α)]i

C1n(α) = C1(α) +O([α(1 + α)]minusn)

9

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 8: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

Set j = n minus k This shows that asymptotically ε is given by a Laurent series of powers ofnminus1 starting with (k minus 1 + C12)(4n) Next we obtain

[C1 minus 2j minus 2 + 2n] + [C2 minus 4j minus 4minus 4n]ε+ [C3 + 8nminus 8j minus 8]ε2 = 0

for some constant C3 More generally powers ε2k lead to a O(1) middotε2k term powers ε2k+1 leadto a O(n) middot ε2k+1 term This gives the estimate

ε = (k minus 1 + C12)(4n) + (2k minus 2 + C1)(4k minus 4 + C2)(64n2) +O(1n3)

Now we deriveS1(z) = ln(Q)minus C1(k minus 1 + C12)(4n) +O(1n2)

with Q =prodinfin

i=1(1minus 12i) = 288788095086 Similarly

S2(z) = 2 ln(2)n+ (1minus k) ln(2) + (minusk22 + k minus 12 + C218)(2n) +O(1n2)

and so

S(z) = ln(Q) + 2 ln(2)n+ (1minus k) ln(2) + (A0 + A1k minus k24)n+O(1n2)

with

A0 = minus(C1 minus 2)216

A1 = (minusC12 + 1)2

Now we turn to the derivatives of S We will analyze with some precision S (2) S(3) S(4)

(the exact number of needed terms is defined by the precision we want in the final result)

Note that from S(3) on only S(l)2 must be computed as S

(l)1 (z) = O(1) This leads to

S(2)(z) = 8n+ (minusC2 minus 4k + 4) +O(1n)

S(3)2 (z) = O(1)

S(4)2 (z) = 192n+O(1)

S(l)2 (z) = O(n) l ge 5

We denote by S(21) the dominant term of S(2)(z) ie S(21) = 8n We now compute (S(3)2 (z)

is not necessary here)

1

2πexp[S(z)]

int infin

minusinfinexp[S2(z)(iτ)22] exp[S4(z)(iτ)44 +O(nτ 5)]dτ

which gives

In(nminus k) sim e2 ln(2)n+(1minusk) ln(2) Q

(2πS(21))12middot

exp[

(A0 + 18 + C216) + (A1 + 14)k minus k24]

n+O(1n2)

(8)

8

To compare our result with Margoliusrsquo we replace n by n+ k and find

In+k(n) =22n+kminus1radicπn

(

q0 minusq0 + q2 minus 2q1

8n+

(q0 minus q1)k

4nminus q0k

2

n+O(nminus2)

)

We have

q0 = Q =infinprod

i=1

(1minus 2minusi)

and

q1 = minus2q0infinsum

i=1

i

2i minus 1

andq22q0

= minusinfinsum

i=1

i(iminus 1)

2i minus 1+(

infinsum

i=1

i

2i minus 1

)2

minusinfinsum

i=1

i2

(2i minus 1)2

Margoliusrsquo form of the constants follows from Eulerrsquos pentagonal theorem [1]

Q(z) =infinprod

i=1

(1minus zi) =sum

iisinZ

(minus1)iz i(3iminus1)2

and differentiationsq1 =

sum

iisinZ

(minus1)ii(3iminus 1)2minusi(3iminus1)

2

respectively

q2 =sum

iisinZ

(minus1)ii(3iminus 1)(i(3iminus 1)

2minus 1

)

2minusi(3iminus1)

2

In our formula k can be negative as well (which was excluded in Margoliusrsquo analysis)Figure 7 gives for n = 300 In(n minus k) normalized by the first two terms of (8) together

with the 1n correction in (8) the result is a bell shaped curve which is perhaps not toounexpected Figure 8 shows the quotient of In(nminus k) and the asymptotics (8)

4 The case j = αnminus x α gt 0

Of course we must have that αnminusx is an integer For instance we can choose α x integersBut this also covers more general cases for instance Iαn+β(γn+ δ) with α β γ δ integersWe have here zlowast = α(1 + α) We derive to first order

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε = 0

with setting ϕ(i α) = [α(1 + α)]i

C1n(α) = C1(α) +O([α(1 + α)]minusn)

9

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 9: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

To compare our result with Margoliusrsquo we replace n by n+ k and find

In+k(n) =22n+kminus1radicπn

(

q0 minusq0 + q2 minus 2q1

8n+

(q0 minus q1)k

4nminus q0k

2

n+O(nminus2)

)

We have

q0 = Q =infinprod

i=1

(1minus 2minusi)

and

q1 = minus2q0infinsum

i=1

i

2i minus 1

andq22q0

= minusinfinsum

i=1

i(iminus 1)

2i minus 1+(

infinsum

i=1

i

2i minus 1

)2

minusinfinsum

i=1

i2

(2i minus 1)2

Margoliusrsquo form of the constants follows from Eulerrsquos pentagonal theorem [1]

Q(z) =infinprod

i=1

(1minus zi) =sum

iisinZ

(minus1)iz i(3iminus1)2

and differentiationsq1 =

sum

iisinZ

(minus1)ii(3iminus 1)2minusi(3iminus1)

2

respectively

q2 =sum

iisinZ

(minus1)ii(3iminus 1)(i(3iminus 1)

2minus 1

)

2minusi(3iminus1)

2

In our formula k can be negative as well (which was excluded in Margoliusrsquo analysis)Figure 7 gives for n = 300 In(n minus k) normalized by the first two terms of (8) together

with the 1n correction in (8) the result is a bell shaped curve which is perhaps not toounexpected Figure 8 shows the quotient of In(nminus k) and the asymptotics (8)

4 The case j = αnminus x α gt 0

Of course we must have that αnminusx is an integer For instance we can choose α x integersBut this also covers more general cases for instance Iαn+β(γn+ δ) with α β γ δ integersWe have here zlowast = α(1 + α) We derive to first order

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε = 0

with setting ϕ(i α) = [α(1 + α)]i

C1n(α) = C1(α) +O([α(1 + α)]minusn)

9

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 10: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

086

088

09

092

094

096

098

1

285 290 295 300 305 310j

Figure 7 normalized In(n minus k) (circle) and the 1n term in the asymptotics (8) (line)n = 300

0993

0994

0995

0996

0997

0998

0999

1

1001

285 290 295 300 305 310

Figure 8 Quotient of In(nminus k) and the asymptotics (8) n = 300

10

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 11: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

C1(α) =infinsum

i=1

i(1 + α)ϕ(i α)

α[ϕ(i α)minus 1]

C2n(α) = C2(α) +O([α(1 + α)]minusn)

C2(α) =infinsum

i=1

ϕ(i α)i(1 + α)2(iminus 1 + ϕ(i α))[(ϕ(i α)minus 1)2α2]

Set j = αnminus x This leads to

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

Next we obtain

[C1n(α)minus (j + 1)(1 + α)α + (1 + α)n] + [C2n(α)minus (j + 1)(1 + α)2α2 minus (1 + α)2n]ε

+ [C3n(α) + (1 + α)3nminus (j + 1)(1 + α)3α3]ε2 = 0

for some function C3n(α) More generally powers εk lead to a O(n) middot εk term This gives

ε = [x+ αxminus 1minus α + C1α][(1 + α)3n] + (x+ xαminus 1minus α + C1α)timestimes (x+ 2xα + xα2 minus α2 + C1α

2 minus 2α + C2αminus 1minus C1)[(1 + α)6n2] +O(1n3)

Next we derive

S1(z) = ln(Q(α))minus C1[x+ αxminus 1minus α + C1α][(1 + α)3n] +O(1n2)

with

Q(α) =infinprod

i=1

(1minus ϕ(i α)) =infinprod

i=1

(

1minus( α

1 + α

)i)

= Q( α

1 + α

)

Similarly

S2(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ (xminus 1) ln(α(1 + α))

+ (C1α + α + 1)(C1αminus αminus 1)[2α(1 + α)3] + x[α(1 + α)]

minusx2[2α(1 + α)]n+O(1n2)

So

S(z) = [minus ln(1(1 + α))minus α ln(α(1 + α))]n+ ln(Q(α)) + (xminus 1) ln(α(1 + α))

+ minus(C1αminus αminus 1)2[2α(1 + α)3]minus x(C1αminus αminus 1)[α(1 + α)2]minus x2[2α(1 + α)]n+ O(1n2)

The derivatives of S are computed as follows

S(2)(z) = (1 + α)3αnminus (2xα3 + 2C1α3 minus 2α3 + C2α

2 + 3xα2 minus 3α2 minus 2C1αminus x+ 1)α2 +O(1n)

S(3)2 (z) = 2(1 + α3)(α2 minus 1)α2n+O(1)

S(4)2 (z) = 6(1 + α)4(α3 + 1)α3n+O(1)

S(l)2 (z) = O(n) l ge 5

11

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 12: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

04

05

06

07

08

09

1

130 140 150 160 170j

Figure 9 normalized In(αn minus x) (circle) and the 1n term in the asymptotics (10) (line)α = 12 n = 300

We denote by S(21) the dominant term of S(2)(z) eg S(21) = n(1 + α)3α Note that

now S(3)2 (z) = O(n) so we cannot ignore its contribution Of course micro3 = 0 (third moment

of the Gaussian) but micro6 6= 0 so S(3)2 (z) contributes to the 1n term Finally Maple gives us

In(αnminus x) sim e[minus ln(1(1+α))minusα ln(α(1+α))]n+(xminus1) ln(α(1+α)) Q(α)

(2πS(21))12times

times exp[minus(1 + 3α + 4α2 minus 12α2C1 + 6C21α

2 + α4 + 3α3 minus 6C2α2 (9)

minus12C31α)[12α(1 + α)3]]

+x(2α2 minus 2C1α + 3α + 1)[2α(1 + α)2]minus x2[2α(1 + α)]

n+O(1n2)]

Figure 9 gives for α = 12 n = 300 In(αn minus x) normalized by the first two terms of (10)together with the 1n correction in (10) Figure 10 shows the quotient of In(αn minus x) andthe asymptotics (10)

5 The moderate Large deviation j = m + xn74

Now we consider the case j = m + xn74 We have here zlowast = 1 We observe the samebehaviour as in Section 2 for the coefficients of ε in the generalization of (4)

Proceeding as before we see that asymptotically ε is now given by a Puiseux series ofpowers of nminus14 starting with minus36xn54 This leads to

ε = minus36xn54minus116425x3n74+(minus24060499230625x5+54x)n94+F1(x)n52+O(nminus114)

12

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 13: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

096

098

1

102

104

130 140 150 160 170

Figure 10 Quotient of In(αnminus x) and the asymptotics (10) α = 12 n = 300

where F1 is an (unimportant) polynomial of x This leads to

S(z) = ln(n)minus 18x2radicnminus 291625x4 minus 27625x2(69984x4 minus 625)

radicn

minus 145815625x4(minus4375 + 1259712x4)n+O(nminus54)

Also

S(2)(z) = n336 + (124 + 35769630625x4)n2 minus 2725x2n52 +O(n74)

S(3)(z) = minus112n3 +O(n154)

S(4)(z) = minusn5600 +O(n92)

S(l)(z) = O(nl+1) l ge 5

and finally we obtain

Jn sim eminus18x2radicnminus291625x4 times

times exp[

x2(minus1889568625x4 + 116125)radicn

+ (minus5150minus 183666009615625x8 + 1763742630625x4)n

+O(nminus54)]

(2πn336)12 (10)

Note that S(3)(z) does not contribute to the correction and that this correction is equivalentto the Gaussian case when x = 0 Of course the dominant term is null for x = 0

To check the effect of the correction we first give in Figure 11 for n = 60 and x isin[minus1414] the comparison between Jn(j) and the asymptotics (10) without the 1

radicn and

1n term Figure 12 gives the same comparison with the correction Figure 13 shows the

13

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 14: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 11 Jn(j) (circle) and the asymptotics (10) (line) without the 1radicn and 1n term

n = 60

0

0001

0002

0003

0004

0005

600 700 800 900 1000 1100 1200j

Figure 12 Jn(j) (circle) and the asymptotics (10) (line) with the 1radicn and 1n term

n = 60

14

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 15: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

1

101

102

103

104

105

106

107

600 700 800 900 1000 1100 1200

Figure 13 Quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term n = 60

quotient of Jn(j) and the asymptotics (10) with the 1radicn and 1n term

The exponent 74 that we have chosen is of course not sacred any fixed number below2 could also have been considered

6 Large deviations j = αn(nminus 1) 0 lt α lt 12

Here again zlowast = 1 Asymptotically ε is given by a Laurent series of powers of nminus1 buthere the behaviour is quite different all terms of the series generalizing (4) contribute to the

computation of the coefficients It is convenient to analyze separately S(1)1 and S

(1)2 This

gives by substituting

z = 1minus ε j = αn(nminus 1) ε = a1n+ a2n2 + a3n

3 +O(1n4)

and expanding with respect to n

S(1)2 (z) sim (1a1 minus α)n2 + (αminus αa1 minus a2a

21)n+O(1)

S(1)1 (z) sim

nminus1sum

k=0

f(k)

where

f(k) = minus(k + 1)(1minus ε)k[1minus (1minus ε)k+1]

= minus(k + 1)(1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k

1minus (1minus [a1n+ a2n2 + a3n

3 +O(1n4)])k+1

15

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 16: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

This immediately suggests to apply the Euler-Mac Laurin summation formula which givesto first order

S(1)1 (z) sim

int n

0

f(k)dk minus 1

2(f(n)minus f(0))

so we set k = minusuna1 and expand minusf(k)na1 This leads to

int n

0

f(k)dk simint minusa1

0

[

minus ueu

a21(1minus eu)n2 +

eu[2a21 minus 2eua21 minus 2u2a2 minus u2a21 + 2euua21]

2a31(1minus eu)2n

]

du+O(1)

minus1

2(f(n)minus f(0))

sim(

eminusa1

2(1minus eminusa1)minus 1

2a1

)

n+O(1)

This readily gives

int n

0

f(k)dk sim minusdilog(eminusa1)a21n2

+ [2a31eminusa1 + a41e

minusa1 minus 4a2dilog(eminusa1) + 4a2dilog(e

minusa1)eminusa1

+ 2a2a21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]n+O(1)

Combining S(1)1 (z) + S

(1)2 (z) = 0 we see that a1 = a1(α) is the solution of

minusdilog(eminusa1)a21 + 1a1 minus α = 0

We check that limαrarr0 a1(α) =infin limαrarr12 a1(α) = minusinfinSimilarly a2(α) is the solution of the linear equation

αminus αa1 minus a2a21 + eminusa1[2(1minus eminusa1)]minus 1(2a1)

+ [2a31eminusa1 + a41e

minusa1 + 4a2dilog(eminusa1)(eminusa1 minus 1) + 2a2a

21eminusa1 minus 2a21 + 2a21e

minusa1 ][2a31(eminusa1 minus 1)]

= 0

and limαrarr0 a2(α) = minusinfin limαrarr12 a2(α) =infinWe could proceed in the same manner to derive a3(α) but the computation becomes quite

heavy So we have computed an approximate solution a3(α) as follows we have expandedS(1)(z) into powers of ε up to ε19 Then an asymptotic expansion into n leads to a n0

coefficient which is a polynomial of a1 of degree 19 (of degree 2 in a2 and linear in a3)Substituting a1(α) a2(α) immediately gives a3(α) This approximation is satisfactory forα isin [015035] Note that a1(14) = 0 a2(14) = 0 as expected and a3(14) = minus36 Weobtain

S(z) = ln(n) + [172a1(a1 minus 18 + 72α)]n

+ [172a31 minus 14a2 + 14a1 minus a1αminus 548a21 + 136a1a2 + a2α + 12a21α]

+ [172a22 + 136a1a3 minus 14a3 + 14a2 + a1 + a3α + a1a2α + 13a31α

minus a2αminus 12a21αminus 524a1a2 + 124a21a2 + 13144a21 minus 116a31]n+O(1n2)

16

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 17: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200j

Figure 14 normalized Jn(αn(nminus1)) (circle) and the 1n term in the asymptotics (11) (line)n = 80

Note that the three terms of S(z) are null for α = 14 as expected This leads to

S(2)(z) = n336 + (minus524 + 112a1 + α)n2 +O(n)

S(3)(z) = 1600a1n4 +O(n3)

S(4)(z) = minusn5600 +O(n4)

S(l)2 (z) = O(nl+1) l ge 5

Finally

Jn(αn(nminus 1))

sim e[172a1(a1minus18+72α)]n+[172a31minus14a2+14a1minusa1αminus548a2

1+136a1a2+a2α+12a21α]

1

(2πn336)12times

times exp[(172a22 + 136a1a3 minus 14a3 + 14a2 minus 12a1 + a3α + a1a2α + 13a31αminus a2α

minus 12a21αminus 524a1a2 + 124a21a2 + 113918000a21 minus 116a31 + 8725minus 18α)n

+ O(1n2)] (11)

Note that for α = 14 the 1n term gives minus5150 again as expectedFigure 14 gives for n = 80 and α isin [015035] Jn(αn(n minus 1)) normalized by the first

two terms of (11) together with the 1n correction in (11) Figure 15 shows the quotient ofJn(αn(nminus 1)) and the asymptotics (11)

17

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 18: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

04

05

06

07

08

09

1

1000 1200 1400 1600 1800 2000 2200

Figure 15 Quotient of Jn(αn(nminus 1)) and the asymptotics (11) n = 80

7 Conclusion

Once more the saddle point method revealed itself as a powerful tool for asymptotic analysisWith careful human guidance the computational operations are almost automatic and canbe performed to any degree of accuracy with the help of some computer algebra at least inprinciple This allowed us to include correction terms in our asymptotic formulaelig where wehave covered all ranges of interest and one can see their effect in the figures displayed

An interesting open problem would be to extend our results to qminusanalogues (see forinstance [6])

8 Acknowledgments

The pertinent comments of the referee led to improvements in the presentation

References

[1] GE Andrews The Theory of Partitions volume 2 of Encyclopedia of Mathematics and

its Applications AddisonndashWesley 1976

[2] EA Bender Central and local limit theorems applied to asymptotics enumerationJournal of Combinatorial Theory Series A 15 (1973) 91ndash111

[3] W Feller Introduction to Probability Theory and its Applications Vol I Wiley 1968

18

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19

Page 19: The Number of Inversions in Permutations: A Saddle Point Approach · 2003-07-23 · 23 11 Article 03.2.8 2 Journal of Integer Sequences, Vol. 6 (2003), 3 6 1 47 The Number of Inversions

[4] P Flajolet and R Sedgewick Analytic combinatoricsmdashsymbolic combinatorics Saddlepoint asymptotics Technical Report 2376 INRIA 1994

[5] HK Hwang Large deviations of combinatorial distributions II Local limit theoremsAnnals of Applied Probability 8 (1998) 163ndash181

[6] H Prodinger Combinatorics of geometrically distributed random variables Inversionsand a parameter of Knuth Annals of Combinatorics 5 (2001) 241ndash250

[7] BH Margolius Permutations with inversions Journal of Integer Sequences 4 (2001)1ndash13

[8] A Odlyzko Asymptotic enumeration methods In R Graham M Gotschel and LLovasz eds Handbook of Combinatorics Elsevier Science 1995 pp 1063ndash1229

[9] VN Sachkov Probabilistic Methods in Combinatorial Analysis Cambridge UniversityPress 1997

2000 Mathematics Subject Classification Primary 05A16 Secondary 05A10Keywords Inversions permutations saddle point method

Received November 15 2002 revised version received July 3 2003 Published in Journal of

Integer Sequences July 22 2003

Return to Journal of Integer Sequences home page

19