On the Distribution of the Length of the Longest ...

1 downloads 0 Views 275KB Size Report
mutation has attracted many researchers in statistics, computer sciences and ... random permutation, based on the insertion procedure and the finite Markov ...
Methodol Comput Appl Probab DOI 10.1007/s11009-013-9376-1

On the Distribution of the Length of the Longest Increasing Subsequence in a Random Permutation James C. Fu · Yu-Fei Hsieh

Received: 23 November 2012 / Accepted: 13 September 2013 © Springer Science+Business Media New York 2013

Abstract The distribution of the longest increasing subsequence in a random permutation has attracted many researchers in statistics, computer sciences and mathematics. There are considerable manuscripts studying the distribution especially for large n. In this short manuscript, we provide a simple probabilistic approach to obtain the exact distribution of the length of the longest increasing subsequence of a random permutation, based on the insertion procedure and the finite Markov chain imbedding technique. Keywords Longest increasing subsequence · Insertion procedure · Finite Markov chain imbedding · Random permutation AMS 2000 Subject Classification 60E05 · 60J10

1 Introduction Given a positive integer n, let Z n = {1, 2, . . . , n} be a set of n successive integers and Pn = {π(n) = (π1 (n), . . . , πn (n)) : πi (n) ∈ Z n , i = 1, . . . , n} be the collection of all permutations generated by integers in Z n . Definition 1 We say that πii (n), . . . , πik (n) is an increasing subsequence (IS) of length k in π(n) if i1 < i2 < · · · < ik and πi1 (n) < πi2 (n) · · · < πik (n). Given π(n), let Ln (π(n)) be the length of the longest increasing subsequence (LIS) among all the increasing subsequences in π(n). Note that the LIS of a permutation may not be unique. For example, if n = 5 and π (5) = (1, 4, 5, 2, 3), then π1 (5) = 1,

J. C. Fu · Y.-F. Hsieh (B) Department of Statistics, University of Manitoba, Winnipeg, MB, Canada R3T 2N2 e-mail: [email protected]

Methodol Comput Appl Probab

π2 (5) = 4, π3 (5) = 5, π4 (5) = 2, π5 (5) = 3. The longest increasing subsequences are {1, 4, 5} and {1, 2, 3}, and L5 (π(5)) = 3. Similarly, let L∗n (π(n)) be the length of the longest decreasing subsequence (LDS) among all the decreasing subsequences in π(n). For the above example, it is easy to see L∗5 (π(5)) = 2. Ulam [10] posted the conjecture that there exists a constant c such that lim

n→∞

E(Ln ) = c. √ n

(1)

Monte Carlo simulations were done in Baer and Brock [3], leading to a conjecture that the value of c equals 2. Then Logan and Shepp [7] established that c ≥ 2; meanwhile, Vershik and Kerov [11] showed that c = 2. Several other conjectures have been made and simulations have been done over the past three decades. For example, lim

n→∞

Var(Ln ) = c1 , n1/3

(2)

where c1 ∼ 0.819 was identified based on Monte Carlo simulations in Odlyzko and Rains [8]. It is interesting that the LIS problem can be re-interpreted by various card games and systems, for example the patience sorting card game and the interacting particle system which provides an probabilistic representation via Poissonization. Aldous and Diaconis [1] used the interacting particle process to re-prove Eq. 1. The exact distribution of LIS was known as a NP-hard problem. The Schensted correspondence (was derived by Schensted [9]) along with Young tableaus have been a major tool for studying the exact distribution of the LIS in a random permutation. The exact distribution of Ln was tabulated for n ≤ 36 in Baer and Brock [3]. Then Odlyzko and Rains [8] extended the exact distribution of Ln for n ≤ 120 and carried out Monte Carlo simulations for n up to 1010 . Hence, the exact distribution of Ln still remains an interesting problem. For the detailed surveys of methods for computing the length of Ln , we refer the reader to Aldous and Diaconis [2] and Baik et al. [4] and the references therein. In this manuscript, we provide a simple and efficient probabilistic method to obtain the exact distribution of Ln based on the insertion procedure and the finite Markov chain imbedding (FMCI) technique which have been applied to find the distributions for various patterns in a random permutation (see, e.g., Fu [5, 6]). Section 2 provides the main result. Numerical results and discussion are given in Section 3.

