Keywords

2010 Mathematics Subject Classification

1 Introduction

For the enumeration of simple lattice paths (allowing just the jumps \(-1\), 0, and \(+1\)), many methods are often used, like the Lagrange inversion, determinant techniques, continued fractions, orthogonal polynomials, bijective proofs, and a lot is known in such cases [32, 45, 52, 54]. These nice methods do not apply to more complex cases of more generic jumps (or, if one adds a spacial boundary, like a line of rational slope). It is then possible to use some ad hoc factorization due to Gessel [35] or context-free grammars to enumerate such lattice paths [28, 47, 50]. One drawback of the grammar approach is that it leads to heavy case-by-case computations (resultants of equations of huge degree). In this article, we show how to proceed for the enumeration and the asymptotics in these harder cases: our techniques are relying on the “kernel method” which (contrary to the context-free grammar approach) offers access to the true simple generic structure of the final generating functions and the universality of their asymptotics via singularity analysis.

Let us start with the history of what Philippe Flajolet named the “kernel method”: It has been part of the folklore of combinatorialists for some time and its simplest application deals with functional equations (with apparently more unknowns than equations!) of the form

$$ K(z,u)F(z,u)= p(z,u)+q(z,u) G(z), $$

where the functions pq, and K are given and FG are the unknown generating functions we want to determine. K(zu) is a polynomial in u which we call the “kernel” as we “test” this functional equation on functions u(z) cancelling this kernel.Footnote 1 The simplest case is when there is only one branch, \(u_1(z)\), such that \(K(z,u_1(z))=0\) and \(u_1(0)=0\); in that case, a single substitution gives a closed-form solution for G: namely \(G(z)=-p(z,u_1(z))/q(z,u_1(z))\).

Such an approach was introduced in 1969 by Knuth to enumerate permutations sortable by a stack, see the detailed solution to Exercise 2.2.1–4 in The Art of Computer Programming ([43, pp. 536–537] and also Ex. 2.2.1.11 therein), which presents a “new method for solving the ballot problem,” for which the kernel K is a quadratic polynomial (this specific case involves just one branch \(u_1(z)\)).

In combinatorics exist many applications of this method for solving variants of the above functional equation: one is known as the “quadratic method” in map enumeration, as initially developed in 1965 by Brown during his collaboration with Tutte (see Sect. 2.9.1 from [9, 24] for the analysis of about a dozen families of maps). During nearly 30 years, the kernel method was dealing only with “quadratic cases” like the ones of Brown for maps or of Knuth for a vast amount of examples involving trees, polyominoes, walks [57], or more exotic applications like the one mentioned by Odlyzko in his wonderful survey on asymptotic methods in enumeration [25]. Then, in 1998, the initial approach by Knuth was generalized by a group of four people, all of them being in contact and benefiting from mutual insights: Banderier in his memoir [5] solved some problems related to generating trees and walks, and this later led to the article with Flajolet [8] and to the solution of some conjectures due to Pinzani in the article with Bousquet-Mélou et al. [6]. At the same time, Petkovšek analyzed linear multivariate recurrences in [55], a work later extended in [23]. All these articles contributed to turn the original approach by Knuth into a method working when the equation has more unknowns (and the kernel has more roots). This solves equations of the type

$$ K(z,u)F(z,u)= \sum _{i=1}^m p_i(z,u) G_i(z), $$

where K and the \(p_i\)’s are known polynomials, and F and the \(G_i\)’s are unknown functions.

A few years later, Bousquet-Mélou and Jehanne [21] solved the case of algebraic equations in F of arbitrary degree:

$$P(z,u,F(z,u),G_1(z),\dots ,G_m(z))=0.$$

The kernel method thus plays a key role in many combinatorial problems. A few examples are directed lattice paths and their asymptotics [8, 19], additive parameters like area [10, 61], generating trees [6], pattern avoiding permutations [49], prudent walks [4, 27], urn models [60], statistics in posets [20] and many other nice combinatorial structures...

Independently, in probability theory, in the 1970s, Malyshev invented an approach now sometimes called the “iterated kernel method.” It can be used to analyze nearest neighbor random walks in queuing theory. In this context, these lead to the following type of equations:

$$\begin{aligned} K(t,x,y) F(t,x,y) = p_0(t,x,y) + p_1(t,x,y) F(x,0) + p_2(t,x,y) F(0,y), \end{aligned}$$

where K and the \(p_i\)’s are known polynomials, while F is the unknown function we are looking for. This approach culminated in the book [31], which was later revisited in the 2000s (e.g., in [46]), also with a more combinatorial point of view in [22]. It is still the subject of vivid activities, including the extension to higher dimensions [18]. Moreover, the kernel method also gives the transient solution of some birth–death queuing processes [37].

Also independently, in statistical mechanics, several authors developed other incarnations of the kernel method. For example, the WKB limit of the Bethe ansatz (also called thermodynamical Bethe ansatz) often leads to algebraic equations and to what is called the algebraic Bethe ansatz [34]. The kernel method is also used in the study of the Ising model of bicolored maps (see Theorem 8.4.5 in [30], and pushing further this method led Eynard to his “topological recurrence”), and in many articles on enumeration related to directed animals, polymers, walks [38,39,40].

After this short history of the kernel method, we want to show how to use it to derive explicit counting formulae and asymptotics for directed lattice paths below a line of rational slope. In the article by Banderier and Flajolet [8], the class of directed lattice paths in \({\mathbb Z}^2\) was investigated thoroughly by means of analytic combinatorics (see [33]). Our work is an extension of this article in mainly five ways:

  1. 1.

    Our work involves lattice paths having a “periodic support,” and the comment in [8, Sect. 3.3] was incomplete for this more cumbersome case; indeed, there are then several dominant singularities, and we had to revisit in more detail the structural properties of the roots associated with the kernel method in order to understand the contribution of each of these singularities. It is pleasant that this new understanding gives a tool to deal with the asymptotics of many other lattice path enumeration problems.

  2. 2.

    We get new explicit formulae for the generating functions of walks with starting and ending at altitude other than 0, and links with complete symmetric homogeneous polynomials.

  3. 3.

    We give new closed forms for the coefficients of these generating functions.

  4. 4.

    We have an application to some harder parameters (like the area below a lattice path).

  5. 5.

    We extend the results to walks below a line of arbitrary rational slope, paving the way for our forthcoming article on walks below a line of arbitrary irrational slope [15].

Let us give a definition of the lattice paths we consider:

Definition 7.1

(Jumps and lattice paths) A step set \(\mathscr {S}\subset {\mathbb Z}^2\) is a finite set of vectors \(\{ (x_1,y_1), \ldots , (x_m,y_m)\}\). An n-step lattice path or walk is a sequence of vectors \((v_1,\ldots ,v_n)\), such that \(v_j\) is in \(\mathscr {S}\). Geometrically, it may be interpreted as a sequence of points \(\omega =(\omega _{0},\omega _{1},\ldots ,\omega _{n})\) where \(\omega _{i} \in {\mathbb Z}^2,~\omega _{0} = (0,0)\) (or another starting point) and \(\omega _{i}-\omega _{i-1} = v_i\) for \(i=1,\ldots ,n\). The elements of \(\mathscr {S}\) are called steps or jumps. The length \(|\omega |\) of a lattice path is its number n of jumps.

The lattice paths can have different additional constraints as shown in Table 1.

Table 1 The four types of paths: walks, bridges, meanders, and excursions. We refer to these walks as the Banderier–Flajolet model, in contrast to the model in which we will consider lattice paths below a rational slope boundary

We restrict our attention to directed paths which are defined by the fact that, for each jump \((x,y) \in \mathscr {S}\), one must have \(x \ge 0\). The next definition allows to merge the probabilistic point of view (random walks) and the combinatorial point of view (lattice paths):

Definition 7.2

(Weighted lattice paths) For a given step set \(\mathscr {S}= \{s_1,\ldots ,s_m\}\), we define the respective system of weights as \( \{w_1,\ldots ,w_m\}\) where \(w_j >0\) is the weight associated with step \(s_j\) for \(j=1,\ldots ,m\). The weight of a path is defined as the product of the weights of its individual steps.

Plan of This Article

  • First, in Sect. 2, we recall the fundamental results for lattice paths below a line of slope \(\alpha \) (where \(\alpha \) is an integer or the inverse of an integer) and the links with trees.

  • Then, in Sect. 3, we give Knuth’s open problem on lattice paths below a line of slope 2 / 5.

  • In Sect. 4, we give a bijection between lattice paths below any line of rational slope and lattice paths from the Banderier–Flajolet model.

  • In Sect. 5, the needed bivariate generating function is defined and the governing functional equation is derived and solved: here the “kernel method” plays the most significant role in order to obtain the generating function (as typical for many combinatorial objects which are recursively defined with a “catalytic parameter”).

  • In Sect. 6, we tackle some questions on asymptotics, thus answering the question of Knuth.

  • In Sect. 7, we comment on links with previous results of Nakamigawa and Tokushige, which motivated Knuth’s problem, and we explain why some cases lead to particularly striking new closed-form formulae.

  • In Sect. 8, we analyze what happens for the Duchon’s club model (lattice paths below a line of slope 2 / 3), and we extend our formulae to general rational slopes.

2 Trees, Fractional Trees, Imaginary Trees

Due to their fundamental role in computer science trees were the subject of many investigations, and there exist many alternative representations of this key data structure. One of the most useful ones is an encoding by “traversing” the tree via a depth-first traversal (or via a breadth-first traversal). This directly gives a lattice path associated with the original tree. In fact, what are called “simple families of ordered trees” (rooted ordered trees in which each node has a degree prescribed to be in a given set) are in bijection with lattice paths. The reason is the famous Łukasiewicz correspondence between trees and lattice paths, see Fig. 1.

Fig. 1
figure 1

The Łukasiewicz bijection between trees and lattice paths: A little fly is travelling along the full contour of the tree starting from the root. Whenever it meets a new node, one draws a new jump of size “arity of the node \(-1\)” in the lattice path. Without loss of generality, one can always remove the very last jump (as it will always be a “\(-1\)”) and thus we get an excursion which is in bijection with the initial tree. It is straightforward to reverse this bijection. Additionally, note that any deterministic traversal of the tree offers such a bijection, so it could be a depth-first traversal, but also, e.g., a breadth-first traversal

