Motzkin Paths, Motzkin Polynomials and Recurrence Relations

We consider the Motzkin paths which are simple combinatorial objects appearing in many contexts. They are counted by the Motzkin numbers, related to the well known Catalan numbers. Associated with the Motzkin paths, we introduce the Motzkin polynomial, which is a multi-variable polynomial " counting " all Motzkin paths of a certain type. Motzkin polynomials (also called Jacobi-Rogers polyno-mials) have been studied before, but here we deduce some properties based on recurrence relations. The recurrence relations proved here also allow an efficient computation of the Motzkin polynomials. Finally, we show that the matrix entries of powers of an arbitrary tridiagonal matrix are essentially given by Motzkin polynomials, a property commonly known but usually stated without proof.


Introduction
Catalan numbers and Motzkin numbers have a long history in combinatorics [19,20].A lot of enumeration problems are counted by the Catalan numbers C n = 1 n+1 2n n , see e.g.[20].Closely related to Catalan numbers are Motzkin numbers M n , C k similarly associated to many counting problems, see e.g.[9,1,18].For example, the number of different ways of drawing non-intersecting chords between n points on a circle is counted by the Motzkin numbers.Counting only the cases where every point meets a chord, one again arrives at the Catalan numbers.A selection of 14 situations where the Motzkin numbers occur along with the Catalan numbers can be found in [9].
the electronic journal of combinatorics 22(2) (2015), #P2.8 In particular in lattice path enumeration, both numbers appear in counting Dyck paths or Motzkin paths [13,14].A Dyck path is a lattice path in the plane integer lattice Z × Z consisting of up steps (1,1) and down steps (1, −1), which never passes below the x-axis.A Motzkin path is similar, but allowing up steps (1,1), down steps (1, −1) and horizontal steps (1,0).The number of Dyck paths from (0, 0) to (2n, 0) is given by the Catalan number C n , and the number of Motzkin paths from (0, 0) to (n, 0) is given by the Motzkin number M n .
To every Motzkin path, one can associate a "weight" keeping track of the height of the up, down and horizontal steps.In the last decade, many results have been published related to generating functions of such Motzkin path weights.The most celebrated result in Motzkin path enumeration is the generating function for Motzkin path weights in a strip, due to Viennot [24]; see also the Appendix in [12] for an accessible overview and proof.
The Motzkin polynomial P n considered in this paper can be seen as the generating function of Motzkin path weights from (0, 0) to (n, 0).This polynomial was already studied by Flajolet [11], where it is called the Jacobi-Rogers polynomial (because it was apparently first introduced by Rogers).In [11], the emphasis is on the relation with continued fractions.In the current paper we also introduce the Motzkin polynomial P (a,b) n , which can be seen as the generating function of Motzkin path weights from (0, 0) to (n, 0) for paths starting with a up steps and ending with b down steps, and study their properties.
In the following section we recall the definition of a Motzkin path and illustrate these combinatorial objects with some examples.In section 3 we introduce the Motzkin polynomials corresponding to (generating functions of) Motzkin paths of a certain type, in particular those that start with a up steps and end with b down steps.Section 4 lists some properties of these Motzkin polynomials.Notably, we prove interesting recurrence relations that allow a fast and efficient way of computing Motzkin polynomials.Section 5 deals with the connection to powers of tridiagonal matrices.Although this is a "folklore result" in combinatorics, it is often stated inaccurately or without proof.For this reason, we think it is useful to incorporate and state this connection here.In section 6, we show how the recurrence relation discussed earlier gives rise to the continued fractions of [11], and in the closing section 7 we indicate how the results can be extended to generalizations of Motzkin paths.
Our own interest in Motzkin paths, Motzkin polynomials and Dyck polynomials came from its relation to powers of tridiagonal matrices, needed in the computation of Wigner distribution functions for finite oscillator systems [23,15].It was only in the process of using and rediscovering Motzkin polynomials, that we realized how much is known in the literature.Despite this, we think we can still contribute to this topic, in particular by the new recurrence relations, their connection to continued fractions, and their computational advantage.

