The variance and the asymptotic distribution of the length of longest k -alternating subsequences

We obtain an explicit formula for the variance of the number of k -peaks in a uniformly random permutation. This is then used to obtain an asymptotic formula for the variance of the length of longest k -alternating subsequence in random permutations. Also a central limit is proved for the latter statistic.


Introduction
Letting (a i ) n i=1 be a sequence of real numbers, a subsequence a i k , where 1 ≤ i 1 < . . .< i k ≤ n, is called an alternating subsequence if a i1 > a i2 < a i3 > • • • .The length of the longest alternating subsequence of (a i ) n i=1 is defined to be the largest integer q such that (a i ) n i=1 has an alternating subsequence of length q.Denoting the symmetric group on n letters by S n , an alternating subsequence of a permutation σ ∈ S n refers to an alternating subsequence corresponding to the sequence σ(1), σ(2), . . ., σ(n).See Stanley (2008) for a survey on the topic.
In other words, the subsequence is k-alternating if it is alternating and additionally where we set [m] = {1, . . ., m} for m ∈ N. Below the length of the longest k-alternating subsequence of σ ∈ S n is denoted by as n,k (σ), or simply as n,k .
If also there is no k-ascending section that contains σ(i) . . .σ(j), it is called a maximal k-ascending section.In this case, σ(i), σ(j) are called a k-valley and a k-peak of σ, respectively.
A maximal k-descending section σ(i) . . .σ(j) can be defined similarly, and this time σ(i), σ(j) are called a k-peak and a k-valley of σ, respectively.An alternative description can be given as in Cai (2015).

and only if it satisfies both of the following two properties:
(i) If there is an s > i with σ(s) > σ(i), then there is a k-down σ(i) . . .σ(j) in σ(i) . . .σ(s).

2
Recep Altar C ¸ic ¸eksiz et.al Considering the case where σ is a uniformly random permutation, our purpose in present paper is to study Var(as n,k ) and to show that as n,k satisfies a central limit theorem.The statistic Var(as n,k ) is well understood for the case k = 1.Indeed, Stanley proved in Stanley (2008) that and Var[as n,1 ] = 8n 45 − 13 180 .
It was later shown in Houdré and Restrepo (2010) and Romik (2011) that as n,1 satisfies a central limit theorem, and convergence rates for the normal approximation were obtained in Islak (2018).All these limiting distribution results rely on the simple fact that as n,1 can be represented as a sum of m-dependent random variables (namely, the indicators of local extrema) and they then use the well-established theory of such sequences.

6
. Pak and Pemantle Pak and Pemantle (2015) then used probabilistic methods to prove that E[as n,k ] is asymptotically 2(n−k) 3 + O n 2/3 .Let us very briefly mention their approach.For x ∈ (0, 1), a vector y = (y 1 , . . ., y n ) ∈ [0, 1] n is said to be x-alternating if (−1) j+1 (y j − y j+1 ) x for all 1 j n − 1.Given a vector y = (y 1 , . . ., y n ) ∈ [0, 1] n , a subsequence 1 ≤ i 1 < i 2 < . . .< i r ≤ n is said to be x-alternating for y if Denoting the length of the longest x−alternating subsequence of a random vector y, with Lebesgue measure on [0, 1] n as its distribution, by as n,x (y), their main observation was: If Z is a binomial random variable with parameters n and 1 − x, then as n,x (y)

