Séminaire Lotharingien de Combinatoire 63 (2010), Article B63e

A BIJECTION BETWEEN WELL-LABELLED POSITIVE PATHS AND MATCHINGS

OLIVIER BERNARDI, BERTRAND DUPLANTIER, AND PHILIPPE NADEAU

Abstract. A well-labelled positive path of size n is a pair (p, σ) made of a word p = p_{1}p_{2} … p_{n−1} on the alphabet {−1, 0, +1} such that ∑_{i=1}^{j} p_{i} ≥ 0 for all j = 1 … n−1, together with a permutation σ = σ_{1}σ_{2} … σ_{n} of {1, …, n} such that p_{i} = −1 implies σ_{i} < σ_{i+1}, while p_{i} = 1 implies σ_{i} > σ_{i+1}. We establish a bijection between welllabelled positive paths of size n and matchings (i.e., fixed-point free involutions) on {1, …, 2n}. This proves that the number of well-labelled positive paths is (2n−1)!! ≡ (2n − 1) · (2n − 3) ⋯ 3 · 1.

Well-labelled positive paths appeared recently in the author’s article “Partition function of a freely-jointed chain in a half-space” [in preparation] as a useful tool for studying a polytope Π_{n} related to the space of configurations of the freely-jointed chain (of length n) in a half-space. The polytope Π_{n} consists of points (x_{1}, …, x_{n}) ∈ [−1, 1]^{n} such that ∑_{i=1}^{j} x_{i} ≥ 0 for all j = 1 … n, and it was shown that well-labelled positive paths of size n are in bijection with a collection of subpolytopes partitioning Π_{n}. Given that the volume of each subpolytope is 1/n!, our results prove combinatorially that the volume of Π_{n} is (2n − 1)!!/n!.

Our bijection has other enumerative corollaries in terms of up-down sequences of permutations. Indeed, by specialising our bijection, we prove that the number of permutations of size n such that each prefix has no more ascents than descents is [(n − 1)!!]^{2} if n is even and n!! (n − 2)!! if n is odd.

1. Introduction

A well-labelled path of size n is a pair (p, σ) made of a word p = p_{1}p_{2} … p_{n−1} on the alphabet {−1, 0, +1}, together with a permutation σ = σ_{1}σ_{2} … σ_{n} of [n] ≡ {1, …, n} such that p_{i} = −1 implies σ_{i} < σ_{i+1}, while p_{i} = 1 implies σ_{i} > σ_{i+1}. We shall represent a path (p, σ) as a lattice path on ℤ^{2} starting at (0,0) and made of steps (1, p_{i}) for i = 1 … n−1 together with the label σ_{i} on the ith lattice point of the path for i = 1 … n. For instance, two well-labelled paths of size 10 are represented in Figure 1. A well-labelled path (p, σ) is said Motzkin (respectively positive) if ∑_{i=1}^{j} p_{i} ≥ 0 for all j = 1 … n−2 and ∑_{i=1}^{n−1} p_{i} = −1 (respectively ∑_{i=1}^{j} p_{i} ≥ 0 for all j = 1 … n−1).

In this paper, we define a bijection between well-labelled Motzkin paths of size n + 1 and matchings (fixed-point free involutions) on [2n]. We then define a closely related bijection between well-labelled positive paths of size n, and matchings on [2n]. Our bijections are defined recursively and involve a bijection by Chen [3] between labelled binary trees and matchings.

The first enumerative consequence of our bijection is that well-labelled Motzkin paths of size n + 1 and well-labelled positive paths of size n are both counted by (2n − 1)!! ≡ (2n − 1) · (2n − 3) ⋯ 3 · 1. In fact, our bijections also have enumerative corollaries

Date: April 26, 2010.

3  4 7 1 8 2 5 6  9 10  2  5 6  9 7  8  1  3 4  10 (b) (a)

Figure 1. (a) A well-labelled Motzkin path. (b) A well-labelled positive path.

in terms of up-down sequences (sequences of ascents and descents) of permutations . In order to obtain these results, we perform a refined enumeration of well-labelled paths (p, σ) according to the number of horizontal steps (the number of letters 0 in p). More precisely, we show that the number of well-labelled positive paths of size n with k horizontal steps is \binom{n}{k}\binom{n−1}{k} k! [(n − k − 1)!!]^{2} if n − k is even and \binom{n}{k}\binom{n−1}{k} k! (n − k)!! (n − k − 2)!! otherwise. Similarly, the number of well-labelled Motzkin paths of size n with k horizontal steps is \binom{n}{k}\binom{n−2}{k} k!(n − k − 1)!!(n − k − 3)!! if n − k is even (and 0 otherwise). Observe that well-labelled paths (p, σ) without horizontal steps are completely determined by the permutation σ. Indeed, in this case the word p encodes the up-down sequence of the permutation σ. Hence, by specialising our results to paths with no horizontal steps (i.e., k = 0), we enumerate permutations whose updown sequence belong to a certain family. For instance, we prove that the number of permutations of size n such that each prefix has no more ascents than descents is [(n − 1)!!]^{2} if n is even and n!! (n − 2)!! otherwise. We also prove that the number of permutations of size n having one more ascent than descent but such that each prefix has no more ascents than descents is (n − 1)!! (n − 3)!! if n is even (and 0 otherwise). These enumerative results contrast with those in [2, 4, 5, 7] by the fact that we consider here a family of admissible up-down sequences rather than a single sequence.