Motzkin paths
A Motzkin path p of size n is a lattice path in the integer plane Z × Z from (0, 0) to (n, 0) which never passes below the x-axis and whose permitted steps are the up step (1, 1), the down step (1, −1) and the horizontal step (1,0).Figure 1   Formally, a Motzkin word of size n is a word consisting of n letters u, d, h in such a way that counting from the left the u count is always greater than or equal to the d count (this ensures the path never passes below the x-axis), and such that the total u count is equal to the total d count (as the end point of the path has to be on the x-axis, namely (n, 0)).
We will denote by M n the set of all Motzkin paths of size n, and by M 0 the set consisting of the empty path only.The elements of M 3 are presented in Figure 2.
correspond with the elements of M 4 , shown in Figure 3.
The cardinalities of M n are precisely the Motzkin numbers, 1, 1, 2, 4, 9, 21, 51, 127, . . . .The Motzkin numbers form a sequence of natural numbers that count specific combinatorial objects including (but not limited to) the Motzkin paths [9,1].They satisfy the recurrence relation  and are closely related to the well known Catalan numbers.For n even, say n = 2r, the paths in M n that contain only up and down steps but no horizontal steps are precisely the Dyck paths of size r, which are counted by the Catalan numbers [6,7].
The elements of M n can be further classified according to common features they share.Here, we consider some specific subsets of M n consisting of paths with certain the electronic journal of combinatorics 22(2) (2015), #P2.8 characteristics that will be useful for our purpose.
We call the height of a Motzkin path p the largest integer N for which p touches the line y = N .Note that a Motzkin path of size n has n steps and has to end at (n, 0), so it can have at most ⌊n/2⌋ up steps, which yields a maximum height of ⌊n/2⌋ for a Motzkin path of size n.In case n is even, the only path with height equal to n/2 is the path that has n/2 up steps followed by n/2 down steps.For n odd, there are n paths with height equal to ⌊n/2⌋ (to attain this height a path needs ⌊n/2⌋ up steps and ⌊n/2⌋ down steps, this leaves n possible places for a horizontal step).
We denote by M n|N the subset of M n consisting of all elements with height at most N (or height "restricted by N ", hence the notation).As all elements of M n have height less than or equal to ⌊n/2⌋, we have M n|⌊n/2⌋ = M n . From

Motzkin polynomials
In order to define the Motzkin polynomial associated to a Motzkin path, we first introduce the concept of the weight of a Motzkin path.
Recall that a Motzkin path consists of a sequence of steps with each step being one of three possible types: up, down or horizontal.Now, to each step of a Motzkin path we will assign a weight, dependent firstly on the specific type of the step.
An up step is of the form (1, 1), so it goes from a lattice point (l − 1, k − 1) to the point (l, k) for some integers l, k.We say that this up step occurs at height k, where k is in fact the largest integer for which the up step touches the line y = k.To each up step at height k, we assign the weight u k .In the same way, we assign to a horizontal step at the integer coordinates (l − 1, k) and (l, k) the weight h k (with k again being the largest integer for which the horizontal step touches the line y = k).Finally, we assign the weight 1 to any down step.Now, we define the weight w(p) of a Motzkin path p to be the product of the weights of its individual steps.The weight of p is thus a monomial in the commuting variables u i (i = 1, 2, . ..) and h i (i = 0, 1, 2, . ..).Each up step and horizontal step contributes a factor to the weight of the path, indicating on the one hand the type of step, and on the other hand the height at which this step occurs.Moreover, to the empty path we assign the weight of 1.For example, the path p in Figure 1 has as weight w(p) = u 2 1 u 2 h 0 h 3 1 h 2 , since there are in total two up steps at height 1, one up step at height 2 and five horizontal steps, one at height 0, three at height 1 and one at height 2.
Note that the weight does not uniquely characterize a path.For instance, the paths udh and hud both have a weight of u 1 h 0 (due to commutativity of multiplication).
In principle, one could also assign the weight d k to a down step at height k.However, as a Motzkin path contains the same number of down steps as up steps, which moreover must occur at the same height, this extension would not give any extra information.It corresponds merely to replacing every u k by u k d k .
We remark that in [22] one also defines a weight for Motzkin paths, which counts the number of horizontal steps of a path with a single variable t but gives no information regarding the height at which a step occurs.This is a different definition than ours, having also a different purpose.
The weights of the four elements of M 3 , shown in Figure 2, are the electronic journal of combinatorics 22(2) (2015), #P2.8 The weights of the paths in Figure 3 are Now, we define the Motzkin polynomial P ( Here we introduced the notation u, h as shorthand to denote the sequence of variables

