13
Skew Dyck paths Emeric Deutsch a , Emanuele Munarini b , Simone Rinaldi c, a Polytechnic University, Six Metrotech Center, Brooklyn, NY 11201, USA b Politecnico di Milano, Dipartimento di Matematica, Piazza Leonardo da Vinci 32, 20133 Milano, Italy c Universit a di Siena, Dipartimento di Matematica, pian dei Mantellini 44, 53100 Siena, Italy article info Available online 20 January 2010 Keywords: Lattice path Dyck path Motzkin path Hex tree Enumeration Bijection abstract In this paper we study the class S of skew Dyck paths, i.e. of those lattice paths that are in the first quadrant, begin at the origin, end on the x-axis, consist of up steps U ¼ð1; 1Þ, down steps D ¼ð1; 1Þ, and left steps L ¼ ð1; 1Þ, and such that up steps never overlap with left steps. In particular, we show that these paths are equinumerous with several other combinatorial objects, we describe some involutions on this class, and finally we consider several statistics on S. & 2010 Elsevier B.V. All rights reserved. 1. Basic facts A Dyck path is a path in the first quadrant which begins at the origin, ends on the x-axis, and consists of up steps U ¼ð1; 1Þ and down steps D ¼ð1; 1Þ (Fig. 1(a)) (Stanley, 1999). It is well known that the number of Dyck paths of semi- length n is given by the Catalan number c n ¼ 2n n 1 n þ 1 ; n Z0; and that the generating function of these numbers is cðzÞ¼ 1 ffiffiffiffiffiffiffiffiffiffiffiffi 14z p 2z : A skew Dyck path (briefly, skew path) is a path in the first quadrant which begins at the origin, ends on the x-axis, and consists of up steps U ¼ð1; 1Þ, down steps D ¼ð1; 1Þ, and left steps L ¼ ð1; 1Þ such that an up step never overlaps with a left step (Fig. 1(b)). Obviously, if no left steps are present, then we have a Dyck path. Thus, a skew Dyck path, contrary to what the term may suggest, is not a special kind of Dyck path; it is a generalization thereof. By the length of a skew path we mean the number of its steps (an even non-negative integer). Note that a path of length 2n does not necessarily end at ð2n; 0Þ. Moreover, the set of skew paths ending at ð2n; 0Þ is infinite. By e we denote the empty path (of length 0); sometimes we denote it pictorially by . Let S n be the set of all skew paths of semi-length n and let S ¼ S 1 n ¼ 0 S n . Each skew path is either the empty path or it can be uniquely decomposed as UaDb ðwith a; b 2 SÞ or UgL ðwith g 2 S; gaÞ: ð1Þ See next figure for a pictorial representation of this decomposition. Contents lists available at ScienceDirect journal homepage: www.elsevier.com/locate/jspi Journal of Statistical Planning and Inference ARTICLE IN PRESS 0378-3758/$ - see front matter & 2010 Elsevier B.V. All rights reserved. doi:10.1016/j.jspi.2010.01.015 Corresponding author. E-mail address: [email protected] (S. Rinaldi). Journal of Statistical Planning and Inference 140 (2010) 2191–2203

Skew Dyck paths

Embed Size (px)

Citation preview

Page 1: Skew Dyck paths

ARTICLE IN PRESS

Contents lists available at ScienceDirect

Journal of Statistical Planning and Inference

Journal of Statistical Planning and Inference 140 (2010) 2191–2203

0378-37

doi:10.1

� Cor

E-m

journal homepage: www.elsevier.com/locate/jspi

Skew Dyck paths

Emeric Deutsch a, Emanuele Munarini b, Simone Rinaldi c,�

a Polytechnic University, Six Metrotech Center, Brooklyn, NY 11201, USAb Politecnico di Milano, Dipartimento di Matematica, Piazza Leonardo da Vinci 32, 20133 Milano, Italyc Universit �a di Siena, Dipartimento di Matematica, pian dei Mantellini 44, 53100 Siena, Italy

a r t i c l e i n f o

Available online 20 January 2010

Keywords:

Lattice path

Dyck path

Motzkin path

Hex tree

Enumeration

Bijection

58/$ - see front matter & 2010 Elsevier B.V. A

016/j.jspi.2010.01.015

responding author.

ail address: [email protected] (S. Rinaldi).

a b s t r a c t

In this paper we study the class S of skew Dyck paths, i.e. of those lattice paths that are

in the first quadrant, begin at the origin, end on the x-axis, consist of up steps U ¼ ð1;1Þ,

down steps D¼ ð1;�1Þ, and left steps L¼ ð�1;�1Þ, and such that up steps never overlap

with left steps. In particular, we show that these paths are equinumerous with several

other combinatorial objects, we describe some involutions on this class, and finally we

consider several statistics on S.

& 2010 Elsevier B.V. All rights reserved.

1. Basic facts

A Dyck path is a path in the first quadrant which begins at the origin, ends on the x-axis, and consists of up stepsU ¼ ð1;1Þ and down steps D¼ ð1;�1Þ (Fig. 1(a)) (Stanley, 1999). It is well known that the number of Dyck paths of semi-length n is given by the Catalan number