Well-labelled positive paths appeared recently in [1], in the computation of the partition function for the freely-jointed chain [6] in a half-space, and this was our original motivation for studying these paths. Indeed, the space of configurations of the freelyjointed chain of length n projects naturally on the polytope Π_{n} consisting of all points (x_{1}, …, x_{n}) ∈ [−1, 1]^{n} such that ∑_{i=1}^{j} x_{i} ≥ 0 for all j = 1 … n; and it is shown in [1] that well-labelled positive paths of size n are in bijection with a set of subpolytopes partitioning Π_{n}. Given that the volume of each subpolytope is 1/n!, our results prove combinatorially that the volume of Π_{n} is \frac{(2n−1)!!}{n!}.

The paper is organised as follows. In Section 2, we define a recursive decomposition of well-labelled positive and Motzkin paths. We then translate these decompositions in terms of generating functions. For Motzkin paths, solving the generating function equation shows that the number of well-labelled Motzkin paths of size n+1 is (2n−1)!!. From this, a simple induction shows that the number of well-labelled positive paths of size n is also (2n−1)!!. In Section 3, we use the recursive decomposition of paths in order to define bijections between well-labelled positive paths, well-labelled Motzkin paths and matchings. One step of these bijections uses a construction of Chen [3] between labelled binary trees and matchings. Lastly in Section 4, we use our bijections to count well-labelled positive and Motzkin paths according to their number of horizontal steps. Specialising these results to the paths with no horizontal steps, we enumerate permutations whose up-down sequence belong to certain families mentioned above.

2. Decomposition of well-labelled paths

In this section, we define a recursive decomposition of the class A of well-labelled Motzkin paths and the class B of well-labelled positive paths. We then translate these equations in terms of generating functions and obtain our first counting results.

We denote respectively by A_{n} and B_{n} the sets of paths of size n in A and B. We denote respectively by a_{n} and b_{n} the cardinality of A_{n} and B_{n} and by

A(z) = ∑_{n≥0} \frac{a_{n}}{n!} z^{n} and B(z) = ∑_{n≥0} \frac{b_{n}}{n!}z^{n}

the corresponding exponential generating functions. Observe that a_{0} = a_{1} = 0 and b_{0} = 0. The following notation will be useful for relabelling objects: given a set I of n integers, we denote by λ_{I} the order preserving bijection from [n] to I (and by λ_{I}^{−1} the inverse bijection).

2.1. Decomposition of well-labelled Motzkin paths. We first define a recursive decomposition of the class A of well-labelled Motzkin paths. For i ∈ {−1, 0, 1}, we denote by A^{i} (respectively A_{n}^{i}) the set of paths (p, σ) in A (respectively A_{n}) such that p_{1} = i. Observe that A^{−1} is made of a single element α_{2} of size 2. The decomposition

A = {α_{2}} ⊎ A^{0} ⊎ A^{1}

is illustrated by Figure 2 and the following proposition reveals its recursive nature.

Proposition 1. For any positive integer n, • the set A_{n}^{0} is in bijection with the set [n] × A_{n−1},

• the set A_{n}^{1} is in bijection with the set C_{n} made of all unordered pairs {(I′, P′), (I′′, P′′)} such that I′ ⊆ [n], I′′ = [n] \ I′ and P′, P′′ are well-labelled Motzkin paths of respective size |I′| and |I′′|.

A  =  α_{2} ⊎  A^{0}  ⊎  A^{1}

Figure 2. Recursive decomposition of well-labelled Motzkin paths.

Proof. • For any path (p, σ) in A_{n}^{0} one obtains a pair (k, (p′, σ′)) in [n]×A_{n−1} by setting k = σ_{1}, p′ = p_{2} … p_{n−1} and σ′ = σ′_{1} … σ′_{n−1} where σ′_{i} = λ_{[n]\{k}}^{−1}(σ_{i+1}) for i = 1 … n−1. This is clearly a bijection between A_{n}^{0} and [n] × A_{n−1}.

• Observe that the set C_{n} is trivially in bijection with the set C′_{n} of ordered pairs ((I′, P′), (I′′, P′′)) such that λ_{I′}(σ′_{1}) < λ_{I′′}(σ′′_{1}). Let (p, σ) be a path in A_{n}^{1} and let k be the least integer such that ∑_{i=1}^{k} p_{i} = 0 (observe that p_{k} = −1). We define an element

ϕ(p, σ) = ((I′, (p′, σ′)), (I′′, (p′′, σ′′)))

of C′_{n} by setting • I′ = {σ_{1}, …, σ_{k}} and I′′ = {σ_{k+1}, …, σ_{n}},

• p′ = p′_{1} … p′_{k−1} and p′′ = p′′_{1} … p′′_{n−k−1}, where p′_{i} = −p_{k−i} and p′′_{i} = p_{k+i},