Any polynomial P (a,b)
n|N only contains a finite number of variables u 1 , . . ., u N , h 0 , . . ., h N , where N is determined by the maximum height of the set of Motzkin paths over which is summed.
For convenience, we shall use a simpler notation for those polynomials corresponding to non-restricted Motzkin paths (i.e. with no restriction on height and/or on the start and end): The polynomials P n will be referred to as the standard Motzkin polynomials.From the previous examples, one can see: Note that in [11], a noncommutative version of the standard Motzkin polynomials P n is defined (i.e. in noncommutative variables).These are called the Jacobi-Rogers polynomials R n , and they are in terms of noncommuting up, horizontal and down variables.For example, 0 , to be compared to P 3 given above.For most of the properties to be considered, commuting variables will do, and when relevant a property can often be translated to the noncommuting case.
In the same paper [11, Proposition 3A], an explicit expression is given for the Jacobi-Rogers polynomials with commuting variables (i.e. the Motzkin polynomials).However, there are some typing errors and a mistake in this expression.So we think it is useful to give it here again.Proposition 1.The Motzkin polynomial of size r is explicitly given by where the sum ranges over all nonnegative integer sequences m = (m 0 , m 1 , m 2 , . ..) and n = (n 1 , n 2 , n 3 , . ..) such that Proof.For given nonnegative integer sequences n = (n 1 , n 2 , . ..) and m = (m 0 , m 1 , m 2 , . ..) with a finite number of non-zero components, we shall prove that ρ(n, m) gives the number of Motzkin paths having n i up steps at height i and m j horizontal steps at height j.
One can see this as follows.Given the number of up steps and horizontal steps at each height, i.e. the numbers n = (n 1 , n 2 , n 3 , n 4 , . ..) and m = (m 0 , m 1 , m 2 , m 3 , . ..) respectively, we find the total number of paths having these step counts by enumerating all possible configurations of step positions relative to each other.
A horizontal step at height i can only occur following an up step at height i, another horizontal step at height i, or a down step at height i which must always have been preceded by an up step at height i + 1.Now, interchanging horizontal steps at one and the same height does not inherently change the configuration of a path and therefore the path itself.This leaves a total of n i + n i+1 inherently different positions at which a horizontal step at height i can occur.As we have m i such steps, the number of different configurations with these step counts is the number of ways to choose m i elements from a set of n i + n i+1 elements with repetitions allowed (multisets of cardinality m i taken from a set of cardinality n i + n i+1 , i.e. n i +n i+1 +m i −1 m i in total).For the horizontal steps at height 0, they can only occur before an up step at height 1 or following a down step at height 1 but before the next up step at height 1.This gives a total of n 1 + 1 different positions.
Similarly, the number of different configurations with n i up steps at height i and n i+1 at height i + 1 is given by the number of multisets of cardinality n i+1 taken from a set of cardinality n i .In a given configuration, the relative positions of the up steps at height 0 is completely fixed by the positions of all other steps.
The explicit expression (8) is not very practical to actually compute the Motzkin polynomials; for this purpose, the recurrence relation of the following section will be most efficient.

