Two kinds of partial Motzkin paths with air pockets

Motzkin paths with air pockets (MAP) are defined as a generalization of Dyck paths with air pockets by adding some horizontal steps with certain conditions. In this paper, we introduce two generalizations. The first one consists of lattice paths in $\Bbb{N}^2$ starting at the origin made of steps $U=(1,1)$, $D_k=(1,-k)$, $k\geq 1$ and $H=(1,0)$, where two down steps cannot be consecutive, while the second one are lattice paths in $\Bbb{N}^2$ starting at the origin, made of steps $U$, $D_k$ and $H$, where each step $D_k$ and $H$ is necessarily followed by an up step, except for the last step of the path. We provide enumerative results for these paths according to the length, the type of the last step, and the height of its end-point. A similar study is made for these paths read from right to left. As a byproduct, we obtain new classes of paths counted by the Motzkin numbers. Finally, we express our results using Riordan arrays.


Introduction
In a recent paper [1], the authors introduce, study and enumerate special classes of lattice paths, called Dyck paths with air pockets (DAP for short).Such paths are non empty lattice paths in the first quadrant of Z 2 starting at the origin, and consisting of up-steps U = (1, 1) and down-steps D k = (1, −k), k 1, where two down steps cannot be consecutive.These paths can be viewed as ordinary Dyck paths where each maximal run of down-steps is condensed into one large down step.As mentioned in [1], they also correspond to a stack evolution with (partial) reset operations that cannot be consecutive (see for instance [6]).The authors enumerate these paths with respect to the length, the type (up or down) of the last step and the height of the end-point.Whenever the last point is on the x-axis, they prove that the DAP of length n are in one-to-one correspondence with the peakless Motzkin paths of length n − 1.They also investigate the popularity of many patterns in these paths and they give asymptotic approximations.In a second work [2], the authors make a study for a generalization of these paths by allowing them to go below the x-axis.They call these paths Grand Dyck paths with air pockets (GDAP), and they also yield enumerative results for these paths according to the length and several restrictions on the height.
In this paper, we introduce two generalizations of partial Dyck paths of air pockets by allowing some possible horizontal steps H = (1, 0) with some conditions.These two kinds of paths can be viewed as special partial Motzkin paths (lattice paths in N 2 starting at the origin and made of U, D, and H), where each maximal run of down-steps is condensed into one large down step.
Firstly, we consider lattice paths in N 2 starting at the origin, consisting of steps U, D k and H, where two down steps cannot be consecutive.Secondly, we consider lattices paths in N 2 starting at the origin, consisting of steps U, D k and H, where any step U and D k (except the last step of the path) is immediately followed by an up step U.These two classes of paths will be denoted M 1 and M 2 , respectively.The paths in M 1 (resp.M 2 ) will be called partial Motzkin paths with air pockets of first kind (resp.second kind), and they are called Motzkin paths with air pockets whenever they end on the x-axis.For short, we denote by PMAP all paths in M i , i ∈ {1, 2}, and by PAP all paths ending on the x-axis.On the other hand, let M ′ 1 (resp.M ′ 2 ) be the set of lattice paths starting at the origin obtained by reading the paths in M 1 (resp.M 2 ) from right to left, i.e. up steps are changed into down step and vice versa, and horizontal steps are unchanged (see below for a more formal definition of these paths).
Throughout the paper, and for each class of paths M i and M ′ i , i ∈ {1, 2}, described above, we will use the following notations.For k 0, we consider the generating function f k = f k (z) (resp.g k = g k (z), resp.h k = h k (z)), where the coefficient of z n in the series expansion is the number of partial Motzkin paths with air pockets of length n ending at height k with an up-step, (resp.with a down-step, resp.with a horizontal step H).
We introduce the bivariate generating functions For short, we also use the notation F (u), G(u) and H(u) for these functions.
The outline of this paper is the following.In Section 2, we present enumerative results for partial Motzkin paths with air pockets of the first kind, and for these paths when we read them from right to left.We provide bivariate generating functions that count these paths with respect to the length, the type of the last step (up, down or horizontal step) and the height of the end-point.In Section 3, we make a similar study for PMAP of second kind, and we present new classes of lattice paths counted by the well known Motzkin numbers.All these results are obtained algebraically by using the famous kernel method for solving several systems of functional equations.Finally, we express our results using Riordan arrays and we deduce closed forms for PMAP of length n ending at height k.

PMAP of the first kind
In this section, we focus on PMAP of the first kind, i.e. lattices paths in N 2 starting at the origin, made of steps U, D k and H, such that two down steps cannot be consecutive.The first subsection considers the paths in M 1 , while the second subsection handles the paths in M ′ 1 (see Introduction for the definition of these two sets).We yield enumerative results for these paths according to the length, the type of the last step, and the height of its end-point.

