Upload
svetlana
View
214
Download
1
Embed Size (px)
Citation preview
Journal of Combinatorial Theory, Series A 125 (2014) 254–272
Contents lists available at ScienceDirect
Journal of Combinatorial Theory,Series A
www.elsevier.com/locate/jcta
The sorting index and equidistribution ofset-valued statistics over restricted permutations
Svetlana Poznanović 1
Department of Mathematical Sciences, Clemson University, United States
a r t i c l e i n f o a b s t r a c t
Article history:Received 9 June 2012Available online 9 April 2014
Keywords:InversionsSorting indexCyclesFerrers board
We prove that the pairs of permutation statistics (sor,Cyc)and (inv,Rmil) are equidistributed on the set of permutationsthat correspond to arrangements of n non-atacking rooks ona fixed Ferrers board with n rows and n columns and givetheir generating functions. Our results extend recent resultsof Petersen. The key elements in the proofs are the A-codeand the B-code introduced by Foata and Han. We showthat the map B-code−1 ◦ A-code is a bijection on the setof restricted permutations which sends inv to sor, Rmil toCyc and preserves the set-valued statistics Lmal and Lmap.We also show analogous equidistribution results for restrictedpermutations of type B and D by constructing appropriateA-codes and B-codes in each case.
© 2014 Elsevier Inc. All rights reserved.
1. Introduction
An inversion in a permutation σ is a pair σ(i) > σ(j) such that i < j. The number ofinversions in σ is denoted by inv(σ). The distribution of inv over the symmetric group Sn
was first found by Rodriguez [7] in 1837 and is well known to be
E-mail address: [email protected] The author was supported in part by a Career Award at the Scientific Interface (CASI) from the
Burroughs Wellcome Fund (BWF) to Christine E. Heitsch, PhD, and in part by NSF grant DMS-1312817.
http://dx.doi.org/10.1016/j.jcta.2014.03.0070097-3165/© 2014 Elsevier Inc. All rights reserved.
S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272 255
∑
σ∈Sn
qinv(σ) = (1 + q)(1 + q + q2) · · ·
(1 + q + · · · + qn−1).
Much later, MacMahon [5] defined the major index maj and proved that it has the samedistribution as inv. In his honor, all permutation statistics that are equally distributedwith inv are called Mahonian. MacMahon’s remarkable result initiated a systematicresearch of permutation statistics and in particular many more Mahonian statistics havebeen described in the literature since then.
Another classical permutation statistic is the number of cycles, cyc. Its distributionis given by
∑
σ∈Sn
tcyc(σ) = t(t + 1)(t + 2) · · · (t + n− 1)
and the coefficients of this polynomial are known as the unsigned Stirling numbers ofthe first kind.
Given these two distributions, it is natural then to ask which “Mahonian–Stirling”pairs of statistics (stat1, stat2) have the distribution
∑
σ∈Sn
qstat1(σ)tstat2(σ) = t(t + q)(t + q + q2) · · ·
(t + q + · · · + qn−1). (1.1)
As proved by Björner and Wachs [2], (inv, rmil) and (maj, rmil) are two such pairs, wherermil is the number of right-to-left minimum letters. In fact, Björner and Wachs provedthe following stronger result
∑
σ∈Sn
qinv(σ)∏
i∈Rmil(σ)
ti =∑
σ∈Sn
qmaj(σ)∏
i∈Rmil(σ)
ti
= t1(t2 + q)(t3 + q + q2) · · ·
(tn + q + · · · + qn−1), (1.2)
where Rmil(σ) is the set of all right-to-left minimum letters in σ. Recall that a right-to-left minimum letter of a permutation σ is a letter σ(i) such that σ(i) < σ(j) for allj > i.
A natural Mahonian partner for cyc was found by Petersen [6]. For a given permutationσ ∈ Sn there is a unique expression
σ = (i1j1)(i2j2) · · · (ikjk)
as a product of transpositions such that is < js for 1 � s � k and j1 < · · · < jk. Thesorting index of σ is defined as
sor(σ) =k∑
(js − is).
s=1256 S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272
The sorting index can also be described as the total distance the elements in σ travel whenσ is sorted using the Straight Selection Sort algorithm [4] in which, using a transposition,we move the largest number to its proper place, then the second largest to its properplace, etc. For example, the steps for sorting σ = 6571342 are
6571342 (37)−−−→ 6521347 (16)−−−→ 4521367 (25)−−−→ 4321567 (14)−−−→ 1324567 (23)−−−→ 1234567
and therefore σ = (2 3)(1 4)(2 5)(1 6)(3 7) and sor(σ) = (3 − 2) + (4 − 1) + (5 − 2) +(6 − 1) + (7 − 3) = 16. The relationship to other Mahonian statistics and the Eulerianpartner for sor were studied by Wilson [8] who called the same statistic DIS.
Using algebraic techniques, Petersen showed that∑
σ∈Sn
qsor(σ)tcyc(σ) = t(t + q)(t + q + q2) · · ·
(t + q + · · · + qn−1), (1.3)
which implies equidistribution of the pairs (inv, rmil) and (sor, cyc). However, this resultwas already implicitly proven in [3] where Foata and Han proved the equidistribution ofseveral pairs of set-valued statistics bijectively. They defined two bijections from Sn toSEn, the set of subexcedent sequences. These two bijections, called A-code and B-code,give rise to mahonian statistics related to inv and sor. Furthermore, the bijection φ =B-code−1 ◦ A-code has the property
(sor,Cyc,Lmal)φ(σ) = (inv,Rmil,Lmal)σ.
In this article we show that this result of Foata and Han extends to restricted permu-tations
Sr ={σ ∈ Sn: σ(k) � rk, 1 � k � n
},
where r is an integer sequence 1 � r1 � r2 � · · · � rn � n. Namely we show thatthe bijection φ also preserves the set of left-to-right places, Lmap, which is the keyreason why the set Sr is invariant under φ. Moreover, we characterize the A-codesand B-codes that correspond to permutations in Sr. This allows us to get the gener-ating functions for (inv,Rmil) and (sor,Cyc) over this set. These results are presentedin Section 2. In Section 3 we define an A-code and B-code for signed permutationswhich are related to the analogous type B statistics. The A-code encodes invB , andthe set-valued statistics RmilB , LmalB , and LmapB , while B-code encodes sorB , Cyc0,LmalB , and LmapB . The composition φ = B-code−1 ◦A-code on Bn then has the prop-erty (sorB ,CycB ,LmalB ,LmapB)φ(σ) = (invB ,RmilB ,LmalB ,LmapB)σ. With this wededuce results about restricted signed permutations analogous to the unsigned case. Fi-nally, in Section 4 we consider the even signed permutations and derive the distributionof (sorB ,Cyc′0) and (invD,RmilD) over restricted type D permutations, which we showare the same by defining a modified B-code and proving some of its properties.
S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272 257
Fig. 1. An example for the sequence r = (2, 3, 3, 5, 6, 7, 7) with the Ferrers board Fr on the left and the Dyckpath D(r) on the right.
2. Permutations
For a word w = w1 · · ·wn whose letters are positive integers, we will denote by Rmil(w)the set of right-to-left minimal letters (the set of all letters wi such that wi < wj for allj > i) and by Rmip(w) the set of right-to-left minima positions (the set of all positionsi such that wi < wj for all j > i). The set-valued statistics left-to-right maximal lettersof w and left-to-right maxima positions will be denoted by Lmal(w) and Lmap(w).Throughout this paper, the cardinality of these sets will be denoted by lower-case letters,e.g. rmil(w) = |Rmil(w)|.
Let r = (r1, . . . , rn) be an integer sequence such that 1 � r1 � r2 � · · · � rn = n.Denote by Sr the set of restricted permutations
Sr ={σ ∈ Sn: σ(k) � rk, 1 � k � n
}.
The set Sr is non-empty if and only if rk � k in which case the elements of Sr correspondto arrangements of n non-atacking rooks on a Ferrers board Fr with rows of lengthr1, . . . , rn drawn with the longest row on top (Fig. 1). Let D(r) be the unique Dyck pathwhose k-th fall is preceded by exactly rk rises. This is exactly the south east boundaryof the Ferrers board Fr traced from the southwest to the northeast corner. We definethe height of a rise of a Dyck path to be the y-coordinate of the right endpoint of thecorresponding (1, 1) segment. The sequence (h1, . . . , hn) of the heights of the rises of aDyck path D of semi-length n when read from left to right will be called shortly theheight sequence of D.
Let SEn denote the set of subexcedent sequences of length n:
SEn ={(a1, a2, . . . , an): 1 � ai � i
}.
For a sequence a = (a1, a2, . . . , an) ∈ SEn we define
Max(a) = {i: ai = i}.
258 S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272
Clearly, |SEn| = n! and there are various bijections between Sn and SEn. In this paperwe will use two that were defined in [3] which encode the contributions of each letter toinv(σ) and sor(σ), respectively.
The bijection A-code: Sn → SEn
The Lehmer code of a permutation σ ∈ Sn is defined to be the sequence Leh(σ) =(a1, a2, . . . , an) given by
ai =∣∣{j: 1 � j � i, σ(j) � σ(i)
}∣∣.
For example, Leh(2763541) = (1, 2, 2, 2, 3, 3, 1). Note that the number of inversions thateach letter σ(i) creates with larger elements to its left is i − ai and therefore inv(σ) =(n+1
2)−
∑ni=1 ai.
The A-code is defined by
A-code(σ) = Leh(σ−1).
The map A-code is a bijection. For a given a = (a1, a2, . . . , an) ∈ SEn, the correspondingpermutation is constructed as follows. First write a word with n empty places. Insert theletter n in the an-th position, then insert the letter n − 1 in the place having an−1 − 1empty letters to its left, then insert the letter n− 2 in the place having an−2 − 1 emptyletters to its left, etc. The resulting permutation σ is A-code−1(a).
We summarize the important properties of the A-code in the following theorem.
Theorem 2.1. Let A-code(σ) = a = (a1, . . . , an). Then
(a) ai is the number of letters j � i that are weakly to the left of the letter i in theone-line notation of σ. Consequently, the number of inversions in σ that the letter i
creates with smaller elements to its right is i− ai and inv(σ) =(n+1
2)−∑n
i=1 ai;(b) Rmil(σ) = Max(a);(c) Lmap(σ) = Rmil(a);(d) Lmal(σ) = Rmip(a).
These properties are evident from the definition of the A-code and therefore theirproofs are omitted. Parts (b) and (c) are stated as Theorem 5 in [3], while part (d) isa new observation that we will use to derive new properties of the map φ : Sn → Sn
from [3]. Next, we show how one can tell from the A-code whether a given permutationσ is in Sr.
Lemma 2.2. The permutation σ ∈ Sn is in Sr if and only if A-code(σ) = (a1, . . . , an)satisfies ai � i + 1 − hi.
S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272 259
Proof. Constructing A-code−1(a) in the way described above corresponds to buildingthe corresponding rook arrangement by filling the columns of an n×n square from rightto left (Fig. 1a). When placing the letters n, n− 1, . . . , 1 in this order, the letter i can beplaced in one of i available positions. Out of those i available cells in the i-th column,exactly the top hi are contained in the shape Fr. Therefore the rook in the i-th columnis placed in Fr if and only if i− hi � ai − 1. �Theorem 2.3. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then
∑
σ∈Sr
qinv(σ)∏
i∈Rmil(σ)
ti =n∏
k=1
(tk + q + q2 + · · · + qhk−1)
where (h1, . . . , hn) is the height sequence of D(r). In particular,
∑
σ∈Sr
qinv(σ)trmil(σ) =n∏
k=1
(t + q + q2 + · · · + qrk−k
).
Proof. Suppose σ ∈ Sr and A-code(σ) = (a1, . . . , an). By Theorem 2.1, the contributionof the letter k to the monomial qinv(σ) ∏
i∈Rmil(σ) ti is exactly qk−ak tχ(ak=k)k which, by
Lemma 2.2 is one of the summands in (tk + q + q2 + · · · + qhk−1).For the second equality, note that the height sequence (h1, . . . , hn) of the Dyck path
D(r) is a permutation of the sequence of the heights of the falls in D(r), where theheight of a fall is the y-coordinate of the higher end of the corresponding (1,−1) step.The height of the k-th fall is easily seen to be rk − k + 1. �
In particular, when r1 = r2 = · · · = rn = n, we have Sr = Sn. The height sequenceof D(r) is (1, 2, . . . , n) and we recover the result (1.2) of Björner and Wachs about thedistribution of (inv,Rmil) over Sn.
The bijection B-code: Sn → SEn
The B-code is based on the decomposition of each permutation as a product of disjointcycles. For σ ∈ Sn and each i = 1, . . . , n, let k(i) be the smallest integer k � 1 such thatσ−k(i) � i. Then B-code(σ) = (b1, b2, . . . , bn) is defined to be
bi = σ−k(i)(i), 1 � i � n.
It is clear from the definition that B-code(σ) ∈ SEn.An alternate inductive definition is the following. First, the B-code of the unique
permutation in S1 is defined to be (1) ∈ SE1. Let n � 2. If σ ∈ Sn is writ-ten as a product of disjoint cycles, the removal of the letter n yields a permutationσ′ ∈ Sn−1. Let (b′1, b′2, . . . , b′n−1) be the B-code of σ′. Then B-code(σ) is defined to be(b′1, b′2, . . . , b′n−1, σ
−1(n)).
260 S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272
We describe two ways of constructing B-code−1(b) for b = (b1, b2, . . . , bn) ∈ SEn
which will be useful in proving the properties of the B-code. The first one is as follows.Start with the identity permutation σ1 = 1 2 · · · n. Let σ2 be the word obtained byexchanging 2 and the letter at the b2-th place in σ1. Then let σ3 be the word obtainedby exchanging 3 and the letter at the b3-th place in σ2, etc. The permutation σn isB-code−1(b).
The second construction of B-code−1(b) is based on the inductive definition of theB-code. Start with the permutation w1 = (1) ∈ S1. Then if b2 = 2 add a single-elementcycle (2) to w1. Otherwise, insert 2 after b2 in the cyclic representation of w1. Call theresulting permutation w2 ∈ S2. Next, if b3 = 3, add the cycle (3) to w2; otherwise insert3 after b3 in the cyclic representation of w2. Call the resulting permutation w3 ∈ S3.Continue the process until the letter n is inserted. The resulting permutation wn isB-code−1(b).
The following theorem summarizes the properties of the B-code. Let Cyc(σ) denotethe set of minimal elements in the cycles of σ.
Theorem 2.4. Let B-code(σ) = b = (b1, . . . , bn). Then
(a) The permutations σ = σn, σn−1, σ1 obtained during the first algorithmic construc-tion of B-code−1(b) are exactly the intermediate permutations obtained while sortingσ using Straight Selection Sort. Consequently, the number of positions the let-ter i travels during the (n + 1 − i)-th step of Straight Selection Sort is i − bi andsor(σ) =
(n+1
2)−∑n
i=1 bi;(b) Cyc(σ) = Max(b);(c) Lmap(σ) = Rmil(b);(d) Lmal(σ) = Rmip(b).
Proof. Part (a) follows from the definition of the sorting index and the algorithmicconstruction of B-code−1(b). Parts (b) and (c) constitute Theorem 6 in [3]. We provehere part (d).
Suppose k ∈ Rmip(b). Then bk < bl for all l > k. For the permutations w1, . . . , wn inthe construction of B-code−1(b), we have bk = w−1
k (k) and no letter is placed after theletters 1, 2, . . . , bk in the construction of wk+1, . . . , wn. Therefore, for m = 1, 2, . . . , bk wehave σ(m) = wn(m) � k which implies k ∈ Lmal(σ).
Conversely, suppose k /∈ Rmip(b). Then bk � bl for some l > k. Note that theconstruction of w1, . . . , wn implies that since wi(bi) = i for every i = 1, 2, . . . , n, thenσ−1(i) = w−1
n (i) � bi for every i = 1, 2, . . . , n. In particular, σ−1(k) � bk. Moreover,since wl(bl) = l we have wm(bl) � l for i � l. In particular, σ(bl) = wn(bl) � l. So, ifbk > bl then the letter σ(bl) > k is to the left of k in σ and thus k /∈ Lmal(σ). If, on theother hand, bk = bl, then σ−1(k) > bk and the letter σ(bl) > k is again to the left of kimplying that k /∈ Lmal(σ). This proves the last property. �
S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272 261
As a direct consequence we get the following.
Theorem 2.5. The bijection φ = B-code−1 ◦ A-code has the property
(sor,Cyc,Lmal,Lmap)φ(σ) = (inv,Rmil,Lmal,Lmap)σ.
Theorem 2.6. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then σ ∈ Sr implies φ(σ) ∈ Sr.
Proof. Since φ preserves both Lmap and Lmal and the left-to-right maxima always forman increasing word, the rooks that correspond to the left-to-right maxima are in thesame positions for both σ and φ(σ). Suppose σ ∈ Sr but φ(σ) /∈ Sr. Then there is a rookR1 in the arrangement of φ(σ) that is not on the board Fr. The letter represented bythat rook cannot be a left-to-right maximum and therefore must be preceded by one.That means that there is a left-to-right maximum rook R2 in φ(σ) that is southeast ofR1 and hence also not on Fr, which is a contradiction. �
Combining Lemma 2.2 and Theorem 2.6 we get the following criterion for when σ ∈ Sr
based on its B-code.
Corollary 2.7. The permutation σ ∈ Sn is in Sr if and only if B-code(σ) = (b1, . . . , bn)satisfies bi � i + 1 − hi.
Theorem 2.8. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then
∑
σ∈Sr
qsor(σ)∏
i∈Cyc(σ)
ti =n∏
k=1
(tk + q + q2 + · · · + qhk−1) (2.1)
where (h1, . . . , hn) is the height sequence of D(r). In particular,
∑
σ∈Sr
qsor(σ)tcyc(σ) =n∏
k=1
(t + q + q2 + · · · + qrk−k
). (2.2)
Note that when r1 = r2 = · · · = rn = n in (2.2), we recover the result (1.3) ofPetersen.
Let �′(σ) be the reflection length of σ, i.e., the minimal number of reflections (i j)needed to represent σ. It is well known that for σ ∈ Sn, �′(σ) = n − cyc(σ). Definenmin(σ) = n− rmil(σ).
Corollary 2.9. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then
262 S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272
∑
σ∈Sr
qinv(σ)tnmin(σ) =∑
σ∈Sr
qsor(σ)t�′(σ) =
n∏
k=1
(1 + tq[hk − 1]q
)
where (h1, . . . , hn) is the height sequence of D(r).
3. Signed permutations
In this section we give the type B analogues of the results from Section 2. For a wordw = w1w2 · · ·wn where wi is an integer we define
RmipB(w) ={k: 0 < wk < |wl| for all l > k
}
LmapB(w) ={k: wk > |wl| for all l < k
}
RmilB(w) ={wk: 0 < wk < |wl| for all l > k
}
LmalB(w) ={wk: wk > |wl| for all l < k
}
with the convention that the cardinalities of these sets are denoted by lowercase letters.When we write RmipB(σ), etc., for a signed permutation σ ∈ Bn we assume that σ isrepresented using window notation as σ(1)σ(2) · · ·σ(n).
Let SEBn be the set of integer sequences (a1, a2, . . . , an) such that ai ∈ [−i, i]\{0}.
For a sequence a = (a1, a2, . . . , an) ∈ SEBn , define Max(a) = {i: ai = i} and Min(a) =
{i: ai = −i}.
The bijection A-code: Bn → SEBn
Define the Lehmer code of σ ∈ Bn to be the sequence Leh(σ) = (a1, a2, . . . , an) ∈ SEBn
where for each i,
ai = sign(σ(i)
)·∣∣{j: 1 � j � i,
∣∣σ(j)∣∣ �
∣∣σ(i)∣∣}∣∣.
Then the A-code of a signed permutation σ is defined to be the sequence
A-code(σ) = Leh(σ−1).
A permutation can be recovered from its A-code a = (a1, . . . , an) in the following way.Start with an empty permutation with n empty places. First insert the letter n with thesame sign as an in the |an|-th position from left. Then place the letter n − 1 with thesame sign as an−1 so that it has |an−1|− 1 empty places to its left. Then place the lettern− 2 with the same sign as an−2 so that it has |an−2| − 1 empty places to its left, etc.The permutation σn obtained this way has A-code a.
Note that the signed permutations can be represented by arrangements of n non-atacking bicolored rooks on an n× n square. In that setting the algorithm for obtainingA-code−1(a) is translated into placing rooks in consecutive columns starting from theshortest one.
S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272 263
The minimal number of terms in {(11)} ∪ {(i i + 1): 1 � i � n} needed to express asigned permutation σ ∈ Bn is called the length of σ, denoted �B(σ). It is known to beequal to the type Bn inversion number invB given by
invB(σ) =∣∣{1 � i < j � n: σ(i) > σ(j)
}∣∣ +∣∣{1 � i < j � n: −σ(i) > σ(j)
}∣∣ + N(σ),
(3.1)
where N(σ) is the number of negative signs in σ. For i = 1, . . . , n, let
invB(σ, i) =∣∣{j: |j| < |i| and the signed i and j form an inversion
}∣∣
+ χ(i has a negative sign in σ).
It follows from the definition of invB that invB(σ) =∑n
i=1 invB(σ, i). The followingproperties of the A-code for signed permutations can readily be seen from the definitions.
Theorem 3.1. Let σ ∈ Bn and A-code(σ) = a = (a1, . . . , an). Then
(a) For i = 1, . . . , n, invB(σ, i) = i− ai − χ(ai < 0) and thus invB(σ) =∑n
i=1(i− ai −χ(ai < 0));
(b) RmilB(σ) = Max(a);(c) LmapB(σ) = RmilB(a);(d) LmalB(σ) = RmipB(a).
Proof. If i has a positive sign in σ, then among the letters j that are of smaller absolutevalue, it creates inversions with those that are to its right. Then from the construction ofA-code−1(a), it is clear that invB(σ, i) = i−ai. On the other hand, if i has a negative signand j < i then i and j create one inversion if j is to the right of i and two inversions if j isto the left of i. So, invB(σ, i) = (i−|ai|)+2(|ai|−1)+1 = i+|ai|−1 = i−ai−1. This provesthe first property, the others are easily seen from the construction of A-code−1(a). �
For an integer sequence r: 1 � r1 � r2 � · · · � rn � n with rk � k, let
Br ={σ ∈ Bn:
∣∣σ(i)∣∣ � ri for all 1 � i � n
}.
Lemma 3.2. The permutation σ ∈ Bn is in Br if and only if A-code(σ) = (a1, . . . , an)satisfies |ai| � i + 1 − hi, where (h1, . . . , hn) is the height sequence of D(r).
Proof. Note that a signed permutation σ is in Br if and only if the underlying unsignedpermutation σ′ is in Sr. Moreover, the A-code of σ′ is (|a1|, |a2|, . . . , |an|), so the resultfollows from Lemma 2.2. �Theorem 3.3. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then
264 S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272
∑
σ∈Br
qinvB(σ)∏
i∈RmilB(σ)
ti =n∏
k=1
(tk + q + q2 + · · · + qhk−1 + q2k−hk
(1 + q + · · · + qhk−1))
where (h1, . . . , hn) is the height sequence of D(r). In particular,
∑
σ∈Bn
qinvB(σ)∏
i∈RmilB(σ)
ti =n∏
k=1
(tk + q + q2 + · · · + q2k−1).
Proof. Suppose σ ∈ Br and A-code(σ) = (a1, . . . , an). By Theorem 3.1,
qinvB(σ,i)tχ(i∈RmilB(σ))i = qi−ai−χ(ai<0)t
χ(ai=i)i . (3.2)
The i-th entry of the A-code satisfies i + 1 − hi � ai � i or −i � ai � hi − i− 1, so thepossible values of (3.2) are exactly the terms in tk + q + q2 + · · · + qhk−1 + q2k−hk(1 +q + · · · + qhk−1). The second equality follows from the first when rk = n for all k, sincethen hk = k. �
Every signed permutation σ ∈ Bn can be uniquely written as a product σ =(i1j1)(i2j2) · · · (ikjk) of transpositions such that is < js for 1 � s � k and 0 < j1 <
· · · < jk. Here the transposition (ij) means to swap both i with j and i with j (providedi �= j). The type Bn sorting index is defined to be
sor(σ) =k∑
s=1
(js − is − χ(is < 0)
).
As before, the sorting index can be interpreted as the total distance the elements inσ move when σ is sorted using a “type B” Straight Selection Sort algorithm in which,using a transposition, the largest number is moved to its proper place, then the secondlargest, and so on. For example, the steps for sorting σ = 51342 are
24315 51342 (15)−−−→ 54312 21345 (44)−−−→ 54312 21345 (12)−−−→ 54321 12345
and therefore σ = (12)(44)(15) and sor(σ) = (2−1)+(4−(−4)−1)+(5−(−1)−1) = 13.Signed permutations can be decomposed into two types of cycles. The cycles can
be of the form (a1, . . . , ak) (this cycle also takes a1 to a2, etc.) or of the form(a1, . . . , ak, a1, . . . , ak), for k � 1 and all a1, . . . , ak different. The former cycles arecalled balanced and the latter ones unbalanced. Let
Cyc0(σ) ={|k|: k is the minimal number in absolute value in a balanced cycle of σ
},
Cyc1(σ)
={|k|: k is the minimal number in absolute value in an unbalanced cycle of σ
},
S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272 265
and let cyc0(σ) = |Cyc0(σ)| and cyc1(σ) = |Cyc1(σ)|. For example, the cycle decomposi-tion of the permutation σ = 395716482 is (135)(2929)(47)(66)(8), so Cyc0(σ) = {1, 4, 8}and Cyc1(σ) = {2, 6}.
The bijection B-code: Bn → SEBn
For a signed permutation σ, let ki be the smallest integer k � 1 such that |σ−k(i)| � i.The B-code of σ is the sequence (b1, b2, . . . , bn) where bi = σ−ki(i).
As in the unsigned case, the B-code for signed permutations can also be definedinductively as follows. The B-codes for the two permutations 1 and 1 in B1 are 1 and−1, respectively. For n � 2 let σ′ ∈ Bn−1 be the permutation obtained by deleting n andn from the cycle decomposition of σ and let (b′1, . . . , b′n−1) be the B-code of σ′. Then theB-code of σ is (b′1, . . . , b′n−1, σ
−1(n)).For b = (b1, b2, . . . , bn) ∈ SEB
n , B-code−1(b) can be constructed algorithmically in thefollowing way. Start with the identity permutation σ0 = 1 2 · · · n. If permutations σi
have been constructed for 0 � i < n, let σi+1 be the signed permutation obtained byexchanging the letter i + 1 and the letter at the |bi+1|-th place in σi and additionallychanging their signs if bi+1 < 0. The permutation σn is B-code−1(b).
The alternate description of constructing B-code−1(b) that uses the cyclic decompo-sitions is the following. If b1 = 1 start with the permutation w1 = (1) ∈ B1, otherwisestart with w1 = (1 1) ∈ B1. Suppose wi ∈ Bi have been constructed for 1 � i < n. Thenif bi+1 = i + 1 add a single element cycle (i + 1) to wi. If bi+1 = −(i + 1) add the cycle(i + 1 i + 1) to wi. Otherwise, insert i + 1 after bi+1 and i + 1 after bi+1 in the cyclicrepresentation of wi. Call the resulting permutation wi+1 ∈ Si+1. Continue the processuntil the letter n is inserted. The resulting permutation wn is B-code−1(b).
Theorem 3.4. Let σ ∈ Bn and B-code(σ) = b = (b1, . . . , bn). Then
(a) The permutations σ = σn, σn−1, σ1 obtained during the algorithmic construction ofB-code−1(b) are exactly the intermediate permutations obtained while sorting σ usingthe Straight Selection Sort algorithm. Consequently, the number of positions the letteri travels during the (n+ 1− i)-th step of Straight Selection Sort is i− bi −χ(bi < 0)and sor(σ) =
∑ni=1(i− bi − χ(bi < 0));
(b) Cyc0(σ) = Max(b) and Cyc1(σ) = Min(b);(c) LmapB(σ) = RmilB(b);(d) LmalB(σ) = RmipB(b).
Proof. Part (a) follows from the definition of the sorting index and the first constructionof B-code−1(b) given above. Note that i ∈ Cyc0(σ) if and only if (i) is a cycle of wi
obtained in the second construction of B-code−1(b) above and this is the case if and onlyif bi = i. Similarly, i ∈ Cyc1(σ) if and only if (i i) is a cycle of wi which occurs if andonly if bi = −i. This implies the second property.
266 S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272
Suppose k ∈ RmipB(b). Then 0 < bk < |bl| for all l > k. This implies that wk isobtained by placing k after bk in the cyclic decomposition of wk−1 and nothing elseis inserted after the letters 1, 2, . . . , bk, 1, 2, . . . , bk in the construction of wk+1, . . . , wn.Therefore σ−1(k) = bk and for |m| < bk we have |σ(m)| = |wn(m)| < k which impliesk ∈ LmalB(σ).
Conversely, suppose k ∈ {1, 2, . . . , n} but k /∈ RmipB(b). If k is with negative sign inσ then clearly k /∈ LmalB(σ). So suppose k is with a positive sign, i.e. σ−1(k) > 0. Thereare two cases: (i) bk > 0 but bk � |bl| for some l > k or (ii) bk < 0. The constructionof w1, . . . , wn implies that since wi(bi) = i and |bi| � i for every i = 1, 2, . . . , n we have|σ−1(i)| = |w−1
n (i)| � |bi| for every i = 1, 2, . . . , n. In particular, |σ−1(k)| � |bk|. So, inthe first case, note that since wl(bl) = l we have |wi(bl)| � l for i � l. In particular,|σ(bl)| = |wn(bl)| � l. Thus, if bk > |bl| then the letter σ(|bl|) is to the left of k andis larger in absolute value and hence k /∈ Lmal(σ). If, on the other hand, bk = |bl|,then |σ−1(k)| > |bk| and the letter σ(|bl|) > k is again to the left of k implying thatk /∈ Lmal(σ). In the second case, k is with negative sign in wk and since it has positivesign in σ, some positive letter l > k was inserted in the cycle between bk and k whichmeans bl = bk for some l > k. The same discussion as in the first case implies thatk /∈ Lmal(σ). This proves the last property.
Lastly, we prove the third property. If k ∈ RmipB(b) = LmalB(σ) then σ−1(k) ∈LmapB(σ). But as we concluded two paragraphs above, k ∈ RmipB(b) also impliesσ−1(k) = bk. Therefore, if k ∈ RmipB(b) then bk ∈ LmapB(σ). If k and k′ are twodifferent right-to-left minima positions in b, the corresponding right-to-left minimumletters bk and bk′ are also different. So, this defines an injective map from RmipB(b)to LmapB(σ). But |LmapB(σ)| = |LmalB(σ)| = |RmipB(b)|, therefore LmapB(σ) ={bk: k ∈ RmipB(b)}. This is exactly the definition of RmilB(b). �
The properties of the A-code and B-code imply the following.
Theorem 3.5. The map φB = B-code−1 ◦ A-code is a bijection on Bn with the property
(sorB ,Cyc0,LmalB ,LmapB)φ(σ) = (invB ,RmilB ,LmalB ,LmapB)σ.
Theorem 3.6. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then σ ∈ Br implies φB(σ) ∈ Br.
Proof. For a sequence w = (w1, w2, . . . , wn) of integers, let |w| = (|w1|, |w2|, . . . , |wn|).The definitions of the A-code and the B-code for the signed and unsigned case immedi-ately yield that for σ ∈ Bn, |A-code(σ)| = A-code(|σ|) and |B-code(σ)| = B-code(|σ|).Let σ ∈ Br and π = φB(σ). Then, B-code(π) = A-code(σ) and this implies thatB-code(|π|) = A-code(|σ|). So, |π| = φ(|σ|) and since |σ| ∈ Sr from Theorem 2.6 weget |π| ∈ Sr which is equivalent to π ∈ Br. �
S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272 267
Corollary 3.7. The permutation σ ∈ Bn is in Br if and only if B-code(σ) = (b1, . . . , bn)satisfies |bi| � i + 1 − hi.
Theorem 3.8. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then
∑
σ∈Br
qsor(σ)∏
i∈Cyc0(σ)
ti∏
j∈Cyc1(σ)
sj
=n∏
k=1
(tk + q + · · · + qhk−1 + q2k−hk
(1 + q + · · · + qhk−1sk
))(3.3)
where (h1, . . . , hn) is the height sequence of D(r). In particular,
∑
σ∈Bn
qsorB(σ)∏
i∈Cyc0(σ)
ti∏
j∈Cyc1(σ)
sj =n∏
k=1
(tk + q + q2 + · · · + q2k−1sk
).
Let �′B(σ) be the reflection length of σ ∈ Bn, i.e., the minimal number of elementsfrom
{(ij): 1 � i < j � n
}∪{(ij): 1 � i < j � n
}
needed to represent σ. It is not difficult to see that the reflection length of a bal-anced cycle (w1 w2 · · · wk) is k − 1 while the reflection length of an unbalanced cycle(w1 · · · wk w1 · · · wk) is k. Therefore, �′B(σ) = n− cyc0(σ). Define
nminB(σ) =∣∣{i: σ(i) >
∣∣σ(j)∣∣ for some j > i
}∣∣ + N(σ).
Clearly, nminB(σ) = n− rmilB(σ). Petersen [6] proved that
∑
σ∈Bn
qsorB(σ)t�′B(σ) =
∑
σ∈Bn
qinvB(σ)tnminB(σ) =n∏
i=1
(1 + t[2i]q − t
).
We obtain a generalization of this result.
Corollary 3.9. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then
∑
σ∈Br
qinvB(σ)tnminB(σ) =∑
σ∈Br
qsorB(σ)t�′B(σ) =
n∏
k=1
(1 + tq[hk − 1]q + tq2k−hk [hk − 2]q
)
where (h1, . . . , hn) is the height sequence of Dr.
268 S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272
4. Even signed permutations
The type D permutations can be defined as signed permutations with an even numberof minus signs. The minimal generating set for Dn is
SD ={(1 2), (1 2), (2 3), . . . , (n− 1 n)
}.
It is known [1] that the length of σ ∈ Dn, i.e., the minimal number of elements from SD
needed to represent σ is equal to the type D inversion number defined as
invD(σ) =∣∣{1 � i < j � n: σ(i) > σ(j)
}∣∣ +∣∣{1 � i < j � n: −σ(i) > σ(j)
}∣∣
and that
∑
σ∈Dn
qinvD(σ) =n−1∏
i=1
(1 + qi
)[i + 1]q = [n]q ·
n−1∏
i=1[2i]q.
Let tij = (i j) if j �= i and tii = (1 1)(i i) and let
TD = {tij : 1 � i < j � n} ∪ {tij : 1 � i � j � n}.
Note that t11 is the identity and that for i > 1, if w = w1 · · ·wn, then wtii =w1w2 · · ·wi−1wiwi+1 · · ·wn. Each σ ∈ Dn has a unique factorization σ = ti1j1ti2j2 · · · tikjksuch that is < js and 1 < j1 < j2 < · · · < jk. Petersen [6] defined the type Dn sortingindex to be
sorD(σ) =k∑
s=1
(js − is − 2 · χ(is < 0)
)
and proved that∑
σ∈Dn
qsorD(σ) =∑
σ∈Dn
qinvD(σ). (4.1)
As Petersen remarks, sorD(σ) can also be interpreted as the total distance the elementstravel during the type B Straight Selection Sort, but with the caveat that the elementsσ(1) and σ(1) are thought to occupy the same position, so that when a transposition tijis applied with i < 0 the distance counted is j − i− 2 instead of j − i− 1 as in the typeB case.
It is not difficult to see that if σ ∈ Bn then σ ∈ Dn if and only if the A-code definedin Section 3 has an even number of negative elements. Namely ai < 0 if and only if ihas a negative sign in σ. For the B-code the analogous statement is not true. We willdefine a modified B-code, denoted B′-code, as follows. Let σ ∈ Dn. Set σn = σ and let
S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272 269
bn = σ−1(n). If σi has been constructed for n � i > 1 let bi = σ−1(i) and σi−1 = σitbii.Finally, if the number of negative elements in the sequence b2, b3, . . . , bn is even, setb1 = 1, otherwise set b1 = −1. We define B′-code(σ) = (b1, b2, . . . , bn). The permutationsσi obtained this way are all in Dn and therefore σ1 is the identity permutation. Wewill call this algorithm for constructing the permutations σi type D Straight SelectionSort.
Note that if σn, σn−1, . . . , σ1 are the intermediate permutations obtained during thetype B Straight Selection Sort of σ and σ′
n, σ′n−1, . . . , σ
′1 are the permutations during
the type D Straight Selection Sort, then σk and σ′k have the same underlying unsigned
permutation. Therefore, it is not surprising that the B-code and the B′-code are very sim-ilar. In fact, the B′-code (b′1, b′2, . . . , b′n) can be obtained from the B-code (b1, b2, . . . , bn)via the following algorithm. For i = n, n− 1, . . . , 1, if bi �= −i set b′i = bi. Otherwise, setbi = b′i and update the sequence (b1, b2, . . . , bn) by changing the sign of every bj suchthat j < i and |bj | = 1.
For even signed permutations, we define the type D right-to-left minima letters to be
RmilD(σ) ={σ(k): 1 < σ(k) <
∣∣σ(l)∣∣ for all l > k
}.
It can readily be seen that this statistic can be seen from the A-code.
Theorem 4.1. Let σ ∈ Dn and A-code(σ) be a = (a1, a2, . . . , an). Then
(a) invD(σ) =∑n
i=1(i− ai − 2χ(a < 0));(b) RmilD(σ) = Max(a)\{1}.
For an integer sequence r: 1 � r1 � r2 < · · · < rn � n with rk � k, let
Dr ={σ ∈ Dn:
∣∣σ(i)∣∣ � ri for all 1 � i � n
}.
Theorem 4.2. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then
∑
σ∈Dr
qinvD(σ)∏
i∈RmilD(σ)
ti
=n∏
k=2
(tk + q + q2 + · · · + qhk−1 + q2k−hk−1(1 + q + · · · + qhk−1))
where (h1, . . . , hn) is the height sequence of D(r). In particular,
∑
σ∈Dn
qinvD(σ)∏
i∈RmilD(σ)
ti =n∏
k=2
(tk + qk−1 + q[2k − 1]q
).
270 S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272
Proof. In an A-code of an even signed permutation the sign and therefore the value of a1is determined by the signs of a2, . . . , an, while the rest of the values ai are independentand can take any nonzero value such that |ai| � i. Moreover, Lemma 3.2 implies thatσ ∈ Dn if and only if |ai| � i+1−hi, for all i, where (h1, . . . , hn) is the height sequenceof the Dyck path D(r). Therefore, the first equality follows from Theorem 4.1 while thesecond one is a special case obtained when r1 = r2 = · · · = rn = n. �
Define Cyc′0(σ) = Cyc′0(σ)\{1} and Cyc′1(σ) = Cyc′1(σ)\{1}.
Theorem 4.3. Let σ ∈ Dn and B′-code(σ) be b′ = (b′1, b′2, . . . , b′n). Then
(a) sorD(σ) =∑n
i=1(i− b′i − 2χ(b′i < 0));(b) Cyc′0(σ) = Max(b′)\{1} and Cyc′1(σ) = Min(b′)\{1}.
Proof. By construction of the B′-code, the factorization of σ into factors σ =ti1j1ti2j2 · · · tikjk with 1 < j1 < j2 < · · · < jk is exactly σ = tb22tb33 · · · tbnn and thereforepart (a) follows from the definition of sorD(σ).
Moreover, if σi, 1 � i � n and σ′i, 1 � i � n are the permutations obtained
during the construction of the B-code and the B′-code, respectively, then σ′k = σk
if σk is even and σ′k = σk(1 1) otherwise. Recall that i ∈ Cyc0(σ) if and only if
(i) or (i i) is a cycle in σi and note how multiplication by (11) changes the cycleof 1: (1 c1 · · · cr 1 c2 · · · cr)(1 1) = (1 c2 · · · cr). We observed above that if(b1, b2, . . . , bn) is the B-code of σ, then b′i �= bi only if bi ∈ {1,−1} and even then thedifference is only in sign. Therefore part (b) follows Theorem 3.4. �Theorem 4.4. The map φD = B′-code−1 ◦ A-code is a bijection on Dn such that
(sorD,Cyc′0
)φD(σ) = (invD,RmilD)σ.
Moreover, for a sequence of integers r: 1 � r1 � r2 � · · · � rn � n if σ ∈ Dr thenφD(σ) ∈ Dr.
Proof. The first part follows directly from Theorems 4.1 and 4.3. The second part followsfrom Lemma 3.2, Corollary 3.7, and the relation between the B-code and B′-code for evensigned permutations. �Theorem 4.5. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then
∑
σ∈Dr
qsor(σ)∏
i∈Cyc′0(σ)
ti∏
j∈Cyc′1(σ)
sj
=n∏(
tk + q + · · · + qhk−1 + q2k−hk−1(1 + q + · · · + qhk−1sk))
(4.2)
k=2S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272 271
where (h1, . . . , hn) is the height sequence of Dr. In particular,
∑
σ∈Dn
qsorB(σ)∏
i∈Cyc′0(σ)
ti∏
j∈Cyc′1(σ)
sj =n∏
k=2
(tk + qk−1 + q2k−2sk + q[2k − 2]q
).
Even though the elements in TD are not reflections, we can define �′D(σ) be theminimal number of elements from TD needed to represent σ.
Lemma 4.6. If σ ∈ Dn then �′D(σ) = n− 1 − cyc′0(σ).
Proof. We will first show that n − 1 − cyc′0(σ) number of transpositions from TD
are sufficient to express σ. A balanced cycle (w1 w2 · · · wk) can be expressed astwk−1wk
twk−2wk· · · tw1wk
. An unbalanced cycle (w1 · · · wk w1 · · · wk) is equal to(1 1)twkwk
twk−1wk· · · tw1wk
, which implies that if it contains 1 then k − 1 transposi-tions are sufficient. Note that (1 1)t1j = t1j(1 1). Using this commuting property, we seethat if 1 is in a balanced cycle, the number of balanced cycles is cyc′0(σ)+1 and this waywe get a factorization into n − 1 − cyc′0(σ). If 1 is not in a balanced cycle, the numberof balanced cycles is cyc′0(σ) and there are cyc′0(σ) + 1 cycles for which the number offactors used is one less then their length. Therefore, the total number of transpositionsused is also n− 1 − cyc′0(σ).
To see that n − 1 − cyc′0(σ) is optimal we use induction on n. Assume σ ∈ Dn suchthat σ(n) �= n. Let b = σ−1(n) and σ1 = σtbn. Then clearly, �′D(σ) � �′D(σ1) + 1. Thepermutation σ1 fixes n, so we will view it as a permutation in Dn−1. By the inductionhypothesis �′D(σ1) = n− 2 − cyc′0(σ1). There are two cases. (i) b �= n: In this case σ1 isobtained by deleting n and n from the cycles of σ and thus cyc′0(σ1) = cyc′0(σ); (ii) b = n:In this case σ1 is obtained by deleting the unbalanced cycle (n n) from σ. Therefore,cyc′0(σ1) = cyc′0(σ). �
Let N ′(σ) be the number of elements greater than 1 that have negative sign in σ anddefine
nminD(σ) =∣∣{i: σ(i) >
∣∣σ(j)∣∣ for some j > i
}∣∣ + N ′(σ).
Clearly, nminD(σ) = n− 1 − rmilD(σ).
Corollary 4.7. Let r be an integer sequence 1 � r1 � r2 � · · · � rn � n with rk � k, forall k. Then
∑
σ∈Dr
qinvD(σ)tnminD(σ) =∑
σ∈Dr
qsorD(σ)t�′D(σ) =
n∏
k=2
(1 + tq[hk − 1]q + tq2k−hk−1[hk]q
)
where (h1, . . . , hn) is the height sequence of D(r).
272 S. Poznanović / Journal of Combinatorial Theory, Series A 125 (2014) 254–272
Acknowledgment
The author would like to thank Michelle Wachs for drawing her attention to [2].
References
[1] A. Björner, F. Brenti, Combinatorics of Coxeter Groups, Springer, New York, 2005.[2] A. Björner, M. Wachs, Permutation statistics and linear extensions of posets, J. Combin. Theory
Ser. A 58 (1991) 85–114.[3] D. Foata, G.-N. Han, New permutation coding and equidistribution of set valued statistics, Theoret.
Comput. Sci. 410 (2009) 3743–3750.[4] D. Knuth, The Art of Computer Programming, vol. 3, Addison–Wesley, 1998.[5] P.A. MacMahon, Two applications of general theorems in combinatory analysis, Proc. London Math.
Soc. 15 (1916) 314–321.[6] T.K. Petersen, The sorting index, Adv. in Appl. Math. 47 (2011) 615–630.[7] O. Rodriguez, Note sur les inversions, ou dérangements produits dans les permutations, J. Math. 4
(1839) 236–240.[8] M.C. Wilson, An interesting new Mahonian permutation statistic, Electron. J. Combin. 17 (2010),
#R147.