Properties and recurrence relations
We now discuss some properties of the Motzkin polynomials.First of all, we consider some evaluations of these polynomials at specific values for the variables.Setting all variables the electronic journal of combinatorics 22(2) (2015), #P2.8 u i , h i in the polynomial P where the notation on the left stands for evaluating the polynomial P 2r|N becomes the Dyck polynomial, used in [15].Consequently, taking u 1 = 1, u 2 = 1, . . .and h 0 = 0, h 1 = 0, . . .we find that P 2r (1, 0) is the Catalan number C r .
The elements of M n|N are those of M n with height at most N .The set M n \ M n|N consists thus of the paths with height higher than N , and the weights of these paths have at least one of the factors u N +1 , u N +2 , . . .and/or h N +1 , h N +2 , . ... Therefore, one can obtain P n|N from P n , by putting u N +1 = u N +2 = . . .= 0 and h N +1 = h N +2 = . . .= 0 in P n : Clearly, this is also valid for Motzkin paths that are restricted on the start and/or end: For this reason, it will be sufficient to study P n|N then follow from a suitable substitution.
Our main new result for Motzkin polynomials is the construction of a recurrence relation.Hereto we first introduce the following notation: This stands for raising the indexes of the variables by 1.So P n (u + , h + ) will have u 2 substituted for u 1 , u 3 for u 2 , etc., and also h 1 substituted for h 0 , h 2 for h 1 , etc.For example: Theorem 2. For integer n, we have the electronic journal of combinatorics 22(2) (2015), #P2.8 Proof.We must show that the right-hand side of (13) contains the weights of all Motzkin paths of size n + 1.The first step of a Motzkin path of size n + 1 is either an up step or a horizontal step.If the first step is horizontal, this leaves a remaining path of n steps.The sum of the weights of all Motzkin paths of size n is given by P n .Hence, multiplying these weights by a factor h 0 for an extra horizontal step at height 0, we find that h 0 P n is exactly the sum of the weights of all Motzkin paths of size n + 1 that start with a horizontal step.Now, consider a Motzkin path of size n + 1 that starts with an up step.Any such path must ultimately meet again at the x-axis with a down step at height 1, occurring as one of its n remaining steps.Say this path meets the x-axis at (i + 2, 0) (i 0) for the first time (counting from the left) after its up step at (0,0), leaving n − 1 − i remaining steps starting from (i + 2, 0) to (n + 1, 0).From (1, 1) to (i + 1, 1) this path never passes below the line y = 1.This Motzkin path can thus be seen as the concatenation of an up step, followed by a "raised" Motzkin path of size i, a down step and finally a Motzkin path of size n − 1 − i.In this way, summing over all possible points (i + 2, 0), we find that the right-hand side of ( 13) is precisely the sum of the weights of all Motzkin paths of size n + 1 that start with an up step.
One easily verifies the relation ( 13) for the first few polynomials In fact, (13) gives a very efficient way of calculating the polynomials P n .It is moreover easy to implement in any computer algebra package.
In a similar way, one obtains a recurrence relation for the polynomials P .First of all, note that obviously Proof.The proof of this relation is similar to the proof of Theorem 1.Consider first the case a 1 and b 1.We must show that the right-hand side of ( 17) contains the weights of all Motzkin paths of size n + 1 that start with a up steps and ends with b down steps.If such path does not meet the x-axis apart from its end points (0,0) and (n + 1, 0), then by removing its first and final step it is in fact reduced to a Motzkin path of size n − 1 starting with a − 1 ups and ending with b − 1 downs.The sum of the weights of these kind of paths is precisely the term The remaining paths all touch the x-axis in some intermediate step.The summation in the right-hand side of ( 17) follows by making the distinction as to where the Motzkin path in question first touches the x-axis, similar to what we did in the proof of Theorem 1. Now, for b = 0 the first count should be deleted, which corresponds to deleting the first term in (17).But this is automatically the case because of (14).
For a = 0, the counting argument (and thus the recurrence relation) does not hold.This is no disadvantage for the actual computation of the polynomials P (a,b) n since one can make use of the symmetry (16).
Note that the sum over i in (17) runs in fact from 2a − 2 to n − 1 − 2b (for i from 0 to 2a − 3, P The recurrence relations ( 13) and ( 17), together with the boundary conditions ( 14) and (15), can be used to easily compute the Motzkin polynomials P Finally, we prove the following relation which we will need in the next section.
with u 0 = 0 in the case a = 0.
Proof.By definition, the left-hand side of ( 18) is precisely the sum of the weights of all Motzkin paths that start with at least a up steps, end with b down steps, and have k + 1 steps in between.The equality in (18) now follows from classifying these paths according to their subsequent step after the a up steps, which is either an up step, a horizontal step, or a down step.Any path with a up steps and as subsequent step again an up step, is in fact a path starting with a + 1 up steps.This leaves a remainder of k steps, followed by b down steps, hence the sum of the weights of all paths of this type is given by P If the subsequent step is a horizontal step, we have again k remaining steps, followed by b down steps.Removing this horizontal step starting at (a, a) and putting the loose ends together, the sum of all weights of these reduced paths is given by P (a,b) a+b+k .The paths we are after then follow by multiplying these weights by a factor h a to compensate for the removed horizontal step at height a.
If the subsequent step is a down step, we have again k remaining steps, now starting at height a − 1, followed by b down steps.Removing the up step from (a, a) to (a + 1, a + 1) and the down step from (a + 1, a + 1) to (a, a), and putting the loose ends together, the sum of all weights of these reduced paths is given by P (a−1,b) a+b+k−1 .Multiplying these weights by a factor u a to account for the removed up (and down) step yields the last term of the sum in the right-hand side of (18), which completes the proof.

Relation to tridiagonal matrices
The relation between powers of tridiagonal matrices and Motzkin polynomials seems to be "commonly known" in the literature on transfer matrices (see e.g.[19,3]).However, it is often stated without a proof.With our current definitions and equation (18), it is easy to describe this relation.
For k a positive integer, and 0 a, b N , we have Proof.We shall prove (20) by induction on k.For k = 1, let us consider the polynomials P (a,b) a+b+1|N .These are precisely the weights of all Motzkin paths that start with at least a up steps and end with b down steps and have one unspecified step in between.Clearly, there are three possible scenarios where this polynomial is nonzero, i.e. when there is at least one valid corresponding Motzkin path.When b = a + 1, we have one path with its weight given by u 1 u 2 • • • u a u a+1 .When b = a, we have a path with associated weight Now we can use the induction hypothesis, and assume that (20) holds for k 1.The matrix elements of R k+1 are computed as follows: 18) (which is obviously also valid after restriction to N variables), this gives The "boundary" matrix elements of R k+1 are computed similarly, taking into account that in (18) when restricted to height N for a = N or b = N , P (a+1,b) a+1+b+k|N = 0.It is straightforward to extend this result to general tridiagonal matrices of the form Indeed, using the diagonal matrix D of the form one can see that where R ′ follows from R by the replacements u i → u i d i .Hence, the powers of S are easily related to the powers of R ′ , and one obtains: Theorem 6.Let S be a general tridiagonal (N + 1) × (N + 1) matrix given by (21).For k a positive integer, and 0 a, b N , we have the electronic journal of combinatorics 22(2) (2015), #P2.8
Multiplying the recurrence relation ( 13) by z n+1 and summing over all n 0 then gives: Repeated use of ( 23) leads to This generating function is the central object of study in [11].In our case, the form of the generating function follows in a very simple way from the recurrence relation (13).
For Motzkin paths restricted to height N and the corresponding Motzkin polynomials restricted to N variables, the generating function the electronic journal of combinatorics 22(2) (2015), #P2.8