• σ′ = σ′_{1} … σ′_{k} and σ′′ = σ′′_{1} … σ′′_{n−k}, where σ′_{i} = λ_{I′}^{−1}(σ_{k+1−i}) and σ′′_{i} = λ_{I′′}^{−1}(σ_{k+i}).

The mapping ϕ is clearly a bijection between the sets A_{n}^{1} and C′_{n}, which concludes the proof. □

Corollary 2. The generating function A(z) of well-labelled Motzkin paths satisfies

A(z) = \frac{z^{2}}{2} + zA(z) + \frac{A(z)^{2}}{2} . (1)

Proof. For i ∈ {−1, 0, 1}, we denote by a_{n}^{i} the cardinality of A_{n}^{i} and by A^{i}(z) = ∑_{n≥0} \frac{a_{n}^{i}}{n!} z^{n} the corresponding generating function. The partition A = \{α_{2}\} ⊎ A^{0} ⊎ A^{1} gives

A(z) = \frac{z^{2}}{2} + A^{0}(z) + A^{1}(z).

Moreover, the bijection between A_{n}^{0} and [n] × A_{n−1} gives a_{n}^{0} = n a_{n−1}, hence A^{0}(z) =

zA(z) while the correspondence between A_{n}^{1} and C_{n} gives a_{n}^{1} = \frac{1}{2} ∑_{k=0}^{n} \binom{n}{k}a_{k}a_{n−k}, hence

A^{1}(z) = \frac{A(z)^{2}}{2} . □

By solving Equation (1) (and using the fact that a_{0} = 0), one gets

A(z) = 1 − z − \sqrt{1 − 2z}. (2)

One can extract the coefficient a_{n} either directly from this expression of A(z) or by applying Lagrange inversion formula to the series C(z) = A(z)/z. Indeed, Equation (1) gives C(z) = z \frac{(1+C(z))^{2}}{2} , hence

a_{n+1} = (n + 1)![z^{n}]C(z) = \frac{(n + 1)!}{n}[x^{n−1}] (\frac{(1 + x)^{2}}{2} )^{n} = \frac{(2n)!}{2^{n}n!} = (2n − 1)!!.

We will now determine the number b_{n} of well-labelled positive paths of size n. This can be done by exploiting a bijection between B_{n} × [n + 1] × {0, 1} and B_{n+1} ⊎ A_{n+1} obtained by adding one step to a positive path. The bijection is as follows: given a well-labelled positive path (p, σ) of size n, an integer k in [n + 1] and an integer b in {0, 1}, we define the labelled path (p′, σ′) = ψ((p, σ), k, b) by setting

• σ′ = σ′_{1} … σ′_{n+1}, where σ′_{i} = λ_{[n+1]\{k}}(σ_{i}) for i = 1 … n and σ′_{n+1} = k,

• p′ = p′_{1} … p′_{n}, where p′_{i} = p_{i} for i = 1 … n−1 and p′_{n} is equal to b−1 if σ′_{n+1} > σ′_{n} and equal to b otherwise.

Observe that the path (p′, σ′) is well-labelled (by the choice of the step p′_{n}) and is either positive or Motzkin (since (p, σ) is positive). Moreover, the mapping ψ is a bijection between B_{n} × [n + 1] × {0, 1} and B_{n+1} ⊎ A_{n+1} showing that

2(n + 1)b_{n} = b_{n+1} + a_{n+1} for all n ≥ 0. (3)

Since a_{n+1} = (2n − 1)!! a simple induction shows that b_{n} = (2n − 1)!! and proves the following.

Proposition 3. The number a_{n+1} of well-labelled Motzkin paths of size n + 1 and the number b_{n} of well-labelled positive paths of size n are both equal to (2n − 1)!!.

2.2. Decomposition of well-labelled positive paths. We now define a recursive decomposition of the class B of well-labelled positive paths. We denote by β_{1} the welllabelled path of size 1 and for i ∈ {0, 1}, we denote by B^{i} the set of paths (p, σ) in B of size at least 2 satisfying p_{1} = i. For a path (p, σ) of size n in B^{1}, we consider the greatest integer k ≤ n such that ∑_{i=1}^{j−1} p_{i} ≥ 1 for all j = 2 … k−1 and ∑_{i=1}^{k−1} p_{i} = 1. We denote by B′ the subset of paths in B^{1} such that k = n and we denote B′′ = B^{1} \ B′ the complement. We also denote by B_{n}^{0}, B′_{n} and B′′_{n} respectively the paths of size n in B^{0}, B′ and B′′. The partition

B = {β_{1}} ⊎ B^{0} ⊎ B′ ⊎ B′′

is illustrated by Figure 3 and the following proposition reveals its recursive nature.

Proposition 4. For any positive integer n, • the set B_{n}^{0} is in bijection with the set [n] × B_{n−1},

• the set B′_{n} is in bijection with the class A_{n} of well-labelled Motzkin paths,

• the set B′′_{n} is in bijection with the set D_{n} made of the ordered pairs ((I′, P′), (I′′, P′′)) such that I′ ⊆ [n], I′′ = [n] \ I′, P′ is a well-labelled Motzkin path of size |I′| and P′′ is a well-labelled positive path of size |I′′|.