PMAP in M 1 -From left to right
In this part, we consider PMAP in M 1 .Figure 1 shows two examples of such paths.Therefore, we have to solve the following system of equations.
Summing the recursions in (1), we have: Notice that we have F (1) − H(1) = 1 by considering the difference of the first and third equations.Now, setting f 1 := F (1) and solving these functional equations, we obtain In order to compute f 1 , we use the kernel method (see [3,8]) on F (u).We can write the denominator (which is a polynomial in u of degree 2), as z(u − r)(u − s) with Using zrs = z 2 − z + 1, we deduce Finally, after simplifying by the factor (u−s) in the numerators and denominators, we obtain which implies that Theorem 1 The bivariate generating function for the total number of PMAP in M 1 with respect to the length and the height of the end-point is given by Total (z, u) = 1 + rs − z r − u , and we have and setting t n := t(n, 0), then we have Proof.The first two equalities are immediately deduced from the previous results.The third equality is obtained by checking that Now, let us prove the last equality.Any length n MAP is of the form (i) HP , or (ii) UDP , or (iii) UP F DQ where P, Q are some MAP so that the length of P lies into [0, n − 3], or (iv) P ♯ Q where P ♯ = UP ′ D k , k 1, and Taking into account all these cases, we obtain the result.✷ Let T be the infinite matrix T := [t(n, k)] n 0,k 0 .The first few rows of the matrix T are .
Corollary 2 The g.f. that counts the MAP in M 1 with respect to the length is given by The first few terms of the series expansion of Total (z, 0) are 1 + z + 2z 2 + 5z 3 + 13z 4 + 36z 5 + 105z 6 + 317z 7 + 982z 8 + 3105z 9 + O(x 10 ) which correspond to the sequence A114465 in [7] counting Dyck paths of semilength n having no ascents of length 2 that start at an odd level.We leave open the question of finding a constructive bijection between these sets.

PMAP in M ′
1 -From right to left Here, we consider the paths of the previous section, but we read them from right to left.This means that down steps become up steps and vice versa, and horizontal steps are unchanged, which implies that two up steps cannot be consecutive now.See Figure 2 for two examples of such paths.With the same arguments and the same notations used in the previous part, we can easily obtain the following equations: (2) Notice that we have 1−z by considering the third equation.Now, setting g 0 := G(0) and solving these functional equations, we obtain In order to compute g 0 , we use the kernel method (see [3,8]) on G(u).We can write the denominator (which is a polynomial in u of degree 2), as Using sr(z 2 − z + 1) = z, we deduce Finally, after simplifying by the factor (u − s) in the numerators and denominators, we obtain which implies that Theorem 2 The bivariate generating function for the total number of PMAP (read from right to left) with respect to the length and the height of the end-point is given by and we have and setting t n := t(n, 0), we have Proof.The first two equalities are directly deduced from the previous results.Since the expression is a polynomial of degree one in u, we deduce the third relation.The last equality is already given in Theorem 1. ✷ Let T be the infinite matrix T := [t(n, k)] n 0,k 0 .The first few rows of the matrix T are Since there is an infinite number of PMAP of length n, we do not provide an ordinary generating function (with respect to the length) for these paths.So, we get around this by counting PMAP ending on a point (x, n − x) for a given n 0.
Corollary 3 The g.f. that counts the partial PMAP ending on the line y = n − x is given by The first few terms of the series expansion of Total(z, z) are 1 + z + 3z 2 + 9z 3 + 25z 4 + 73z 5 + 223z 6 + 697z 7 + 2217z 8 + 7161z 9 + O(z 10 ), which correspond to the sequence A101499 in [7], which is a Chebyshev transform of the Catalan number that counts peakless Motzkin paths of length n where horizontal steps at level at least one come in 2 colors.
Notice that we obviously retrieve (see Corollary 2) that the g.f.counting the MAP with respect to the length is given by

PMAP of the second kind
In this section, we focus on PMAP of the second kind.The first subsection considers paths in M 2 , while the second handles paths in M ′ 2 .We yield enumerative results for these paths according to the length, the type of the last step, and the height of the end-point.

