Nestings of Matchings and Permutations and North Steps in PDSAWs

We present a simple bijective proof of the fact that matchings of [2n] with N nestings are equinumerous to partially directed self avoiding walks confined to the symmetric wedge defined by y=+-x, with n east steps and N north steps. A very similar construction connects permutations with N nestings and PDSAWs remaining below the x-axis, again with N north steps. Furthermore, both bijections transport several combinatorially meaningful parameters.


Introduction
This article exhibits a connection, at first maybe surprising, between two at present very actively researched, yet classic, areas of combinatorics. The first area to be mentioned concerns the enumeration of matchings, set-partitions and permutations, keeping track of various statistics such as crossings and nestings. For example, it was observed only rather recently by Martin Klazar and Marc Noy (see Section 1 of [6]) that the joint distribution of crossings and nestings of matchings is symmetric. A little later, this proved to be true also for set-partitions, as shown by Anisse Kasraoui and Jiang Zeng [4], and finally by Sylvie Corteel [1] for permutations. The other area concerns counting self avoiding walks on lattices under various restrictions. These objects are not only interesting from a purely combinatorial point of view, but also for physicists, who seem to use them as models for polymers in dilute solutions. Unfortunately, self avoiding walk models are usually intractable from a combinatorial point of view. However, imposing some sort of directedness on the walks, we obtain models that are easier to deal with. More precisely, in this article we will consider self avoiding walks that are partially directed : Definition 1.1. A partially directed self avoiding walk, short PDSAW is a walk in the plane, starting at the origin and taking unit east, north, and south steps, where, however, a north step must not be immediately followed or preceded by a south step. Within this article, we restrict our attention to walks that either stay within the symmetric wedge, defined by y = ±x, or the asymmetric wedge enclosed by the x-axis and y = −x. Furthermore, we require that the paths end at some point on y = −x.  1.1. PDSAWs in the symmetric wedge. An example of a walk in the symmetric wedge can be found in Figure 1.a. Since a walk is entirely determined by the ycoordinates of its east steps, it is immediate that the total number of walks with n east steps is given by (2n − 1)!! = 1 · 3 . . . (2n − 3)(2n − 1). Note that this is also the number of matchings of the set [2n] = {1, 2, . . . , 2n}. By introducing the iterated kernel method, Janse van Rensburg, Thomas Prellberg and Andrew Rechnitzer [11] were able to derive a rather complicated expression for the generating function of PDSAWs according to the total number of steps. Using that expression they also computed the asymptotic number of such paths.
Intriguingly, the generating function they found was composed of pieces which all seemed to have a combinatorial interpretation. Roughly, it consisted of an alternating series of powers of Catalan generating functions, albeit shifted by a quadratically growing power, hinting at the distinct possibility of a more direct combinatorial derivation. When one of them related this to Philippe Flajolet, he pointed out an apparent similarity to a formula counting the number of matchings with respect to crossings. Following up on this connection, they discovered the surprising fact that the generating function for PDSAWs with n east steps, where q marks the number of north steps, is as simple as (1) This formula is known as Touchard-Riordan Formula, and counts the number of matchings of the set [2n] according to crossings, i.e., pairs of matched points {i, j} and {k, l} with i < k < j < l, pictorially: A bijective proof of the latter fact was given by Jean-Guy Penaud [8], exhibiting a whole zoo of combinatorial objects counted by these numbers, including certain horizontally convex polyominoes.
Of course, we would now like to see a bijection between PDSAWs in the symmetric wedge with N north steps and matchings with N crossings. It is the main purpose of this article to describe such a bijection. However, it turns out that it is more convenient to consider matchings with N nestings instead, that is, pairs of matched points {i, j} and {k, l} with i < k < l < j: Note that nestings and crossings in matchings (and, in fact, also in partitions and permutations, given appropriate definitions) are equidistributed, see the articles by Anisse Kasraoui and Jiang Zeng, and Sylvie Corteel [1,4].
The bijection we present in Sections 2.1 and 2.2 will transport several combinatorially meaningful statistics on PDSAWs and matchings. In particular, it will map factors of PDSAWs to factors of matchings: A factor of a matching is a sub-matching such that all elements of the sub-interval {a, a + 1, . . . , b} are matched within that interval.
As an example, the PDSAW in Figure 1.a has two (prime) factors which are separated by the dotted line.  (To compute the area enclosed by the path and the line y = −x, we only count full squares and disregard triangles. The length of the last descent is the number of south steps after the last east step of the PDSAW.) 1.2. PDSAWs in the asymmetric wedge. We now shift our attention to PD-SAWs in the asymmetric wedge. Again, it is immediate that the total number of such walks with n east steps equals n!. Indeed, after performing a few computations and consulting the on-line encyclopedia of integer sequences [10], one will be convinced that these paths should be in bijection with permutations, north steps being mapped to nestings as defined by Sylvie Corteel [1], or, alternatively, to the number of occurrences of the (generalised) pattern 31-2. Similar to the case of matchings, there is a formula for the generating function of permutations of [n] according to nestings, as shown by Sylvie Corteel [1] building on work of Lauren Williams [13]: Sure enough, just a few days (or were it mere hours?) after being presented with this conjecture, Philippe Nadeau came up with a surprisingly simple bijection between PDSAWs that remain below the x-axis with N north steps and permutations that contain the generalised pattern 31-2 N times. Motivated by this, and given the definitions of Sylvie Corteel [1], it was not hard to find another bijection to permutations with N nestings, that again transports factors and the length of the last descent nicely. Of course, in this situation, a factor is defined slightly differently: Definition 1.4. A factor of a PDSAW in the asymmetric wedge is a sub-path starting at (a, −a) and ending at (b, −b), that stays below the line y = −a, for some a and some b.
A factor of a permutation is a sub-permutation such that all elements less than a are mapped to elements less than a, and all elements greater than b are mapped to elements greater than b.
Analogous to Theorem 1.3 we can prove: Moreover, factors are preserved, the last factor of the PDSAW being mapped to the first factor of the permutation.