=  B′ B  ⊎ ⊎  ⊎ ⊎  B′′ β^{1}  B^{0}

Figure 3. Recursive decomposition of well-labelled positive paths.

Proof. • For any path (p, σ) in B_{n}^{0} one obtains a pair (k, (p′, σ′)) in [n]×B_{n−1} by setting k = σ_{1}, p′ = p_{2} … p_{n−1} and σ′ = σ′_{1} … σ′_{n−1} where σ′_{i} = λ_{[n]\{k}}^{−1}(σ_{i+1}) for i = 1 … n−1. This is clearly a bijection between B_{n}^{0} and [n] × B_{n−1}.

• A bijection between the sets B′_{n} and A_{n} is obtained by reading the positive path backward: given a path (p, σ) in B′_{n} one obtain a path (p′, σ′) in A_{n} by setting σ′ = σ_{n} … σ_{1} and p′ = p′_{1} … p′_{n−1} where p′_{i} = −p_{n−i} for i = 1 … n−1. This is clearly a bijection.

• Let (p, σ) be a path in B′′_{n} and let k < n be the greatest integer such that ∑_{i=1}^{j−1} p_{i} ≥ 1 for all j = 2 … k−1 and ∑_{i=1}^{k−1} p_{i} = 1. We define a pair

ϕ′(p, σ) = ((I′, (p′, σ′)), (I′′, (p′′, σ′′)))

by setting • I′ = {σ_{1}, …, σ_{k}} and I′′ = {σ_{k+1}, …, σ_{n}},

• p′ = p′_{1} … p′_{k−1} and p′′ = p′′_{1} … p′′_{n−k−1}, where p′_{i} = −p_{k−i} and p′′_{i} = p_{k+i},

• σ′ = σ′_{1} … σ′_{k} and σ′′ = σ′′_{1} … σ′′_{n−k}, where σ′_{i} = λ_{I′}^{−1}(σ_{k+1−i}) and σ′′_{i} = λ_{I′′}^{−1}(σ_{k+i}). We first want to prove that ((I′, (p′, σ′)), (I′′, (p′′, σ′′))) is in D_{n}. It is clear that (p′, σ′) and (p′′, σ′′) are well-labelled paths and moreover, (p′, σ′) is a Motzkin path. It remains to prove that (p′′, σ′′) is a positive path. Observe that the step p_{k} is non-zero otherwise it contradicts the maximality of k. If p_{k} = −1, then (p′′, σ′′) is clearly positive because (p, σ) is positive; and if p_{k} = +1, then (p′′, σ′′) is positive otherwise it would contradict the maximality of k. Hence, ϕ′ is a mapping from A_{n} to D_{n}. The bijectivity of ϕ′ is easy to check after observing that the step p_{k} can be recovered: it is equal to 1 if λ_{I′}(σ′_{1}) < λ_{I′′}(σ′′_{1}) and to −1 otherwise. □

Proposition 4 will allow to define a bijection between positive paths and matchings in the next section. It also leads to the following relation between the generating functions A(z) and B(z):

(4)  B(z) = z + zB(z) + A(z) + A(z)B(z),

which, by (2), gives B(z) = \frac{1}{\sqrt{1 − 2z}} −1. This result could also have been derived from

the observation that b_{n} = a_{n+1} implies B(z) = A′(z).

3. Bijections with matchings

Proposition 3 suggests that the classes of paths A_{n+1} and B_{n} are both in bijection with matchings. The goal of this section is to describe such bijections. For this, we will introduce intermediate objects called labelled binary trees.

3.1. Bijections between well-labelled paths and labelled binary trees. A labelled binary tree of size n is a rooted tree with n leaves having n different labels in [n] and such that each (unlabelled) internal vertex has exactly two unordered children. We call marked labelled binary tree a labelled binary tree in which one of the (internal or external) vertices is marked. A binary tree and a marked binary tree are represented in Figure 4. We denote by T the set of labelled binary trees of size at least 2 and we denote by R the set of marked labelled binary trees. We will now show that the recursive descriptions of the classes T and R parallel those of the classes A and B and obtain bijections between T and A and between R and B.

We use the following notation for relabelling trees: if λ is a bijection between two sets of integers I, J and τ is a binary tree whose leaves have labels in I, then λ(τ) denotes the tree obtained from τ by replacing replacing the label i ∈ I of each leaf by the label λ(i) ∈ J.

Bijection between Motzkin paths and labelled trees. We denote by τ_{2} the unique labelled binary tree of size 2 and by T^{0} (respectively T^{1}) the set of labelled binary trees made of the root-vertex and two subtrees, one of which (respectively none of which) is a leaf. For all integers n ≥ 2, we denote respectively by T_{n}, T_{n}^{0} and T_{n}^{1} the set of trees of size n in T , T^{0} and T^{1}. We now explicit the recursive nature of the partition

T = {τ_{2}} ⊎ T^{0} ⊎ T^{1}.

6 3 10 5  1  4 9 7 2 8  9 6 5 8 2 4  7  3 (a)  (b)  10 1

