Crossings and nestings over some Motzkin objects and $q$-Motzkin numbers

We examine the enumeration of certain Motzkin objects according to the numbers of crossings and nestings. With respect to continued fractions, we compute and express the distributions of the statistics of the numbers of crossings and nestings over three sets, namely the set of $4321$-avoiding involutions, the set of $3412$-avoiding involutions, and the set of $(321,3\bar{1}42)$-avoiding permutations. To get our results, we exploit the bijection of Biane restricted to the sets of $4321$- and $3412$-avoiding involutions which was characterized by Barnabei et al.~ and the bijection between $(321,3\bar{1}42)$-avoiding permutations and Motzkin paths, presented by Chen et al.~. Furthermore, we manipulate the obtained continued fractions to get the recursion formulas for the polynomial distributions of crossings and nestings, and it follows that the results involve two new $q$-Motzkin numbers.


Introduction and result
We let S n denote the set of all permutations of [n] := {1, . . . , n}. A permutation σ ∈ S n is an involution whenever σ(σ(i)) = i for all i ∈ [n], and we write I n to denote the set of all involutions in S n . We refer |σ| as the length of the permutation σ.
Suppose that σ ∈ S n and τ ∈ S k . We say a subsequence s = σ(i 1 )σ(i 2 ) · · · σ(i k ) is an occurrence of τ if and only if s and τ are in the same isomorphic order, i.e. σ(i x ) < σ(i y ) if and only if τ(x) < τ(y). Whenever σ contains no occurrence of τ, we say that σ avoids the pattern τ or simply σ is τ-avoiding. For any given set of permutations T, called set of patterns, we write S n (T) and I n (T) to denote the sets of permutations and involutions, respectively, in S n which avoid every pattern in T, and we write S(T) and I(T) to denote the sets of all permutations and involutions, respectively, including the empty permutation, which avoid every pattern in T. Usually, if T = {τ 1 , . . . , τ k }, we write S n (T) = S n (τ 1 , . . . , τ k ) and S(T) = S(τ 1 , . . . , τ k ). For example, the subsequence 5297 of the permutation π = 35142987 is an occurrence of 2143. We can easily verify that π ∈ I 9 (4321).
A barred permutation is a permutation such that some of its elements are barred. We letS k denote the set of all barred permutations of length k. Example: 32451 is a barred permutation inS 5 . Wheneverτ ∈S k , we let τ denote the permutation obtained by unbarringτ, and τ ′ denote the reduction of the permutation obtained fromτ by removing the barred element (if any). Example: ifτ = 32451, we have τ = 32451 and τ ′ = 231. We say that a permutation σ avoidsτ if each occurrence of τ ′ in σ (if any) is part of an occurrence of τ in σ. For example, a permutation σ is 3142-avoiding if and only if, for any occurrence σ(i)σ(j)σ(k) of 321 in σ, there exists i < l < j such that σ(l) < σ(k).
A statistic over a given set E is a map s : E → N. The polynomial distribution of the statistic s over the E is the polynomial ∑ e∈E q s(e) . For example, if we let P n denote the set of all subsets of [n] and card(A) denote the cardinality of A for any A ∈ P n , then card is a statistic over P n and its polynomial distribution is ∑ A∈P n q card(A) = (1 + q) n . Furthermore, the generating function of the polynomial ∑ A∈P n q card(A) is We will now define some statistics over S n . For that, we let σ ∈ S n . An excedance (resp. fixed point) of σ is an index i such that σ(i) > i (resp. σ(i) = i). A crossing (resp. nesting, inversion) of σ is a pair of indices (i, j) such that i < j < σ(i) < σ(j) or σ(i) < σ(j) ≤ i < j (resp. i < j < σ(j) < σ(i) or σ(j) < σ(i) ≤ i < j, i < j and σ(j) > σ(i)). We let exc(σ) (resp. cr(σ), nes(σ), inv(σ)) denote the number of excedances (resp. crossings, nestings, inversions) of σ. For example, the permutation π = 4 6 2 9 8 1 7 3 10 5 ∈ S 10 has the following properties: exc(π) = 5, cr(π) = 7, nes(π) = 4 and inv(π) = 20. Therefore, exc, cr, nes, and inv are all statistics over S n . Médicis and Viennot [17] and Randrianarivony [21] showed that these statistics are related by the following identity: inv(σ) = exc(σ) + cr(σ) + 2nes(σ), for any σ ∈ S n . (1.1) In this paper, we are interested in the distribution of the statistics numbers of crossings and nestings over the sets I n (4321), I n (3412) and S n (321, 3142). These sets are all enumerated by the n-th Motzkin number (the sequence A001006 in [22]) and they are well studied in the literature (see [2,6,11] and references therein).
Motzkin numbers M n are traditionally defined by the following recurrence relation: The first values for M n are 1, 1, 2, 4, 9, 21, 51, 127, 323, 835, . . . . Using (1.2), the generating function for Motzkin numbers, i.e. M(t) = ∑ n≥0 M n t n , satisfies the following equivalent functional equations Solving the first equation of (1.3) for M(t), we obtain The second identity of (1.3) leads to the following continued fraction expansion for M(t) The term q-Motzkin numbers refers to a sequence of polynomials in q whose evaluation at q = 1 gives the sequence of Motzkin numbers. In other words, this polynomial satisfies the recurrence for the Motzkin numbers and equals to the Motzkin numbers when specializing q = 1. Some q-generalizations of Motzkin numbers are studied by Barcucci et al. [1] and recently by Barnabei and al. [3]. Here, we are interested in two new q-Motzkin numbers M n (q) andM n (q). The first one M n (q) is defined by ( 1.4) and the second oneM n (q) bỹ where δ is the usual Kronecker symbol. With a view to extend the results on q-Motzkin numbers introduced in [1, 3], we will show how these q-Motzkin numbers are the distributions of crossings and nestings over restricted permutations, using continued fractions. For continued fractions, we are inspired by various known applications on enumeration of combinatorial objects (eg. [14,15,16,20,21]). The study of the crossings and nestings over permutations was introduced by Médicis and Viennot in [17] and extended in [5,7,8,20,21]. The study of these statistics over patternavoiding permutations was introduced by the second author [18] who exploited a known bijection of Elizalde and Pak [13] to find the equidistributions of the crossings over the sets of permutations avoiding the patterns 132, 213, and 321. Later, Rakotomamonjy et al. [19] enumerated the sets of permutations avoiding some pairs of patterns of length 3 according to cr, and they found new combinatorial interpretations of some known sequences in [22]. In this work, we investigate the enumeration of some Motzkin objects, namely the sets I n (4321), I n (3412), and S n (321, 3142), according to the numbers of crossings and nestings (see Theorem 1.1). The use of some known bijections between these sets and Motzkin paths allows us to reach our goal.
A Motzkin path of length n is a lattice path starting at (0, 0), ending at (n, 0), and never going below the x-axis, consisting of up steps u = (1, 1), horizontal steps h = (1, 0), and down steps d = (1, −1). The set of Motzkin paths of length n will be denoted by M n .
It is well known that the cardinality of M n is the n-th Motzkin number M n . The bijections between our combinatorial objects and Motzkin paths are well studied in [2,6]. Firstly, Barnabei et al. [2] studied the bijection of Biane [4] restricted to involutions. The bijection of Biane maps an involution into a Motzkin path whose down steps are labelled with an integer that does not exceed their height, while the other steps are unlabelled. Barnabei  Consequently, when restricted to 4321-and 3412-avoiding involutions, we can ignore the labels on Motzkin paths. Secondly, using reduced decomposition of Motzkin paths, Chen et al [6] exhibited a bijection between S n (321, 3142) and M n which exchanges the statistics inv and area − sh u . Through these two bijections, we interpret the statistics cr and nes in terms of statistics on Motzkin paths. Thus, as main results, we find the following combinatorial interpretations of M n (q) andM n (q). We organise the rest of this paper in three sections. Section 2 is a preliminary section in which we define some statistics over Motzkin paths and we compute the generating function of their joint distribution. In Section 3 and 4, making use of the result obtained in Section 2 using the bijections of Biane [4] and Chen et al. [6], we compute and express, in terms of continued fractions, the distributions of cr and nes over the sets I n (4321), I n (3412), and S n (321, 3142). Using the obtained continued fractions, we provide the proof of Theorem 1.1.