The bijection for PDSAWs in the symmetric wedge
In this section we exhibit a bijective proof of Theorem 1.3. We do so by taking a slight detour over certain weighted Dyck paths, known as 'histoires de Hermite'.

2.1.
A bijection between matchings and weighted Dyck paths. For convenience, we introduce a group of objects which are known to be in bijection with matchings (see, for example, the article by Anisse Kasraoui and Jiang Zeng [4]), namely Dyck paths with weights on the south-east steps. A Dyck path is a path starting at the origin, taking north-east and south-east steps, returning to the xaxis but never going below it. The height of a step is the y-coordinate of the point where it ends, and we allow a non-negative weight on each south-east step, at most as big as its height. These objects are also known as 'histoires de Hermite', because of their connection to the Hermite orthogonal polynomials. An example of such a path is given in Figure 4. For brevity, we will refer to these weighted Dyck paths always simply as 'Dyck paths'.
To be able to keep track of all the statistics mentioned in Theorem 1.3, we need to describe their meaning also on Dyck paths: The total weight of a Dyck path is the sum of the weights of its south-east steps. The complementary weight of a step is the difference of its height and its weight, and the complementary weight of a Dyck path is the sum of the complementary weights of its steps.
A factor of a Dyck path is a subpath that starts and ends at the x-axis, but does not return to the x-axis otherwise.
The following are trivial consequences of the bijection exhibited in the article by Anisse Kasraoui and Jiang Zeng [4], which is a variant of bijections in Philippe Flajolet's and Xavier Viennot's articles [2,12]: (The position of the first step in a Dyck path is one, the second step has position two, etc.)