2 Main Result Every permutation π(n) = (π1 (n), . . . , πn (n)) ∈ Pn can be decomposed uniquely into a sequence of permutations π(t) ∈ Pt , t = 1, . . . , n, by deleting the largest integer one by one. It is easy to see that the decomposition {π(t)}nt=1 is one-to-one corresponding to a realization of inserting n integers 1, 2, . . . , n one by one into the gaps between two adjacent integers (including the two end gaps). When we say the i-th gap in a permutation, it stands for the location between the (i − 1)-th and i-th

Methodol Comput Appl Probab

elements of a permutation. To illustrate, we give a simple example. Given n = 5 and π(5) = (1,4,5,2,3), the decomposition (1) → (1,2) → (1,2,3) → (1,4,2,3) → (1,4,5,2,3) is unique with respected insertion procedure and L5 (π(5)) = 3. Given π(t − 1) = (π1 (t − 1), . . . , πt−1 (t − 1)), the integer t (t = 2, . . . , n) is inserted into the i-th gap (i = 1, . . . , t) with equal probability 1/t, and the newly forming permutation π(t) = (π1 (t), . . . , πt (t)) is related to the former permutation π(t − 1) in the following ways: (I) (II) (III)

the i-th gap of π(t − 1) is split into two gaps, the i-th and i + 1-th gaps of π(t), π j(t − 1) = π j(t) for j = 1, · · · , i − 1, πi (t) = t and π j−1 (t − 1) = π j(t) for j = i + 1, . . . , t, and πi (t) > π j(t) for all j = 1, . . . , t with j = i.

Definition 2 For a given permutation π(t) ∈ Pt , we define a vector [π (t)] = [a1 (t), . . . , a j(t), . . . , ak (t)] for all the first ISs of length j, j = 1, . . . , k and 1 ≤ k ≤ t of π(t), where a j(t) is the position (location or coordinate) of the last integer of the first IS of length j. By the first IS of length j of π(t), we mean the leftmost IS of length j. To illustrate, the definition above, we provide an example. Given the permutation π(8) = (4,8,6,5,1,2,7,3), it is easy to check that {4} is the first IS of length 1 and a1 (8) = 1, {4,8} is the first IS of length 2 and a2 (8) = 2, and {4,6,7} is the first IS of length 3. Hence we have [π (8)] = [1,2,7]. Given π(t), it follows that [a1 (t), . . . , a j(t), . . . , ak (t)] is unique and a1 (t) = 1 < a2 (t) < · · · < ak (t) ≤ t.

(3)

Further given [a1 (t), . . . , a j(t), . . . , ak (t)], there may be more than one π(t) ∈ Pt which has the same [a1 (t), . . . , a j(t), . . . , ak (t)], for example [(5,8,6,4,1,2,7,3)] = [1,2,7]. In another word, the set of permutations Pt is partitioned by the location vector [a1 (t), . . . , ak (t)] of the first increasing subsequences of lengths 1, 2, . . . , k, where k is the length of the longest increasing subsequence in permutation π(t). Note also that, for example, if the integer 9 is inserted into the first gap, then [1,2,7] becomes [1,3,8] with probability 1/9, or if the integer 9 is inserted into the 5-th gap then [1,2,7] becomes [1,2,5]. Given π (t − 1), we denote < [π (t − 1)], (t, i) >= [π (t)] as a mapping induced by inserting the integer t into the i-th gap of the permutation π(t − 1) and [π (t − 1)] → [π (t)]. In view of all the above observed facts, we expect the following Lemma to hold. It specifies the relationship between [π(t − 1)] and [π (t)] with respect to inserting the integer t into the gaps of permutation π(t − 1). Lemma 1 For given [π (t − 1)] = [a1 (t − 1), . . . , ak (t − 1)], 1 ≤ k ≤ t, if the integer t is inserted into the i-th gap then (i) if i = 1, then < [a1 (t − 1), . . . , ak (t − 1)], (t : i) >= [a1 (t), . . . , ak (t)], where a1 (t) = 1, a2 (t) = a2 (t − 1) + 1, . . . , ak (t) = ak (t − 1) + 1;

