RECURRENCE RELATIONS WITH TWO INDICES

2 downloads 0 Views 183KB Size Report
A sequence with k indices is a function α : Ak → B, where A ⊆ N. The ... complete solution. ... Our main goal is the use the combinatorial methods and the kernel method (see [1]) .... see [5, Exercise 6.19(s)]). ..... Let f(x, q) be the ordinary generating function for the number of R-Hobby's ... 2x3 − 3x2 + 4x − 1 + (1 − x)2√1. − 4x.
RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

Toufik Mansour Department of Mathematics, University of Haifa, 31905 Haifa, Israel Center for Combinatorics, LPMC, Nankai University, 300071 Tianjin, P.R. China [email protected] Abstract Recently, the author, see [3], introduced a combinatorial problem, called Hoppy’s problem, to study different types of recurrence relations with two indices. Moreover, he presented several recurrence relations with two indices related to Dyck paths and Schr¨oder paths. In this paper, we generalize Hoppy’s problem to study other types of recurrence relations with two indices for which a combinatorial method provides a complete solution. Combinatorially, we describe these recurrence relations as a set of lattice paths in the second octant of the plane integer lattice, and then we map bijectively these lattice paths to the set of even trees. Analytically, we use the kernel method technique to solve these recurrence relations. Keywords: Recurrence relations with two indices, Kernel method, Plane trees, Even trees. AMS Mathematical Subject Classifications: 10A35, 65Q05, 05.10 1. Introduction A sequence with k indices is a function α : Ak → B, where A ⊆ N. The element αn = αn1 ,...,nk of the sequence α is called the n-th term, and the integral vector n is the sequence vector of indices. A recurrence relation is an equation which defines a sequence recursively, that is, each term of the sequence is defined as a function of the preceding terms, together with specified initial conditions. The initial conditions are necessary to ensure that the sequence is uniquely defined. Recently, the author, see [3], introduced a combinatorial problem, called the Hobby’s problem, to study different types of recurrence relations with two indices. Moreover, he presented several recurrence relations with two indices related to Dyck paths and Schr¨oder paths. In this paper, we generalize Hobby’s problem to study other types of recurrence relations with two indices for which a combinatorial method provides a complete solution. This leads us to plane trees and even trees. A plane tree T can be defined recursively as a finite set of vertices, such that one distinguished vertex r is called the root of T , and the remaining vertices form 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. The edges connecting the 1

2

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

root of the tree to the roots of T1 , T2 , . . . , Tm , which will be drawn from left to right on second level. For each vertex v, the vertices in the next lower level adjacent to v are called the children of v, and v is said to be their parent. Clearly, each vertex other than r has exactly one parent. A vertex of T is called a leaf if it has no children (by convention, we assume that the empty tree, formed by a single vertex, has no leaves), otherwise it is said to be an internal vertex. The outdegree of a vertex v it is number of its children, and denoted by deg(v). It is well-known that the number of plane trees  2n 1 with n edges equals Cn = n+1 n , the n-th Catalan number (see [5, Exe. 6.19e]). An even tree is a plane tree in which each vertex has even outdegree (see [2, 6]). A lattice path is a sequence of points p1 p2 . . . pk with n ≥ 1 such that each point pi belongs to the plane integer lattice and each two consecutive points pi and pi+1 are connected by a line segment. In this context, p2 − p1 , p3 − p2 , . . . , pk − pk−1 are called the steps of the path and k is called the number of steps of the path. Generalization of Hobby’s problem. Let A = {(m, n) | 0 ≤ m ≤ n} be the second octant of the plane integer lattice Z2 . Assume there is a rabbit, called Hobby, in his home at O = (0, 0) ∈ A; his n bunnies are located at points (j, n − 1) for j = 0, 1, . . . , n − 1. Suppose that Hobby can not jump to the left, that is, it can jump from point (i, j) ∈ A to the point (i + a, j + b) ∈ A, where (a, b) ∈ Rij . In such a context, the family R = {Rij }i,j≥0 is called the steps of Hobby. Then, the R-Hobby’s problem is to find the number of ways (lattice paths) for Hobby required to get from home to one of his n bunnies. In this case, n is called the length of the Hobby’s path. Our main goal is the use the combinatorial methods and the kernel method (see [1]) to obtain an explicit solution for several types of recurrences relation with two indices. In addition, we relate the Hobby’s problem to the set of even trees with fixed number of leaves. The paper is organized as follows. In Section 2 we deal with the sequence an = an,0 + an,1 + · · · + an,n , where an,j satisfies the following recurrence relation (1.1)