Motzkin paths and statistics
In this section, we define some statistics over Motzkin paths and we prove a preliminary result that is fundamental for the rest of the paper (see Theorem 2.4).
Let P = P 1 P 2 · · · P n be a Motzkin path of length n. Let us first define the following sets: The height of each step s in P is the y-coordinate of the starting point of s. Therefore, the height of the i-th step of P is equal to where P(1, i) := P 1 P 2 · · · P i is the initial sub-path of length i of P and, for any word w, |w| a is the number of occurrences of the letter a in the word w. Here are some statistics over M n : • area(P) the area between the path P and the x-axis, • up(P) (resp. hor(P),down(P)) the number of up (resp. horizontal, down) steps of P, • sh u (P) (resp. sh h (P), sh d (P)) the sum of heights of all up (resp. horizontal, down) steps of P, i.e.
For example, the Motzkin path in Fig. 1 has the following properties: hor(P) = 2, up(P) = down(P) = 7, sh u (P) = 8, sh h (P) = 4, sh d (P) = 15 and area(P) = 27. We will show how these statistics are related. Proposition 2.1. For any Motzkin path P, we have Proof. The proof is simply based on the following properties.
• If the i-th step of P is a down step of height h, the area of the polygon • If the i-th step of P is a horizontal step of height h, the area of the polygon The area of the path P is equal to the sum of the areas of such polygons corresponding to down and horizontal steps (see Figure 2). By the same way, when we decompose the area statistic according to up and horizontal steps, we obtain the following proposition.
Proof. Using both propositions 2.1 and 2.2 with the obvious fact that up(P) = down(P) for any Motzkin path P, we obtain the corollary.
We now consider the following polynomial and we denote by I(a, b, c, d; t) = ∑ n≥0 I n (a, b, c, d)t n the generating function of I n (a, b, c, d).
Before closing this section, we will prove a fundamental identity which allows us to get easily the main results of this paper. Theorem 2.4. The continued fraction expansion of I(a, b, c, d; t) is Proof. The proof is based on the usual decomposition of Motzkin paths. Let P ∈ M n . Using the first return decomposition, we obtain the following relations: • if P = hP ′ for some P ′ ∈ M n−1 , then we have (hor, up, sh u , sh h )P = (1 + hor, up, sh u , sh h )P ′ .
• If P = uP 1 dP 2 for some k ≥ 2 such that P 1 ∈ M k−2 and P 2 ∈ M n−k , then we have These two points lead to the following recurrence for the polynomial I n (a, b, c, d): with I 0 (a, b, c, d) = 1. Thus, when we compute I(a, b, c, d; t), we obtain from (2.3) the following relation .
Developing I(ad, bc, c, d; t) in its turn, we obtain the desired continued fraction expansion for I(a, b, c, d; t).