Figure 4. (a) A labelled binary tree. (b) A marked labelled binary tree

Proposition 5. For any integer n > 2, • the set T_{n}^{0} is in bijection with the set [n] × T_{n−1}.

• the set T_{n}^{1} is in bijection with the set U_{n} of unordered pairs {(I′, τ′), (I′′, τ′′)} such that I′ ⊆ [n], I′′ = [n] \ I′ and τ′, τ′′ are labelled binary trees in T of respective size |I′| and |I′′|.

Proof. Let n > 2.

• Given an integer k ∈ [n] and a tree τ in T_{n−1}, one defines a tree τ′ in T_{n}^{0} as the tree made of a root-vertex, one subtree which is a leaf labelled k and one subtree equal to λ_{[n]\{k}}(τ) (which is not a leaf). This is a bijection between [n] × T_{n−1} and T_{n}^{0}.

• Given a pair {(I′, τ′), (I′′, τ′′)} in U_{n}, one defines a tree τ in T_{n}^{1} as the tree made of a root-vertex, a subtree equal to λ_{I′}(τ′) and a subtree equal to λ_{I′′}(τ′′). This is a bijection between U_{n} and T_{n}^{1}. □

Definition of bijection Φ. Comparing Propositions 1 and 5, it is clear that one can define a recursive bijection Φ between the class A of well-labelled Motzkin paths and the class T of labelled binary trees. We now summarise the recursive construction of the image of a well-labelled Motzkin path (p, σ) by the bijection Φ:

(i) If (p, σ) = α_{2}, then Φ(p, σ) = τ_{2}.

(ii) If (p, σ) has size n > 2 and p_{1} = 0, then we set p′ = p_{2} … p_{n−1} and σ′ = σ′_{1} … σ′_{n−1} where σ′_{i} = λ_{[n]\{σ_{1}}}^{−1}(σ_{i+1}) for i = 1 … n−1. With these notations, we define Φ(p, σ) as the tree made of a root-vertex, the subtree made of a leaf labelled σ_{1} and the subtree λ_{[n]\{σ_{1}}}(Φ(p′, σ′)).

(iii) If (p, σ) has size n > 2 and p_{1} = 1, then we consider the least integer k such that ∑_{i=1}^{k} p_{i} = 0 and we set (as in the proof of Proposition 1):

• I′ = {σ_{1}, …, σ_{k}} and I′′ = {σ_{k+1}, …, σ_{n}},

• p′ = p′_{1} … p′_{k−1} and p′′ = p′′_{1} … p′′_{n−k−1}, where p′_{i} = −p_{k−i} and p′′_{i} = p_{k+i},

• σ′ = σ′_{1} … σ′_{k} and σ′′ = σ′′_{1} … σ′′_{n−k}, where σ′_{i} = λ_{I′}^{−1}(σ_{k+1−i}) and σ′′_{i} = λ_{I′′}^{−1}(σ_{k+i}).

With these notations, we define Φ(p, σ) as the tree made of a root-vertex, the subtree λ_{I′}(Φ(p′, σ′)) and the subtree λ_{I′′}(Φ(p′′, σ′′)).

For instance, the image of the Motzkin path represented in Figure 1(a) by the mapping Φ is represented in Figure 4(a). From the definition of Φ and Propositions 1 and 5, we have the following theorem.

Theorem 6. For any positive integer n > 1, the mapping Φ is a bijection between well-labelled Motzkin paths of size n and labelled binary trees with n leaves.

Bijection between positive paths and marked trees. We now define a bijection Φ′ between well-labelled positive paths and marked labelled binary trees. Before defining the bijection Φ′, let us explain briefly what led us to consider marked labelled binary trees. As seen in Section 2, the recursive decomposition of positive paths leads to consider subpaths corresponding to either positive paths or Motzkin paths. The recursive relation is captured by Equation (4) which can be written

B(z) = Ã(z) + Ã(z)B(z),

where Ã(z) = z + A(z) is the generating function of unmarked binary trees (of size n ≥ 1), or equivalently, binary trees marked at their root-vertex. This relation suggests that one can interpret B(z) as the generating function of marked binary trees.

We denote by ρ_{1} the marked labelled tree of size 1. We denote by R′ ⊂ R the set of marked trees of size at least 2 such that the marked vertex is the root. Clearly, this set is in bijection with the set T of unmarked trees. We denote by R^{0} (respectively R′′) the set of marked trees made of a non-marked root and two subtrees, one of which (respectively none of which) is a non-marked leaf. For all integer n > 1, we denote respectively by R_{n}, R_{n}^{0}, R′_{n} and R′′_{n} the set of marked trees of size n in R, R^{0}, R′ and R′′. We now explicit the recursive nature of the partition

R = {ρ_{1}} ⊎ R^{0} ⊎ R′ ⊎ R′′.

Proposition 7. For all integer n > 1, • the set R_{n}^{0} is in bijection with the set [n] × R_{n−1},

• the set R′_{n} is in bijection with T_{n},