Basic manipulations on lattice paths also show that Dyck paths (paths with jumps North and East, see Fig. 2) below the line \(y= \alpha x\) (\(\alpha \) being here a positive integer), or below the line \(y= x/\alpha \), are in bijection with trees (of arity \(\alpha \), i.e., every node has exactly 0 or \(\alpha \) children).

Fig. 2
figure 2

Examples of combinatorial structures which are in bijection: ternary trees, excursions of directed lattice paths with jumps \(+2\) and \(-1\), Dyck paths of North-East steps below the line \(y = 2x\), Dyck paths above the line \(y=\frac{1}{2} x\), and Dyck paths below the line \(y=\frac{1}{2}x\)

The generating function \(F(z)=\sum f_n z^n\), where \(f_n\) counts the number of trees with n nodes (internal and external ones), satisfies the functional equation \(F(z) =z \phi ( F(z))\,,\) where \(\phi \) encodes the allowed arities. Thus, we get binary trees: \(\phi (F)=1+F^2\), unary-binary trees: \(\phi (F)=1+F+F^2\), t-ary trees: \(\phi (F)=1+F^t\), general trees: \(\phi (F)=1/(1-F)\). See [33] for more on this approach, also extendible to unordered trees (i.e., the order of the children is not taken into account).

Because of the bijection with lattice paths, the enumeration of ordered trees solves the question of lattice paths below a line of integer slope. In the simplest case of classical Dyck paths, many tools were developed. In 1886, Delannoy was the first to promote a systematic way to enumerate lattice paths, using recurrences and an array representation (see [13] for more on this). Then, the Bertrand ballot problem [16] (already previously considered by Whitworth) and the ruin problem (as studied along centuries by Fermat, Pascal, the Bernoullis, Huygens, de Moivre, Lagrange, Laplace, Ampère and Rouché) were a strong motor for the birth of the combinatorics of lattice paths, one famous solution being the one by André [2] via a bijective proof involving “good minus bad” paths. Aebly [1] and Mirimanoff [51] gave a geometric variant of this bijective proof, which corresponds to what is nowadays known as the reflection principle. Later, the cycle lemma by Dvoretsky and Motzkin [29] proved useful for many similar problems. During the last century, all these tools were extended and applied to other cases than the classical Dyck paths, and we will use some of them in this article.

With respect to the closed form for the enumeration, another powerful tool is the Lagrange–Bürmann inversion formula (see, e.g., [33]). Applied on \(T(z) = 1 + z T(z)^t\) (the equation for the generating function of t-ary trees where z marks internal nodes), it gives

$$\begin{aligned} T(z)^r= \sum _{k\ge 0} \left( {\begin{array}{c}tk+r\\ k\end{array}}\right) \frac{r}{tk+r} z^k = \sum _{k\ge 0} \left( {\begin{array}{c}tk+(r-1)\\ k\end{array}}\right) \frac{r}{(t-1)k+r} z^k \,. \end{aligned}$$
(7.1)
Fig. 3
figure 3

It is possible to plug any value for t in T(z), which is known to count trees and lattice paths when t is an integer. What happens when we consider generalized binomial series of order 3 / 2 or of other fractional values? To recycle a nice pun by Don Knuth [44]: Nature is offering nice binary trees; will imaginary trees one day play a role in computer science?

Plugging rational values is not directly leading to a power series with integer coefficients, but it “miraculously” becomes the case after basic transformations (Fig. 3). For example, as observed by Knuth [44], for \(t=3/2\), one has the following neat non-trivial identity:

$$\begin{aligned} T(z) T(-z) = \left( \sum _{k\ge 0} \frac{\left( {\begin{array}{c}3k/2\\ k\end{array}}\right) }{k/2+1} z^k \right) \left( \sum _{k\ge 0} \frac{\left( {\begin{array}{c}3k/2\\ k\end{array}}\right) }{k/2+1} (-z)^k \right) = \sum _{n \ge 0} \frac{\left( {\begin{array}{c}3n+1\\ n\end{array}}\right) }{n+1} z^{2n}\,. \end{aligned}$$
(7.2)

What could be the meaning of such identities involving “half-trees”? The explanation behind this formula is better seen in terms of lattice paths, and we will shed light on it in the next sections via the kernel method. Another set of mysterious identities is, e.g., incarnated by:

$$\begin{aligned} \ln T(z) = \ln \sum _{n\ge 0} \frac{\left( {\begin{array}{c}tn\\ n\end{array}}\right) }{(t-1)n+1} z^n = \sum _{n\ge 1} \frac{\left( {\begin{array}{c}tn\\ n\end{array}}\right) }{tn} z^n\,. \end{aligned}$$
(7.3)

In fact, this one is just another avatar of the cycle lemma, which is also the reason for the link between the generating function of bridges and the generating function of excursions (a fact also appearing in various disguises, e.g., in the Spitzer formula, in the Sparre Andersen formula), see [8] for explanations and proofs.

As we have seen, Dyck paths below an integer slope (or structures in bijection with them) were subject to many approaches, now considered as “folklore.” The first result for lattice paths below a rational slope came much later and is best summarized by the following theorem:

Theorem 7.1

(Bizley’s formula, Grossman’s formula) The number f(anbn) of Dyck paths from (0, 0) to (anbn) staying weakly above \(y=\frac{a}{b}x\) is given by the following expressions, where \(c_j := \frac{1}{a j+ b j }\left( {\begin{array}{c} a j+ b j\\ a j\end{array}}\right) \):

$$\begin{aligned} f(an,bn)&=\displaystyle [t^n] \exp \sum _{j\ge 0}^n \frac{1}{(a+b)} \left( {\begin{array}{c}(a+b) j\\ a\end{array}}\right) t^j\,,\end{aligned}$$
(7.4)
$$\begin{aligned} f(an,bn)&= \displaystyle \sum _{\left\{ \begin{array}{c} \text {integer partitions of } n:\\ \sum _{j=1}^{k} j \, e_j = n \end{array}\right\} } \, \prod _{j=1}^{k} \frac{(c_{j})^{e_j}}{e_j!} \,. \end{aligned}$$
(7.5)

Formula (7.5) was first stated without proof by Grossman in 1950. A proof was then given by Bizley [17] in 1954. It starts with Formula (7.4), which is an avatar of the cycle lemma [29] expressed in terms of a generating function. Then, routine power series manipulation gives Formula (7.5). These formulae (or special cases of them) have since been rediscovered (and published ...) many times. One nice modern formulation of the method behind is found in the article by Gessel [35]. There exist alternative generic formulae as given by Banderier and Flajolet [8], Sato [59], which simplify for ad hoc cases [11, 28].

This formula admits many extensions as one could, for example, add parameters or take into account certain patterns. This would lead to “rational” Narayana numbers, “rational” q-analogues, “rational” Mahonian statistics (on lattice paths!), etc.

For each n, Grossman’s formula (7.5) for f(anbn) involves p(n) summands, where p(n) is the integer partition sequence of Hardy–Ramanujan fame:

$$ \displaystyle p(n)= [t^n] \prod _{n\ge 1} \frac{1}{1-t^n} \sim \frac{1}{4n\sqrt{3}} \exp \left( \pi \sqrt{\frac{2n}{3}}\,\right) \,. $$

Therefore, this nice closed-form formula of Grossman has many summands if n is large (computing it will have an exponential cost); it is thus useful to have an algorithmic alternative to it. Bizley’s formula (7.4) allows to compute f(anbn) in quasi-linear time by a power series manipulation. This is also the advantage of other expressions like the ones given by [8] using the kernel method, on which we will come back in the next sections.

Formula (7.4) for \(n=1\) gives \(f(a,b)=\frac{1}{a + b }\left( {\begin{array}{c} a + b \\ a \end{array}}\right) \), also known as the rational Catalan numbers \({\text {Cat}}(a,b)\). In the last years, many properties of the Dyck paths and their “Catalan combinatorics” (i.e., the enumeration of the numerous combinatorial and algebraic structures related to them) were extended to Dyck paths below a line of rational slope. This new area of research is sometimes called “rational Catalan combinatorics” [3]. We expect that the recent developments of “rational Catalan combinatorics” have a generalization to \(n>1\), but with less simple formulae, as suggested by Table 2.

Table 2 The number f(anbn) of Dyck walks from (0, 0) to (anbn) staying weakly below \(y=\frac{a}{b} x\). To shorten our expressions, we use the shorthand \(c_j := \frac{1}{a j+ b j }\left( {\begin{array}{c} a j+ b j\\ a j\end{array}}\right) \) In the rest of the article, we will see further nice formulae for Dyck paths below a rational slope

3 Knuth’s AofA Problem #4

During the conference “Analysis of Algorithms” (AofA’2014) in Paris in June 2014, Knuth gave the first invited talk, dedicated to the memory of Philippe Flajolet (1948–2011). The title of his lecture was “Problems that Philippe would have loved” and he was pinpointing/developing five nice open problems with a good flavor of “analytic combinatorics” (his slides are available online.Footnote 2) The fourth problem was on “Lattice paths of slope 2/5,” in which Knuth investigated Dyck paths under a line of slope 2/5, following the work of [53]. This is best summarized by the two following original slides of Knuth:

figure b

In the next sections, we prove that Knuth was indeed right! In order not to conflict with our notation, let us rename Knuth’s constants a and b into \(\kappa _1\) and \(\kappa _2\).

4 A Bijection for Lattice Paths Below a Rational Slope

Consider paths in the \(\mathbb {N}^2\) lattice,Footnote 3 starting in the origin, and whose allowed steps are of the type either East or North (i.e., steps (1, 0) and (0, 1), respectively). Let \(\alpha , \beta \) be positive rational numbers. We restrict the walks to stay strictly below the barrier \(L: y = \alpha x + \beta \). Hence, the allowed domain of our walks forms an obtuse cone with the x-axis, the y-axis and the barrier L as boundaries. The problem of counting walks in such a domain is equivalent to counting directed walks in the Banderier–Flajolet model [8], as seen via the following bijection:

Proposition 7.1

(Bijection: Lattice paths below a rational slope are directed lattice paths) Let \(\mathscr {D}: y < \alpha x + \beta \) be the domain strictly below the barrier L. From now on, we assume without loss of generality that \(\alpha =a/c\) and \(\beta =b/c\) where abc are positive integers such that \(\gcd (a,b,c)=1\) (thus, it may be the case that a / c or b / c are reducible fractions). There exists a bijection between “walks starting from the origin with North and East steps” and “directed walks starting from (0, b) with the step set \(\{(1,a), (1,-c)\}\).” What is more, the restriction of staying below the barrier L is mapped to the restriction of staying above the x-axis.