cn ¼2n

n

� �1

nþ1; nZ0;

and that the generating function of these numbers is

cðzÞ ¼1�

ffiffiffiffiffiffiffiffiffiffiffiffi1�4zp

2z:

A skew Dyck path (briefly, skew path) is a path in the first quadrant which begins at the origin, ends on the x-axis, andconsists of up steps U ¼ ð1;1Þ, down steps D¼ ð1;�1Þ, and left steps L¼ ð�1;�1Þ such that an up step never overlaps with aleft step (Fig. 1(b)). Obviously, if no left steps are present, then we have a Dyck path. Thus, a skew Dyck path, contrary towhat the term may suggest, is not a special kind of Dyck path; it is a generalization thereof.

By the length of a skew path we mean the number of its steps (an even non-negative integer). Note that a path of length2n does not necessarily end at ð2n;0Þ. Moreover, the set of skew paths ending at ð2n;0Þ is infinite. By e we denote the emptypath (of length 0); sometimes we denote it pictorially by �. Let Sn be the set of all skew paths of semi-length n and letS¼

S1n ¼ 0 Sn.

Each skew path is either the empty path or it can be uniquely decomposed as

UaDb ðwith a;b 2 SÞ or UgL ðwith g 2 S; ga�Þ: ð1Þ

See next figure for a pictorial representation of this decomposition.

ll rights reserved.

Page 2: Skew Dyck paths

ARTICLE IN PRESS

Fig. 1. (a) A Dyck path and (b) a skew Dyck path.

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–22032192

Consequently, the generating function sðzÞ for the enumeration of skew paths according to semi-length (coded by z)satisfies the equation

sðzÞ ¼ 1þzs2ðzÞþzðsðzÞ�1Þ; ð2Þ

and hence it is given by

sðzÞ ¼1�z�

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi1�6zþ5z2p

2z: ð3Þ

The first 11 terms of the sequence given by the coefficients sn of the series sðzÞ are

1;1;3;10;36;137;543;2219;9285;39587;171369; . . .

(sequence A002212 in Sloane).Writing (2) in the form sðzÞ ¼ 1þzðsðzÞ2þsðzÞ�1Þ, from a straightforward application of the Lagrange inversion theorem

Stanley (1999) we have

sn ¼ ½zn�sðzÞ ¼

1

n½ln�1

�ð1þ3lþl2Þn for every nZ1:

Expanding ð1þ3lþl2Þn, after writing the trinomial successively as ð1þlÞ2þl, ð1�lÞ2þ5l2, and ð1þ3lÞþl2, we obtain the

explicit formulae:

sn ¼Xn

k ¼ 1

n�1

k�1

� �ck; ð4Þ

sn ¼Xn

k ¼ 1

n�1

k�1

� �ð�1Þk�15n�kck; ð5Þ

sn ¼1

n

Xbðn�1Þ=2c

k ¼ 0

n

k

� �n�k

kþ1

!3n�2k�1: ð6Þ

Relation (4) shows that the sequence ðsnÞnZ1 is the binomial transform of the sequence ðcnÞnZ1. Consequently (see, forexample, Bernstein and Sloane, 1995)

sðzÞ ¼ cz

1�z

� �: ð7Þ

To obtain a recurrence for the numbers sn we first differentiate sðzÞ and then eliminateffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi1�6zþ5z2p

. In this way wearrive at the identity

zð1�6zþ5z2Þs0ðzÞþð1�3zÞsðzÞþz�1¼ 0;

which leads at once to the recurrence

ðnþ3Þsnþ2�3ð2nþ3Þsnþ1þ5nsn ¼ 0: ð8Þ

From here we can derive easily that the sequence ðsn=sn�1ÞnZ1 is bounded. Indeed from (8), replacing n with n�2, weobtain

ðnþ1Þsn�3ð2n�1Þsn�1r0

and then

sn

sn�1r

3ð2n�1Þ

nþ1r

6n

n¼ 6:

In Liu and Wang (2007) it has been proved that the sequence ðsnÞnZ0 is log-convex, i.e. s2nrsn�1snþ1 (Corollary 3.14).

Page 3: Skew Dyck paths

ARTICLE IN PRESS

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–2203 2193

Consequently, the sequence ðsn=sn�1ÞnZ1 is both non-decreasing and bounded. Therefore the limit of sn=sn�1 exists. Now,from (8) we obtain easily (Woan, 2005)

limn-1

sn

sn�1¼ 5: ð9Þ

Writing (2) as sðzÞ2 ¼ ð1�zÞðsðzÞ�1Þ=z, we have that the convolution of the sequence ðsnÞnZ0 with itself gives thesequence of first differences of ðsnÞnZ1, i.e.

Xn

k ¼ 0

sksn�k ¼ snþ1�sn; nZ1:

The first few terms of the sequence s1; s2�s1; s3�s2; . . . are