an,j = an−1,0 + an−1,1 + . . . + an−1,j + an−2,j ,

j = 0, 1, . . . , n,

with the initial conditions a0,0 = 1 and an,j = 0 for j > n. This allows us to relate this recurrence relation to the number of Hobby’s paths of length n. Then we present a bijection between the set of Hobby’s paths of length n and the set of even trees with n + 2 leaves (see Theorem 2.4). In section 3 we present several directions to extend and to generalize the above recurrence relation which allows us to link our new recurrence relations to the Hobby’s problem with a special family of steps. Then we map bijectively the set of these Hobby’s paths of length n to the set of colored even trees with n + 2 leaves (see Theorem 3.4). 2. Recurrence relation with two indices and Even trees Let an,j be a sequence with two indices satisfying (1.1). In this section, we present two different methods for finding an explicit formula for the general term of the sequence an,j .

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

2.1. The Kernel method. First, define An (v) =

n P

an,j v j and A(x; v) =

j=0

3

P

An (v)xn .

n≥0

Multiplying (1.1) by v j and summing over all j = 0, 1, . . . , n − 1, we arrive at An (v) = =

n−1 P

vj −vn an−1,j 1−v

j=0 1 (An−1 (v) 1−v

+ v n An−1 (1) + An−2 (v)

− v n+1 An−1 (1)) + An−2 (v).

Again, multiplying the above recurrence relation by xn , summing over all n ≥ 1 and using the initial condition A0 (v) = 1, we obtain the following functional equation x A(x; v) = 1 + (A(x; v) − v 2 A(xv; 1)) + x2 A(x; v), 1−v which is equivalent to  1−

 x xv 2 2 − x A(x; v) = 1 − A(xv; 1). 1−v 1−v

This type of functional equation can be solved systematically using the kernel method 2 1−x2 (see [1]). In this case, if we assume that v = 1−x−x , then A(xv; 1) = (1−x−x 2 )2 , which 1−x2 implies that 1 A(x, 1) = (y(x) − 1), x 2

y (x) where y(x) satisfies the following equation y(x) = x + 1−y 2 (x) . It is well-known that the ordinary generating function for the number of even trees with n + 2 leaves is given by y(x) (see [4, Sequence A049124]). Thus we can state the following result.

Theorem 2.1. The number of Hobby’s paths of length n is the same as the number of even trees with n + 2 leaves. Let en be the number of even trees with n + 2 leaves. The generating function A(x, v) can be written as P xv2 i i A(x, v) = 1−x−x1−v 2 −v(1−x2 ) − 1−x−x2 −v(1−x2 ) i≥0 ei x v  P P (1−x2 )i i = i≥0 (1−x−x 1 − v − xv 2 i≥0 ei xi v i , 2 )i+1 v

which implies that the coefficient of v j in the ordinary generating function is j−2