Generalizations of Motzkin paths
There exist several lattice paths that are generalizations of Motzkin paths occurring in a range of different fields.We now show that the approach above is readily transferred to such generalized paths.More specifically, we demonstrate that one easily associates weights and polynomials to these paths which can be computed efficiently by means of a (modified) recurrence relation.
A first extension is obtained by removing the restriction that a path may not pass below the x-axis.Such paths are sometimes called super Dyck paths and super Motzkin paths, see e.g.[17,5].In exactly the same manner as for the classical paths, one easily assigns a weight to any path that is allowed to go below the x-axis by letting the indices of the variables u i and h i take on negative values.The associated polynomials and corresponding recurrence relation then follow immediately.Note, however, that these kind of paths are in fact already included in the class of paths having a fixed number of steps at the start and at the end.Indeed, a super path of size n is up to an upward shift equivalent to the middle part of a regular path of size n + 2⌊n/2⌋ that starts with ⌊n/2⌋ up steps and ends with ⌊n/2⌋ down steps.The appropriate weight then follows after a shift of the indices of the variables u i and h i and accounting for the extra up steps at the beginning.
Another class of generalized paths consists of coloured Motzkin paths, where the allowed steps can occur in a number of different colours, see e.g.[17,2,8].Also, in [10] a bijection is established between the n-cell standard Young tableaux of bounded height and the coloured Motzkin paths of size n.This colouring makes it possible to distinguish between two steps of the same kind occurring at the same height, which is something one would want to incorporate when assigning weights to these paths.For instance, consider a Motzkin path which has horizontal steps in k different colours, also called a k-coloured Motzkin path.To each step of such a path we can once more associate a weight in the usual way, now assigning to a horizontal step the weight h i,j where i ranges from 1 to k and stands for the colour of the step, while the index j again denotes the height at which the step occurs.Removing the colouring of a path (replacing all coloured horizontal steps by its uncoloured variant) we obtain a classical Motzkin path.In terms of its weight this corresponds to substituting h j for h i,j for every i.The number of coloured paths which reduce to the same classical Motzkin path depends on the number of horizontal steps it has and how many different colours these steps can take on.The sum of the weights of all paths which reduce to the same path p when removing their colouring can then easily be obtained from the weight w(p) by carrying out the substitution for all relevant heights i in p.Hence, the polynomial consisting of the sum of the weights of all paths with a specified size n then follows from this same substitution but now for the Motzkin polynomial P n .Similarly, with regard to the weights of paths, the substitution corresponds to introducing ℓ different colours that an up step is allowed to have.
the electronic journal of combinatorics 22(2) (2015), #P2.8 Imposing conditions on height and/or on the start and end of such paths then corresponds to using the appropriate polynomial P (a,b) n|N instead of P n .By means of the recurrence relations for the Motzkin polynomials this allows to efficiently compute also polynomials associated to coloured Motzkin paths.
We mention a last generalization which is obtained through tinkering with the length of the individual steps occurring in a Motzkin path.In general, the length of each kind of step can be altered; however, the most prominent type of such generalized paths is the one where up and down steps remain of the form (1, 1) and (1, −1), while horizontal steps are changed to k-horizontal steps which have a fixed length k or thus are of the form (k, 0).These paths are also called k-Motzkin paths, see [8,16,22].The case k = 1 then covers regular Motzkin paths, while k = 0 corresponds to Dyck paths.
For any k, in exactly the same manner as was the case for the classical paths, one assigns to each path a weight which portrays the steps it contains and the height they occur at.Now, if we again define polynomials as the sum of the weights of all paths of a given size n, then the following modified version of the recurrence relation ( 13) holds: Note that for n + 1 < k, the term h 0 P n+1−k (u, h) disappears, in line with (14).The reason for this is that these paths are of insufficient size to accommodate a horizontal step of length k.In this case, (26) reduces to the recurrence relation for Dyck paths, evidently as they contain no horizontal steps, see [15].Just as in Section 6, the recurrence relation where P n now denotes the polynomial containing the weights of all k-Motzkin paths for some arbitrary integer k.Multiplying the recurrence relation (26) by z n+1 and summing over all n 0 then yields: which leads to Plugging in k = 1 indeed gives the generating function for the standard Motzkin polynomials.The case k = 0 corresponds to a generating function for Dyck polynomials which allow zero-length horizontal steps, i.e. dots.The known expression then follows after putting h i = 0 for all i, and substituting z for z 2 (which is the result of Dyck paths always having even size), see [15].We conclude with a remark on the case where k = 2.A 2-Motzkin path consists of horizontal steps of the form (2, 0), up steps (1, 1) and down steps (1, −1).Note that a 2-Motzkin path must always be of even size n = 2r.These paths correspond precisely to the Schröder paths which are counted by the (large) Schröder numbers.A Schröder path is usually defined as a path which goes from (0, 0) to (r, r) using horizontal steps (1, 0), vertical steps (0, 1) and diagonal steps of the form (1, 1) and which does not rise above the line y = x [21].Setting all variables u i , h i equal to 1 in the polynomial P n associated to the 2-Motzkin paths thus gives the Schröder numbers.Moreover, if we also define the polynomials P (a,b) n which consist of the weights of all 2-Motzkin paths which start with a up steps and end with b down steps, then these can be related to the Delannoy numbers [4].For integers a, b, the Delannoy number D(a, b) counts all paths going from the southwest corner (0, 0) of a rectangular grid to the northeast corner (a, b), using only single steps north (0, 1), northeast (1, 1), or east (1, 0).Now, the 2-Motzkin polynomial P depicts a Motzkin path of size 11.Denoting the up step by u, the down step by d and the horizontal step

Figure 1 :
Figure 1: Example of a Motzkin path of size n = 11.

Figure 3 ,Figure 4 :
Figure 4: All Motzkin paths of size n = 8 with a = 3 and b = 2, i.e. starting with at least three up steps and ending with at least two down steps.

(a,b) n|N at u 1 = 1 , u 2 = 1 ,
. . ., h 0 = 1, h 1 = 1, . . . .Hence, for integer n, the value P n (1, 1) is precisely the Motzkin number M n .Setting all h i -variables to zero in P (a,b) n|N , the polynomial reduces to the sum of the weights of all elements of M (a,b) n|N that do not contain any horizontal steps.For n an odd integer, this equals zero as any Motzkin path of odd size must contain a horizontal step.For n = 2r even, these paths are precisely the Dyck paths, and P (a,b)

,
and thus work with Motzkin paths of size n that are not restricted in height.The properties for P (a,b)