1;2;7;26;101;406;1676;7066;30302;131782;579867; . . .

(sequence A045868 in Sloane).

2. Bijections with other combinatorial objects

In this section we give bijections between skew paths and other combinatorial objects. For the definition of orderedtrees and binary trees, see, for example, Stanton and White (1986, p. 59).

2.1. Hex trees and 3-Motzkin paths

A hex tree is a rooted tree where each vertex has 0, 1, or 2 children and, when only one child is present, it is either a leftchild or a middle child, or a right child. Hex trees will be represented with the root at the bottom. The term hex tree comesfrom the fact that there is a very simple bijection between tree-like polyhexes (i.e. tree-like hexagonal polyominoes) rootedat an edge, and hex trees: place a vertex in the center of each hexagon and join two such vertices by an edge if and only ifthe corresponding hexagons are adjacent. For instance

For the precise definition of tree-like polyhexes rooted at an edge, see Harary and Read (1970, pp. 3–4). Notice that tree-like polyhexes are allowed to overlap without touching. Alternatively, one can draw them without overlapping by alteringthe size and the shape of some of the hexagons.

Let H denote the set of all hex trees. We define the map ð�Þ0 : S\f�g-H recursively by

Page 4: Skew Dyck paths

ARTICLE IN PRESS

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–22032194

where a;b; g are non-empty skew paths. One can see by induction that this bijection maps skew paths of semi-length n intohex trees with n�1 edges.

Remark. From the definition of this bijection one can easily see that its restriction to Dyck paths is a bijection betweenDyck paths and binary trees. If we replace the Dyck paths by ordered trees via a standard bijection (variously known as thewalkaround or glove bijection; it will be recalled later in the paper) and we represent the binary trees with roots at the top,then we obtain the following bijection between ordered trees and binary trees

where a, b are non-empty ordered trees. One can easily see by induction that this is the so-called first child-next sibling

bijection or the natural correspondence (see, Knuth, 1977 vol. 1, Sec. 2.3.2; Stanton and White, 1986, p. 60). Here in eachbinary tree we have deleted the very first edge that always goes from the root to its only (left) child.

A 3-Motzkin path is a path starting and ending on the horizontal axis but never going below it, with possible steps (1,1),(1,0) and ð1;�1Þ, where the level steps (1,0) can be of three colors. The length of the path is defined to be the number of itssteps.

There is a very simple bijection between hex trees and 3-Motzkin paths: traverse the hex tree in preorder; to each edgemet for the first time and leading to a left, middle, or right child there corresponds a horizontal step of colors 1, 2, or 3,respectively; to a left (right) edge met for the first time and emanating from a branch point there corresponds an up (down)step. The composition of this bijection with the above given bijection between skew paths and hex trees yields a bijectionbetween skew paths and 3-Motzkin paths, given recursively by

where a, b, g are non-empty skew paths. The restriction of this bijection to Dyck paths yields a bijection between Dyckpaths and 2-Motzkin paths. The reader can verify that this is not the standard bijection between these combinatorialobjects Delest and Viennot (1984) and Deutsch and Shapiro (2002).

Page 5: Skew Dyck paths

ARTICLE IN PRESS

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–2203 2195

Obviously, from the decomposition pictures

where ai ði¼ 1;2; . . . ;5Þ are hex trees and

where bi ði¼ 1;2; . . . ;5Þ are 3-Motzkin paths, we obtain immediately that the generating function for the enumeration ofhex trees according to the number of edges is identical to the generating function for the enumeration of 3-Motzkin pathsaccording to length; namely, this common generating function f ðzÞ is given by

f ðzÞ ¼ 1þ3zf ðzÞþz2f ðzÞ2: ð10Þ

It is easy to see that the generating function f ðzÞ for the hex trees and 3-Motzkin paths and the generating function sðzÞ forthe skew paths are connected by the relation

sðzÞ ¼ 1þzf ðzÞ:

This is consistent with the fact that in the bijection between skew paths and hex trees, to paths of length n therecorrespond hex trees with n�1 edges.

Making use of the fact that 3-Motzkin paths of length n are counted by snþ1, we will derive combinatorially severalformulas for snþ1.

(i)

From the n unit segments between (0,0) and ðn;0Þ we select 2k segments. Over these 2k segments we can construct ck

possibly ‘‘broken’’ Dyck paths. Finally, we supply n�2k level steps, each having any of the three given colors. This leadsat once to Aigner (1999)

snþ1 ¼Xbn=2c

k ¼ 0

n

2k

� �3n�2kck:

2-Motzkin paths are defined similarly to 3-Motzkin paths with the only exception that the level steps are of two

(ii) colors. It is well-known (see, for example, Delest and Viennot, 1984; Deutsch and Shapiro, 2002) that 2-Motzkin pathsof length n are counted by the Catalan number cnþ1. Now, from the n unit segments between (0,0) and ðn;0Þ we selectk segments over which we can have ckþ1 possibly ‘‘broken’’ 2-Motzkin paths. We supply n�k level steps, each havingthe third color. We obtain again