2.2.
A bijection between weighted Dyck paths and PDSAWs. In this section we present a bijection between weighted Dyck paths and PDSAWs, thus proving Theorem 1.3. As a side remark, for PDSAWs without north steps the transformation is particularly simple: it consists of rotating the PDSAW counterclockwise by 45 and reflecting the result at a vertical line, giving all south-east steps weight zero.
Let P be a PDSAW, given by the y-coordinates of its east steps. We proceed recursively: there is only one PDSAW with a single east step, so we assume that P has n > 1 east steps. Let P ′ be obtained from P by removing its last east step.
If the length of the last descent of P is minimal, i.e., one, we map P to the Dyck path obtained by prepending 0 • • • to the Dyck path D ′ corresponding to P ′ . Otherwise, letP be the PDSAW obtained from P by lowering the last east step by one and letD be the corresponding Dyck path. Let M (D) be the position of the first south-east step inD with weight zero. We consider the step immediately before and the step immediately after, and produce the Dyck path D corresponding to P according to the following five local transformation rules: We observe that for a given Dyck path, exactly one of these rules applies, and each of them is invertible. Furthermore, the rules imply that M (D) = M (D)+ 1. It remains to check that also the other statistics in Theorem 1.3 are correctly mapped.
First, we remark that the five local transformation rules form an automaton as in Figure 5: transformation (I) can only be followed by one of the transformations (I), (II) or (III), and so on.
We now show that the last two steps of the PDSAW have the same y-coordinate precisely when transformation (III) applies, i.e., the first south-east step with weight zero is preceded by a north-east step and followed by another south-east step with weight zero: Suppose that the last descent of the PDSAW P ′ has length M − 1. By induction, M is the position of the first south-east step of D ′ with weight zero. To obtain D, we first prepend 0 • • • to D ′ . In this new path, the second south-east step with weight zero is now at position M + 2. Then, if the last two east steps of P have the same ycoordinate, we must apply exactly M −1 times some local transformation. This will move the first south-east step having weight zero from position 2 to position M + 1, i.e., just before the second south-east step with weight zero. We conclude that we only applied transformations of type (I) and (II), and end up in a configuration as described in the preceding paragraph.
Since (I) and (II) preserve the total weight of the Dyck path, and (III), (IV) and (V) increase it by one, the bijection indeed transforms the number of north steps into the total weight of the Dyck path.
A simple computation reveals that transformations (I) and (V) increase the complementary weight by one, while the other transformations decrease it by one. Increasing the y-coordinate of the final east step of a PDSAW by one also increases the area enclosed by the path and the line y = −x by one. Thus, we find that the parity of the area and of the complementary weight coincides.
It remains to show that the bijection preserves prime factors, i.e., factors that do not contain a smaller factor. To start with, we observe that transformations (II), (III) and (IV) preserve prime factors, while (I) and (V) merge the first two prime factors, given that the middle step in the preimage has height zero.
The preimage of transformation (I), with middle step having height zero corresponds exactly to the situation where the last east step of the PDSAW is minimal. The preimage must occur at the very beginning of the Dyck path, since a step preceding it would have to be a south-east step at height zero, and therefore necessarily of weight zero.
Finally, the preimage of transformation (V), with middle step having height zero corresponds exactly to the situation where the last east step of the last prime factor of the PDSAW is maximal, i.e., making it higher would merge the last two prime factors. This is because no south-east step before the middle step in the preimage can have weight zero. Therefore, the middle step of the preimage marks the end of the first prime factor of the Dyck path, and the length of this prime factor minus one is also the length of the last descent in the PDSAW. P P P P P P q 1 1 P P P P P P q Figure 5. The automaton corresponding to the local rules from Section 2.2. Figure 6. A Motzkin path with 14 steps corresponding to the PDSAW in Figure 1.b. Only non-zero weights are indicated.

The bijection for the asymmetric wedge
The aim of this section is to present a construction for PDSAWs in the asymmetric wedge analogous to the one presented in the preceding section. The rôle played by weighted Dyck paths in Section 2 is now taken by weighted Motzkin paths, or 'histoires de Laguerre'. Note that the bijection presented in the last section does not seem to restrict nicely to PDSAWs in the asymmetric wedge. At least, we were unable to find a good characterisation of those weighted Dyck paths that correspond to these PDSAWs.