• the set R′′_{n} is in bijection with the set U_{n} of ordered pairs ((I′, τ′), (I′′, τ′′)) such that I′ ⊆ [n], I′′ = [n] \ I′, τ′ is a non-marked labelled binary tree of size |I′| and τ′′ is a marked labelled binary tree of size |I′′|.

The proof of Proposition 7 is similar to the proof of Proposition 5 and is omitted.

Definition of bijection Φ′. Comparing Propositions 4 and 7, it is clear that one can define a recursive bijection Φ′ between the class B of well-labelled paths and the class R of marked labelled binary trees. We now summarise the recursive construction of the image of a well-labelled positive path (p, σ) by the bijection Φ′:

(i) If (p, σ) = β_{1} then Φ′(p, σ) is the marked tree ρ_{1}.

(ii) If (p, σ) has size n > 1 and p_{1} = 0, then we define p′ = p_{2} … p_{n−1} and σ′ = σ′_{1} … σ′_{n−1}, where σ′_{i} = λ_{[n]\{σ_{1}}}^{−1}(σ_{i+1}) for i = 1 … n−1. With these notations, we define Φ′(p, σ) as the tree made of a non-marked root-vertex, the subtree made of a non-marked leaf labelled σ_{1} and the marked subtree λ_{[n]\{σ_{1}}}(Φ′(p′, σ′)).

(iii) If (p, σ) has size n > 1 and p_{1} = 1, then we consider the greatest integer k ≤ n such that ∑_{i=1}^{j−1} p_{i} ≥ 1 for all j = 2 … k−1 and ∑_{i=1}^{k−1} p_{i} = 1, and we set (as in the proof of Proposition 4):

• I′ = {σ_{1}, …, σ_{k}} and I′′ = {σ_{k+1}, …, σ_{n}},

• p′ = p′_{1} … p′_{k−1} and p′′ = p′′_{1} … p′′_{n−k−1}, where p′_{i} = −p_{k−i} and p′′_{i} = p_{k+i},

• σ′ = σ′_{1} … σ′_{k} and σ′′ = σ′′_{1} … σ′′_{n−k}, where σ′_{i} = λ_{I′}^{−1}(σ_{k+1−i}) and σ′′_{i} = λ_{I′′}^{−1}(σ_{k+i}).

If k = n (that is, (p, σ) is in B′), we define Φ′(p, σ) as the marked tree obtained by marking the root-vertex of the unmarked tree Φ(p′, σ′) (note that I′′, p′′ and σ′′ are empty in this case). Otherwise (that is, if k < n), we define Φ′(p, σ) as the marked tree made of a non-marked root-vertex, the non-marked subtree λ_{I′}(Φ(p′, σ′)) and the marked subtree λ_{I′′}(Φ′(p′′, σ′′)).

For instance, the image of the positive path represented in Figure 1(b) by the mapping Φ′ is represented in Figure 4(b). From the definition of Φ′ and Propositions 4 and 7, we have the following theorem.

Theorem 8. The function Φ′ is a bijection between well-labelled positive paths of size n and marked labelled binary trees with n leaves.

Remark. The final height of a positive path (p, σ) of size n is ∑_{i=1}^{n−1} p_{i}. It is not hard to prove inductively that a positive path (p, σ) has an even final height if and only if the mark of the image tree, ρ = Φ′(p, σ), is on a leaf. Indeed, if (p, σ) = β_{1} the final height is 0, and the mark is on a leaf of the tree ρ = ρ_{1}; while if (p, σ) is in B′ the final height is 1, and the mark is on an internal vertex (the root-vertex) of ρ. In the other cases ((p, σ) ∈ B_{0} ⊎ B′′), the mark is in a subtree ρ′′ of ρ corresponding to a path (p′′, σ′′) having a final height of the same parity as (p, σ).

3.2. Bijections between labelled binary trees and matchings. We will now present a bijection Ψ due to Chen [3] between labelled binary trees of size n and matchings on [2n−2]. We follow the exposition from [8, p.16] for defining the bijection Ψ and then define a similar bijection Ψ′ between marked binary trees of size n and matchings on [2n]. The mappings Ψ and Ψ′ are represented in Figure 5. The first step of this bijection is to attribute a label to each internal node of the binary tree.

Definition of bijection Ψ [3]. Let τ be a labelled binary tree with n leaves labelled on [n]. One defines an induced labelling of the n−2 internal non-root vertices of τ by the following procedure. While there are unlabelled non-root vertices, we consider those among them that have both of their children labelled. There is at least one such vertex and we consider the vertex v which has the child with least label; we then attribute to v the least label in [2n−2]\[n] which has not yet been attributed. For instance, starting from the tree in Figure 4(a) one obtains the labels indicated in the fully labelled tree represented in Figure 5(a). One then obtains the matching π = Ψ(τ) on [2n−2] by letting π(i) = j for all pairs i, j ∈ [2n − 2] which are the labels of siblings in the fully labelled tree. In [8, p.16] the mapping Ψ is proved to be a bijection between labelled binary trees of size n and matchings on [2n−2].