Methodol Comput Appl Probab

(ii) if a j−1 (t − 1) < i ≤ a j(t − 1), j = 2, . . . , k, then < [a1 (t − 1), . . . , a j−1 (t − 1), a j(t − 1), . . . , ak (t − 1)], (t : i) > = [a1 (t), . . . , a j−1 (t), a j(t), . . . , ak (t)], where a1 (t) = a1 (t − 1) = 1, . . . , a j−1 (t) = a j−1 (t − 1), a j(t) = i, a j+1 (t) = a j+1 (t − 1) + 1, . . ., and ak (t) = ak (t − 1) + 1, and (iii) if ak (t − 1) < i ≤ t, then < [a1 (t − 1), . . . , ak (t − 1)], (t : i) >= [a1 (t), . . . , ak (t), ak+1 (t)], where a1 (t) = a1 (t − 1) = 1, a2 (t) = a2 (t − 1), . . . , ak (t) = ak (t − 1) and ak+1 (t) = i. Proof For i = 1, the result (i) follows directly from the definition of a1 (t) = 1 and the relationships (I) and (II). For a j−1 (t − 1) < i ≤ a j(t − 1), since t is the largest integer among all the π j(t), hence the IS associated with a j−1 (t) together with integer t forms the first IS of length j and a j(t) = i. Hence, the result (ii) is immediate consequence of relationships of (I) and (II). If i > ak (t − 1) and t is the largest integer, then the IS associated with ak (t − 1) and t form the IS of length k + 1 and ak+1 = i. This completes the proof of part (iii). Note also that if integer t is inserted into the permutation π(t − 1), it is easy to check that the length of the LIS either remains the same with probability ak (t − 1)/t or increases by one with probability (t − ak (t − 1))/t. In order to make the state spaces t , t = 2, . . . , n as small as possible, we adopt a truncating procedure. Given n, s and t, for t = 1, 2, . . . , n − 1, and s = 2, . . . , n, let Kt = max(1, s + t − n) and Kt = min(t, s − 1).

(4)

It is easy to check that Kt ≤ Kt for all s = 2, . . . , n and t = 1, . . . , n − 1. Given s, we define a non-homogeneous Markov chain {Yt }nt=1 on the state spaces, for t = 1, . . . , n − 1, t = {[a1 (t), . . . , ak (t)] : Kt ≤ k ≤ Kt } ∪ {∅, α},

(5)

and for t = n, n = {∅, α}, where a1 (t), . . . , ak (t) satisfy the condition given by Eq. 3, the absorbing state α represents that k is truncated at t ≥ s from above, and the absorbing state ∅ represents that k is truncated at t ≤ n − s + 1 from below. The reasons that k is truncated from above and also from below are two-fold: (1) to make the state space t much smaller, and (2) to clearly identify the states at time t such that the probabilities P(Ln ≥ s) and P(Ln < s) can be obtained. Let us consider the case n = 10 and s = 5, and for example the state spaces 8 = {∅, [a1 (8), a2 (8), a3 (8)], [a1 (8), a2 (8), a3 (8), a4 (8)], α}, 9 = {∅, [a1 (9), a2 (9), a3 (9), a4 (9)], α} and 10 = {∅, α}. One can see that the reduction of the size of the state space t is considerable. For the special case, 10 = {∅, α}, it can be interpreted as after the integer 10 has been inserted the length of the LIS either is longer than or equal to s (in the state α) or shorter than s (in the state ∅).

Methodol Comput Appl Probab