A bijection between permutations and weighted bicoloured Motzkin
Paths. We employ a slight variation of a bijection due to Dominique Foata and Doron Zeilberger that maps permutations to weighted bicoloured Motzkin paths.
A bicoloured Motzkin path is a path starting at the origin, taking north-east, south-east, east and coloured east steps, returning to the x-axis but never going below it. The height of a step is the y-coordinate of the point where it ends, and we allow a non-negative weight on every step as follows: south-east steps and east steps have weight at most as big as their height, and north-east steps and coloured east steps have weight less than their height. Note that this implies that coloured east steps must have height greater than zero. Such paths are also referred to as 'histoires de Laguerre'. An example of such a path is given in Figure 6. For brevity, we will refer to weighted Motzkin paths always simply as 'Motzkin paths'.
The total weight of a Motzkin path is the sum of the weights of its steps. A factor of a Motzkin path is a subpath that starts and ends at the x-axis. Thus, an east step of height zero constitutes a prime factor. Following Sylvie Corteel [1], an arc i, σ(i) of a permutation is nested by an arc j, σ(j) , if j < i ≤ σ(i) < σ(j) or j > i > σ(i) > σ(j). Two arcs i, σ(i) and j, σ(j) cross if i < j ≤ σ(i) < σ(j) (the middle inequality is weak!) or σ(j) < σ(i) < j < i.
• C crossings, and • 1 being mapped to M are in bijection with Motzkin paths with n steps, • total weight N , • complementary weight C, and • M being the position of the first east or south-east step with weight 0. Moreover, factors are preserved.
The path is created as follows: let σ be a permutation of [n], then the i th step is , and coloured east, if σ(i) < i < σ −1 (i). The weight of the i th step is the number of arcs nesting σ −1 (i), i . We remark that this definition differs slightly from Sylvie Corteel's in [1], where the weight was taken to be the number of arcs nesting (i, σ(i)) instead.
Let us show that σ(1) = M entails that the M th step is the first east or southeast step with weight zero: since it is impossible to nest the arc 1, σ(1) , the M th step certainly has weight zero. Since either M > max σ(M ), σ −1 (M ) = 1 or σ −1 (M ) = 1 ≤ M ≤ σ(M ), it must be south-east or east. Finally, suppose that the i th step, with i < M , is east or south-east. We then must have σ −1 (i) ≤ i, so it is nested by 1, σ(1) and has therefore non-zero weight.
To prove that prime factors are preserved, we remark that a left factor of a permutation is a permutation by itself and therefore mapped to a Motzkin path, and vice verse.