2 4  1 3 5 7 9 2 4 6 8  12  16 18 14 1011 13 15 17  20 19 2 4 1 7 6 3 10 5 2 8  9 4  1 7 6 3 10 5 2 8  9 4  1 3 5 7 9 2 4 6 8  12  16 18 14 1011 13 15 17 1 7 5 6  9 8  10 3  Ψ′ 17  15 13 18 16 12 14  1 7 5 6 8  10 3 9 15 (a) (b)  Ψ 11 14 16 18 17  13 12  11

Figure 5. Bijections between labelled binary trees and matchings.

Definition of bijection Ψ′. Let τ′ be a marked labelled binary tree of size n and let τ be the corresponding unmarked tree. We consider the matching π = Ψ(τ) on [2n−2] and define a matching π′ = Ψ′(τ′) on [2n] as follows. If the marked vertex v of τ′ is the root, then π′(i) = π(i) for all i in [2n−2] and π′(2n − 1) = 2n. If v is not the root, then we consider its label k and the label l of its sibling. In this case π′(i) = π(i) for all i ≠ k, l in [2n−2], π′(k) = 2n and π′(l) = 2n − 1. It is clear that the mapping Ψ′ is a bijection between marked labelled binary tree of size n and matchings on [2n].

Combining the bijections Φ, respectively Φ′, with the bijections Ψ, respectively Ψ′, gives the following bijective proof of Proposition 3.

Theorem 9. The composition Ψ ∘ Φ is a bijection between well-labelled Motzkin paths of size n and matchings on [2n−2]. Similarly, Ψ′ ∘ Φ′ is a bijection between well-labelled positive paths of size n and matchings on [2n].

4. Enumerative corollaries

We will now study the number of horizontal steps in well-labelled paths through the bijections Φ, Φ′, Ψ, Ψ′ and deduce some enumerative corollaries in terms of the up-down sequences of permutations. Recall that a horizontal step of a well-labelled path (p, σ) is a letter 0 in p. We say that a leaf in a labelled binary tree is single if its sibling is an internal node.

Theorem 10. For all integers n, k, the mappings Φ and Ψ induce successive bijections between

• well-labelled Motzkin paths of size n with k horizontal steps,

• labelled binary trees with n leaves, k of which are single leaves,

• matchings on [2n − 2] having k pairs (i, j) such that i ∈ {1, …, n} and j ∈ {n+ 1, …, 2n−2}.

For example, the Motzkin path of size n = 10 in Figure 1(a) has 2 horizontal steps, the corresponding labelled binary tree represented in Figure 4(a) has 2 single leaves, and the corresponding matching represented in Figure 5(a) has 2 pairs (i, j) such that i ∈ {1, …, n} and j ∈ {n+1, …, 2n−2}.

Proof. • The correspondence between the number of horizontal steps of a Motzkin path (p, σ) and the number of single leaves in the binary tree Φ(p, σ) follows from a simple induction on the size of (p, σ). Indeed, one creates a single leaf in the recursive construction of Φ(p, σ) exactly when case (ii) thereof (corresponding to a horizontal step of (p, σ)) occurs.

• The correspondence between the number of single leaves in the binary tree τ and the number of pairs (i, j) such that i ∈ {1, …, n} and j ∈ {n+1, …, 2n−2} in the matching Ψ(τ) is an immediate consequence of the fact that the labels of external vertices are in {1, …, n} while the labels of internal vertices are in {n+1, …, 2n−2}. □

Corollary 11. The number of well-labelled Motzkin paths of size n having k horizontal steps is

a_{n,k} = \binom{n}{k}\binom{n − 2}{k} k! (n − k − 1)!! (n − k − 3)!!

if n − k is even and 0 otherwise.

Proof. By Theorem 10, the number a_{n,k} counts matchings on [2n − 2] with exactly k pairs (i, j) such that i ∈ {1, …, n} and j ∈ {n+1, …, 2n−2}. To enumerate such matchings, first choose these k pairs: there are \binom{n}{k} possibilities of choosing the integers i in \{1, …, n\}, there are \binom{n−2}{k} possibilities for choosing the integers j in \{n+1, …, 2n−2\} and then k! possibilities to define the pairing between the chosen integers in {1, …, n} and the chosen integers in {n+1, …, 2n−2}. After that, it remains to choose a pairing of the n − k unmatched integers in {1, …, n} and a pairing of the n − k − 2 unmatched integers in {n+1, …, 2n−2}. Such matchings exist only if n − k is even and there are (n − k − 1)!!(n − k − 3)!! of them in this case. □

We now examine horizontal steps in positive paths. We say that a leaf in a marked labelled binary tree is quasi-single if it is not marked and its sibling is either marked or internal.

Theorem 12. For all integers n, k, the mappings Φ′ and Ψ′ induce successive bijections between

• well-labelled positive paths of size n with k horizontal steps,

• marked labelled binary trees of with n leaves, k of which are quasi-single leaves,

• matchings on [2n] having k pairs (i, j) with i ∈ {1, …, n} and j ∈ {n+1, …, 2n−1}.

Proof. • The correspondence between the number of horizontal steps of a positive path (p, σ) and the number of quasi-single leaves in the marked tree Φ′(p, σ) follows from a simple induction on the size of (p, σ). Indeed, one creates a quasi-single leaf in the recursive construction of Φ′(p, σ) exactly when case (ii) of the definition of either Φ or Φ′ occurs.