Definition 3 A state [a1 (t), . . . , ak (t)] ∈ t is defined as a lower critical state if k = Kt = s + t − n and is defined as an upper critical state if k = Kt = s − 1, otherwise it is referred as a regular state. Assuming the probability of inserting the integer t into any one gap is 1/t, the above definitions and Lemma 1 provide the following Lemma 2 which gives the transition probabilities from t−1 → t induced by the insertion procedure. Lemma 2 (i) If [a1 (t − 1), . . . , ak (t − 1)] is a lower critical state of t−1 and if the integer t is inserted the i-th gap then P(Yt = ∅|Yt−1 = [a1 (t − 1), . . . , ak (t − 1)]) =

ak (t − 1) , ∀i ≤ ak (t − 1), t

and P(Yt = [a1 (t), . . . , ak (t), ak+1 (t)]|Yt−1 = [a1 (t − 1), . . . , ak (t − 1)]) =

1 , t

where a1 (t) = a1 (t − 1), . . . , ak (t) = ak (t − 1) and ak+1 (t) = i, for i > ak (t − 1). (ii) If [a1 (t − 1), . . . , ak (t − 1)] is an upper critical state of t−1 and the integer t is inserted into the i-th gap then P(Yt = α|Yt−1 = [a1 (t − 1), . . . , ak (t − 1)]) =

t − ak (t − 1) , for i > ak (t − 1), t

and P(Yt = [a1 (t), . . . , ak (t)]|Yt−1 = [a1 (t − 1), . . . , ak (t − 1)]) =

1 , t

for a j−1 (t − 1) < i ≤ a j(t − 1), j = 2, . . . , k, where a1 (t) = a1 (t − 1), . . . , a j−1 (t) = a j−1 (t − 1), a j(t) = i, a j+1 (t) = a j+1 (t − 1) + 1, . . . , and ak (t) = ak (t − 1) + 1. (iii) If Yt−1 = [a1 (t − 1), . . . , ak (t − 1)] is a regular state in t−1 and if the integer t is inserted into the i-th gap then 1 P(Yt = [a1 (t), . . . , ak (t)]|Yt−1 = [a1 (t − 1), . . . , ak (t − 1)]) = , for i = 1, . . . , t, t where [a1 (t), . . . , ak (t)] is given by Lemma 1 (i), (ii) and (iii). (iv) For absorbing state ∅ and α, P(Yt = ∅|Yt−1 = ∅) = P(Yt = α|Yt−1 = α) = 1. The sequence {Yt }nt=1 defined on {t } from a non-homogeneous Markov chain with transition probability matrices   M t = px,y (t|t − 1) , t = 2, . . . , n, where the transition probabilities px,y (t|t − 1) are defined by Lemma 2 (i)–(iv). Note that for s = 1 and s = n + 1 we have P(Ln < 1) ≡ 0 and P(Ln < n + 1) ≡ 1. Given 2 ≤ s ≤ n, the initial distribution ξ 1 = (0, 1, 0) of Y1 on 1 = {∅, [1], α} the following theorem follows directly from Lemmas 1 and 2.

Methodol Comput Appl Probab

Theorem 1 Given n, 2 ≤ s ≤ n and ξ 1 , we have P(Ln < s) = P(Yn = ∅|ξ 1 ) = ξ 1

 n  t=2

and N(Ln < s) = n!ξ 1

 n  t=2

  1 , Mt 0

  1 Mt , 0

where N(Ln < s) is the number of the longest increasing subsequences of length less than s.

3 Numerical Results and Discussion To illustrate our result we provide a detailed example with n = 7 and s = 4. Example 1 Given s = 4 and n = 7, the state spaces associated with the imbedded Markov chain {Yt }nt=1 are 1 = {∅, [1], α}, 2 = {∅, [1], [1, 2], α}, 3 = {∅, [1], [1,2], [1,3], [1,2,3], α}, 4 = {∅, [1], [1,2], [1,3], [1,4], [1,2,3], [1,2,4], [1,3,4], α}, 5 = {∅, [1,2], [1,3], [1,4], [1,5], [1,2,3], [1,2,4], [1,2,5], [1,3,4], [1,3,5], [1,4,5], α}, 6 = {∅, [1,2,3], [1,2,4], [1,2,5], [1,2,6], [1,3,4], [1,3,5], [1,3,6], [1,4,5], [1,4,6], [1,5,6], α} and 7 = {∅, α}. It follows from Lemma 2, we have transition matrices M2 , M3 , and M7 ⎤ ⎡ ⎤ ⎡ 3 0 0 0 0 0 2 0 0 0 1 1 ⎢0 1 1 1 0 0⎥ ⎥, M2 = ⎣ 0 1 1 0 ⎦ , M3 = ⎢ 2 0 0 0 2 3 ⎣0 0 1 1 1 0⎦ 0 0 0 0 0 3 and M7 =

 1 7 7 0

