Leaves_on_trees
Leaves_on_trees
www.elsevier.com/locate/ejc
Abstract
A leaf of a plane tree is called an old leaf if it is the leftmost child of its parent, and it is called
a young leaf otherwise. In this paper we enumerate plane trees with given numbers of old leaves
and young leaves. The formula is obtained combinatorially via two bijections between plane trees
and 2-Motzkin paths which map young leaves to red horizontal steps, and old leaves to up steps.
We derive some implications for the enumeration of restricted permutations with respect to certain
statistics such as pairs of consecutive deficiencies, double descents, and ascending runs. Finally, our
main bijection is applied to obtain refinements of two identities of Coker, involving refined Narayana
numbers and the Catalan numbers.
© 2005 Elsevier Ltd. All rights reserved.
1. Introduction
Plane trees, also referred to as ordered trees, are basic objects frequently used in
combinatorics. Many enumerative results about them appear throughout the literature.
For example, a well-known interpretation of the Narayana numbers is that they count the
number of plane trees with a fixed number of leaves. In this paper we classify the leaves of
a plane tree into two different kinds, distinguishing between old leaves and young leaves.
0195-6698/$ - see front matter © 2005 Elsevier Ltd. All rights reserved.
doi:10.1016/j.ejc.2004.12.008
W.Y.C. Chen et al. / European Journal of Combinatorics 27 (2006) 414–427 415
This definition, which is introduced in Section 2, naturally gives rise to a refinement of the
Narayana numbers.
These refined Narayana numbers also appear in the enumeration of 2-Motzkin paths
with respect to the numbers of up steps and red horizontal steps. Such paths were
introduced in [1], and their structure has proved to be useful in the study of lattice paths,
noncrossing partitions, plane trees [6], and other combinatorial objects and identities.
Our paper gives yet another example of the applicability of 2-Motzkin paths. The key
to several of our results is a new bijection between plane trees and 2-Motzkin paths, with
very convenient properties. It provides a combinatorial derivation of the expression for the
number of plane trees with given numbers of old and young leaves.
Partly motivated by our work, Chen, Yan and Yang [4] give combinatorial
interpretations of two identities involving the Narayana numbers and Catalan numbers,
due to Coker [5]. While the proof in [4] uses a different bijection, the authors note that our
bijection provides a combinatorial proof as well. Here we will show that a more detailed
analysis of the bijection and its properties gives refinements of the two identities of Coker,
as well as bijective proofs of these refinements.
The paper is structured as follows. In Section 2 we review some definitions and notation
about plane trees, Dyck paths, Motzkin paths, and 2-Motzkin paths. We also introduce the
concepts of old leaves and young leaves of a plane tree. In Section 3 we give the generating
function for plane trees with variables marking the number of old leaves and the number of
young leaves, as well as exact formulas for the number of plane trees of a given size when
the numbers of old and young leaves are fixed. In Section 4 we present two bijections
from the set of plane trees with n edges to the set of 2-Motzkin paths of length n − 1.
Some interesting properties of these bijections are studied in Section 5. We show that they
map old and young leaves of trees into statistics on 2-Motzkin paths that are easier to
deal with. In Section 6 we describe some bijections between plane trees and permutations
avoiding patterns of length 3, and investigate what old and young leaves are mapped to
by these bijections. This implies that the distributions of certain parameters on restricted
permutations are given by the same formulas enumerating plane trees with respect to old
and young leaves. Finally, in Section 7 we apply our bijection to obtain refinements of two
combinatorial identities due to Coker [5] and proved combinatorially by Chen, Yan and
Yang [4].
2. Preliminaries
A plane tree T can be defined recursively (see for example [11, Appendix]) as a finite set
of vertices such that one distinguished vertex r is called the root of T , and the remaining
vertices are put into an ordered partition (T1 , T2 , . . . , Tm ) of m disjoint non-empty sets,
each of which is a plane tree. We will draw plane trees with the root on the top level, with
edges connecting it to the roots of T1 , T2 , . . . , Tm , which will be drawn from left to right
on the second level. For each vertex v, the nodes in the next lower level connected to v by
an edge are called the children or successors of v, and v is called the parent of its children.
Clearly each vertex other than r has exactly one parent. A vertex of T is called a leaf if it
416 W.Y.C. Chen et al. / European Journal of Combinatorics 27 (2006) 414–427
has no children (by convention, we assume that the empty tree, formed by a single node,
has no leaves).
We denote by Tn the set of (unlabeled) plane trees with n edges. It is well known that
|Tn | = n+1 2n
1
n , the n-th Catalan number, and that the number of trees with n edges and
n
k leaves is the Narayana number n1 nk k−1 .
We classify the leaves of a plane tree into old and young leaves. We say that a leaf is
an old leaf if it is the leftmost child of its parent, and that it is a young leaf otherwise. For
example, the tree in Fig. 1 has four young leaves, drawn with black filled circles, and three
old leaves, drawn with empty circles. The enumeration of plane trees with respect to the
numbers of old and young leaves is done in Section 3.
Fig. 1. A tree with three old leaves and four young leaves.
T1 , T2 , . . . , Tm be the sequence of plane trees hanging from left to right from the children
of the root. If T1 has no edges, then it creates an old leaf of T ; otherwise all the old (resp.
young) leaves of T1 become old (resp. young) leaves of T . Therefore, the contribution to
the generating function of T1 and the edge connecting it to the root is z(G − 1 + t). For
i ≥ 2, old and young leaves of Ti become leaves of T of the same kind as well. However,
if Ti has no edges, then an additional young leaf of T is created. Thus, the contribution
to the generating function of each Ti with i ≥ 2 and the edge connecting it to the root is
z(G − 1 + s). It follows that for m ≥ 1, the contribution of the plane trees whose root has
degree m is z m (G − 1 + t)(G − 1 + s)m−1 . Summing over all m ≥ 0 we obtain
z(G − 1 + t)
G =1+ . (1)
1 − z(G − 1 + s)
Isolating G, the formula follows.
Proposition 2. (1) The number of plane trees with n edges, i old leaves, and j young
leaves is
1 n n − i n −i − j
.
n i j i −1
(2) The number of plane trees with n edges and k old leaves is
2n−2k+1 n − 1 2k − 2
.
k 2k − 2 k −1
(3) The number of plane trees with n edges and k young leaves is
n−1
Mn−k−1 .
k
the Lagrange inversion to the same equation, after making the substitutions s = 1 and
t = 1 respectively.
Second proof. We can give a bijective proof of the first part of Proposition 2 as follows.
In [3], the author gives a bijective algorithm to decompose any labeled plane tree with
n edges (where the set of vertex labels is {1, 2, . . . , n + 1}) into a set F of n matches
with labels {1, . . . , n, n + 1, (n + 2)∗ , . . . , (2n)∗ }, where a match is a rooted tree with two
vertices. The reverse procedure of the decomposition algorithm is the following merging
algorithm. We start with a set F of matches on {1, . . . , n +1, (n +2)∗ , . . . , (2n)∗ }. A vertex
labeled with a mark ∗ is called a marked vertex.
(1) Find the tree T with the smallest root in which no vertex is marked. Let i be the root of
T.
(2) Find the tree T ∗ in F that contains the smallest marked vertex. Let j ∗ be this marked
vertex.
(3) If j ∗ is the root of T ∗ , then merge T and T ∗ by identifying i and j ∗ , keep i as the
new vertex, and place the subtrees of T ∗ to the right of T . The operation is called a
horizontal merge. If j ∗ is a leaf of T ∗ , then replace j ∗ with T in T ∗ . This operation is
called a vertical merge. See Fig. 2.
(4) Repeat the above procedure until F becomes a labeled tree.
For any labeled plane tree with n edges, i old leaves, and j young leaves, the
corresponding set F of n matches consists of i matches without marked vertices, j matches
with marked roots and unmarked leaves, and all leaves in the remaining matches are
marked vertices. Thus, we can count the number of labeled plane trees with n edges, i
old leaves, and j young leaves as follows:
n + 1 (2i )! n + 1 − 2i n−1 n−1− j
j! (n − i − j )!
2i i! j j n −i − j
(n + 1)! n n − i n −i − j
= .
n i j i −1
Now, to count unlabeled plane trees we just divide by (n + 1)!, obtaining the desired
formula.
Summing for all j we obtain the formula in part (2) of the proposition, and summing
for all i we derive the third formula.
Particular cases of this proposition give rise to the following two statements. The second
one appeared already in [7] as a manifestation of the Motzkin numbers.
W.Y.C. Chen et al. / European Journal of Combinatorics 27 (2006) 414–427 419
Corollary 3. (1) The number of plane trees in Tn with exactly one old leaf is 2n−1 .
(2) The number of plane trees in Tn with no young leaves is Mn−1 .
Now we describe another bijection Ψ between Tn and the set of 2-Motzkin paths
of length n − 1. We can construct Ψ recursively. Given a plane tree T , consider the
decomposition given in Fig. 7, where (e1 , e2 , . . . , ek ) is the path obtained starting at the
root and successively descending to the rightmost child until we reach a leaf. T1 , T2 , . . . , Tk
are possibly empty subtrees hanging from the vertices of this path. When i = k, if the
subtree Ti consists of a single vertex, then we encode the edge ei with B; otherwise, ei is
encoded with a U and a D. When i = k, if the subtree Tk consists of a single vertex, then
the edge ek does not produce any step in the encoding; otherwise, ek is encoded with R.
We traverse the path from e1 to ek and construct Ψ (T ) as follows. If the encoding of ei is
B or R, then we record Q i = B or Q i = RΨ (Ti ) respectively. If the encoding of ei is a
U and a D, then we denote Q i = U Ψ (Ti )D. Joining these segments Q i from 1 to k, we
obtain a 2-Motzkin path M = Q 1 Q 2 · · · Q k .
Here is an alternative way to describe Ψ . Given a plane tree T with n edges, label its
vertices with U, D, B or R while traversing it in preorder. For an internal vertex, if it is
W.Y.C. Chen et al. / European Journal of Combinatorics 27 (2006) 414–427 421
not the leftmost child of its parent we label it with U ; otherwise we label the vertex with
B. A young leaf is labeled with R and an old leaf with D, except the last old leaf that we
encounter, which is left unlabeled. Thus all vertices get a label except the root and the last
old leaf.
To construct the 2-Motzkin path we traverse the vertices of the tree in a different order
and read the labels. Suppose that the root of T has k children v1 , v2 , . . . , vk and that Ti is
the subtree with root vi . Then we traverse first the vertices vk , vk−1 , . . . , v1 in this order,
and then traverse T1 , T2 , . . . , Tk recursively. It can be shown that the path obtained in this
way is Ψ (T ).
that the path has no occurrences of R D, so each D is in one of these sequences). In the
sequence of D’s following the rightmost peak all the steps are marked. For each remaining
peak, among the D steps in the consecutive sequence following it, all but the last one are
marked. Thus, only one D step survives for each peak other than the rightmost one. In
other words, the number of D steps in Ψ (T ) is the number of peaks of the Motzkin path
minus one. This implies (1).
By means of the bijection Ψ and the properties described above, we can now give a
combinatorial proof of Corollary 3. To prove the first part, observe that by property (1)
of Proposition 4, Ψ induces a bijection between plane trees with exactly one old leaf and
2-Motzkin paths with no U steps. But these paths are just sequences of horizontal steps,
each of which can be colored red or blue. Thus, the number of plane trees on n edges with
exactly one old leaf is 2n−1 .
A direct proof of this nice fact, without using bijections to lattice paths, can be given as
follows. Let T be a tree with n edges and exactly one old leaf, call it . We can find by
following the path that starts at the root and always continues to the leftmost child. Let P
be this path. Then must be at the end of P. Now we claim that the remaining nodes of
T are leaves hanging from the nodes of P other than . Indeed, if a node of P had a child
not in P with successors, then following the path that starts at this child and continues
always to the leftmost child, we would end at another old leaf, which is a contradiction.
Reciprocally, if only leaves are hanging from P, then no more old leaves appear. Now, the
number of trees consisting of a path P with leaves hanging from its nodes is clearly 2n−1 .
Indeed, one can think of it as a composition of n, say n = a1 + a2 + · · ·, where ai is the
number of children of the i -th node of P.
More generally, we can use our bijection to give a combinatorial proof of the second
part of Proposition
2, namely
the number of plane trees with n edges and k old leaves
2n−2k+1 n−1 2k−2
is k 2k−2 k−1 . By the first property of Ψ given above, we have to count the
number of 2-Motzkin paths of length n − 1 with k − 1 U steps. To produce such a path,
n−1
we can choose in 2k−2 ways the positions of the k − 1 U ’s and k − 1 D’s in the path.
Deciding which of these positions will be filled with a U or with a D is equivalent
to
1 2k−2
choosing a Dyck path with 2k − 2 steps, and this can be done in k k−1 ways. The
remaining n − 2k + 1 positions are horizontal steps, which can be colored red or blue in
2n−2k+1 ways.
To show the second part of Corollary 3 combinatorially, notice that property (2) of
Proposition 4 implies that Ψ maps plane trees with no young leaves into 2-Motzkin paths
with no R steps. These are just Motzkin paths with steps U , D and B. Therefore, the
number of plane trees on n edges with no young leaves equals the number of Motzkin
paths with n − 1 steps, which is Mn−1 .
More generally, the same property of Ψ can be used to prove the last part of
Proposition
2, namely the number of plane trees with n edges and k young leaves is
n−1
k M n−k−1 . Indeed, now the problem is equivalent to counting 2-Motzkin paths of
length n − 1 with k R steps. We can choose in n−1 k ways where these R steps go, and
then the remaining n −k −1 steps can be filled with a Motzkin path with steps U , D and B.
W.Y.C. Chen et al. / European Journal of Combinatorics 27 (2006) 414–427 423
δ(T ) as follows. For each node with r children, draw r up steps followed by one
down step; draw a D for each leaf except for the last leaf, for which we do not
draw anything. For example, the path corresponding to the tree in Fig. 1 is δ(T ) =
UUUU DUUU D D D DU DU DU D D DU DUU D D.
Define a drop of a Dyck path to be a maximal succession of at least two consecutive D
steps, and a triple fall to be an occurrence of D D D. Then the bijection δ maps each old
leaf of T to a drop of δ(T )D, and each young leaf to a triple fall of δ(T )D. For the above
example, δ(T )D has three drops and four triple falls.
Following arguments similar to the ones in Propositions 5 and 6, but using the bijection
δ instead of θ , we obtain the next two results.
In [5] Coker established the following two identities, involving the Narayana and the
Catalan numbers:
1 n
n (n−1)/2
n n − 1 k n−2k−1
4 n−k
= Ck 4 5 , (2)
k=1
n k k − 1 k=0
2k
n
1 n n
n−1
n−1
x 2k (1 + x)2n−2k = x 2 Ck+1 x k (1 + x)k . (3)
k=1
n k k − 1 k=0
k
Proof. It will be convenient to use the term critical leaf to denote the last old leaf that we
encounter when we traverse a plane tree in preorder. Given a plane tree T with n edges,
assign weights to the vertices of T as follows: young leaves are given weight y, old leaves
other than the critical one are given weight x, and the rest of the vertices (including the
critical leaf) are given weight 1. The weight of T is the product of the weights of its
vertices. Then, the left hand side of (4) is the sum of the weights of all plane trees with n
edges.
By Proposition 4, Ψ is a weight preserving bijection between the set of weighted plane
trees on n edges, with weights given as above, and the set of weighted 2-Motzkin paths of
length n − 1 where weights are assigned as follows: U steps are given weight x, R steps
are given weight y, and all the remaining steps are given weight 1, defining the weight of
a 2-Motzkin path to be the product of weights of its steps. We claim that the right hand
side of (4) is the sum of the weights of all 2-Motzkin paths of length n − 1. Indeed, let
k ≤ (n − 1)/2 and consider the weighted 2-Motzkin paths with k up steps and k down
steps. These up and down steps from a Dyck path of length 2k, and the positions of these
2k steps can be chosen in n−1 2k ways. They contribute x k to the weight of the path. The
remaining n − 2k − 1 steps are either R or B steps. Since R steps have weight y and B
steps have weight 1, the total contribution of the horizontal steps in paths with k up steps
is (1 + y)n−2k−1 . This justifies the right hand side.
With the substitution y = x in Eq. (4) we recover the result proved in [4], and the
particular case y = x = 4, together with the symmetry of the Narayana numbers, yields
Eq. (2). A refinement of the second identity (3) is given next.
Theorem 10. For n ≥ 1, we have
(n−1)/2
n−2i+1 1 n n − i n − i − j
x 2(i−1) y j z n−2i− j +1
i=1 j =0
n i j i − 1
n−1
n−1
= Ck+1 x k (y + z − 2x)n−1−k . (5)
k=0
k
Proof. Recall the definition of the critical leaf from the proof of Theorem 9. Given a plane
tree T with n edges, assign weights to the vertices of T in the following way. Old leaves
other than the critical one are given weight x, the parents of such leaves are given weight
x as well, young leaves are given weight y, the critical leaf and its parent are given weight
1, and the rest of the vertices are given weight z. As before, the weight of T is the product
of the weights of its vertices. Notice that two different old leaves cannot have the same
parent, so the weight of a tree with i old leaves and j young leaves is x 2(i−1) y j z n−2i− j +1 .
The left hand side of (5) is the sum of the weights of all plane trees with n edges.
By Proposition 4, a tree with i old leaves and j young leaves is mapped by Ψ to a
2-Motzkin path with i −1 up steps, i −1 down steps, j horizontal R steps, and n −2i − j +1
horizontal B steps. To make Ψ a weight preserving bijection between plane trees on n
edges with the above weights and 2-Motzkin paths of length n − 1, we assign weights to
the steps of a 2-Motzkin path by giving weight x to U and D steps, weight y to R steps,
and weight z to B steps.
W.Y.C. Chen et al. / European Journal of Combinatorics 27 (2006) 414–427 427
Consider now the set of 3-Motzkin paths of length n − 1, where horizontal steps can
be either red, blue or green (call them R, B and G steps respectively). Assign weights
to the steps by giving weight y + z − 2x to G steps and weight x to all the other steps.
Again, the weight of a path is the product of weights of its steps. This weight assignment
for 3-Motzkin paths has the property that the sum of the weights of an R step, a B step
and a G step equals the sum of the weights of an R step and a B step in the assignment for
2-Motzkin paths above (namely x + y), and also that U and D steps have the same weight
x in both assignments. This implies that the sum of weights over all 2-Motzkin paths with
the above weight assignment equals the sum of weights over all 3-Motzkin paths with this
new assignment. Therefore, it remains to show that the right hand side of (5) is the total
sum of the weights of 3-Motzkin paths of length n −1. But this is clear because if we fix the
number of G stepsof a 3-Motzkin path to be n − 1 − k, then the positions of these G steps
n−1
can be chosen in k ways. The remaining steps, U , D, R and B, form a 2-Motzkin
path of length k, and the number of such paths is Ck+1 .
To recover identity (3) we only need to substitute x(1 + x) for x, x 2 for y, and (1 + x)2
for z in Eq. (5), and notice that a tree with i old leaves and j young leaves has k = i + j
leaves in total.
Acknowledgements
We are grateful to Laura Yang for her valuable suggestions, and to two anonymous
referees for helpful comments. The work of W.Y.C. Chen was partially supported by
the 973 Project on Mathematical Mechanization, the National Science Foundation, the
Ministry of Education, and the Ministry of Science and Technology of China. The work
of S. Elizalde was partially supported by the Ministry of Foreign Affairs of Spain and the
AECI.
References
[1] E. Barcucci, A. Del Lungo, E. Pergola, R. Pinzani, A construction for enumerating k-coloured Motzkin
paths, in: Lecture Notes in Comput. Sci., vol. 959, Springer, Berlin, 1995.
[2] D. Callan, Bijections from restricted Dyck paths to Motzkin paths, Preprint arxiv:math.CO/0406381.
[3] W.Y.C. Chen, A general bijective algorithm for trees, Proc. Natl. Acad. Sci. USA 87 (1990) 9635–9639.
[4] W.Y.C. Chen, S.H.F. Yan, L.L.M. Yang, Identities from weighted 2-Motzkin paths, Adv. Appl. Math. (in
press).
[5] C. Coker, Enumerating a class of lattice paths, Discrete Math. 271 (2003) 13–28.
[6] E. Deutsch, L.W. Shapiro, A bijection between ordered trees and 2-Motzkin paths and its many
consequences, Discrete Math. 256 (2002) 655–670.
[7] R. Donaghey, L.W. Shapiro, Motzkin numbers, J. Combin. Theory Ser. A 23 (1977) 291–301.
[8] S. Elizalde, Statistics on pattern-avoiding permutations, Ph.D. Thesis, MIT, 2004.
[9] D. Knuth, The Art of Computer Programming, vol. III, Addison-Wesley, Reading, MA, 1973.
[10] C. Krattenthaler, Permutations with restricted patterns and Dyck paths, Adv. Appl. Math. 27 (2001)
510–530.
[11] R. Stanley, Enumerative Combinatorics, vol. I, Cambridge Univ. Press, Cambridge, 1997.
[12] Y. Sun, The statistic “number of udu’s” in Dyck paths, Discrete Math. 287 (2004) 177–186.