D
= means equality in distribution).That is, they concluded that as n,x (y) has the same distribution as the length of the longest ordinary alternating subsequence of a random permutation on S Z .Afterwards, using E[as n,1 ] = 4n+1 6 and Var(as n,1 ) = 8n 45 − 13 180 , they proved Further, for suitable x 1 and x 2 , they showed that ] and in this way they are able to bound E[as n,k ].
A closely related problem to the longest alternating subsequence problem is that of calculating the longest zigzagging subsequence.For a given permutation σ, denoting its vertical flip by σ, a subsequence is said to be zigzagging if it is alternating for either σ or σ.The k-zigzagging case is defined similarly.We will be using the notation zs n,k for the length of the longest k-zigzagging subsequence in the sequel.Note that in exactly half of the permutations, as n,k and zs n,k are equal to each other, and in the other half the length of the k-zigzagging subsequence is exactly one more than the length of the k-alternating subsequence.This is seen via the involution map Cai (2015).Therefore , and then combining this with (1), solved the Armstrong conjecture Cai (2015).
Our first result in this paper is an asymptotic formula for Var(as n,k ).Namely, we will prove In order to obtain this result, we first study the number of k-peaks P in random permutations and show that Our second result is a central limit theorem for as n,k : where G is the standard normal distribution and where → d is used for convergence in distribution.The rest of the paper is organized as follows.Next section proves our formulas for the variances of P and as n,k .In Section 3, we prove the central limit theorem for as n,k .
The variance and the asymptotic distribution of the length of longest k-alternating subsequences 3 2 The variances of P and as n,k Next result gives an exact formula for the variance of the number of k-peaks P in a uniformly random permutation.
Theorem 2.1 Let P be the number of k-peaks in a uniformly random permutation in S n .We have We will prove Theorem 2.1 after providing a corollary related to the length of longest k-alternating subsequence of a uniformly random permutation.Note that we have as n,k = 2P + E where |E| ≤ 1 for any n, k.Thus, Var(as n,k ) = 4 Var(P ) + Var(E) + 2 Cov(P, E).Here, clearly Var(E) ≤ 1 and by Cauchy-Schwarz inequality | Cov(P, E)| ≤ 2 Var(P ) Var(E) ≤ C 0 √ n where C 0 is a constant independent of n and k.We now obtain the following.
Corollary 2.1 Let as n,k be the length of longest k-alternating subsequence of a uniformly random permutation in S n .Then, In particular, when k = o(n), Var(as n,k ) ∼ 8n 45 as n → ∞.
Remark Proof of Theorem 2.1.Below P i is the indicator of i being a k-peak (i) , i.e.
In particular, We are willing to compute Recall from Cai (2015) that Denoting the probability that i is a k-peak by p n,k (i) and the probability that both i, j are k-peaks by p n,k (i, j), we may rewrite this last equation as We already know from (2) that the first sum on the right-hand side is n−k+2

3
. We are then left with calculating p n,k (i, j).

4
Recep Altar C ¸ic ¸eksiz et. al With the definition of k-peaks in mind, for given i and j, we can divide [n] \ {i} and [n] \ {j} into three sets according to the following partitions respectively.The first partition is with respect to i: and the second partition is with respect to j: Assuming without loss of generality that i < j, observe By Proposition 1.1, we observe that for i to be a k-peak, there should be at least one element from A i between any element of C i and i, and similarly for j to be a k-peak, there should be at least one element from A j between any element of C j and j.To ensure these two properties, we will place the elements accordingly.
Our procedure for placing the elements starts with placing A i ∪ {i} in a row a 1 a 2 . . .a i−k+1 arbitrarily.Leaving the insertion of the elements in A j \ A i to the end of the argument, we will next focus on placing the elements of C i and C j .Note that by the observation in previous paragraph, in order to have i and j as k-peaks, the two places next to i are not available for the elements in C i \ C j , and the four places next to i and j are not available for the elements in Now, let us focus on the elements of C i \ C j = {i + 1, . . ., j}.There are |A i ∪ {i}| = i − k + 1 elements that are placed in a row.Thus, we have i − k + 2 vacant spots for the element i − k + 2 to be inserted into the row a 1 a 2 . . .a i−k+1 .Since the two places next to i are prohibited, we see that Now, we have i + k + 3 vacant spots for the element i + 2, and the two places next to i are prohibited, and so, Continuing in this manner, we see that when we arrive at j, which is the last element to be inserted in from the set C i \ C j , we have i − k + (j − i + 1) = j − k + 1 many vacant places, and the two places next to i are prohibited, and then P({j} does not prevent i, j being a k-peak) More generally, for t = 1, . . ., j − i, we have Therefore, P (Ci \ Cj does not prevent i, j being a k-peak) = P j−i t=1 {i + t} does not prevent i, j being a k-peak Now, let us focus on the elements of C i ∩ C j = C j = {j + 1, . . ., n}.Recall that there are four prohibited places for these elements to be inserted.We have j − k + 2 many vacant places to insert j + 1 into but four of these are prohibited.Thus, Similar to the analysis in C i \ C j , continuing in this manner, we have n = j + (n − j), and in the end we will have j − k + (n − j + 1) = n − k + 1 many vacant places to insert n, and four of these are prohibited.So, We may generalize this to obtain for t = 1, . . ., n − j.We then obtain ) .
Note that we can multiply the probabilities (here, and above in the case of C i \ C j ), since in essence what we are doing is conditioning on the event that the previous added elements do not prevent i, j being a k-peak.Now, clearly, the elements of A j \ A i are in B i ∪ C i .Since the elements that are in C i have been inserted, we will then be done once we insert the elements of B i and B j .But the elements in the sets B i and B j have no effect on i and j being a k-peak (once the elements from C i and C j are placed), and so we may insert them in any place.Thus, overall, we have p n,k (i, j) = P(the set C i ∪ C j does not prevent i, j being a k-peak) = P(C i \ C j does not prevent i, j being a k-peak) ×P(C i ∩ C j does not prevent i, j being a k-peak) where the sum is computed fairly easily noting that essentially we are summing the consecutive integers and squares of consecutive integers.Therefore we obtain 6 Recep Altar C ¸ic ¸eksiz et.al Using this we arrive at as asserted in Theorem 2.1.