snþ1 ¼Xn

k ¼ 0

n

k

� �ckþ1

(see (4) and Aigner, 1999).

(iii) Finally, we can use Motzkin paths (i.e. 1-Motzkin paths) to build up 3-Motzkin paths. This time, from the n unit

segments between (0,0) and ðn;0Þ we select k segments over which we can have mk possibly ‘‘broken’’ Motzkin paths.Here mk denotes the k-th Motzkin number (see Donaghey and Shapiro, 1977). Assuming that the level steps of theseMotzkin paths have color 1, we supply n�k level steps, each having one of the other two colors. Consequently

snþ1 ¼Xn

k ¼ 0

n

k

� �2n�kmk: ð11Þ

Incidentally, from here it follows that snþ1 and mk have the same parity. A combinatorial proof of this is given inDeutsch and Sagan (2006) (in the proof of Corollary 3.4).

The above proofs have been inspired by Louis Shapiro’s combinatorial proof of Touchard’s identity concerning Catalannumbers (Shapiro, 1976). However, here we have used j-Motzkin paths of length n rather than the bijectively equivalentconfigurations of n points on a circle, some of which are paired off by non-intersecting chords and the remaining isolatedones are colored with one of the j given colors.

Now, that 3-Motzkin paths have been introduced, we are in position to give a combinatorial proof of the fact that theHankel matrix of the sequence ðsnÞnZ1 is positive definite. Let A¼ ðAijÞi;jZ0 be the lower triangular matrix in which Aij is the

number of left factors of 3-Motzkin paths of length i and ending at height j (in other words, the number of paths in the first

quadrant from (0,0) to ði; jÞ, using the steps of a 3-Motzkin path). Clearly, Ai0 ¼ siþ1 and Aii ¼ 1 ði¼ 0;1;2; . . .Þ. Denote

H¼ AAT , where AT is the transpose of A. The (i,j)-entry Hij of H is the finite sum

Hij ¼ Ai0Aj0þAi1Aj1þAi2Aj2þ � � � :

Page 6: Skew Dyck paths

ARTICLE IN PRESS

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–22032196

But Ajk, the number of paths from (0,0) to ðj; kÞ, is equal to the number of paths from ði; kÞ to ðiþ j;0Þ, and so AikAjk is equal to

the number of paths from (0,0) to ðiþ j;0Þ passing through ði; kÞ. Consequently, Hij is equal to the number of paths from (0,0)

to ðiþ j;0Þ, i.e. Hij ¼ siþ jþ1, then

s1 s2 s3 . . .

s2 s3 s4 . . .

s3 s4 s5 . . .

^ ^ ^ &

0BBBB@

1CCCCA:

Incidentally, Hij ¼ siþ jþ1 ¼ Aiþ j;0 shows that A is an admissible matrix in the sense of Aigner (1999).

From H¼ AAT it follows that H is positive definite. From the fact that Aii ¼ 1 it follows that the leading principal minorsof the matrix H have determinants equal to 1 (i.e. the Hankel transform of the sequence ðsnÞnZ1 is ð1;1;1;1; . . .Þ, Aigner,1999; Layman, 2001).

Remark. Although, as seen from the above, the actual expression of the matrix A was not required, we indicate briefly aprocedure for obtaining A. Let f ðzÞ be the generating function of the 3-Motzkin paths with z marking number of steps. LetFðt; zÞ be the bivariate generating function of the left factors of 3-Motzkin paths, where z marks number of steps and t

marks the height of the endpoint. Now, from the fact that every left factor of a 3-Motzkin path is either a 3-Motzkin path orit is of the form aUb, where a is a 3-Motzkin path and b is a left factor of a 3-Motzkin path, we obtainFðt; zÞ ¼ f ðzÞþtzf ðzÞFðt; zÞ. But f ðzÞ ¼ ðsðzÞ�1Þ=z and, consequently,

Fðt; zÞ ¼sðzÞ�1

zð1�tðsðzÞ�1ÞÞ:

Clearly, Aij ¼ ½tjzi�Fðt; zÞ.

Remark. The proof given above for the derivation of the Hankel matrix corresponding to the sequence of numberscounting the 3-Motzkin paths can be extended to the more general (a,b,c)-Motzkin paths, where the steps U ¼ ð1;1Þ,H¼ ð1;0Þ, and D¼ ð1;�1Þ come in a, b, and c colors, respectively.

2.2. Marked trees

There is a very well-known bijection between ordered trees and Dyck paths (variously known as the walkaround orglove bijection): traverse the tree in preorder (the root is at the top); to each edge passed on the way down therecorresponds an up step and to each edge passed on the way up there corresponds a down step (see, for example, Deutsch,1999, Appendix E.1(i)).

In this section we intend to derive an analogue of this bijection for the class of skew paths. The part of the ordered treeswill be played by the class of marked trees introduced below. An edge in an ordered tree is said to be right non-final if (i) it isthe rightmost edge among the edges emanating from the same vertex and (ii) it does not end in a leaf.