X xi+1 (1 − x2 )i (1 − x2 )j (1 − x2 )j−1 fj (x) = − − e , j−2−i 2 )i+1 (1 − x − x2 )j+1 (1 − x − x2 )j (1 − x − x i=0

which is equivalent to fj (x) =

P

i≥0

=

P

i,p≥0



j+i xi i (1−x2 )i+1

 j+i i





P

i≥0

 j−1+i i



j−1+i xi i (1−x2 )i+1

 i+p p

xi+2p −

j−2 P



j−2 P

P

ej−2−i

i=0 p≥0

P

i=0 p,q≥0

ej−2−i

i+p p





i+p xp+i+1 p (1−x2 )p+1 p+q q



xp+2q+i+1 .

Hence, by finding the coefficient of xn in fj (x), we can state the following result.

4

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

Theorem 2.2. The number of R-Hobby’s paths of length n from his home to his (j + 1)-st bunnies is given by     n+i  X   n−1−i+p ! j−2 n  n−1−i X X j+i j−1+i i+p 2 2 − − ej−2−i , i i i p p p=0 i=0 i=0 where en is the number of even trees with n + 2 leaves.

2.2. Combinatorial method. In this subsection we use a combinatorial method to solve (1.1).

sa4,0 sa4,1 sa4,2 sa4,3 sa4,4 sa3,0 sa3,1 sa3,2 sa3,3 sa2,0 sa2,1 sa2,2 sa1,0 sa1,1 sa0,0

Figure 1. The terms of the sequence an,j . Assume that an,j denotes the point (j, n) on the plane integer lattice Z2 as described in Figure 1. Let us fix the steps of Hobby to be the family R = {Rij }i,j≥0 with Rij = {(a, 1)|0 ≤ a ≤ j − i + 1} ∪ {(0, 2)}. Now, we define an integer lattice with the property that two points (i, j) and (i′ , j ′ ) in the second octant are connected by a line segment if (i′ , j ′ ) − (i, j) ∈ Rij . Thus, finding the (n, j)-th term of the sequence an,j is equivalent to find the number of R-Hobby’s paths required to get from his home to the (j + 1)-st of his n + 1 bunnies. For example, Figure 2 presents all of R-Hobby’s paths of length n = 1, 2, 3. •

•   • •

• •         • • •    • •

•O

•O

• • •O







Figure 2. All R-Hobby’s paths required to get from his home to one of his n + 1 bunnies, where n = 1, 2, 3. The goal of this subsection is to present a bijection between the set of even trees En with n + 2 leaves and the set of R-Hobby’s paths Pn required to get from his home to one of his n + 1 bunnies. First, we define a code for each plane tree.

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

5

2.2.1. Coding plane trees. We start by recalling the definition of preorder on plane trees. The general recursive pattern for traversing a nonempty plane trees T = (T1 , . . . , Tm ) is the following. At vertex v you must preform m + 1 actions • for each i = 1, 2, . . . , m, recursively traverse its subtree Ti , then back to v, • process v itself. The preorder of a nonempty plane tree T = (T1 , . . . , Tm ) is traversing the tree T by hitting the vertex v, the subtree T1 , the subtree T2 , until the subtree Tm . For instance, see Figure 3. 1 sQ 2s A  A 3 s 4As C  C 5 s Cs6

Q Q Q s 7Q

CJ

 CJ s s Cs J s

8 9 10 11

Figure 3. A preorder of a plane tree. Now we ready to code a plane tree T as a word ψ(T ) (for a similar coding plane trees, see [5, Exercise 6.19(s)]). Let T be any nonempty plane tree with n + 1 vertices, where we label its vertices according to the preorder. 1s

A  A As7 2 s −→ A  A 3 s 4 s 5As s8 B  B 6 s s9 Bs10

1s

1s

A

 A  s As7 2 88+ A  A 3 s 4 s 5As s8

−→

A  A As7 788+ 2sA  A 3 s 4 s 5As

6s

6s

1s

−→

A  A As7 5788+ 2As  A 3 s 4 s 5As

1s

−→ 2225788+

A  A As7 2 s

−→ 112225788

Figure 4. The bijection ψ. Proposition 2.3. The map ψ(T ) is a bijection from the set of plane trees with n + 1 vertices to the set of all words w = w1 w2 . . . wn such that 1 = w1 ≤ w2 ≤ · · · wn ≤ n and wi ≤ i for all i. Moreover, the number of leaves of T is given by n + 1 − #{w1 , w2, . . . , wn }. Proof. From the definition of ψ(T ) we obtain that ψ(T ) = w1 w2 . . . wn is a word of length n such that 1 ≤ w1 ≤ · · · ≤ wn ≤ n and wi ≤ i, for all i (see Figure 4).

6

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

To show that ψ −1 is well-defined, let w = w1 w2 . . . wn be any word of length n with 1 ≤ w1 ≤ · · · ≤ wn ≤ n and wi ≤ i for all i, and let us find a plane tree T with n + 1 vertices such that ψ(T ) = w. The tree T can be defined recursively as follows: let T be the empty tree (root with no children). For each i = 1, 2, . . . , n, define the preorder on T , add one child to the vertex wi (since wi ≤ i, and since there are i vertices after processing the case i − 1, we get that there exists a vertex wi ), and delete all the labels on T . At the end of this processwe obtain a plane tree with n + 1 vertices as it is described in Figure 5. Let S be a (nonempty) subtree of T such that the root of S is 1s 112225788 −→ 2225788+ 1s

−→

A  A As7 788+ 2sA  A 3 s 4 s 5As

 2 s

A

1s

A As3

−→

A  A As6 5788+ 2sA  A 3 s 4 s 5As

1s

1s

A

−→

6s

 A As7 88+2sA  A 3 s 4 s 5As s8

−→

6s

A  A As7 2 s A  A 3 s 4 s 5As s8 B  B 6 s s9 Bs10

Figure 5. The inverse of the bijection ψ. labelled by s with s maximal. Then the code of T can be defined as the word w = w ′ [s]deg(S) = w ′ ss . . . s}, | {z deg(S)





where w is the code of the tree T obtained from the tree T by removing the subtree S, that is, removing all the children of the root of the tree S (see Figure 4). The code ψ(T ) can be defined equivalently as follows. First, let the code to be empty word. Read the tree by its preorder. When we read an internal vertex of degree d, we add his label exactly d times to the code, otherwise we pass it, as it is described in Figure 4. In addition, the length of the code ψ(T ) is n, which is the number edges in the tree T , and the number of different letters in the code ψ(T ) is exactly the number of (nonempty) subtrees of T . Thus the number of leaves of T is given by n + 1 − #{w1 , w2, . . . , wn }.  2.2.2. Bijection between even trees and R-Hobby’s paths. Now we present a bijection φ between the set of even trees En with n + 2 leaves and the set of R-Hobby’s paths Pn of length n. Let T ∈ En and let ψ(T ) = w = w1 w2 . . . we = [a1 ]b1 [a2 ]b2 . . . [ak ]bk be its code, where e is the number of edges in T , k the number of (nonempty) subtrees in T , 1 = w1 = w2 ≤ w3 ≤ · · · ≤ we ≤ n and w2i−1 ≤ 2i − 1 for all i (clearly, bi ≥ 2 is an even number for all i). We read the code ψ(T ) from left to right and successively generate the path φ(T ). First, assume that Hobby stays at home. When a subword w2p−1 w2p , p ≥ 2, is read and Hobby is at (i, j), then Hobby jumps to

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

7

• (i, j + 2) if w2p−1 = w2p−3; • (i + w2p−1 − w2p−3 − 1, j + 1) if w2p−1 > w2p−3 . After processing the subwords w1 w2 w3 w4 . . . w2s−1 w2s , s ≥ 2, as described above, and assume Hobby is at point (r, h), then r=

s X

j=2, w2j−1 >w2j−3

w2j−1 − w2j−3 − 1 and h =

s X

j=2, w2j−1 =w2j−3

2+

s X

1,

j=2, w2j−1 >w2j−3

which is equivalent to P P r = sj=2 (w2j−1 − w2j−3 − 1) + sj=2, w2j−1 =w2j−3 1, P = w2s−1 − w1 − (s − 1) + sj=2, w2j−1 =w2j−3 1, P = w2s−1 − s + sj=2, w2j−1 =w2j−3 1, P h = s − 1 + sj=2, w2j−1 =w2j−3 1.

Using the fact that w2j−1 ≤ 2j − 1 for all j, we get that r ≤ h. Hence, after each step in our algorithm, Hobby stays at point (r, h) where r ≤ h. Therefore φ(T ) is a path in the second octant of the plane integer lattice. Theorem 2.4. The map φ is a bijection between the set of even trees En with n + 2 leaves and the set of R-Hobby’s paths Pn of length n. Proof. Let T be any even tree with n + 2 leaves and P = φ(T ). From the above algorithm and Proposition 2.3 we have that n + 2 = #leaves in T = length of the code ψ(T ) + 1 − #different letters in ψ(T ) = length of the path P + 2 ⇒ n = length of the path P.

In addition, P is a lattice path in the second octant of the plane integer lattice. Hence, P is a R-Hobby’s path of length n.

q q q q q pp p p pqp p pp pp q q q q qp p pp p pqp p q q q q q q q q q q q q q q q q q q q q q q q q q pqppppppppq q q q qppppppp q q q q ppp qp q q qppp q q q q q

q q q q q q q q q q

φ ←→

q H @H   @HH   q q @q HHq C ACS  C  CAS q Cq qq q CqAS q q D  D q Dq

Figure 6. The bijection φ. To find the inverse map of φ we need first to define a code φ′ (P ) for each Hobby’s path P . Let P be any Hobby’s path of length n. We read the path P from left to right and successively generate the code w = φ′ (P ). First set the code w = 11 and a = 1. When • (i, j)(i, j + 2) is read, then add the subword aa to w;

8

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

• (i, j)(i + s, j + 1) is read, then increase a by s + 1 and add the subword aa to w. For instance, see Figure 6. At the end we obtain a word w = w1 w2 . . . we , where 1 = w1 = w2 ≤ w3 ≤ · · · ≤ we ≤ n and w2i−1 ≤ 2i − 1 for all i. We notice that if a letter occurs in w then the letter a occurs an even number of times. Thus, if we define φ−1 (P ) to be ψ −1 (φ′ (P )) for each R-Hobby’s path, then by Proposition 2.3, we get that φ−1 (P ) is an even tree T with m + 2 leaves. Now let us prove that m = n. Again by Proposition 2.3, we can state that m + 2 = #verices in T + 1 − #nonempty subtrees in T = length the code φ′ (P ) + 1 − #different letters in the code φ′ (P ) = length of the path P + 2 = n + 2, which implies that m = n, that is, T has n + 2 leaves. Hence, φ−1 (P ) is an even tree with n + 2 leaves, and φ is a bijection, as required.  Our bijection φ gives the following result. Corollary 2.5. Let n ≥ 0. Then the number of R-Hobby’s paths of length n with k stepsPof the form (0, 2) is the same as the number of even trees with n + 2 leaves and k = v node of T (deg(v) − 2)/2, which is    1 2n + 2 − 2k n+1−k . n+1−k n+2 k Proof. Let f (x, q) be the ordinary generating function for the number of R-Hobby’s paths of length n with k steps of the form (0, 2), that is, X X f (x, q) = xn q #steps of form (0, 2) in P . n≥0 P ∈Pn

Theorem 2.4 gives that

f (x, q) =

XX

xn+2 q

P

v

node of

T (deg(v)−2)/2

.

n≥0 T ∈En

It is not hard to see that f (x, q) satisfies F2 F = F (x, q) = x + F + qF + q F + · · · = x + . 1 − qF 2 2

4

2

6

Defining G(x, q) = F (x, q) − x, we then obtain that

G(x, q) = (G(x, q) + x)2 (1 + qG(x, q)).

The Lagrange inversion formula [5, Sec. 5.4], together with a straightforward computation gives  X 1 m−1 X 2m m G(x, q) = F (x, q) − x = x2m−j q m−1−j . m j m − 1 − j j=0 m≥1

Finding the xn+2 q k coefficient in G(x, q), we get the desired result.



RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

9

3. Generalizations There are several ways to generalize the results of the previous section. We use the kernel method technique to generalize Theorem 2.1 and we extend our combinatorial constructions to study a general recurrence relation with two indices, namely, an,j = an−1,0 + . . . + an−1,j + ℓan−2,j for all j = 0, 1, . . . , n, with the initial conditions a0,0 = 1 and an,j = 0 for j > n. 3.1. Other types of recurrence relations with two indices. Our method in Section 2.1 can be generalized to study the following recurrence relation: (3.1)

an,j = an−1,0 + . . . + an−1,j + bn,j ,

j = 0, 1, . . . , n,

with initial conditions a0,0 = b0,0 = 1 and an,j = 0 for j > n. If we define An (v) =

n X

an,j v j , Bn (v) =

j=0

n X

bn,j v j , A(x; v) =

j=0

X

An (v)xn , B(x; v) =

X

Bn (v)xn ,

n≥0

n≥0

then using similar arguments as above we obtain that   x xv 2 (3.2) 1− A(x; v) = B(x; v) − A(xv; 1). 1−v 1−v

Now we present an explicit solution for several particular cases of the functional equation (3.2). In the first of these examples we assume that bn,j is a constant for any n, j with n ≥ 1. Theorem 3.1. Let an,j be a sequence satisfying an,j = an−1,0 + . . . + an−1,j + d,

j = 0, 1, . . . , n,

with initial conditions a0,0 = 1 and an,j = 0 for j > n. Then A(x; v) satisfies the following functional equation   x dx(1 − v − xv) xv 2 (3.3) 1− A(x; v) = 1 + − A(xv; 1), 1−v (1 − xv)(1 − x) 1 − v

which implies that

√ √ 1 − 2x − 1 − 4x 2x3 − 3x2 + 4x − 1 + (1 − x)2 1 − 4x A(x; 1) = − d. 2x2 2(1 − x)x3 P Moreover, the sequence an = nj=0 an,j is given by an = Cn+1 + d(Cn+2 − Cn+1 − 1),  2m 1 is the m-th Catalan number. where Cm = m+1 m Proof. From the definitions and (3.1), we obtain X 1 − v n+1 dx(1 − v − xv) b(x; v) = 1 + dxn =1+ , 1 − v (1 − xv)(1 − x) n≥0

which implies (3.3). To solve (3.3) let us assume that v = 1 − u. We then arrive at 1 du(u2 − 2u + 2) A(u(1 − u); 1) = + , (1 − u)2 (1 − u + u2 )(1 − u)3

10

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

which implies (u =

√ 1+ 1−4x ) 2

that √ √ 1 − 2x − 1 − 4x 2x3 − 3x2 + 4x − 1 + (1 − x)2 1 − 4x A(x; 1) = − d 2x2 2(1 − x)x3 P = (Cn+1 + d(Cn+2 − Cn+1 − 1))xn , n≥0

as required.



Using similar arguments as in the proof of the above theorem we obtain another generalization of Theorem 2.1. Theorem 3.2. Let I be any subset of N = {1, 2, . . .}, let {αd }d∈I be a sequence of constants, and let an,j be a sequence satisfying X an,j = an−1,0 + . . . + an−1,j + αd an−d;j , j = 0, 1, . . . , n, d∈I

with initial conditions a0,0 = 1 and an,j = 0 for j > n. Then A(x; v) satisfies the functional equation ! X x xv 2 d 1− − x A(x; v) = 1 − A(xv; 1), 1 − v d∈I 1−v which implies that  A x−

1−

x2 P

;1 d d∈I αd x



=

1−

P

1−x−

d∈I

P

αd xd

d∈I

αd xd

2 .

For example, the above corollary with I = {2} and α1 = 1 gives Theorem 2.1 (The case I = {1} was studied in [3, Section 3]). As an another example, the above corollary with I = N and αd = 1 gives that the ordinary generating 1) satisfies  A(x; P function 2n+1 1 n A(x(1 − x); 1) = (1−x)(1−2x) , which implies that A(x; 1) = n≥0 n x . 3.2. Colored even trees and recurrence relations with two indices. The method proposed in Section 2.2 can be generalized to study the following recurrence relation (3.4)

an,j = an−1,0 + . . . + an−1,j + ℓan−2,j ,

j = 0, 1, . . . , n,

with initial conditions a0,0 = 1 and an,j = 0 for j > n. This recurrence relation describes another Hobby’s problem which can formulated as follows. Assume that an,j denotes the point (j, n) on the second octant of the plane integer lattice Z2 as described ′ in Figure 1. Then, we fix the steps of Hobby to be the family Rℓ = {Rij }i,j≥0 with ′ 1 ℓ 1 Rij = {(a, 1)|0 ≤ a ≤ j −i+1}∪{(0, 2) , . . . , (0, 2) }, where the steps (0, 2) , . . . , (0, 2)ℓ mean that • Hobby can jump from (i, j) to (i + a, j + 1) with a ≤ j − i + 1, • there are ℓ different ways to jump from point (i, j) to point (i, j + 2) (the k-th way denoted by colored step (0, 2)k ).

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES



•     • •

•  •        • • •    • •

•O

•O

• • •O





11



Figure 7. All R2 -Hobby’s paths required to get from home to one of his n bunnies, where n = 1, 2, 3. Clearly, R1 = R in analogy with Section 2.2. Thus, finding the (n, j)-th term of the sequence an,j is equivalent to find the number of Rℓ -Hobby’s paths required to get from home to the (j + 1)-st of his n + 1 bunnies. For example, Figure 7 presents all of R2 -Hobby’s paths of length n = 1, 2, 3. Our goal to present a bijection between a special class of colored even trees and the set of Rℓ -Hobby’s paths. In order to do that we need the following definitions.

An ℓ-colored word on an alphabet K of length e is a word w = w1 w2 . . . we such that each letter wi ∈ K can be colored by one of the colors 0, 1, 2, . . . , ℓ. We write a[j] to denote that the letter a is colored by color j. In the case when the letter a is colored by color 0, then we say that the letter a has no color, and we identify a = a[0] . We define the absolute value of the colore letter a[j] to be a, and we write |a[j] | = a.

An ℓ-colored plane tree T is a plane tree such that the vertices of T can be colored by one of the colors 0, 1, 2, . . . , ℓ (we say that the vertex has no color if its colored by color 0). 3.2.1. Coding ℓ-colored plane trees. Now we are ready to encode an ℓ-colored plane tree T as a word ψℓ (T ), such that the letters of the word can be colored by one of the colors 0, 1, . . . , ℓ (again, we say that a letter has no color if its colored by color 0). Let T be any nonempty ℓ-colored plane tree with n + 1 vertices, where we use the preoder to label its vertices. Let S be a (nonempty) subtree of T such that the root of S is labelled s and s is maximal. Then the code of T can be defined as the word w = w ′ [s]deg(S) = w ′s[a1 ] s[a2 ] . . . s[adeg(S) ] , where w ′ is the code of the tree T ′ obtained from the tree T by removing the subtree S and ai is the color of the i-th child of the root of S (see Figure 8). Using similar techniques, as in the proof of Proposition 2.3, we get the following result. Proposition 3.3. The map ψℓ (T ) is a bijection from the set of ℓ-colored plane trees with n + 1 vertices to the set of all ℓ-colored words w = w1 w2 . . . wn such that 1 = |w1 | ≤ |w2 | ≤ · · · |wn | ≤ n and |wi | ≤ i for all i. Moreover, the number of leaves of T is given by n + 1 − #{|w1 |, |w2|, . . . , |wn |}. Now, our aim is to use the above result to show that the number of all Rℓ -Hobby’s paths of length n is the same as the number of colored even trees. Let En,ℓ be the set of even trees T with n + 2 leaves such that the vertices of T (the root colored by color 0) can be colored by one of the colors 0, 1, . . . , ℓ with the following property: if

12

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

1s

1s

A  A Ac7 2 s −→ A  A 3 s 4 c 5Ac s8 B  B 6 s s9 Bc10

1s

A

 A  s Ac7 [1] 2 88 + A  A 3 s 4 c 5Ac s8

−→

A  A Ac7 788[1] + 2sA  A 3 s 4 c 5Ac

6s

1s

−→

A  A Ac7 5788[1]+ 2As  A 3 s 4 c 5Ac

6s 1s

−→ 22[1] 2[1] 5788[1] +

 2 s

A A Ac7

−→ 11[1] 22[1] 2[1] 5788[1]

Figure 8. The code ψ2 , where the black (white) vertex is presented a vertex with no color (color 1). v1 , v2 , . . . , v2s are the children (from left to right) of a vertex v in T , then the children v1 and v2 have no color, and each two consecutive children v2i+1 and v2i+2 have the same color c ∈ {1, 2, . . . , ℓ}, where i = 1, 2, . . . , e − 1. Clearly, En,1 = En . 3.2.2. Bijection between ℓ-colored even trees and Rℓ -Hobby’s paths. Now we present a bijection φℓ between the set of even trees En,ℓ with n + 2 leaves and the set of Rℓ Hobby’s paths Pn of length n. Let T ∈ En and let ψℓ (T ) = w = w1 w2 . . . we be its code, where e is the number of edges in T , 1 = w1 = w2 ≤ |w2 | ≤ · · · ≤ |we | ≤ n, and |w2i−1 | ≤ 2i − 1 for all i. We read the code w from left to right and successively generate the path φℓ (T ). First, assume that Hobby stays at home. When a subword w2s+1 w2s+2 , s ≥ 1, is read and Hobby is at (i, j), then • Hobby jumps to (i, j + 2) with a step (0, 2)k , if w2s+1 = w2s+2 = a[k] with 1 ≤ k ≤ ℓ, • Hobby jumps to (i + |w2s+1 | − |w2s | − 1, j + 1), if w2s+1 = w2s+2 = a. Notice that form the definition of the code w1 w2 . . . we for an colored even tree, we have that the subword w2s+1 w2s+2 equals either aa or a[k] a[k] for some a. Using similar arguments as described in the algorithm φ, we can observe that the path φℓ (T ) is a path in the second octant of the plane integer lattice. Theorem 3.4. The map φℓ is a bijection between the set of ℓ-colored even trees En,ℓ with n + 2 leaves and the set of Rℓ -Hobby’s paths Pn of length n. Proof. Let T be any ℓ-colored even tree with n + 2 leaves and let P = φℓ (T ). From the above algorithm and Proposition 3.3 we have that n + 2 = #leaves in T = length of the code ψℓ (T ) + 1 − #different letters in ψℓ (T ) = length of the path P + 2 ⇒ n = length of the path P.

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

13

In addition, P is a lattice path in the second octant of the plane integer lattice. Hence, P is a Rℓ -Hobby’s path of length n.

Steps colored by color 1

q q q q q p p p pqpp p pp ppq q q q qp p pp p ppqpp q q q q q q q q q 3 q q q q q q q q q q q q q q :    q q pqpppppppq q q p B q qpppppppp q q q B qpp ppp qp q q BNB qqp qq q q

q q q q q q q q q q

φ ←→

tH  @HH  @ HH  t t @d Hd C ACS  C  CAS t Ct tt d CdAS dd D  D t Dt

Figure 9. The bijection φ2 . To find the inverse map of φℓ , we need first to define a code φ′ℓ (P ) for each Rℓ -Hobby’s path P . Let P be any Rℓ -Hobby’s path of length n. We read the path P from left to right and successively generate the code w = φ′ℓ (P ). First, set the code w = 11 and a = 1. When: • (i, j)(i, j + 2) with color i is read, then add the subword a[i] a[i] to w; • (i, j)(i + s, j + 1) is read, then increase a by s + 1 and add the subword aa to w. At the end, we obtain a word w = w1 w2 . . . we such that 1 = w1 = w2 ≤ |w3 | ≤ · · · ≤ |we | ≤ n and |w2i−1 | ≤ 2i − 1 for all i. We notice that if the letter a (resp. a[i] ) occurs in w then the letter a (resp. a[i] ) occurs even number of times. Thus, if we define −1 ′ φ−1 ℓ (P ) to be ψℓ (φℓ (P )) for each Rℓ -Hobby’s path, then by Proposition 3.3 we get −1 that φℓ (P ) is an ℓ-colored even tree T with m + 2 leaves (see Figure 9). Now, let us prove that m = n. By Proposition 3.3 we obtain that m + 2 = #vertices in T + 1 − #nonempty subtrees in T = length of the code φ′ℓ (P ) + 1 − #different letters in the code φ′ℓ (P ) = length of the path P + 2 = n + 2, which implies that m = n, that is, T has n + 2 leaves. Hence, φ−1 ℓ (P ) is an ℓ-colored even tree with n + 2 leaves. Hence, φℓ is a bijection, as required.  Let degm (T ) be half the number of vertices colored by color m in T . Then our bijection φℓ gives the following result. Corollary 3.5. Let n ≥ 1 and m ∈ {1, 2, . . . , ℓ}. Then the number of Rℓ -Hobby’s paths of length n with k steps (0, 2) colored by the color m is the same as the number of ℓ-colored even trees T with n + 2 leaves and degm (T ) = k, which is     n+1 X 1 2m m n+1−m (ℓ − 1)n+1−m−k . m n+2 n+1−m k m=1

14

RECURRENCE RELATIONS WITH TWO INDICES AND EVEN TREES

Proof. Let f (x, q) be the ordinary generating function for the number of Rℓ -Hobby’s paths of length n with k steps (0, 2) colored by color m, that is, X X f (x, q) = xn q #steps (0, 2) colored by color m in P . n≥0 P ∈Pn

Theorem 2.4 gives that

f (x, q) =

XX

xn+2 q degm (T ) .

n≥0 T ∈En

It is not hard to see that f (x, q) satisfies

F = F (x, q) = x + F 2 + (q + ℓ − 1)F 4 + (q + ℓ − 1)2 F 6 + · · · = x + Defining G(x, q) = F (x, q) − x, we then obtain that

F2 . 1 − (q + ℓ − 1)F 2

G(x, q) = (G(x, q) + x)2 (1 + (q + ℓ − 1)G(x, q)).

The Lagrange inversion formula [5, Sec. 5.4], together with a straightforward computation gives  X 2m X 1 m−1 m G(x, q) = F (x, q) − x = x2m−j (q + ℓ − 1)m−1−j . m j m − 1 − j j=0 m≥1

Finding the xn+2 q k coefficient in G(x, q), we get the desired result.



Acknowledgement. The author would like to thank Simone Severini for reading previous version of the present paper and Sabrina X.M. Pang for a number of helpful discussions. References [1] C. Banderier, M. Bousquet-M´ elou, A. Denise, P. Flajolet, D. Gardy, and D. Gouyou-Beauchamps, Generating functions for generating trees, Discr. Math. 246:1-3 (2002) 29–55. [2] E. Deutsch, S. Fereti, and M. Noy, Diagonally convex directed polyominoes and even trees: a bijection and related issues, Discr. Math. 256:3 (2002) 645–654. [3] T. Mansour, Combinatorial methods and recurrence relations with two indices, J. Diff. Eq. Appl. 12:6 (2006) 555–563. [4] N.J.A. Sloane and S. Plouffe, The Encyclopedia of Integer Sequences, Academic Press, New York (1995). [5] R. Stanley, Enumerative Combinatorics, vol. 1, Wadsworth and Brooks/Cole, Pacific Grove, CA, 1986, second printing, Cambridge University Press, Cambridge, 1996. ´cs, Enumeration of rooted trees and forests, Math. Sci. 18 (1993) 1-10. [6] L. Taka