A Central Limit theorem
In this section, we will prove the following central limit theorem.
Theorem 3.1 Let k be a fixed positive integer.Then the length of the longest k-alternating subsequence as n,k of a uniformly random permutation satisfies a central limit theorem, where G is the standard normal distribution.
The proof involves a suitable truncation argument that allows us to reduce the problem to proving a central limit theorem for sums of locally dependent random variables for which a theory is already available.Since the length of the longest k alternating sequence differs from twice the number of k peaks by at most 1, we may focus on the number of peaks.For any i, let P i be the random variable that is 1 if the value i is a k-peak and zero otherwise as before.Also recall P = P 1 + • • • + P n .We know that P i = 1 precisely when • Scanning to the right of the value i, we encounter an element in [i − k] before we encounter an element in It is permitted that we do not encounter an element from [i + 1, n] at all.
• Scanning to the left of the value i, we encounter an element in [i−k] before we encounter an element in [i+1, n].
It is permitted that we do not encounter an element from [i + 1, n] at all.
Our approach to getting a central limit theorem is to define a suitable truncation that can be computed using local data.There are a number of theorems that establish central limit behaviour for variables with only local correlations and this approach has been employed in a number of situations.
• There is an index j < σ −1 (i) such that i − k ≥ σ(j) and such that Note that we might need to scan far to the left and right in order to determine whether a value is a k-peak or not and thus we will have long range dependence.We will show that ignoring long range interactions does not change the statistic very much.Fix a number m that we will specify later.Let Y i = 1 if we can determine that i is a k-peak by only looking at m positions to the left and right of i. Precisely, let The variance and the asymptotic distribution of the length of longest k-alternating subsequences 7 If Y i = 1, we call it a local k-peak (suppressing the reference to m).Note that any local k-peak is a k-peak and thus, Y i ≤ P i .We should next understand the case where Y i = 0 and P there is no issue when scanning to the left.However, if we scan to the right and this event happens, then the m indices to the right should have values in . Similarly, the probability of this event when σ Putting these together, recalling Y i ≤ P i , and denoting the total variation distance by d T V , we see that This implies d T V (P 1 + . . .
When k is fixed, taking m = 3 suffices for our purpose.Note in particular that when m is chosen appropriately.Next we will show that Y = Y 1 + • • • + Y n satisfies a central limit theorem.Let Z i = 1 if the position i is a local k-peak and 0 otherwise.It is immediate that Z = Z 1 + • • • + Z n and Y have the same distribution.We let Z be such a random variable for which (P, Z) and (P, Y ) have the same distribution.Further, note that the variables Z i have the property that Z i and Z j are independent if |i − j| > 2m.
There are a number of related theorems that guarantee central limit behaviour for sums of locally dependent variables.A result due to Rinott Rinott (1994) will suffice for our purpose.The version we give is a slight variation of the one discussed in Raic (2003).We will now apply this result for Z = Z 1 + • • • + Z n .For this purpose we need a lower bound on the variance of the random variable Z. Recall that the variance of P is Ω(n) and let us show that the same holds for Z.
the event can only happen if the 2m positions, m to the left and m to the right take values in [i − k − 1, i − 1] and the probability of this is at most k−1 n−1 2m .

Theorem 3. 2
Let U 1 , . . ., U n be random variables such that U i and U j are independent when |i − j| > 2m.Setting U = U 1 + • • • + U n ,we have where d K is the Kolmogorov distance.
Now, let us proceed to the proof of Theorem 2.1.