PMAP in M 2 -From left to right
In this part, we consider PMAP in M 2 , i.e. lattice paths in N 2 starting at the origin, consisting of steps U, D k and H, and where any down step or horizontal step (except for the last step of the path) is immediately followed by an up step.Figure 3 shows two examples of such paths.So, we easily obtain the following equations: Summing the recursions in (6), we have: Notice that H(1) = zF (1) using the third equation.Now, setting f 1 := F (1) and solving these functional equations, we deduce In order to compute f 1 , we use the kernel method (see [3,8]) on F (u).We can write the denominator (which is a polynomial in u of degree 2), as z 2 (u − r)(u − s) with , .
and thus f 1 = s − 1 sz 2 .Finally using z(1 + z)rs = 1 and simplifying by the factor (u − s) in the numerators and denominators, we obtain , and H(u) = zr r − u , which implies that Theorem 3 The bivariate generating function for the total number of PMAP with respect to the length and the height of the end-point is given by and we have and setting t n := t(n, 0), we have Proof.The first two equalities are immediately deduced from the previous results.The third equality is obtained by checking that For the last equality, it suffices to remark that the o.g.f of the first column, that is 1/(zr), generates a shift of the well known Motzkin sequence A001006.✷ Let T be the infinite matrix T := [t(n, k)] n 0,k 0 .The first few rows of the matrix T are Corollary 4 The g.f. that counts the PMAP with respect to the length is given by Total(z, 1) = 1 z(r − 1) .
Corollary 5 The g.f. that counts the MAP with respect to the length is given by Total(z, 0) = 1 zr .
Figure 4: The 9 PMAP in M 2 .Notice that two paths end on the x-axis, three paths end at height 1, three paths end at height 2, and one path end at height 3.

-From right to left
Here, we consider the paths of the previous section, but we read them from right to left.This means that down steps become up steps and vice versa, and horizontal steps are unchanged, which implies that any up step or horizontal step (except the first step of the path) is preceded by a down step.See Figure 5 for two examples of such paths.
Using the same notations as in the previous sections, and summing the recursions in (10), we have: Notice that F (0) = 1 and H(0) = z+zG(0) by the third relation.Now, setting g 0 := G(0) and solving these functional equations, we deduce In order to compute g 0 , we use the kernel method (see [3,8]) on F (u).We can write the denominator (which is a polynomial in u of degree 2), as (u − r)(u − s) with Plugging u = s (which have a Taylor expansion at z = 0) in F (u)(u − r)(u − s), we obtain the equation Using rs = z(1 + z), we deduce Finally, after simplifying by the factor (u−s) in the numerators and denominators, we obtain which implies that Theorem 4 The bivariate generating function for the total number of PMAP with respect to the length and the height of the end-point is given by and setting t n := t(n, 0), we have Proof.The proof are obtained mutatis mutandis as for the previous theorems.✷ Let T be the infinite matrix T := [t(n, k)] n 0,k 0 .The first few rows of the matrix T are Since there is an infinite number of PMAP of length n, we do not provide an ordinary generating function (with respect to the length) for these paths.So, we get around this by counting PMAP ending on a point (x, n − x) for a given n 0.
Corollary 6 The g.f. that counts the partial PMAP ending on the line y = n − x is given by Total (z, z) = 1 r − z .
The first few terms of the series expansion of Total (z, z) are 1 + z + 2z 2 + 4z 3 + 9z 4 + 21z 5 + 51z 6 + 127z 7 + 323z 8 + 835z 9 + O(z 10 ), which correspond to the sequence A001006 in [7] that counts the Motzkin paths with respect to the length.See Figure 6 for the illustration of the 9 PMAP in M ′ 2 ending on the line y = 4 − x.Notice that we obviously retrieve the results of Corollary 5, i.e., the g.f.Total(z, 0) that counts the MAP with respect to the length is also a shift of the Motzkin sequence A001006 in [7].

A Riordan array point of view
In this section, we make links between the previous matrices T = [t n,k ] n 0,k 0 and some Riordan arrays or 'almost' Riordan arrays.We first give a short background on Riordan arrays [4,5,10].
An infinite column vector (a 0 , a 1 , . . . ) T has generating function f (z) if f (z) = n 0 a n z n .A Riordan array is an infinite lower triangular matrix whose k-th column has generating function g(z)f (z) k for all k 0, for some formal power series g(z) and f (z), with g(0) = 0, f (0) = 0, and f ′ (0) = 0.Such a Riordan array is denoted by (g(z), f (z)).If we multiply this matrix by a column vector (c 0 , c 1 , . . . ) T having generating function h(z), then the resulting column vector has generating function g(z)h(f (z)).This property is known as the fundamental theorem of Riordan arrays.
The product of two Riordan arrays (g(z), f (z)) and (h(z), l(z)) is defined by Under the operation " * ", the set of all Riordan arrays is a group [10].The identity element is I = (1, z), and the inverse of (g(z), f (z)) is where f (z) denotes the compositional inverse of f (z).
Finally, we will say that a matrix M is the rectification of the Riordan array (g(z), f (z)) whenever the bivariate generating function of M equals g(z)