Crossings and nestings over I n (4321) and I n (3412)
In this section, we will establish the proof of the first part of Theorem 1.1 concerning the recursion for the polynomial distribution of crossings and nestings over the sets I n (4321) and I n (3412). For that, we first recall the bijection of Biane [4] restricted to the set of involutions that was studied by Barnabei et al. [2]. The bijection maps an involution into a Motzkin path whose down steps are labelled with an integer that does not exceed its height, while the other steps are unlabelled. Barnabei et al. [2] proved the following characterisations: • An involution σ avoids 4321 if and only if the label of any down step in the corresponding Motzkin path is 1.
• An involution σ avoids 3412 if and only if the label of any down step in the corresponding Motzkin path equals its height.
Consequently, when restricted to 4321-and 3412-avoiding involutions, we can ignore the labels on Motzkin paths. Let us denote by Φ 1 (resp. Φ 2 ) the bijection from M n to I n (4321) (resp. I n (3412)). In this section, we manipulate the bijections Φ 1 and Φ 2 , and we will show how these bijections interchange the statistics (fp, exc, cr, nes) and (hor, up, a.sh u , b.sh h ), where a and b are two arbitrary integers.
Since the construction of the image of an involution under the maps Φ 1 and Φ 2 is the same and obvious (see [2]), we just focus on how to get the corresponding involutions from Motzkin paths. Let P ∈ M n . We will construct σ 1 = Φ 1 (P) by the following procedure (see Figure 3 for graphical illustration).
• From left to right, number the steps of P from 1 up to n.  Before giving the formulation of Φ 2 , we first recall what a tunnel is. The notion of tunnels on Dyck paths (Dyck paths are Motzkin paths having no horizontal step) is introduced by Elizalde et al. [12,13] and Barnabey et al. [3] extend the notion in terms of Motzkin paths. A tunnel of a Motzkin path P is a horizontal segment between two distinct lattice points of P that intersects P only at these two points and lies always below P. Each tunnel t starts from the starting point of an up step u to the ending point of a down step d. We say that the tunnel t matches u and d. For example, the Motzkin path in Figure 4 has 7 tunnels drawn in right dashed arrows. In particular, the tunnel t 3 matches the up step numbered 4 and the down step numbered 7. For any Motzkin path P, we can construct σ 2 = Φ 2 (P) by the following procedure (see Figure 4): • From left to right, number the steps of P from 1 up to n.
Proof. Let σ be an involution. By definition, we have Notice first that the following properties are obvious: (a) if σ is 4321-avoiding, then we have |{j < i|σ(j) > σ(i)}| = 0 for all i such that σ(i) > i.
This also ends the proof of (ii). Thus, Proposition 3.1 follows.
Now, to close this section, we will prove the first identities of the main result presented in the introduction (see. Theorem 1.1).