We are interested in the ordered tree statistic: ‘‘number of right non-final edges’’. Let Fðt; zÞ be the bivariate generatingfunction for these numbers, where z marks number of edges and t marks number of right non-final edges. From thedecomposition

where the ai’ s, bi’ s, and gi’ s are ordered trees, we derive at once

F ¼ 1þz½tðF�1Þþ1�þz2F½tðF�1Þþ1�þz3F2½tðF�1Þþ1�þ � � �

or

zFðt; zÞ2�ð1þz�tzÞFðt; zÞþ1þz�tz¼ 0:

Indeed, the right non-final edges that occur in the subtrees aj;bj; gj; . . . ; are taken care of by the t in the Fðt; zÞ’ s. In addition,an edge leading to the subtree aj is a right non-final edge provided aj is non-empty; these are taken care of by the t in frontof the factor F�1.

A straightforward application of the Lagrange inversion theorem yields the number ank of ordered trees having n edgesand k right non-final edges:

ank ¼ ½tkzn�Fðt; zÞ ¼

n�1

k

� �mn�k�1: ð12Þ

Page 7: Skew Dyck paths

ARTICLE IN PRESS

Fig. 2. The ‘‘glove’’ bijection between marked trees and skew paths.

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–2203 2197

Now, we define a marked tree to be an ordered tree in which all, some, or none of the right non-final edges are marked.Making use of (11) and (12), for the number of marked trees with n edges we obtain

Xn�1

k ¼ 0

2k n�1

k

� �mn�k�1 ¼

Xn�1

j ¼ 0

2n�1�jn�1

j

!mj ¼ sn: ð13Þ

These marked trees form a new manifestation of the numbers sn. For instance we have the following c3 ¼ 5 ordered treeswith three edges, where the right non-final edges are shown with heavy lines:

and consequently the following s3 ¼ 10 marked trees with three edges:

Now, the ‘‘glove’’ bijection between marked trees and skew paths is defined in the following manner: given a marked tree,traverse it in preorder (the root is at the top); to each edge passed on the way down there corresponds an up step, and toeach edge passed on the way up there corresponds a down step if the edge is not marked and a left step if the edge ismarked (see Fig. 2).

2.3. Weighted Dyck paths

Relation (7) suggests a way to construct combinatorial objects counted by the generating function sðzÞ. The function cðzÞ

is the generating function for Dyck paths, with z marking the number of down-steps. Trivially, if we give each down stepthe weight 1, then z marks the weight-sum of the Dyck paths. Replacing z in the generating function by z=ð1�zÞ, we obtainthe generating function of Dyck paths where each down-step can have as weight any positive integer and z marks theweight-sum of the path. We will call these objects weighted Dyck paths.

For example, denoting a down-step with weight j by DðjÞ, the 10 weighted Dyck paths with weight-sum 3 are UDð3Þ,UDð1ÞUDð2Þ, UDð2ÞUDð1Þ, UUDð1ÞDð2Þ, UUDð2ÞDð1Þ and the 5 Dyck paths of semi-length 3, with all down-steps havingweight 1.

Since each Dyck path of semi-length j can be weighted with a weight-sum n in ðn�1j�1Þ ways (number of compositions of n

into j parts), we obtain again, this time combinatorially

sn ¼Xn

j ¼ 1

n�1

j�1

!cj: ð14Þ

Remark. An entirely similar manifestation of the numbers sn is mentioned in the OEIS Sloane at A002212 by RolandBacher: ‘‘number of rooted, planar trees having edges weighted by strictly positive natural integers (multi-trees) withweight-sum n’’.

We present a bijection between the set Wn of weighted Dyck paths with weight-sum n and the set Sn of skew Dyckpaths of semi-length n. The mapping ð�Þ0 :Wn-Sn is defined recursively by e0 ¼ e and

Page 8: Skew Dyck paths

ARTICLE IN PRESS

1

3

12

2

1

12

2

Fig. 3. The correspondences given by ð-Þ0 for the non-skew Dyck paths in S3.

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–22032198

where e denotes the empty path and k is the weight of the first return-to-the-axis step. Clearly, the restriction of ð�Þ0 to theusual Dyck paths (i.e. all weights equal to 1) is the identity mapping. The value of k is determined from the height k�1 ofthe ‘‘skew elevation’’ of the given skew path. The correspondences for the non-skew Dyck paths in S3 are shown in Fig. 3.

Remark. It can be easily seen that the above bijection preserves the number of D steps (also the number of peaks).Consequently, the term ðn�1

j�1Þcj in (14) gives the number of skew Dyck paths of semi-length n having j D steps.

3. Involutions on skew paths

In this section we present several involutions on skew paths. Although they do not look trivial, they are induced, via theskew path–hex tree bijection, from trivial involutions on hex trees.

Involution #1: The involution ð�Þ� : Sn-Sn is defined recursively as follows:

e� ¼ e; ðUDÞ� ¼UD;ðUDaÞ� ¼Ua�L; ðUaLÞ� ¼UDa�; ðUaDbÞ� ¼Ua�Db�

with a;b 2 Sn, and aa�. It can be easily checked that ðÞ� is an involution on Sn. Pictorially, the involution is defined by

where aa�. From the definition it follows that for each skew path a we have that the number of UDU’s in a is equal to thenumber of L’s in a�. It is easy to see from the definition that

(1)

no path of the form UDa or UaL, with aa�, is a fixed point of the involution, and (2) a path UaDb, with aa�, is a fixed point if and only if a� ¼ a and b� ¼ b.

Hence, each fixed point which is different from � and from UD can be uniquely decomposed as UaDb, where a and b arefixed points and aa�. Consequently, the generating function jðzÞ for the number of fixed points, according to semi-length,satisfies the equation

jðzÞ ¼ 1þzþzðjðzÞ�1ÞjðzÞ;

leading to

jðzÞ ¼ 1þz�ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi1�2z�3z2p

2z: ð15Þ

It follows that the number of skew paths of semi-length n that are fixed points of the involution is mn�1, the ðn�1Þ�thMotzkin number ðnZ1Þ.

Alternatively, we can derive this result from the fact that this involution is induced by the trivial involution on the hextrees that interchanges the edges that lead to a middle child with the edges that lead to a right child. Clearly, the fixed

Page 9: Skew Dyck paths

ARTICLE IN PRESS

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–2203 2199

points of this involution are the hex trees having no such edges, i.e. ordered trees in which each vertex has outdegree atmost 2 (called sometimes 0–1–2 trees). It is known (Donaghey and Shapiro, 1977) that such trees with n edges are countedby the Motzkin number mn. Since skew paths of semi-length n are in bijection with hex trees having n�1 edges, we obtainagain that the number of skew paths of semi-length n that are fixed points of the involution is mn�1.

Involution #2: The involution ð�Þ� : Sn-Sn is defined recursively as follows:

e� ¼ e ðUDÞ� ¼UD;

ðUaDÞ� ¼Ua�L; ðUaLÞ� ¼Ua�D; aa�;ðUaDbÞ� ¼Ua�Db�; ba�:

It can be easily checked that ð�Þ� is an involution on Sn. Pictorially, the involution is defined by

From the definition it follows that this involution preserves the number of peaks, the number of valleys and the number ofdouble rises at a given level, as well as the lengths of the ascents (i.e. the maximal number of consecutive U steps). Thisinvolution is induced by the trivial involution on the hex trees that interchanges the edges that lead to a middle child withthe edges that lead to a left child. It follows, just in the previous case, that the number of skew paths of semi-length n thatare fixed points of the involution is mn�1.

Involution #3: The involution ð�Þ� : Sn-Sn is defined recursively as follows:

e� ¼ e; ðUDÞ� ¼UD;

ðUaDÞ� ¼UDa�; ðUaLÞ� ¼Ua�L; ðUDaÞ� ¼Ua�D; aa�;ðUaDbÞ� ¼Ua�Db�; a;ba�:

Page 10: Skew Dyck paths

ARTICLE IN PRESS

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–22032200

It can be checked that ð�Þ� is an involution on Sn. Pictorially, the involution is defined by

From the definition it follows that this involution preserves the number of left steps. Consequently, the restriction of thisinvolution to Dyck paths is an involution on Dyck paths. Involution #3 is induced by the trivial involution on the hex treesthat interchanges the edges that lead to a left child with the edges that lead to a right child. It follows, just in the previouscases, that the number of skew paths of semi-length n that are fixed points of the involution is mn�1.

Involution #4: The involution ð�Þ� : Sn-Sn is defined recursively as follows:

e� ¼ e; ðUaLÞ� ¼Ua�L; aa�; ðUaDbÞ� ¼Ub�Da�:

It can be checked that ð�Þ� is an involution on Sn. Pictorially, the involution is defined by

From the definition it follows that this involution preserves the number of left steps. Consequently, the restriction of thisinvolution to Dyck paths is an involution on Dyck paths, identical with the one defined in Deutsch (1999). Involution #4 isinduced by the reflection involution on the hex trees (take the reflection of a hex tree in the vertical axis passing throughthe root). From the definition it follows that UaL ða 2 S, aa�Þ is a fixed point if and only if a is a fixed point. On the otherhand, UaDb ða;b 2 SÞ is a fixed point of the involution if and only if its size is odd and b¼ a�, a being arbitrary.Consequently, denoting by pn the number of fixed points in Sn, we have

p2nþ1 ¼ snþp2n and p2n ¼ p2n�1 ðnZ1Þ:

From here one can easily derive that

p2n�1 ¼ p2n ¼ s0þs1þ � � � þsn�1: ð16Þ

Alternatively, since the involution is induced by the reflection involution on hex trees, the number of fixed points in Sn ofour involution is equal to the number of symmetric hex trees having n�1 edges. Let wðzÞ be the generating function of thesymmetric hex trees. Since every non-empty symmetric hex tree is one of the form

where d is a symmetric hex tree, z is an arbitrary hex tree and z0 is the image of z under reflection, we have