Comment on Section 2.1
Proposition 1 The matrix T = [t(n, k)] n 0,k 0 is a Riordan array defined by where is the generating function of the Catalan numbers Proof.Indeed, since 1 + rs − z = 1 z , we have Therefore, the array T satisfies where is the generating function of the Catalan numbers where The matrix [C n,k ] n,k 0 is the Riordan array (C(z), zC(z)) (see the Catalan matrix A033184 in [7]).The matrix The sequence , begins Then the sequence t(n, 0) (A114465) which begins is the convolution of (u n ) n 0 = 1, 1, 1, 4, 11, 31, . . .and 1, 0, 1, 0, 1, 0, . .., which means that Proposition 2 The general term t(n, k) equals Since we have are defined as follows: ] n,k 0 is the 'almost' Riordan array with initial column whose generating function is g 0 (z) which is followed by the shifted 'stretched' Riordan array .
Proof.An almost Riordan array of order 1 is represented by an initial column vector with generating function g 0 (z), followed by a vertically shifted Riordan array (g(z), f (z)).The bivariate generating function of this matrix is then given by g 0 (z) + zu g(z) 1−uf (z) .In our case, we have We let G(z, u) = g 0 (z) + zu g(z) 1−uf (z) , the bivariate generating function of the almost Riordan array of first order.We seek to find G(z, z 1−z ).We get which coincides with the generating function Total(z, u) of the matrix T .✷ Proposition 4 The matrix is the rectification of the Riordan array (g(z), f (z)) with .
Proof.It suffices to check that the g.f. of T , i.e.Total (z, u), equals to g 0 (z) + zu g(z) We can express f (z) and g(z), respectively, in the following form Then g(z) expands to give the first column 1, 3, 8, 23, . .., whose n-th term v n can be expressed Using v n , we can deduce the following.

Proposition 5 The general term t(n, k) equals
, where is the general term of Riordan array (1, zC(z)) (see A106566).

Comment on Section 3.1 Proposition 6
The matrix T = [t(n, k)] n 0,k 0 is the Riordan array is the generating function of the Catalan numbers c n = 1 n+1 2n n , and is the generating function of the Motzkin numbers A001006.
Proof.It suffices to check that Total(z, u) = g(z) 1−uf (z) .✷ This triangle T corresponds to A091836 in [7] where the coefficient of row n − 1 and column k is the number of Motzkin paths of length n having k points on the horizontal axis (besides the first and last point).
As a consequence, we deduce that Alternatively, we have A third expression for t(n, k) is given by the following proposition.

Proposition 7
The general term t(n, k) of the Riordan array (1 + zM(z), z(1 + zM(z))) is given by Proof.We prove this using Lagrange inversion, using the fact that (zM(z)) (−1) = z 1 + z + z which is followed by the shifted stretched Riordan array (g(z), z 2 g(z)) where Proof.The almost Riordan array A has generating function g 0 (z) + zu g(z) 1 − z 2 ug(z) .
Using the fundamental theorem of Riordan arrays, the product has generating function .
By simplifying this expression, we obtain Total (z, u), which completes the proof.✷ Proposition 9 The matrix

Figure 1 :
Figure 1: The left drawing shows a Motzkin path with air pockets of length 18.The right drawing shows a partial Motzkin path with air pockets of length 18 ending at height 3.

Figure 2 :
Figure 2: The left drawing shows a Motzkin path with air pockets of length 18 read from right to left.The right drawing shows a partial Motzkin path with air pockets of length 18 ending at height 2 and reaf from right to left.

Figure 3 :
Figure 3: The left drawing shows a MAP of length 18 in M 2 .The right drawing shows a PMAP of length 18 ending at height 3 in M 2 .

Figure 5 :
Figure 5: The left drawing shows a Motzkin path with air pockets of length 18 read from right to left.The right drawing shows a partial Motzkin path with air pockets of length 18 ending at height 2 and reaf from right to left.

Figure 6 :
Figure 6: The 9 PMAP ending on the line y = 4 − x in M ′ 2 .Notice that four paths end on the x-axis.

4 . 2 2 Proposition 3
Comment on Section 2.The matrix T = [t(n, k)] n 0,k 0 can be written k 0 is defined by b 0,0 = 1, and b n,0 = b 0,n = 0 if n 1, and b n,k = k−1 n−1 otherwise, which is a kind of Pascal matrix.• The matrix A = [a n,k

✷ 4 . 4 2 Proposition 8
Comment on Section 3.The matrix T = [t(n, k)] n 0,k 0 can be written follows:• The matrix B = [b n,k ] n,k 0 is defined by b 0,0 = 1,and b n,0 = b 0,n = 0 if n 1, and b n,k = k−1 n−1 otherwise, which is a kind of Pascal matrix.• The matrix A = [a n,k ] n,k 0 is the almost 'stretched' Riordan array with initial column whose generating function is

Proof.
It suffices to check that the generating function of T , i.e.Total(z, u), equals to g 0 (z) + zu M (z) We let m n denote the n-th Motzkin number m n = ⌊ n 2 ⌋ k=0 n 2k c k where c k is the k-th Catalan defined above.