Proof

The following affine transformation gives the bijection (see Fig. 4):

$$\begin{aligned} \begin{pmatrix} x \\ y \end{pmatrix} \mapsto \begin{pmatrix} x + y \\ a x - c y + b \end{pmatrix}. \end{aligned}$$

Indeed, the determinant of the involved linear mapping is \(-(c+a) \ne 0\). What is more, the constraint of being below the barrier (i.e., one has \(y<\alpha x+\beta \)) is thus forcing the new abscissa to be positive: \(ax-cy+b>0\). The gcd conditions ensure an optimal choice (i.e., the thinnest lattice) for the lattice on which walks will live. Note that this affine transformation gives a bijection not only in the case of an initial step set North and East, but for any set of jumps.

The purpose of this bijection is to map walks of length n to meanders (i.e., walks that stay above the x-axis) which are constructed by n unit steps into the positive x direction.

Fig. 4
figure 4

Example showing the bijection from Proposition 7.1: Dyck paths below the line \(y=(2/5) x +2/5\) (or touching it) are in bijection with walks allowing jumps \(+2\) and \(-5\), starting at altitude 2, and staying above the line \(y=0\) (or touching it)

Note that if one does not want the walk to touch the line \(y=(a/c) x + b/c\), it corresponds to a model in which one allows to touch, but with a border at \(y= (a/c) x + (b-1)/c\). Time reversal is also giving a bijection between

  • walks starting at altitude b with jumps \(+a, -c\) and ending at 0,

  • and walks starting at 0 and ending at altitude b with jumps \(-a,+c\).

5 Functional Equation and Closed-Form Expressions for Lattice Paths of Slope 2/5

In this section, we show how to derive closed forms (i.e., explicit expressions) for the generating functions of lattice paths of slope 2/5 (and their coefficients). First, define the jump polynomial \(P(u) := u^{-2} + u^5\). Note that the bijection in Proposition 7.1 gives jump sizes \(+2\) and \(-5\). However, a time reversal gives this equivalent model (jumps \(-2\) and \(+5\)), which has the advantage of leading to more compact formulae (see below). Let \(f_{n,k}\) be the number of walks of length n which end at altitude k. The corresponding bivariate generating function is given by

$$\begin{aligned} F(z,u) = \sum _{n,k \ge 0} f_{n,k} z^n u^k = \sum _{n \ge 0} f_n(u) z^n = \sum _{k \ge 0} F_k(z) u^k, \end{aligned}$$

where the \(f_n(u)\) encode all walks of length n, and the \(F_k(z)\) are the generating functions of walks ending at altitude k. A step-by-step approach yields the following linear recurrence

$$\begin{aligned} f_{n+1}(u) = \{u^{\ge 0}\} \left[ P(u) f_n(u) \right] \qquad \text { for } n \ge 0, \end{aligned}$$

with initial value \(f_0(u)\) (i.e., the polynomial representing the walks of length 0), and where \(\{u^{\ge 0}\}\) is a linear operator extracting all monomials in u with non-negative exponents. Summing the terms \(z^{n+1} f_{n+1}(u)\) leads to the functional equation

$$\begin{aligned} (1 - z P(u)) F(z,u) = f_0(u) - z u^{-2} F_0(z) - z u^{-1} F_1(z). \end{aligned}$$
(7.6)

We apply the kernel method in order to transform this equation into a system of linear equations for \(F_0\) and \(F_1\). The factor \(K(z,u):=1-zP(u)\) is called the kernel and the kernel equation is given by \(K(z,u)=0\). Solving this equation for u, we obtain 7 distinct solutions. These split into two groups, namely we get 2 small roots \(u_1(z)\) and \(u_2(z)\) (the ones going to 0 for \(z\sim 0\)) and 5 large roots which we call \(v_i(z)\) for \(i=1,\ldots ,5\) (the ones going to infinity for \(z\sim 0\)). It is legitimate to insert the 2 small branches into (7.6) to obtainFootnote 4

$$\begin{aligned} z F_0 + z u_1 F_1&= u_1^2 f_0(u_1),\\ z F_0 + z u_2 F_1&= u_2^2 f_0(u_2). \end{aligned}$$

This linear system is easily solved by Kramer’s formula, which yields

$$\begin{aligned} F_0(z)&= - \frac{u_1 u_2 \left( u_1 f_0(u_1) - u_2 f_0(u_2) \right) }{z (u_1 - u_2)}\,, \\ F_1(z)&= \frac{u_1^2 f_0(u_1) - u_2^2 f_0(u_2) }{z (u_1 - u_2)}\,. \end{aligned}$$

Now, let the functions F(zu) and \(F_k(z)\) denote functions associated with \(f_0(u) = u^3\) (i.e., there is one walk of length 0 at altitude 3) and let the functions G(zu) and \(G_k(z)\) denote functions associated with \(f_0(u) = u^4\). One thus gets the following theorem:

Theorem 7.2

(Closed forms for the generating functions) Let us consider walks in \(\mathbb {N}^2\) with jumps \(-2\) and \(+5\). The number of such walks starting at altitude 3 and ending at altitude 0 is given by \(F_0(z)\), the number of such walks starting at altitude 4 and ending at altitude 1 is given by \(G_1(z)\), and we have the following closed forms in terms of the small roots \(u_1(z)\) and \(u_2(z)\) of \(1-zP(u)=0\) with \(P(u)=u^{-2}+u^5\):

$$\begin{aligned} F_0(z)&= - \frac{u_1 u_2 \left( u_1^4 - u_2^4\right) }{z (u_1 - u_2)}, \end{aligned}$$
(7.7)
$$\begin{aligned} G_1(z)&= \frac{u_1^6 - u_2^6 }{z (u_1 - u_2)}\,. \end{aligned}$$
(7.8)

Thanks to the bijection given in Sect. 4 between walks in the rational slope model and directed lattice paths in the Banderier–Flajolet model (and by additionally reversing the timeFootnote 5), it is now possible to relate the quantities A and B of Knuth with \(F_0\) and \(G_1\):

$$\begin{aligned} A_n&:= A[5n-1,2n-1] = [z^{7n-2}] G_1(z), \end{aligned}$$
(7.9)
$$\begin{aligned} B_n&:= B[5n-1,2n-1] = [z^{7n-2}] F_0(z). \end{aligned}$$
(7.10)

Indeed, from the bijection of Proposition 7.1, the walks strictly below \(y =\frac{a}{c} x + \frac{b}{c}\) (with \(a=2\), \(c=5\)) and ending at \((x,y) = (5n-1,2n-1)\) are mapped (in the Banderier–Flajolet model, not allowing to touch \(y=0\)) to walks starting at (0, b) and ending at \((x+y,ax-cy+b)=(7n-2,3+b)\). Reversing the time and allowing to touch \(y=0\) (thus b becomes \(b-1\)), we see that \(A_n\) counts walks starting at 4, ending at 1 (the generating function of this sequence is given by \(G_1\)!) and that \(B_n\) counts walks starting at 3, ending at 0 (the generating function of this sequence is given by \(F_0\)!). While there is no nice formula for \(A_n\) or \(B_n\) (see, however, [7] and page 136 for a formula involving nested sums of binomials), it is striking that there is a simple and nice formula for \(A_n+B_n\):

Theorem 7.3

(Closed form for the sum of coefficients) The sum of the number of Dyck paths (in our rational slope model) touching or staying below \(y=(2/5)x+1/5\) and \(y=(2/5)x\) simplifies to the following expression:

$$\begin{aligned} A_n + B_n = \frac{2}{7n-1} \left( {\begin{array}{c}7n-1\\ 2n\end{array}}\right) . \end{aligned}$$
(7.11)

Proof

A first proof of this was given by [53] using a variant of the cycle lemma. (We comment more on this in Sect. 7.) We give here another proof; indeed, our Theorem 7.2 (Closed form for the generating functions) implies that

$$\begin{aligned} A_n + B_n = [z^{7n-1}] \left( u_1^5 + u_2^5 \right) \,. \end{aligned}$$
(7.12)

This suggests to use holonomy theory to prove the theorem. First, a resultant equation gives the algebraic equation for \(U:=u_1^5\) (namely, \(z^7+(U-1)^5 U^2=0\)) and then, the Abel–Tannery–Cockle–Harley–Comtet theorem (see the comment after Proposition 4 in [7]) transforms it into a differential equation for the series \(u_1^5(z^2)\). It is also the differential equation (up to distinct initial conditions) for \(u_2^5(z^2)\) (as \(u_2\) is defined by the same equation as \(u_1\)) and thus of \(u_1^5(z^2)+u_2^5(z^2)\). Therefore, it directly gives the differential equation for the series \(C(z)=\sum _n (A_n+B_n) z^n\), and it corresponds to the following recurrence for its coefficients:

$$ {C_{n+1}=\frac{7}{10}\frac{(7n+5)(7n+4)(7n+3)(7n+2)(7n+1)(7n-1)}{(5n+4)(5n+3)(5n+2)(5n+1)(2n+1)(n+1)}C_n\,,} $$

which is exactly the hypergeometric recurrence for \(\frac{2}{7n-1} \left( {\begin{array}{c}7n-1\\ 2n\end{array}}\right) \) (with the same initial condition). This computation takes 1 second on an average computer, while, if not done in this way (e.g., if instead of the resultant shortcut above, one uses several gfun[diffeq*diffeq] or variants of it in Maple, see [58] for a presentation of the corresponding package), the computations for such a simple binomial formula surprisingly take hours.

Some additional investigations conducted by Manuel Kauers (private communication) show that this is the only linear combination of \(A_n\) and \(B_n\) which leads to a hypergeometric solution (to prove this, you can compute a recurrence for a formal linear combination \(r A_n+ s B_n\), and then check which conditions it implies on r and s if one wishes the associated recurrence to be of order 1, i.e., hypergeometric). It thus appears that \(r A_n+ s B_n\) is generically of order 5, with the exception of a sporadic \(4A_n-B_n\) which is of order 4, and the miraculous \(A_n+B_n\) which is of order 1 (hypergeometric).