3 4

4 3

5 2

6 1

4 3

5 2

6 1

5 2

6 1

6 1

0 7



,

and we leave the transition probability matrices M4 , M5 and M6 to the reader. Hence, given ξ 1 = (0, 1, 0) we have  7    1 = 0.54781746, and N(L7 < 4) = 2761. Mt P(L7 < 4) = ξ 1 0 t=2 Table 1 provides the number of longest increasing subsequences of length less than s, N(Ln < s), for various n and s from 2 to 12. These are consistent with the results of Baer and Brock [3]. Note that the current state spaces {t } induced by the truncation technique are the smallest. By the same token, if we insert the integers one-by-one starting from the largest integer n to 1, then it follows from the symmetric arguments, the length of the longest decreasing subsequence L∗n (π(n)) has the same distribution as Ln (π(n)): P(Ln (π(n)) < s) = P(L∗n (π(n)) < s),

2

1 1 1 1 1 1 1 1 1 1 1

n/s

2 3 4 5 6 7 8 9 10 11 12

5 14 42 132 429 1430 4862 16796 58786 208012

3

23 103 513 2761 15767 94359 586590 3763290 24792705

4

119 694 4582 33324 261808 2190688 19318688 178108704

5

Table 1 N(Ln < s) for n and s from 2 to 12

719 5003 39429 344837 3291590 33835114 370531683

6

5039 40270 361302 3587916 38957991 457647966

7

40319 362815 3626197 39832877 476591309

8

362879 3628718 39912738 478842196

9

3628799 39916699 478995537

10

39916799 479001478

11

479001599

12

Methodol Comput Appl Probab

Methodol Comput Appl Probab

for all s = 2, . . . , n. With some modifications of our method, it seems our result also hold for random permutation with [s]-specification, permutations with s1 ≥ 1 of integer 1, . . ., and sn ≥ 1 of integer n. However we are not able to prove it mathematically.

References 1. Aldous D, Diaconis P (1995) Hammersley’s interacting particle process and longest increasing subsequences. Probab Theory Related Fields 103(2):199–213 2. Aldous D, Diaconis P (1999) Longest increasing subsequences: from patience sorting to the Baik-Deift-Johansson theorem. Bull Am Math Soc (NS) 36(4):413–432 3. Baer RM, Brock P (1968) Natural sorting over permutation spaces. Math Comput 22:385–410 4. Baik J, Deift P, Johansson K (1999) On the distribution of the length of the longest increasing subsequence of random permutations. J Am Math Soc 12(4):1119–1178 5. Fu J (2012) On the distribution of the number of occurrences of an order-preserving pattern of length three in a random permutation. Methodol Comput Appl Probab 14:831–842 6. Fu JC (1995) Exact and limiting distributions of the number of successions in a random permutation. Ann Inst Stat Math 47(3):435–446 7. Logan BF, Shepp LA (1977) A variational problem for random Young tableaux. Adv Math 26(2):206–222 8. Odlyzko AM, Rains EM (1998) On longest increasing subsequences in random permutations. Technical report, AT&T Labs 9. Schensted C (1961) Longest increasing and decreasing subsequences. Can J Math 13:179–191 10. Ulam SM (1961) Monte Carlo calculations in problems of mathematical physics. In: Modern mathematics for the engineer: second series. McGraw-Hill, New York, pp 261–281 11. Vershik AM, Kerov SV (1977) Asymptotics of the plancherel measure of the symmetric group and the limiting form of young tables. Soviet Math Dokl 18:527–531. Translation of Dokl Acad Nauk SSSR 233:1024–1027