• We now consider a marked labelled binary tree τ′ of size n > 1. Let v be the marked vertex and let τ be the non-marked tree obtained by forgetting the mark. The number k of single leaves in τ and the number k′ of quasi-single leaves in τ′ are related by

• k′ = k if v is internal,

• k′ = k − 1 if v is a leaf and its sibling is internal

• k′ = k + 1 if v and its sibling are both leaves. Similarly, the definition of Ψ′ gives a relation between the number l′ of pairs (i, j) of the matching Ψ′(τ′) such that i ∈ {1, …, n} and j ∈ {n + 1, …, 2n − 1} and the number l of pairs (i, j) of the matching Ψ(τ) such that i ∈ {1, …, n} and j ∈ {n+1, …, 2n−2}:

• l′ = l if the label of v is larger than n,

• l′ = l − 1 if the label of v is not larger than n and the label of its sibling is larger than n,

• l′ = l + 1 if the label of v and its sibling are not larger than n. Theorem 10 gives k = l, hence the previous discussion gives k′ = l′ and concludes the proof. □

Corollary 13. The number of well-labelled positive paths of size n having k horizontal steps is

(5)  b_{n,k} = \{ \begin{matrix}\binom{n}{k}\binom{n − 1}{k} k! [(n − k − 1)!!]^{2} & if n−k is even, \\ \binom{n}{k}\binom{n − 1}{k} k! (n − k)!! (n − k − 2)!! & otherwise. \end{matrix}

The proof of Corollary 13 is very similar to the Corollary 11 and is omitted. We now study the consequence of these results in terms of the up-down sequences of permutations.

Counting permutations having a positive up-down sequence. An ascent of a permutation σ = σ_{1}σ_{2} … σ_{n} is an index i < n such that σ_{i} < σ_{i+1}; a descent is an index i < n such that σ_{i} > σ_{i+1}. The enumeration of permutations with a given sequence of ascents and descents, called up-down sequences (or shape) was investigated for instance in [2, 4, 5, 7]. Here we will count permutations of size n such that their up-down sequences belong to a certain family, while previous works focused on the enumeration according to a single up-down sequence.

We say that a permutation σ has a positive up-down sequence if for all j ≤ n the number of ascents less than j is no more than the number of descents less than j. We say that σ has a Dyck up-down sequence if it has one more ascent than descents but for all j < n the number of ascents less than j is no more than the number of descents less than j. Observe that a well-labelled path (p, σ) with no horizontal steps is completely determined by the permutation σ (indeed, the word p is determined by the up-down sequence of σ). Moreover, the well-labelled path (p, σ) is positive (respectively Motzkin) if and only if the permutation σ has a positive (respectively Dyck) up-down sequence. Thus, the following theorem immediately follows by looking at the specialisation k = 0 in Corollaries 11 and 13.

Theorem 14. For any integer n, the number of permutations of size n having a positive up-down sequence is [(n − 1)!!]^{2} if n is even and n!! (n − 2)!! otherwise. The number of permutations of size n having a Dyck up-down sequence is (n − 1)!! (n − 3)!! if n is even and 0 otherwise.

We would be happy to see a more direct bijective proof of these specialisations.

Acknowledgement: We are very thankful to Sylvie Corteel for fruitful discussions and for providing us with the conjectural formula for the numbers b_{n,k}.

References

[1] O. Bernardi, B. Duplantier, and P. Nadeau. Partition function of a freely-jointed chain in a halfspace. In preparation.

[2] L. Carlitz. Permutations with prescribed pattern. Math. Nachr., 58:31–53, 1973.

[3] W. Y. C. Chen. A general bijective algorithm for trees. Proc. Nat. Acad. Sci. U.S.A., 87(24):9635– 9639, 1990.

[4] N. G. de Bruijn. Permutations with given ups and downs. Nieuw Arch. Wisk. (3), 18:61–65, 1970.

[5] H. O. Foulkes. Enumeration of permutations with prescribed up-down and inversion sequences. Discrete Math., 15(3):235–252, 1976.

[6] H. Kramers. The behavior of macromolecules in inhomogeneous flow. J. Chem. Phys., 14(7):415– 424, 1946.

[7] I. Niven. A combinatorial problem of finite sequences. Nieuw Arch. Wisk. (3), 16:116–123, 1968.

[8] R. Stanley. Enumerative combinatorics, volume 2. Cambridge University Press, 1999.

O. Bernardi: CNRS, Département de Mathématiques, Université Paris-Sud, 91405 Orsay, France

  E-mail address: olivier.bernardi@math.u-psud.fr

B. Duplantier: Institut de Physique Théorique, Orme des Merisiers, CEA Saclay, 91191 Gif-sur-Yvette, France

  E-mail address: bertrand.duplantier@cea.fr

P. Nadeau: Fakultät für Mathematik, Universität Wien, Nordbergstraße 15, A-1090 Vienna, Austria

  E-mail address: philippe.nadeau@univie.ac.at