However, there are many other hypergeometric expressions floating around: expressions of the type of the right-hand side of (7.12) have nice hypergeometric closed forms. This can also be explained in a combinatorial way; indeed, we observe that setting \(k=-5\) in Formula (10) from [8] leads to \(5 W_{-5}(z) = \varTheta (A(z)+B(z))\) (where \(\varTheta \) is the pointing operator). The “Knuth pointed walks” are thus in 1-to-5 correspondence with unconstrained walks (see our Table 1, top left) ending at altitude −5.

We want to end this section with exemplifying the miracles involved in the simplifications of (7.11). Using the Flajolet–Soria formula [7] for the coefficients of an algebraic function, we can extract the coefficient of \(z^{7n-2}\) of \(G_1(z)\) and \(F_0(z)\) in terms of nested sums. According to (7.9), this corresponds to \(A_n\) and \(B_n\), which are thus given by formulae involving respectively 45 and 34 nested sumsFootnote 6 (see Fig. 5).

Then, in the next section, we perform some analytic investigations in order to prove what Knuth conjectured:

$$\begin{aligned} \frac{A_n}{B_n} = \kappa _1 - \frac{\kappa _2}{n} + \mathscr {O}(n^{-2}), \end{aligned}$$

with \(\kappa _1\approx 1.63026\) and \(\kappa _2\approx 0.159\).

Fig. 5
figure 5

The “ugly + ugly = nice” formula. \(A_n\) is counting Dyck paths touching or staying below the line \(y=(2/5) x+ 1/5 \), and \(B_n\) is counting Dyck paths touching or staying below the line \(y=(2/5) x\). They are given by complicated “ugly” nested sums, so the miracle is that the sum \(A_n + B_n\) is nice. We give several explanations of this fact in this article

6 Asymptotics