Proof. Let us denote by
Simple manipulation of the continued fraction expansion of A(q; t) leads to the following functional equation This is also equivalent to the following one A(q; t) = 1 + tA(q; t) + t 2 A(q; t)A(q; qt).

When we extract the coefficient A n (q) of t n on both sides of this equation, we obtain
A 0 (q) = 1, A n (q) = A n−1 (q) + n−2 ∑ k=0 q k A k (q)A n−2−k (q) for n ≥ 1.
Since the polynomials A n (q) and M n (q) have the same recurrence (see recursion (1.2)) and the same initial values, so they are the same. Furthermore, from (3.1) and (3.2), we obtain ∑ σ∈I(4321) Thus, we get Theorem 3.3.

Crossings over S n (321, 3142)
The main goal of this section is to prove the second part of Theorem 1.1 concerning the distribution of crossings over S n (321, 3142). For that, we will use the bijection of Chen et al. [6] based on reduced decomposition of permutations and strip decomposition of Motzkin paths.
A transposition s i = (i i + 1) (i.e. 2-cycle) is a map from S n to itself which interchanges the numbers in the ith and (i + 1)th position in a permutation. For example, s 3 (623514) = 625314. Every permutation σ in S n can be represented as a sequence of transpositions s i 1 s i 2 · · · s i k which, when applied from right to left to the identity permutation 123 · · · n, results in σ. Such representation is not necessarily unique. For example, 321 can be written as both s 1 s 2 s 1 and s 2 s 1 s 2 . In fact, the product of simple transpositions satisfies the Braid relations: s i+1 s i s i+1 = s i s i+1 s i and s i s j = s j s i , where |i − j| = 1.
Let σ ∈ S n . We now determine an unique representation corresponding to σ, called the canonical reduced decomposition of σ, by a specific procedure. For that, we denote by R(σ) the set of the pairs resulting from the following procedure and initiate it to the empty set.
1. If σ is the identity, then the corresponding canonical reduced decomposition of σ is the identity. Otherwise, we let σ (0) := σ and we go to the next step.
2. Locate the pair (n 1 , i 1 ), where n 1 is the greatest excedance value of σ (0) and i 1 its position (i.e. i 1 < n 1 = σ (0) (i 1 ) since i 1 is an excedance of σ (0) ). Move n 1 from i 1 to position n 1 by applying from right to left the sequence s n 1 −1 s n 1 −2 · · · s i 1 +1 s i 1 and leave the relative order of the other numbers unchanged. Let σ (1) be the resulting permutation. Then, add the pair (n 1 − 1, i 1 ) to R(σ) and pass to the next step.
3. Return to the first step and apply the procedure to σ (1) .
We have to notice that the above algorithm is none other than that of Chen et al. [6]. We just modified it to emphasize the notion of excedance. In Chen et al. [6], the set R(σ) is known as the set of pairs (head,tail) and they showed the following characterisation.  t 2 ), . . . , (h k , t k )}. We have σ ∈ S n (321, 3142) if and only if t j−1 + 2 ≤ t j for 1 < j ≤ k.
Proof. Let σ ∈ S n (321, 3142). Since σ is 321-avoiding, then nes(σ) = 0 (see. [18,Lem. 5.1]). Consequently, if i 1 < i 2 < · · · < i k and j 1 < j 2 < · · · < j n−k are respectively excedances and non-excedances of σ, then we have σ(i 1 ) < σ(i 2 ) < · · · < σ(i k ) and σ(j 1 ) < σ(j 2 ) < · · · < σ(j n−k ). It is clear that, when we apply the above procedure, we get R(σ) = {(σ(i 1 ) − 1, i 1 ), (σ(i 2 ) − 1, i 2 ), . . . , (σ(i k ) − 1, i k )}. So, we have Exc(σ) = {i 1 , i 2 , . . . , i k }. For any 1 ≤ j ≤ k, since i j + 2 < i j+1 (see Theorem 4.1), then i j + 1 is a non-excedance of σ and consequently we have σ(i j ) > σ(i j + 1). Thus, excedances of σ are all descents of σ. Furthermore, for some x, a non-excedance j x of σ can not be descent of σ because j x is followed by, either an excedance and we have σ(j x ) < j x + 1 < σ(j x + 1), or a non-excedance and we have σ(j x ) < σ(j x + 1) < j x + 1. Thus, we get Des(σ) = Exc(σ). Now, we recall the (x+y)-labelling and the strip decomposition of a Motzkin path. We call the (x+y)-labelling of a Motzkin path P the action of labelling some cells (squares and triangulars containing a down-step) between P and the x-axis by the sum of the coordinates of their left bottom coin. We now define the strip decomposition of a Motzkin path. Suppose P = P n,k is a Motzkin path of length n that contains k up steps. If k = 0, then the strip decomposition of P n,0 is simply the empty set. For any P n,k ∈ M n , let A → B be the last up step and E → F the last down step on P n,k . Then we define the strip of P n,k as the path from B to F along the path P n,k . Now we move the points from B to E one layer lower, namely, subtract the y-coordinate by 1, and denote the adjusted points by B 0 , . . . , E 0 . We form a new Motzkin path by using the path P n,k up to the point A, then joining the point A to B 0 and following the adjusted segment until we reach the point E 0 , then continuing with the points on the x-axis to reach the destination (n, 0). Denote this Motzkin path by P n,k−1 , which may end with some horizontal steps. From the strip of P n,k , we may define the value h k as the label of the cell containing the step E → F. Clearly, we have h k ≤ n − 1. The value t k is defined as the label of the cell containing the step starting from the point B.
This ends the proof of our proposition.
We will prove the following unexpected recursion satisfied by the sequence (H n,i ). Proof. To prove (4.7), we will proceed by induction on n. For that, we can easily verify that (4.7) holds for n = 1, 2, 3. Suppose that it holds until some integer n. To prove that it still holds for n + 1, we treat separately the cases i =   This also ends the proof of Theorem 4.6.
Corollary 4.7. For any positive integer n, we have H n,0 =M n (q).
Proof. Using (4.5) with the fact that H n,0 = H n−1,0 + H n−1,1 for any integer n ≥ 0, we get Since H n,0 andM n (q) satisfy the same recursion (see (1.5)) and the same initial values, then they are equal.
Combining this last corollary with identity (4.6), we obtain our desired result. q cr(σ) =M n (q).
We close this section with an interesting non-trivial identity concerning equality of two continued fractions as another consequence of Corollary 4.7.