3.2.
A bijection between weighted Motzkin paths and PDSAWs below the x-axis. For brevity, we refer in this section to PDSAWs that remain below the x-axis simply as PDSAWs. The bijection we are about to describe is very similar to the one in Section 2.2, so we allow ourselves to keep the description shorter.
Let P be a PDSAW with n > 1 east steps and let P ′ be obtained from P by removing its last east step. If the length of the last descent of P is minimal, we map it to the Motzkin path obtained by prepending an east step to the Motzkin path M ′ corresponding to P ′ .
Otherwise, letP be the PDSAW obtained from P by lowering the last east step by one and letM be the corresponding Motzkin path. We consider the first east or south-east step inM that has weight zero, along with the step immediately after it. Then we produce M corresponding to P according to the following local transformation rules: (I) if the first step of the pair is an east step, and the second is not an east or south-east step with weight zero, exchange the two steps; (II) if the first step of the pair is an east step, and the second is an east step with weight zero, replace them with a north-east step followed by a south-east step, both with weight zero; (I) -1 P P P P P P q P P P P P P q (III) if the first step of the pair is an east step, and the second is a south-east step with weight zero, replace them with a coloured east step followed by a south-east step, both with weight zero; (IV) otherwise, that is, if the first step of the pair is a south-east step, increase the weight of the second step by one and exchange the two steps and their weights. Again, these rules form an automaton, which is depicted in Figure 7. Note however that this automaton differs structurally from the one in described in Section 2.2: here, one of transformations (II) or (III) applies if the final east step of the PDSAW is just below its next-to-last east step. I.e., there are two transient states, and the transition occurs before the final two east steps of the PDSAW have the same y-coordinate. Since we enter state (IV) when the final east step of P is at the same height as the next-to last east step of P , and each transformation in state (IV) increase the weight by one, every north step between the last two east steps of P contributes one to the total weight of the resulting Motzkin path.
We have to remark that the bijection in this section does not transform the number of crossings of the permutation into a meaningful statistic on PDSAWs. This is a little disappointing, given the other parallels between Theorems 1.3 and 1.5.
3.3. Philippe Nadeau's bijection. In this section we present Philippe Nadeau's bijection, which was already mentioned in the introduction. The theorem it proves is almost identical to Theorem 1.5: Moreover, prime factors are preserved, the last prime factor of the PDSAW being mapped to the first factor of the permutation.
Let P be a PDSAW with n east steps and let R = {1, 2, . . . , n}. We construct the corresponding permutation σ as follows: for i in 1, 2, . . . , n, let h be 1 minus the y-coordinate of the (n − i + 1) st east step of P , let σ(i) be the h-largest element in R, and delete this element from R. It is immediate that 1 is mapped to M , since for i = 1 we have h = 1 − (M − n). To prove that north steps are translated to occurrences of the pattern 31-2, note that for every east step that is k units above the preceding step we introduce k occurrences of the pattern 31-2 in σ. (Of course, this does not mean, that the images of the steps under σ would differ by k!) Apart from being extremely simple, this bijection has another beautiful property: it is identical to the composition of the bijection presented in the previous section with the bijection given by Sylvie Corteel in [1], although this does not appear obvious at all.
We have to remark, unfortunately, that we were unable to find a similar bijection between matchings and PDSAWs in the symmetric wedge. In particular, we could not find a 'nice' definition of a pattern in matchings, such that the number of occurrences thereof would correspond to the number of north steps in PDSAWs in the symmetric wedge.

The end of the story?
A brief look at the literature will convince us that there remains a fair bit of work to be done. Most pressing is the question whether we can derive the generating functions obtained by Janse van Rensburg, Thomas Prellberg and Andrew Rechnitzer [11] for PDSAWs ending anywhere, according to the total number of steps. For example, for the symmetric wedge they obtain, with Although the bijections described here treat the length of the last descent of the PDSAW nicely, we were unable to derive a formula for PDSAWs for a fixed value of this statistic, or a generating function keeping track of it. Apart from that, it might be worth exploring whether there is a generalisation of PDSAWs that correspond to partitions. Since the bijection of Anisse Kasraoui and Jiang Zeng also applies to these more general objects, it would not be too surprising to find such a generalisation. Maybe this would involve PDSAWs allowing diagonal steps.
Related to this, we would like to point out the link to continued fractions and orthogonal polynomials. Indeed, the machinery developed by Philippe Flajolet [2] and Xavier Viennot [12] teaches us to interpret the expression in Equation (1) as the 2n th moment of a q-analogue of the Hermite polynomials, and the expression in Equation (2) as the n th moment of a q-analogue of the Laguerre polynomials. The generating function n≥0 M 2n x n has the continued fraction expansion while the generating function n≥0 P n x n has the expansion Finally, we would like to explain why we chose to present the bijections in terms of automatons. The reason, although realised only after having found the bijections, is that they are unique in the following sense: given that the bijections should preserve the parameters as described in Theorems 1.3, and there should be local rules displacing the first occurrence of a south-east step with weight zero to the right, the rules in Section 2.2 are already determined. Of course, this does not exclude the possibility of other bijective proofs, as demonstrated very recently by Svetlana Poznanović [9].