As usual, we need to locate the dominant singularities and to understand the local behavior there. The fact that there are several dominant singularities makes the game harder here, and this case was only sketched in [8]. Similarly to what happens in the rational world (Perron–Frobenius theory), or in the algebraic world (see [7]), a periodic behavior of the generating function leads to some more complicated proofs, because additional details have to be taken into account. With respect to walks, it is, e.g., crucial to understand how singularities spread among the roots of the kernel. To this aim, some quantities will play a key role: The structural constant \(\tau \) is defined as the unique positive root of \(P'(\tau )\), where

$$P(u)=u^{-2}+u^5$$

is encoding the jumps, and the structural radius \(\rho \) is given as \(\rho = 1/P(\tau )\). For our problem, one thus has the explicit values (Fig. 6):

$$\begin{aligned} \tau&= \root 7 \of {\frac{2}{5}},&P(\tau )&= \frac{7}{10} \root 7 \of {2^5 5^2},&\rho&= \frac{\root 7 \of {2^2 5^5}}{7}. \end{aligned}$$
Fig. 6
figure 6

P(u) is the polynomial encoding the jumps, and its saddle point \(\tau \) gives the singularity \(\rho =1/P(\tau )\) where the small root \(u_1\) (in green) meets the large root \(v_1\) (in red), with a square root behavior. (In black, we also plotted \(|u_2|, |v_2|=|v_3|\), and \(|v_4|=|v_5|\).) This is the key for all asymptotics of such lattice paths

From [8], we know that the small branches \(u_1(z)\) and \(u_2(z)\) are possibly singular only at the roots of \(P'(u)\). Note that the jump polynomial has periodic support with period \(p=7\) as \(P(u) = u^{-2} H(u^7)\) with \(H(u) = 1 + u\). Due to that, there are 7 possible singularities of the small branches

$$\begin{aligned} \zeta _k = \rho \omega ^k, \qquad \text { with } \omega = e^{2 \pi i / 7}. \end{aligned}$$

Definition 7.3

We call a function F(z) p-periodic if there exists a function H(z) such that \(F(z)=H(z^p)\).

Additionally, we have the following local behaviors:

Lemma 7.1

(Local behavior due to rotation law) The limits of the smallbranches when \(z \rightarrow \zeta _k\) exist and are equal to

$$\begin{aligned} u_1(z) \underset{z\,\sim \,\zeta _k}{=}&{\left\{ \begin{array}{ll} \tau \omega ^{-3k} + C_k \sqrt{1 - z / \zeta _k} +\mathscr {O}((1 - z / \zeta _k)^{3/2}), &{} \text {for } k = 2,5,7,\\ \tau _2 \omega ^{-3k} + D_k (1-z / \zeta _k) + \mathscr {O}((1 - z / \zeta _k)^2), &{} \text {for } k= 1,3,4,6, \end{array}\right. }\\ u_2(z) \underset{z\,\sim \,\zeta _k}{=}&{\left\{ \begin{array}{ll} \tau _2 \omega ^{-3k} + D_k (1-z / \zeta _k) + \mathscr {O}((1 - z / \zeta _k)^2), &{} \text {for } k = 2,5,7,\\ \tau \omega ^{-3k} + C_k \sqrt{1 - z / \zeta _k} +\mathscr {O}((1 - z / \zeta _k)^{3/2}), &{} \text {for } k= 1,3,4,6, \end{array}\right. } \end{aligned}$$

where \(\tau _2 = u_2(\rho )\approx -.707723271\) is the unique real root of \(500t^{35}+3900t^{28}+13540t^{21}+27708t^{14}+37500t^7+3125\), \(C_k = -\frac{\tau }{\sqrt{5}} \omega ^{-3k}\), and \(D_k = \tau _2\frac{\tau _2^7+1}{5\tau _2^7-2} \omega ^{-3k}\).

Proof

We will show the following rotation law for the small branches (for all \(z \in \mathbb {C}\), with \(|z| \le \rho \) and \(0<\arg (z)<\pi -2\pi /7\)):

$$\begin{aligned} u_1(\omega z)&= \omega ^{-3} u_2(z),\\ u_2(\omega z)&= \omega ^{-3} u_1(z). \end{aligned}$$

Let us consider the function \(U(z):=\omega ^3 u_i(w z)\) (with \(i=1\) or \(i=2\), as you prefer!) and the quantity X, defined by \(X(z):= U^2-z\phi (U)\) (where \(\phi (u):=u^2 P(u)\)). So we have \(X(z)= (\omega ^3 u_i(\omega z))^2-z \phi (\omega ^3 u_i(\omega z))= \omega ^6 u_i(\omega z)^2 -z \phi (u_i(\omega z))\) (because \(\phi \) is 7-periodic) and thus \(\omega X(z/\omega )= \omega (\omega ^6 u_i(z)^2 -z/\omega \phi (u_i(z))) = u_i(z)^2 -z \phi (u_i(z))\), which is 0 because we recognize here the kernel equation. This implies that \(X=U^2-z\phi (U)=0\) and thus U is a root of the kernel. Which one? It is one of the small roots, because it is converging to 0 at 0. What is more, this root U is not \(u_i\), because it has a different Puiseux expansion (and Puiseux expansions are unique). So, by the analytic continuation principle (therefore, here, as far as we avoid the cut line \(\arg (z)=-\pi \)), we just proved that \(\omega ^3 u_1(\omega z)= u_2(z)\) and \(\omega ^3 u_2(\omega z)= u_1(z)\) (and this also proves a similar rotation law for large branches, but we do not need it).

Accordingly, at every \(\zeta _k\), among the two small branches, only one branch becomes singular: This is \(u_1\) for \(k=2,5,7\) and \(u_2\) for \(k=1,3,4,6\). This is illustrated in Fig. 7.

Hence, we directly see how the asymptotic expansion at the dominant singularities is correlated with the one of \(u_1\) at \(z=\rho =\zeta _7\), which we derive following the approach of [8]; this gives for \(z\sim \rho \):

$$\begin{aligned} u_{1}(z) = \tau + C_7\sqrt{1 - z / \rho } + C'_7(1-z/\rho )^{3/2}+\ldots , \end{aligned}$$

where \(C_7= -\sqrt{2 \frac{P(\tau )}{P''(\tau )}}\). Note that in our case \(P^{(3)}(\tau )=0\) (this funny cancellation holds for any \(P(u)=p_{5} u^5+p_0+p_{-2} u^{-2}\) ), so even the formula for \(C'_7\) is quite simple: \(C'_7=-\frac{1}{2} C_7\).

In the lemma, the formula for \(\tau _2=u_2(\rho )\) is obtained by a resultant computation.

Fig. 7
figure 7

The locations of the 7 possible singularities of the small branches (left); the small branch which is singular at that location (right)

For the local analysis of Knuth’s generating functions \(F_0(z)\) and \(G_1(z)\) with periodic support, we introduce a shorthand notation.

Definition 7.4

(Local asymptotics extractor \([z^{n}]_{\zeta _k}\)) Let F(z) be an algebraic function with p dominant singularities \(\zeta _k\) (for \(k=1,\ldots , p\)). Accordingly, for each \(\zeta _k\), F(z) can be expressed as a Puiseux series; that is, there exist \(r \in \mathbb {Q}\) and coefficients \(c_n\) (both depending on k) such that

$$ F(z) = \sum _{j \ge 0} c_j (1 - z/\zeta _k)^{r j}, \qquad \text {for } z \sim \zeta _k. $$

Then, we define the local asymptotic extractor \([z^{n}]_{\zeta _k}\) as

$$\begin{aligned}{}[z^{n}]_{\zeta _k}F(z) := \sum _{j \ge 0} c_j [z^n] (1 - z/\zeta _k)^{r j}. \end{aligned}$$

This notation can be considered as “extracting the \(z^n\)-coefficient in the Puiseux expansionFootnote 7 of F(z) at \(z=\zeta _k\),” and singularity analysis allows to write \([z^n] F(z) = \sum _{k} [z^{n}]_{\zeta _k}F(z)+o(C^{-n})\), for some constant \(C > |\zeta _k|\).

Example 7.1

A sloppy but easy to remember formulation would be to say

$$\begin{aligned}{}[z^{n}]_{\zeta _k}F(z) := [z^n] \text {(singular expansion of }F(z)~\text {at }z=\zeta _k). \end{aligned}$$

This is well illustrated by the generating function D(z) of Dyck paths defined by the functional equation \(D(z) = 1+ z^2 D(z)^2\). In this case, we have \(D(z) = \frac{1 - \sqrt{1- 4z^2}}{2z^2}\) with \(p=2\) and \(\zeta _1 = 1/2\) and \(\zeta _2 = -1/2\). Therefore, we get for any \(\varepsilon >0\)

$$\begin{aligned}{}[z^n] D(z)&= [z^{n}]_{1/2} \,D(z) + [z^{n}]_{-1/2} \,D(z) + o\left( \left( 2-\varepsilon \right) ^{n}\right) \\&= [z^n] (-2\sqrt{2})\sqrt{1 - 2z} + [z^n] (-2\sqrt{2}) \sqrt{1 + 2z} + O\left( \frac{2^n}{n^{5/2}}\right) + o\left( \left( 2-\varepsilon \right) ^{n}\right) \,. \end{aligned}$$

Proposition 7.2

(Periodic rule of thumb) Let \(\rho \) be the positive real dominant singularity in the previous definition. If additionally the generating function F(z) satisfies a rotation law \(F(\omega z)=\omega ^mF(z)\) (where \(\omega =\exp (2i\pi /p)\), p maximal), then one has a neat simplification:

$$\begin{aligned}{}[z^n]F(z) = p [z^n]_{\rho } F(z) + o(\rho ^n), \end{aligned}$$

if \(n-m\) is a multiple of p. (The other coefficients are equal to 0.)

Proof

As F(z) is a generating function, it has real positive coefficients, and therefore, by Pringsheim’s theorem [33, Theorem IV.6], one of the \(\zeta _k\)’s has to be real positive, called \(\rho \). We relabel the \(\zeta _k\)’s such that \(\zeta _k:=\omega ^k \rho \). Then

$$\begin{aligned}{}[z^n]F(z)-o(\rho ^n)&=\sum _{k=1}^p [z^{n}]_{\zeta _k}F(z) =\sum _{k=1}^p [z^{n}]_{\zeta _k}(\omega ^m)^k F(\omega ^{-k} z) \\&=\sum _{k=1}^p (\omega ^m)^k (\omega ^{-k})^n [z^n]_\rho F(z) \\&=\left( \sum _{k=1}^p (\omega ^k)^{m-n}\right) [z^n]_\rho F(z) = p [z^n]_{\rho } F(z), \end{aligned}$$

if \(n-m\) is a multiple of p, and 0 elsewhere.

We can apply this proposition to \(F_0(z)\) and \(G_1(z)\), because the rotation law for the \(u_i\)’s implies: \(F_0(\omega z)=\omega ^{-2} F_0(z)\) and \(G_1(\omega z)=w^{-2} G_1(z)\). Thus, we just have to compute the asymptotics coming from the Puiseux expansion of \(F_0(z)\) and \(G_1(z)\) at \(z=\rho \), and multiply it by 7 (recall that it is classical to infer the asymptotics of the coefficients from the Puiseux expansion of the functions via the so-called transfer Theorem VI.3 from [33]); this gives:

Theorem 7.4

(Asymptotics of coefficients, answer to Knuth’s problem) The asymptotics for the number of excursions below \(y=(2/5)x+2/5\) and \(y=(2/5)x+1/5\) are given by:

$$\begin{aligned} A_n&=[z^{7n-2}] G_1(z) = \alpha _1 \frac{\rho ^{-7n}}{\sqrt{\pi (7n-2)^3}} + \frac{3\alpha _2}{2}\frac{\rho ^{-7n}}{\sqrt{\pi (7n-2)^5}} + \mathscr {O}(\rho ^{-7n}n^{-7/2}), \\ B_n&=[z^{7n-2}] F_0(z) = \beta _1 \frac{\rho ^{-7n}}{\sqrt{\pi (7n-2)^3}} + \frac{3\beta _2}{2}\frac{\rho ^{-7n}}{\sqrt{\pi (7n-2)^5}} + \mathscr {O}(\rho ^{-7n}n^{-7/2}), \end{aligned}$$

with the following constants, where we use the shorthand \(\mu \) for \(\tau _2/\tau \):

$$\begin{aligned} \alpha _1&= \frac{\mu ^4 + 2 \mu ^3 + 3 \mu ^2 + 4 \mu + 5}{\sqrt{5}}, \qquad \beta _1 = \sqrt{5}-\alpha _1, \qquad \beta _2 = -\frac{9}{10}\sqrt{5} - \alpha _2, \\ \alpha _2&= -\frac{1}{2} \frac{ \tau _2^7 (13\mu ^4 + 22\mu ^3 + 29\mu ^2+36\mu +45) }{\sqrt{5}(5\tau _2^7-2)}\\&\qquad \qquad \qquad \qquad \qquad -\frac{1}{5} \frac{ 15\mu ^4+20\mu ^3+13\mu ^2-8\mu -45}{\sqrt{5}(5\tau _2^7-2)}. \end{aligned}$$

This theorem leads to the following asymptotics for \(A_n+B_n\) (and this is for sure a good sanity test, coherent with a direct application of Stirling’s formula to the closed-form formula (7.11) for \(A_n+B_n\)):

$$\begin{aligned} A_n+B_n = \sqrt{\frac{5}{7^3\pi }} \frac{\rho ^{-7n}}{\sqrt{ n^3}} + \mathscr {O}(n^{-5/2}). \end{aligned}$$

Finally, we directly get

$$\begin{aligned} \frac{A_n}{B_n}&= \frac{\alpha _1 + \frac{3\alpha _2}{2 (7n-2)}}{\beta _1 + \frac{3\beta _2}{2 (7n-2)}} + \mathscr {O}(n^{-2}) = \frac{\alpha _1}{\beta _1} + \frac{3}{14} \left( \frac{\alpha _2 \beta _1 - \alpha _1 \beta _2}{\beta _1^2} \right) \frac{1}{n} + \mathscr {O}(n^{-2}), \end{aligned}$$

which implies that Knuth’s constants are

$$\begin{aligned} \kappa _1&= \frac{\alpha _1}{\beta _1} = - \frac{5}{\mu ^4 + 2 \mu ^3 + 3 \mu ^2 + 4 \mu } - 1 \\&\approx 1.6302576629903501404248,\\ \kappa _2&= - \frac{3}{14} \left( \frac{\alpha _2 \beta _1 - \alpha _1 \beta _2}{\beta _1^2} \right) = \frac{3}{9800} (13-236 \kappa _1 -194 \kappa _1^2 -388 \kappa _1^3 +437 \kappa _1^4) \\&\approx 0.1586682269720227755147. \end{aligned}$$

Now a few resultant computations give the algebraic equations satisfied by \(\tau _2\), \(\kappa _1\) and \(\kappa _2\). We will illustrate their derivation with the required Maple commands. In what follows, these are always set in a typewriter font. First, we compute an annihilating polynomial for \(\rho \):

figure c

Then, we construct from it an annihilating polynomial for \(u_i(\rho )\).

figure d

This polynomial contains \(u_1(\rho )=\tau \) and \(u_2(\rho )=\tau _2\) as roots. It factorizes into smaller polynomials, and these two roots are in separate factors. Thus, we can go on with the right factor which we save in Rtau2. Then, we continue with the annihilating polynomial for \(\mu \).

figure e

We identify the algebraic relation for \(\mu \) and save it in Rmu. Finally, we compute the minimal polynomial for \(\kappa _1\):

figure f

In conclusion, \(\kappa _1\) is the unique real root of the polynomial \(23 x^5 -41 x^4 +10 x^3 -6x^2 - x- 1\), and similar computations show that \((7/3) \kappa _2\) is the unique real root of \(11571875x^5-5363750x^4+628250x^3-97580x^2+5180x-142\). The Galois group of each of these polynomials is \(S_5\). This implies that there is no closed-form formula for the Knuth constants \(\kappa _1\) and \(\kappa _2\) in terms of basic operations on integers and roots of any degree.

In the next section, we want to establish a link with the results from Nakamigawa and Tokushige. We will show how Knuth derived his problem and how to establish more such nice identities.

7 Links with the Work of Nakamigawa and Tokushige

In this section, we show the connection between a result of Nakamigawa and Tokushige [53] and Knuth’s statement. Furthermore, we derive extensions of this result.

Let \(\alpha , \beta \) be positive rational numbers. The Nakamigawa–Tokushige model consists of a single boundary \(L:y = \alpha x + \beta \) and a lattice pointFootnote 8 \(Q=(q_1, q_2) \in {\mathbb Z}^2\) on L, i.e., \(q_2 = \alpha q_1 + \beta \). Furthermore, the walks go in the opposite direction; that is, they start in Q, use unit steps South and West (i.e., \((0,-1)\) and \((-1,0)\), respectively) and end in the origin. Let V be the “vast” set of such walks without any restriction. The enumeration of V is a folklore result: \(|V| = \genfrac(){0.0pt}1{q_1+q_2}{q_1}\). Let \(W \subset V\) be the set of walks which do not cross the line L and touch it only at Q.

Definition 7.5

(Nearest distance to the boundary) Let \(w \in V\) be a walk from a point Q to the point (0, 0). We define the minimum y-distance \(\delta (w)\) as follows: If the walk w touches or crosses the boundary \(y=\alpha x +\beta \) after the first step, then let \(\delta (w) = 0\), otherwise let \(\delta (w)\) be the minimum of \(\alpha p_1 + \beta - p_2\), where \((p_1,p_2)\) runs over all lattice points on w except Q, see Fig. 8.

Fig. 8
figure 8

The 3 walks of length 6 in the \((2/5)x+2/5\) model with \(\delta (w) >0\). The vertical bars mark the minimal y-distance \(\delta (w)\). The first walk has \(\delta (w)=1/5\), whereas the last two have \(\delta (w)=2/5\). All of them are members of \(W_{1/5}\), but only the two last ones belong to \(W_{2/5}\)

Hence, we see that \(\delta (w) = 0\) if and only if \(w \in V \setminus W\), and so \(\sum _{w \in V} \delta (w) = \sum _{w \in W} \delta (w)\). Note, if \(\alpha \) and \(\beta \) are positive integers, then \(\sum _{w \in V} \delta (w) = |W|\), because \(\delta (w) = 1\) for all \(w \in W\). This gives rise to the interpretation as a weighted sum corresponding to the number of walks.

For a real \(t \ge 0\), let \(W_t := \{ w \in W \, | \, \delta (w) \ge t \}\); that is, the walks staying at least a y-distance of t away from the boundary. Due to the definition, \(|W_t|\) is a left-continuous step function of t, and we get the representation

$$\begin{aligned} \int _{0}^{1} |W_t| \, dt = \sum _{w \in V} \delta (w). \end{aligned}$$

It is quite nice that this sum can be further simplified; this is what the next theorem states:

Theorem 7.5

(Nakamigawa–Tokushige lattice path integral) Let \(q_1,q_2\) be positive integers, and let \(\alpha ,\beta \) be positive reals with \(q_2=\alpha q_1 + \beta \). Let V be the set of walks from the origin to the pointFootnote 9 \((q_1,q_2)\). Then, we have

$$\begin{aligned} \int _{0}^{1} |W_t| \, dt = \sum _{w \in V} \delta (w) = \frac{\beta }{q_1+q_2} \genfrac(){0.0pt}0{q_1+q_2}{q_1}. \end{aligned}$$
(7.13)

Proof

This corresponds to [53, Theorem 1 and Corollary 1], where it is proven using a cycle lemma approach. We give a generalization of this formula in Sect. 8 hereafter, based on our kernel method approach and Lagrange inversion.

A geometric bijection. If \(\alpha \) is a rational slope, i.e., \(\alpha = a/c\) for some \(a,c \in \mathbb {N}\setminus \{ 0 \}\), then

$$\begin{aligned} \int _{0}^{1} |W_t| \, dt = \frac{1}{c} \sum _{t \in T} |W_t|, \end{aligned}$$
(7.14)

where \(T = \{\delta (w) \, | \, w \in W \} = \{ 1/c, 2/c, \ldots , (c-1)/c \}\).

This gives rise to the following interpretationFootnote 10: If \(w \in W\), then the first step is a South step. Then, let \(\tilde{w}\) be the walk obtained from w by omitting this step. Therefore, \(\tilde{w}\) is a walk with \(q_1+q_2-1\) steps, starting from \(Q - (0,1) = (q_1,q_2-1)\) and ending in the origin. We see that all these walks which never cross or touch L are in bijection with all walks in W. Now, take a walk \(w \in W_t\) and its corresponding walk \(\tilde{w}\). As \(\delta (w) \ge t\), we can translate the barrier L by \(t- 1/c\) down and the walk \(\tilde{w}\) still does not touch or cross this new barrier \(\tilde{L}\). Hence, all walks in \(W_t\) are in bijection with walks from \((q_1,q_2-1)\) to the origin which stay strictly below the barrier \(\tilde{L}\).

Example 7.2

This is the bijection that Knuth used in order to state his conjecture. In his case, we have \(\alpha =\beta =2/5\) and \(q_1=5n-1\), \(q_2=2n\) for \(n \in \mathbb {N}\setminus \{ 0 \}\). We see that \(q_2=\alpha q_1 + \beta \). Hence, \(a=2\) and \(c=5\) which implies \(T = \{1/5, 2/5, 3/5, 4/5 \}\). In this case, the values 3 / 5 and 4 / 5 are playing no role, as \(|W_{3/5}| = |W_{4/5}| = 0\) because \(\beta =2/5\) is the maximal value for \(\delta (w)\) for all walks to the origin. Therefore, \(\int _{0}^{1} |W_t| \, dt\) can be represented by two summands involving \(W_{1/5}\) and \(W_{2/5}\). They correspond to the two models A and B with the barriers \(L_{1} : y < (2/5) x + 2/5\) and \(L_{2} : y < (2/5) x + 1/5\), respectively, where the paths start at \((5n-1,2n-1)\) and move by South and West steps to the origin. Compare also Fig. 8. Note that in Knuth’s case the walks move in the opposite direction, which is obviously equivalent.

In general, the number of summands \(|W_t|\), which corresponds to the number of models in the equivalent formulation, is determined by the size of T minus the maximal y-distance at (0, 0). Hence, we need to consider \(\widetilde{T} = \{t \in T \, | \, t < \beta \} = \{ 1/c,\ldots ,k/c \}\). This gives k models with walks from \((q_0,q_1-1)\) to the origin which stay strictly below the boundaries \(L_i : y < \alpha x + (\beta - (i-1)/c)\) for \(i=1,\ldots ,k\). Then, the above reasoning implies that the walks with boundary \(L_i\) correspond to the set \(W_{i/c}\). Thus, counting the walks in these k models and summing them up give the binomial closed form appearing in the lattice path integral theorem (7.13) divided by c, compared with (7.14).

Up to now in this section, we explained which different counting models are connected with the Nakamigawa–Tokushige lattice path integral formula. Now, we discuss the possible starting points on the boundary and their interplay with the (ir)rationality of the slope.

Lemma 7.2

(Possible starting points on the boundary) Let \(\alpha ,\beta \) be positive reals. Then the equation \(y = \alpha x + \beta \) possesses in the positive integers

  1. 1.

    infinitely many solutions (xy), if \(\alpha = a/c,~ \beta =b/c\) with \(a,b,c \in \mathbb {N}\), and \(\gcd (a,c)|b\);

    $$\begin{aligned} x&= c s - r_a,&y&= a s + r_c, \end{aligned}$$

    with \(s \ge S_0 := \max \left( \lceil r_a/c \rceil , \lceil -r_c /a \rceil \right) \), and \(r_a\) and \(r_c\) are integers such that \(r_a a + r_c c = b\);

  2. 2.

    exactly one solution \((x,y) = (q_1,q_2)\), if \(\alpha \notin \mathbb {Q}\) and \(\beta = q_2 - \alpha q_1 > 0\);

  3. 3.

    no solution, otherwise.

Proof

Let us start with rational slope \(\alpha = a/c\), with \(a,c \in \mathbb {N}\). In order to get integer solutions we need a rational \(\beta = b/c\), with \(b \in \mathbb {N}\). Then we need to find the solutions of the following linear Diophantine equation:

$$\begin{aligned} cy - ax = b. \end{aligned}$$
(7.15)

These solutions exist if and only if \(\gcd (a,c) | b\). By the extended Euclidean algorithm we get integers \(r_a, r_c \in {\mathbb Z}\) such that

$$\begin{aligned} r_a a + r_c c = b. \end{aligned}$$

This is done by first computing numbers \(r_a', r_c'\) such that

$$r_a' a/\gcd (a,c) + r_c' / \gcd (a,c) = 1$$

and multiplying by b. All solutions are then given by the linear combination stated in the lemma. Due to the special form of (7.15) with a positive and a negative coefficient in front of the unknowns, it follows that for all \(s \ge S_0\) the solutions are positive.

Finally, let \(\alpha \) be irrational. Assume there exist two points \(Q = (q_1,q_2)\) and \(P = (p_1, p_2)\) fulfilling the assumptions. By taking the difference, we get \(q_2-p_2 = \alpha (q_1-p_1)\) which implies that for \(q_1 \ne q_2\) we get the contradiction \(\alpha \in \mathbb {Q}\). But for \(q_1 = q_2\) it also holds that \(p_1 = p_2\) and therefore \(Q=P\).

It is easy to see that this solution exists if and only if \(\beta = q_2 - \alpha q_1\) for arbitrary \(q_1, q_2 \in \mathbb {N}\) as long as \(\beta > 0\).

The previous lemma also appeared in [42]; there, Kempner (of Kempner’s series fame) also mentions that a similar claim holds for the number of algebraic rational (respectively algebraic) points on \(y =\alpha x +\beta \) when \(\alpha \) is algebraic (respectively transcendental) slope. The lemma gives us all possible integer solutions on a boundary with rational slope. With this knowledge, we can reformulate the lattice path integral from Theorem 7.5 in order to give a more explicit result for all possible starting points and for any slope.

Theorem 7.6

(Lattice path integral and explicit binomial expression) Let abc be positive integers such that \(\gcd (a,c)|b\). Let \(r_a, r_c\) be integers such that \(r_a a + r_c c = b\). Then, \(q_1(s):=cs-r_a\) and \(q_2(s):=as+r_c\) define all pairs \((q_1(s),q_2(s))\) of integers on the barrier \(L : y = \frac{a}{c} x + \frac{b}{c}\). Furthermore, let V be the set of walks from \((q_1(s),q_2(s))\) to the origin strictly below the barrier L. Then, we have

$$\begin{aligned} \int _{0}^{1} |W_t| \, dt = \frac{b/c}{(a+c)s + (r_c - r_a)} \genfrac(){0.0pt}0{(a+c)s + (r_c - r_a)}{a s + r_c}, \end{aligned}$$
(7.16)

for \(s \ge S_0:=\max \left( \lceil r_a/c \rceil , \lceil -r_c /a \rceil \right) \).

For fixed s, the walks are ending after \(q_1(s) + q_2(s) = (a+c)s + (r_c - r_a)\) steps, start at \((q_1(s),q_2(s))\) and go to the origin. In the equivalent formulation, the walks start at \((q_1(s),q_2(s)-1)\) and go to the origin, but we consider \(k = c\beta = b \) different boundaries, given by

$$\begin{aligned} L_1: y< \frac{a}{c}x + \frac{b}{c}, \qquad L_2: y< \frac{a}{c}x + \frac{b-1}{c}, {\qquad \dots , \qquad } L_b: y < \frac{a}{c}x + \frac{1}{c}. \end{aligned}$$

Example 7.3

Returning to Knuth’s model, we have \(y < \frac{2}{5}x + \frac{2}{5}\). Thus, the explicit values are \(a=b=2\) and \(c=5\) and the assumptions of Theorem 7.6 (Lattice path integral and explicit binomial expression) are satisfied, as \(\gcd (a,c)=1\). The Euclidean algorithm gives \(r_a=-4\) and \(r_c=2\). From Lemma 7.2 on the possible starting point on the boundary, we deduce the possible integer coordinates on the barrier L:

$$\begin{aligned} q_1(s)&= 5s + 4,&q_2(s)&= 2s + 2, \end{aligned}$$

for \(s \ge 0\) which represent the starting points of the walks. Finally, Theorem 7.6 directly gives the solution

$$\begin{aligned} \int _{0}^{1} |W_t| \, dt = \frac{2/5}{7s+6} \genfrac(){0.0pt}0{7s+6}{2s+2}. \end{aligned}$$

This value can be equivalently interpreted as the number of walks in \(k=2\) models starting from \((5s+4,2s+1)\) and moving to the origin below the barriers

$$\begin{aligned} L_1: y&< \frac{2}{5}x + \frac{2}{5},&L_2: y&< \frac{2}{5}x + \frac{1}{5}. \end{aligned}$$

This is exactly Knuth’s problem, where his index \(t=s+1\).

Formula (7.16) directly yields nice lattice path identities in the manner of Knuth’s problem. Yet, there are even more formulae of this type that we will reveal in the next section. But let us start with an interesting (everyday) problem first.

8 Duchon’s Club and Other Slopes

8.1 Duchon’s Club: Slope 2/3 and Slope 3/2

A Duchon walk is a Dyck path starting from (0, 0), with East and North steps, and ending on the line \(y=\frac{2}{3}x\) (see Fig. 9). This model was analyzed by Duchon [28] and further investigated by Banderier and Flajolet [8], who called it the “Duchon’s club” model, as it can be seen as the number of possible “histories” of couples entering a club in the evening,Footnote 11 and exiting in groups of 3. What is the number of possible histories (knowing the club is closing empty)? Well, this is exactly the number \(E_n\) of excursions with n steps \(+2, -3\), or (by reversal of the time) the number of excursions with n steps \(-2, +3\). This gives the sequence \((E_{5n})_{n\in \mathbb {N}}=(1,2,23,377,7229,151491,3361598,\dots )\) (OEIS A060941). In fact, these numbers \(E_n\) appeared already in the article by Bizley [17] (who gave some binomial formulae, as we explained in Sect. 2). Duchon’s club model should then be the Bizley–Duchon’s club model; Stigler’s law of eponymy strikes again.

One open problem in the article [28] was the following one: “The mean area is asymptotic to \(K n^{3/2}\), but the constant K can only be approximated to 3.43.” Our method allows to identify this mysterious constant:

Theorem 7.7

(Area below Duchon lattice paths) The average area below Duchon excursions of length n (lattice paths from 0 to 0, which jumps \(-2\) and \(+3\)) is

$$A_n \sim K n^{3/2} \text { where } K=\sqrt{15 \pi }/2 \approx 3.432342124\,.$$

Proof

The approach of [10] gives an expression for \(A(z)=\sum A_n z^n\) in terms of the two small roots \(u_1(z)\) and \(u_2(z)\) of \(1-z(1/u^2+u^3)=0\). Then, using the rotation law gives the singular behavior of A(z) and therefore the asymptotics of \(A_n\) with the explicit constant K (Fig. 11).

Fig. 9
figure 9

Dyck paths below the line of slope 2/3 and Duchon’s club histories (i.e., excursions with jumps \(+2, -3\)) are in bijection. Duchon conjectured that the average area (in gray) after n jumps is asymptotically equal to \(K n^{3/2}\); our approach shows that \(K=\sqrt{15 \pi }/2\)

8.2 Arbitrary Rational Slope

The closed form for the coefficient (Theorem 7.3) generalizes to arbitrary rational slope:

Theorem 7.8

(General closed forms for any rational slope) Let abc be integers such that \(\gcd (a,c)|b\). Let \(A_s(k)\) be the number of Dyck walks below the line of slope \(y=\frac{a}{c} x + \frac{k}{c}\), ending at \((x_s,y_s)\) given by

$$\begin{aligned} x_s&= c s - r_a,&y_s&= a s + r_c - 1, \end{aligned}$$

where \(r_a\) and \(r_c\) are integers such that \(r_a a + r_c c = b\). These numbers are non-negative for \(s \ge S_0 := \max \left( \lceil r_a/c \rceil , \lceil -r_c /a \rceil \right) \). Then, we have

$$\begin{aligned} \sum _{k=1}^{b} A_s(k) = \frac{b}{(a+c)s + (r_c - r_a)} \genfrac(){0.0pt}0{(a+c)s + (r_c - r_a)}{a s + r_c}. \end{aligned}$$

Proof

This result is a direct consequence of Theorem 7.6 (lattice path integral and explicit binomial expression) and the geometric bijection (7.14).

The enumeration of lattice paths below the line \(y=\frac{a}{c} x + \frac{b}{c}\) simplifies even more in the case \(a=b\). Additionally, we are able to extend the nice counting formula in terms of binomial coefficients. In order to get these nice formulae, let us first state what becomes the equivalent of Theorem 7.2 (Closed form for the generating function) in the case of any rational slope.

Lemma 7.3

(Schur polynomial closed form for meanders ending at a given altitude) Let us consider walks in \(\mathbb {N}^2\) with jumps \(-a\) and \(+c\) starting at altitude \(h \ge a\). Let \(u_1(z), \ldots ,u_a(z)\) be the small roots of the kernel equation \(1-zP(u)=0\), with \(P(u) = u^{-a} + u^c\). Let \(F_{0}(z), \ldots , F_{a-1}(z)\) be the generating functions of meanders ending at altitude \(0, \ldots , a-1\), respectively. They are given by

$$\begin{aligned} F_i (z) = \frac{(-1)^{a-i-1}}{z} s_{(h+1,1^{a-i-1},0^{i})} \left( u_1(z), \ldots , u_a(z) \right) , \end{aligned}$$
(7.17)

where \(s_{\lambda }(x_1,\ldots ,x_a)\) is a Schur polynomial in a variables, and \(\lambda = (\lambda _1,\ldots ,\lambda _a)\) is an integer partition, i.e., \(\lambda _1 \ge \lambda _2 \ge \cdots \ge \lambda _a \ge 0\). The notation \(1^{s}\) denotes s repetitions of 1.

Proof

Similar to (7.6) for the given step set, the functional equation is given by

$$\begin{aligned} (1 - z P(u)) F(z,u) = f_0(u) - z u^{-a} F_0(z) - z u^{-a+1} F_1(z) - \ldots - z u^{-1}F_{a-1}(z). \end{aligned}$$

Applying the kernel method, one may insert the a small branches into this equation. Then, one gets a independent linear equations for the a unknowns \(F_0(z),\ldots , F_{a-1}(z)\). Expressing the solutions by Cramer’s rule and rearranging the determinants, one uncovers the defining expressions for the claimed Schur polynomials (see, e.g., [62, Chap. 7.15] for an introduction to the relevant notions and notations).

Example 7.4

Let us consider the previous lemma for \(a=3\). We get the linear system

$$\begin{aligned} z \begin{pmatrix} 1 &{} u_1(z) &{} u_1(z)^2 \\ 1 &{} u_2(z) &{} u_2(z)^2 \\ 1 &{} u_3(z) &{} u_3(z)^2 \end{pmatrix} \begin{pmatrix} F_0(z) \\ F_1(z) \\ F_2(z) \end{pmatrix} = \begin{pmatrix} u_1(z)^{h+3} \\ u_2(z)^{h+3} \\ u_3(z)^{h+3} \end{pmatrix}\,. \end{aligned}$$

Solving it with Cramer’s rule and rearranging the determinants, we get

$$\begin{aligned} F_0(z)&= \frac{s_{(h+1,1,1)}(u_1,u_2,u_3)}{z}, \\ F_1(z)&= -\frac{s_{(h+1,1,0)}(u_1,u_2,u_3)}{z}, \\ F_2(z)&= \frac{s_{(h+1,0,0)}(u_1,u_2,u_3)}{z}, \end{aligned}$$

by the definition of Schur polynomials.

Now, we are able to extend the results of the closed form for the sum of coefficients (Theorem 7.3) even further. At its heart lies the nice expression (7.12): \(u_1^5+u_2^5\). We will see that such a phenomenon holds in full generality, involving a sum of \(u_i^h\).

Theorem 7.9

(General closed forms for lattice paths below a rational slope \(y=\frac{a}{c} x + \frac{b}{c}\), with b a multiple of a) Let ac be integers such that \(a<c\), and let b be a multiple of a. Let \(A_s(k)\) be the number of Dyck walks below the line of slope \(y=\frac{a}{c} x + \frac{k}{c}\), \(k \ge 1\), ending at \((x_s,y_s)\) given by

$$\begin{aligned} x_s&= c s - 1,&y_s&= a s - 1. \end{aligned}$$

Then, it holds for \(s \ge 1\) and \(\ell \in \mathbb {N}\) such that \((\ell + 1) a < c\) that

$$\begin{aligned} \sum _{k=\ell a+1}^{(\ell +1)a} A_s(k) = \frac{\ell a+c}{(a+c)s+\ell -1} \genfrac(){0.0pt}0{(a+c)s + \ell - 1}{as-1}. \end{aligned}$$

Proof

Consider walks starting at (0, 0), ending at \((x_s,y_s)\) and staying below the line \(\frac{a}{c} x + \frac{1}{c}\). These are counted by \(A_s(1)\). Let us transform such walks by adding a new horizontal jump at the end. Note that the first \(\lfloor \frac{c}{a} \rfloor \) jumps must be horizontal jumps. Thus, we can interpret this walk as one starting from (1, 0), ending at \((x_s+1,y_s)\) staying below the given boundary. But as a horizontal jump increases the distance to the boundary by \(\frac{a}{c}\), this is equivalent to counting walks starting at (0, 0), ending at \((x_s,y_s)\) and staying below the boundary \(\frac{a}{c} x + \frac{a+1}{c}\). This process is shown in Fig. 10. Such walks are counted by \(A_s(a+1)\).

Thus, the sequence \(A_s(1), A_s(a+1), A_s(2a+1), \ldots \) can be interpreted as counting walks staying always below the boundary \(\frac{a}{c} x + \frac{1}{c}\), starting at (0, 0) and ending at \((x_s,y_s), (x_s+1,y_s), (x_s+2,y_s), \ldots \), respectively. In particular, for \(\ell \ge 0\) we define these new ending points as \((\tilde{x}_s,\tilde{y}_s)\) given by

$$\begin{aligned} \tilde{x}_s&= x_s + \ell = c s + \ell - 1,&\tilde{y}_s&= y_s = a s - 1. \end{aligned}$$

Analogously, the same holds for \(A_s(2), \ldots , A_s(a-1)\).

For the start, we then follow the line of thought from Theorem 7.3 (Closed form for the sum of coefficients). Let us first derive the respective generating functions. Therefore, we apply the bijection from Proposition 7.1, reverse the time and allow to touch \(y=0\). Then, the sum \(\sum _{k=\ell a+1}^{(\ell +1)a} A_s(k)\) can be interpreted as walks of length \(\tilde{x}_s + \tilde{y}_s = (a+c)s+\ell -2\), starting at altitude \(a\tilde{x}_s- c \tilde{y}_s + i = \ell a + (c-a) + i\) and ending at altitude i for \(i=0,\ldots ,a-1\). To simplify notation, let us introduce the constant

$$h:=\ell a + c\,.$$
Fig. 10
figure 10

Transforming walks by moving the first step to the end of the walk. The red dot at (1, 0) and the red y-axis mark the new origin

Then, walks end at \(h - a + i\). Therefore, we are now able to apply Lemma 7.3 (Schur polynomial closed form for meanders ending at a given altitude). Additionally, by reversing the summation order, we get:

$$\begin{aligned} \sum _{k=\ell a+1}^{(\ell +1)a} A_s(k)&= [z^{(a+c)s+\ell -2}] \sum _{j=0}^{a-1} \frac{(-1)^{j}}{z} s_{(h - j,1^{j},0^{a-j-1})} \left( u_1(z), \ldots , u_a(z) \right) \nonumber \\&= [z^{(a+c)s+\ell -1}] \left( \sum _{i=1}^a u_i(z)^{h} \right) . \end{aligned}$$
(7.18)

This surprisingly simple result is due to a nice representation theorem of power symmetric functions in terms of Schur polynomials: [62, Theorem 7.17.1]. One gets this equation by setting \(\mu =\emptyset \) and restricting the case to a variables. Note that this is the analogue of (7.12). It is in one sense the reason for the nice closed forms in this article.

In contrast to Theorem 7.3 (Closed form for the sum of coefficients), we proceed now differently by Lagrange inversion [48]. From the kernel method, we know that the small branches \(u_i(z)\) satisfy the kernel equation \(1-zP(u)=0\), where \(P(u) = u^{-a} + u^c\) for general slope a / c. The entire form of the kernel equation satisfies nearly a Lagrangian scheme

$$\begin{aligned} u_i(z)^a = z \left( 1 + u_i(z)^{a+c} \right) . \end{aligned}$$

By taking the a-th root, one gets for an auxiliary power series U(x):

$$\begin{aligned} U(x)&= x \phi (U(x)),&\text { with }&\phi (u)&= \left( 1 + u^{a+c} \right) ^{1/a}. \end{aligned}$$

Let \(\omega \ne 1\) be an a-th root of unity (i.e., \(\omega ^a=1\)). Then, we recover the \(u_i(z)\), \(i=1,\ldots ,a\), by

$$\begin{aligned} u_i(z) = U\left( \omega ^{i-1} z^{1/a} \right) . \end{aligned}$$

Thus, coming back to (7.18) we are actually interested in

$$\begin{aligned} \sum _{i=1}^a u_i(z)^{h}&= \sum _{i=1}^a U\left( \omega ^{i-1} z^{1/a}\right) ^{h} = \sum _{n \ge 0} U_{n} z^{n/a} \left( \sum _{i=1}^a \omega ^{(i-1)n} \right) = a \sum _{n \ge 0} U_{a n} z^{n}, \end{aligned}$$

where \(U(x)^{h} = \sum _{n \ge 0} U_n x^n\) (in fact, by construction many coefficients \(U_n\) are 0, because U(z) has an \((a+c)\) periodic support, but this is not altering our reasoning hereafter). Considering (7.18) again, we need \(U_{an}\) for \(n=(a+c)s+\ell -1\). It is determined by the above Lagrangian scheme:

$$\begin{aligned} U_{an}&= [x^{a ((a+c)s+\ell -1)}] U(x)^h \\&= \frac{\ell a + c}{a((a+c)s+\ell -1)} [u^{a ((a+c)s+\ell -1) - 1}] u^{\ell a + c -1} \left( 1 + u^{a+c}\right) ^{(a+c)s+\ell -1} \\&= \frac{\ell a + c}{a((a+c)s+\ell -1)} \left( {\begin{array}{c}(a+c)s + \ell -1\\ as-1\end{array}}\right) . \end{aligned}$$

Rewriting the binomial coefficient by symmetry, the claim follows.

Example 7.5

Knuth’s original problem was dealing with boundaries \(y = \frac{2}{5}{x} + \frac{k}{5}\), \((k=1,\ldots ,4)\). In particular, we may choose \(\ell = 0\) and \(\ell = 1\) to get:

$$\begin{aligned} \sum _{k=1}^{2} A_{s}(k)&= \frac{5}{7s-1} \left( {\begin{array}{c}7s-1\\ 2s-1\end{array}}\right) = \frac{2}{7s-1} \left( {\begin{array}{c}7s-1\\ 2s\end{array}}\right) ,\\ \sum _{k=3}^{4} A_{s}(k)&= \frac{1}{s} \left( {\begin{array}{c}7s\\ 2s-1\end{array}}\right) . \end{aligned}$$

The first one is the known result, whereas the second one is yet another surprising identity.

Now, we come back to the asymptotics of Sect. 6. Some key ingredients were Proposition 7.2 (Periodic rule of thumb) and the rotation law of the small branches. Happily, such a rotation law holds in general for any slope, and the derived techniques can also be applied. This is what we present now.

Let \(P(u) = u^{-a} + u^c\) be the jump polynomial of directed walks. Thus, we have a small branches \(u_i(z)\) satisfying the kernel equation \(1-zP(u_i(z)) = 0\). As before let \(\tau \) be the unique positive root of \(P'(\tau )\), and let \(\rho \) be defined as \(\rho = 1/P(\tau )\). Recall that the small branches are possibly singular only at the roots of \(P'(u)\). The jump polynomial has periodic support with period \(p=a+c\) as \(P(u) = u^{-a} H(u^p)\) with \(H(u) = 1 + u\). Hence, there are p possible singularities of the small branches

$$\begin{aligned} \zeta _k = \rho \omega ^k, \qquad \text { with } \qquad \omega = e^{2 \pi i / p}. \end{aligned}$$

The general version of Lemma 7.1 reads then as follows:

Lemma 7.4

(Rotation law of small branches) Let \(\gcd (a,c)=1\). Then there exists a permutation \(\sigma \) of \(\{1,\ldots ,p\}\) without fix points and an integer \(\kappa \) (satisfying \(\kappa a +1 \equiv 0 \mod p\)) such that

$$\begin{aligned} u_i(\omega z) = \omega ^{\kappa } u_{\sigma (i)} (z), \end{aligned}$$

for all \(z \in \mathbb {C}\) with \(|z| \le \rho \) and \(0< \arg (z) < \pi -2\pi /p\).

Proof

We proceed as in the proof of Lemma 7.1. Define \(U(z) := \omega ^\kappa u_i(\omega z)\) and a function \(X(z) := U^a - z \phi (U)\) with \(\phi (u) := u^a P(u)\). Then a straightforward computation shows that

$$\begin{aligned} X(z) = \left( \omega ^\kappa u_i(\omega z) \right) ^a - z \phi \left( \omega ^\kappa u_i(\omega z) \right) = \omega ^{\kappa a} u_i(\omega z)^a - z \phi (u_i(\omega z)), \end{aligned}$$

as \(\phi (u)\) is p-periodic. Therefore, we get by the following transformation

$$\begin{aligned} \omega X(z/\omega ) = \omega ^{\kappa a+1} u_i(z)^a - z \phi (u_i(z)) = 0, \end{aligned}$$

if \(\kappa a+1 \equiv 0 \mod p\), because of the kernel equation. Thus, \(X = U^a - z\phi (U)=0\) and therefore, U(z) is a root of the kernel equation. It has to be a small root, as it is converging to 0 if z goes to 0. Furthermore, it has to be a different root, as it has a different Puiseux expansion. By the analytic continuation principle (as long as we avoid the cut line \(\arg (z)=-\pi \)), the result follows.

The last lemma allows us to state the following “meta”-result:

Theorem 7.10

(Metatheorem/rule of thumb: enumeration and asymptotics of lattice paths) Constrained 1-dimensional lattice paths have an algebraic generating function, expressible in terms of Schur functions (a symmetric function involving the small branches of the kernel). Singularity analysis gives its asymptotic behavior, which is equal to the asymptotics at the dominant real singularity (times the periodicity whenever the rotation law holds).

We call this a metatheorem because it is rather informal in the description of the constraints allowed (it could be positivity, prescribed starting or ending points, to live in a cone, to stay below a line of rational slope, to have some additional Markovian behavior, to be multidimensional with one border, or in bijection with any of these constraints ...); in all these cases, the spirit of the kernel method and analytic combinatorics should give the enumeration and the asymptotics. Different incarnations of this rule of thumb appear in [7, 8, 10, 12, 19], and no doubt that many new lattice problems on the one hand, and many new combinatorial problems involving some type of periodicity on the other hand, will offer additional incarnations of this metatheorem (Fig. 11).

Fig. 11
figure 11

Landscape in the complex plane of the generating function of lattice paths

9 Conclusion

In this article, we analyzed some models of directed lattice paths below a line of rational slope. As a guiding thread, we first illustrated our method on Dyck paths below the line of slope 2 / 5. Beside the (pleasant) satisfaction of answering a problem of Don Knuth, this sheds light on properties of constrained lattice paths, including the delicate case (for analysis) of a periodic behavior.

We can shortly recall the main methods used in this article to attack lattice path problems:

Firstly, the method of choice of Nakamigawa and Tokushige was the cycle lemma. It is a classical result for lattice paths which uses the geometry of the problem. However, its applications are limited to certain cases.

Secondly, a more general result is given in Theorem 7.9 (General closed forms for lattice paths below a rational slope \(y=\frac{a}{c} x + \frac{b}{c}\)), via the Lagrange inversion. This directly gives the sought closed form. However, it does not give access to the asymptotics.

Thus, thirdly, we used the kernel method to express the generating functions explicitly in terms of (known) algebraic functions. This gave us access to the asymptotics and is an alternative way to access the closed forms. Our Proposition 7.2 (Periodic rule of thumb) explains in which way the asymptotic expansions are modified in the case of a periodic behavior (via some local asymptotics extractor and the rotation law); we expect this approach to be reused in many other problems.

Also, the method of holonomy theory used in Theorem 7.3 (Closed form for the sum of coefficients) shows the possible usage of computer algebra to prove such conjectured identities. This is probably the fastest technique for checking given identities and can be automatized to a great extent. The interested reader is referred to the nicely written introductions [41, 56].

Our approach extends to any lattice path (with any set of jumps of positive coordinates) below a line of (ir)rational slope (see [15]). This leads to some nice universal results for the enumeration and asymptotics. As an open question, it could be natural to look for similar results for lattice paths (with any set of jumps with positive and negative coordinates, and not just jumps to the nearest neighbors) in a cone given by two lines of rational slope. This is equivalent to the enumeration of non-directed lattice paths in dimension 2. Despite the nice approach from the probabilistic school [26, 31] and from the combinatorial school [22] via the iterated kernel method, this remains a terribly simple problem (to state!), but a challenge for the mathematics of this century.