wðzÞ ¼ 1þzwðzÞþz2f ðz2Þ;

where f ðzÞ is defined in (10) and is related to sðzÞ via sðzÞ ¼ 1þzf ðzÞ. Consequently, wðzÞ ¼ sðz2Þ=ð1�zÞ, from where it followsthat the sequence defined by the function wðzÞ consists of the partial sums of the sequence s0;0; s1;0; s2;0; . . . ; in agreementwith (16).

Page 11: Skew Dyck paths

ARTICLE IN PRESS

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–2203 2201

4. Some statistics on skew paths

In this section we present some simple statistics on skew paths that lead to interesting combinatorial properties of thesequence ðsnÞnZ0.

4.1. Number of paths ending in D and number of paths ending in L

A path ending in D is of one of the following forms:

Ua1D; Ua1DUa2D; Ua1DUa2DUa3D; . . . with a1;a2;a3; . . . 2 S:

Consequently their generating function is

zsðzÞ

1�zsðzÞ¼

2

1þzþffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi1�6zþ5z2p �1: ð17Þ

It follows that the generating function for the skew paths ending in L is

sðzÞ�1�zsðzÞ

1�zsðzÞ¼

zðsðzÞ�1Þ

1�zsðzÞ¼

2ð1�zÞ

1þzþffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi1�6xþ5x2p �1: ð18Þ

We denote by dn (resp. ln) the number of skew paths of semi-length n ending in D (resp. L) (see table below; we havedn ¼ A033321ðnÞ and ln ¼ A128714ðnÞ).

n

1 2 3 4 5 6 7 8 . . .

dn

1 2 6 21 79 311 1265 5275 . . .

ln

0 1 4 15 58 232 954 4010 . . .

Denote dðzÞ ¼ zsðzÞ=ð1�zsðzÞÞ. Writing it in the form dðzÞ ¼ zsðzÞþzsðzÞdðzÞ, we obtain

dn ¼ sn�1þXn�1

j ¼ 1

djsn�1�j; d0 ¼ 0:

Similarly, setting lðzÞ ¼ zðsðzÞ�1Þ=ð1�zsðzÞÞ, we obtain

ln ¼ sn�1þXn�1

j ¼ 2

ljsn�1�j; l0 ¼ l1 ¼ 0:

The relation dn�dn�1 ¼ ln can be easily checked by using the corresponding generating functions. It follows also bijectively.Indeed, the number of paths in Sn that end with UD is dn�1. The other ones that end in D (their number is dn�dn�1) are in asimple bijection with those ending in L: replace the last D by an L.

From this relation, from the obvious equality dnþ ln ¼ sn and from limn-1ðsn=sn�1Þ ¼ 5 (Eq. (9)) we obtain at once

limn-1

dn

sn¼

5

9; lim

n-1

lnsn¼

4

9:

We have, for example, d400=g400 ¼ 0:555658 and l400=g400 ¼ 0:444341.

4.2. Number of left steps

Let Sðt; zÞ denote the generating function for the enumeration of skew Dyck paths according to semi-length, coded by z,and the statistic ‘‘number of left steps’’, coded by t. Let ank denote the number of skew paths of semi-length n and having k

left steps. From the decomposition (1) we obtain at once

Sðt; zÞ ¼ 1þzSðt; zÞ2þtzðSðt; zÞ�1Þ: ð19Þ

From here,

Sðt; zÞ ¼ cz

1�tz

� �: ð20Þ

Now, either from (19) by the Lagrange inversion theorem or from (20) by elementary manipulations, we obtain

ank ¼ ½tkzn�Sðt; zÞ ¼

n�1

k

� �cn�k:

This formula follows also combinatorially by noticing that the set of skew paths of semi-length n having k left steps is inbijection with the cross-product of the collection of subsets of size k of f1;2; . . . ;n�1g and the collection of Dyck paths ofsemi-length n�k. Sketch of the proof: consider a skew path a of semi-length n having k left steps. If we label the up steps ofa, from left to right, by 1;2; . . . ;n, and their matching down or left steps by 10;20; . . . ;n0, then the labels of the left steps forma subset of size k of f10;20; . . . ; ðn�1Þ0g (the matching step of the last up step is always a down step). Removing the left steps

Page 12: Skew Dyck paths

ARTICLE IN PRESS

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–22032202

and their corresponding up steps from a, we obtain a possibly broken Dyck path of semi-length n�k. For example, for thesix skew paths of semi-length 4, having two left steps, the bijection is given in Fig. 4.

Alternatively, we can proceed in the following way. In the bijection of Section 2 between skew paths and hex trees, toleft steps there correspond vertical edges (i.e. edges leading to a middle child). Consequently, ank is the number of hex treeswith n�1 edges, exactly k of which are vertical. Then one must have n�k�1 non-vertical edges. The number of binary treeswith n�k�1 edges is cn�k. In each of these binary trees we insert k vertical edges at the n�k vertices, repetitions allowed.This can be done in ðn�1

k Þ ways. Consequently,

ank ¼n�1

k

� �cn�k:

The first values of ank are given in the table below (sequence A126181 in Sloane).

Fig.

(1,2) UDUD

(1,3) UUDD

4. The bijection fo

2

(2,3) U

(1,2) U

r the six skew path

3

DUD

UDD

s of semi-length 4

3

2

(2,3) UUDD

(1,3) UDUD

, having two left

steps.

n\k

0 1 2 3 4 5 6 . . .

0

1

1

1

2

2 1

3

5 4 1

4

14 15 6 1

5

42 56 30 8 1

6

132 210 140 50 10 1

7

429 792 630 280 75 12 1 . . .

^

^ ^ ^ ^ ^ ^ ^ &

Let sn denote the number of left steps in all skew paths of semi-length n. Clearly,

sn ¼XkZ0

kank ¼ ½zn�@S

@t

����t ¼ 1

:

From (19) a simple computation yields

@S

@t

����t ¼ 1

¼zðsðzÞ�1Þ

1�z�2zsðzÞ¼ z2s0ðzÞ;

from where

sn ¼ ðn�1Þsn�1: ð21Þ

We can prove this also bijectively. Since any skew path of semi-length n�1 has exactly n�1 up steps, we define a bijectionbetween the starting points of the n�1 up steps of each of the sn�1 skew paths of semi-length n�1 and the left steps of allthe skew paths of semi-length n. Let x denote the starting point of an up step of a path of semi-length n�1. Denote by x0 theleftmost point of the path, to the right of x, at the same level as x, and not followed by an up step. Now replace x by an upstep and x0 by a left step. This left step in this new skew path of semi-length n is taken as the image of the point x. Theinverse mapping is the following. Let a be a skew path of semi-length n with a left step L0. Let U0 be the step matching L0, i.e.the rightmost up step to the left of L0 and at the same level as L0. The step U0 is necessarily followed by an up step U00.Removing the steps U0 and L0 from a, we obtain a skew path of semi-length n�1; the starting point of the step U00 is theinverse image of L0 under the defined mapping. Fig. 5 sketches the bijection. Fig. 6 shows an example of the bijection forskew paths of semi-length 3.

Page 13: Skew Dyck paths

ARTICLE IN PRESS

x L’

U’’

U’x’

Fig. 5. A sketch of the above defined bijection.

Fig. 6. The bijection between the starting points of the 6 up steps of each of the three skew paths of semi-length 2 and the left steps of all the skew paths

of semi-length 3.

E. Deutsch et al. / Journal of Statistical Planning and Inference 140 (2010) 2191–2203 2203

From (9) and (21) it follows that for the expected value sn=sn of the number of left steps in a random skew path of semi-length n we have

sn

sn¼ðn�1Þsn�1

sn�

1

5n:

For example, we actually have s900=s900 ¼ 180:09979.

References

Aigner, M., 1999. Catalan-like numbers and determinants. J. Combin. Theory A 87, 33–51.Bernstein, M., Sloane, N.J.A., 1995. Some canonical sequences of integers. Linear Algebra Appl. 226–228, 57–72.Delest, M.P., Viennot, G., 1984. Algebraic languages and polyominoes enumeration. Theoret. Comput. Sci. 34, 169–206.Deutsch, E., 1999. An involution on Dyck paths and its consequences. Discrete Math. 204, 163–166.Deutsch, E., 1999. Dyck path enumeration. Discrete Math. 204, 167–202.Deutsch, E., Sagan, B.E., 2006. Congruences for Catalan and Motzkin numbers and related sequences. J. Number Theory 117, 191–215.Deutsch, E., Shapiro, L.W., 2002. A bijection between ordered trees and 2-Motzkin paths and its many consequences. Discrete Math. 256, 655–670.Donaghey, R., Shapiro, L., 1977. Motzkin numbers. J. Combin. Theory A 23, 291–301.Harary, F., Read, R.C., 1970. The enumeration of tree-like polyhexes. Proc. Edinburgh Math. Soc. 17 (2), 1–13.Knuth, D.E., 1997. The Art of Computer Programming, vol. 1. Addison-Wesley, Reading, MA.Layman, J.W., 2001. The Hankel transform and some of its properties. J. Integer Sequences 4 Article 01.1.5.Liu, L.L., Wang, Y., 2007. On the log-convexity of combinatorial sequences. Adv. Appl. Math. 39, 453–476.Shapiro, L.W., 1976. A short proof of an identity of Touchard concerning Catalan numbers. J. Combin. Theory A 20, 375–376.Sloane, N.J.A., On-Line Encyclopedia of Integer Sequences. published electronically at /http://www.research.att.com/�njas/sequences/S.Stanley, R.P., 1999. Enumerative Combinatorics Cambridge Studies in Advanced Mathematics 62, vol. 2. Cambridge University Press, Cambridge.Stanton, D., White, D., 1986. Constructive Combinatorics. Springer, New York.Woan, W.J., 2005. A recursive relation for weighted Motzkin sequences. J. Integer Sequences 8 Article 05.1.6.