Enumeration of walks reaching a line
Philippe Nadeau
Laboratoire de Recherche en informatique, Bˆat. 490, Universit´e Paris Sud, 91405 ORSAY Cedex, France
We enumerate walks in the planeR2, with steps East and North, that stop as soon as they reach a given line; these walks are counted according to the distance of the line to the origin, and we study the asymptotic behavior when the line has a fixed slope and moves away from the origin. When the line has a rational slope, we study a more general class of walks, and give exact as well as asymptotic enumerative results ; for this, we define a nice bijection from our walks to words of a rational language. For a general slope, asymptotic results are obtained; in this case, the method employed leads us to find asymptotic results for a wider class of walks inRm.
Keywords:walk, generating function, rational language, singularity analysis
1 Introduction
In this work we consider primarily two classes of walks in the planeR2, notedWa,δ+ andWa,δ− , defined in the following manner :
Definition 1 Leta∈[0,1[andδ>0be real numbers. We denote byDa,δthe line ofR2with slope−a, going through the point(δ,0). An equation ofDa,δisy =−a(x−δ). We denote byWa,δ+ (resp.Wa,δ− ) the set of walks in the planeR2starting at the originO= (0,0)with steps East or North, which end as soon as they reach the open (resp.closed) half plane aboveDa,δ. The cardinalities of the setsWa,δ+ and Wa,δ− are denoted respectively byWa,δ+ andWa,δ− .
These definitions are illustrated on Figure 1.
These walks stop as soon as they cross the lineDa,δ, those inWa,δ+ having to go strictly beyond the line, whereas those inWa,δ− stop on it if they happen to touch it. We are interested in the enumeration of these walks according to the parameterδ; that is, we fix the slope−aof the lineDa,δ, and study the numbersWa,δ+ andWa,δ− in function ofδ. Note that, up to a constant factora,δrepresents the distance of the lineDa,δto the origin.
We can now state our first theorem which gives all asymptotic results forWa,δ+ andWa,δ− whenδgoes to infinity.
Theorem 1 Leta∈]0,1], and letλbe the unique positive solution to the equationλ−1+λ−1/a= 1.
Ifa=p/q >0is a fixed rational number, wherepandqare relatively prime positive integers, then the asymptotic approximations
Wa,δ+ ∼
∞
a
p(1−λ−1/p)· 1
1−(1−a)λ−1λbpδc/p and Wa,δ− ∼
∞
a
p(λ1/p−1)· 1
1−(1−a)λ−1λbpδc/p
1365–8050 c2005 Discrete Mathematics and Theoretical Computer Science (DMTCS), Nancy, France
000000 111111 000000 111111 000000 111111
000000 111111 000000 111111 000000 111111
000000 111111 000000 111111
000000 111111 000000 111111 000000 111111 000000 111111
000000 111111
000000 111111
000000 111111
000000 111111
000000 111111
000000 111111
000000 111111
000000 111111
000000 111111
000000 111111 000000
111111 000000
111111
O
Fig. 1:An example of walk inWa,δ+ witha=37 andn= 14.
hold whenδgoes to infinity. Ifais irrational, then the asymptotic approximations
Wa,δ+ ∼
∞
a
lnλ· 1
1−(1−a)λ−1λδ and Wa,δ− ∼
∞
a
lnλ· 1
1−(1−a)λ−1λδ
hold whenδgoes to infinity.
As this theorem shows, the behavior ofWa,δ+ andWa,δ− depends on the rationality of the numbera; if ais rational, then we will find the generating function of the numbersWa,n+ andWa,n− . In this case, we will actually introduce another class of walks that includesWa,n+ andWa,n− and find a bijection that sends walks to words of a rational language; various enumerative and asymptotic results derive from there. In the case of a generala, we will proceed differently, and start from an easily obtained functional equation to obtain asymptotic results. Our method is close to Erd¨os et al. (EHO+87), method that is also applicable to a wider class of walks defined inRn.
2 Walks reaching a set of points
As announced in the introduction, we now introduce a new class of walks that will include our original walks when the slope ofDa,δ is rational. The reader is advised to look at Figure 2 while reading the following definition.
Definition 2 (Vd,nandWd,n) Letd= (di)i>1be an infinite sequence of positive integers, and lete = (ei)i∈Nbe the corresponding sequence of partial sums, defined bye0= 0andek =d1+d2+· · ·+dk, fork>1. We associate toda set of pointsVdin the plane, with integer coordinates: the setVd⊂Z×N consists in the originOtogether with, for everyk > 1, thedk points withy-coordinate equal tokand x-coordinate in[[−ek,−ek−1−1]].
For any integern,Vd,nis defined as the translated ofVdby the vector(n,0). That is,Vd,n=Vd+(n,0).
Thegeneralized set of walksWd,n consists of the walks that start at the originO, make steps East or North, and have their last points, and no other one, inVd,n.
These walks are a generalization of our walksWa,n+ andWa,n− . Indeed, letd+a andd−a be the sequences whosekth terms are given respectively bydkae − dk−1a eandbkac − bk−1a c. Then we have the following proposition :
0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111
Fig. 2:A setVd,nwith examples of walks inWd,n. Heren= 14andd= (3,1,2,3,6,1,1, . . .)
Proposition 1 For everyn∈Nanda∈]0,1], we have the equalities Wa,n+ =Wd+
a,n+1andWa,n− =Wd− a,n.
An interesting case happens when the sequencedis periodic. It is easy to see that d+a andd−a are periodic exactly when ais a rational number. Ifd = (d1, . . . , dp) is a finite sequence, we will note Vd,n=Vd,n¯ andWd,n=Wd,n¯ , whered¯is the periodic infinite sequence(d1, . . . , dp, d1, . . . , dp, . . .).
From now on d will stand for a finite sequence d = (d1, . . . , dp)of positive integers. We define q=d1+· · ·dp, anda=p/q. To such a sequence we attach the following language on a finite alphabet (recall that arunin a finite word is a maximal factor composed of identical letters)
Definition 3 (LanguageLd) The languageLdis the set of wordswon the alphabetΣ ={a0, a1, . . . , ap−1} that satisfy the following conditions (where we set by conventiond0=dpandap=a0):
C1. wis the empty word, or its initial letter belongs to{a0, a1}
C2. for alli, a run ofaiinwis terminal or is followed by a run ofai+1;
C3. for alli, the runs ofaiinware of length at leastdi; this constraint does not apply to the last run, and, ifwbegins witha0, it does not apply to the first run either.
We can finally state the theorem announced in the introduction:
Theorem 2 Letn>0be an integer. There exists an explicit bijection between walks inWd,nand words ofLdof lengthn.
The languageLdis rational, and we give an unambiguous rational expression that represents it. Then the existence of a bijection as stated in Theorem 2 allows us to explicit the generating functionWd(x) = P∞
k=0Wd,kxk of the sequence(Wd,n)n∈N:
Theorem 3 The generating functionWd(x)has the following expression:
Wd(x) = N(x)
(1−x)p−xq, withN(x) = (1−x)p−2+
p−2
X
i=1
xei+1(1−x)p−2−i+
ep−1
X
k=ep−1+1
xk.
its series expansion, and we show that the first part of Theorem 1 can thus be obtained as a consequence of Theorem 3.
In fact, thanks to the bijection of Theorem 2, we can even find the bivariate generating function of the numbers(Wd,n,k)n,kwhich enumerate walks inWd,n of lengthk. By the techniques of singularity analysis exposed in chapter 8 of (FS), we can then prove that the average length of a walk inWd,n is asymptoticallyCa·nwhenngoes to infinity, whereCais positive constant depending only ona.
3 Asymptotic results in the general case
LetWa+be the function defined onRbyWa+(δ) = 1ifδ <0, and byWa+(δ) = Wa,δ+ ifδ>0. Then, by decomposing walks according to their first step, one shows thatWa+satisfies the following functional equation :
∀δ>0, Wa+(δ) =Wa+(δ−1/a) +Wa+(δ−1). (1) This equation and related ones have appeared in various contexts, and have been studied in numerous works, including (CG01; FK74; Pip93). Here we use a method inspired by the paper (EHO+87). This consists in interpreting Equation 1 as a “renewal equation”, so that its asymptotic behavior is given by the celebratedRenewal Limit Theorem(RLT) of probability theory; see Feller (Fel71) for all necessary back- ground. Application of the RLT immediately leads to a proof of Theorem 1 as far asWa,δ+ is concerned.
It is then extended toWa,δ− by finding simple relations between the two numbers.
Our walks have a natural generalization in any dimension. Let ¯a = (a1, . . . , am) be a vector in Rm, with all coordinates being positive, andHδ be the hyperplane of equationHδ : a1x1+· · ·+ am−1xm−1+am(xm−δ) = 0.Then defineW¯a,δ+ (resp. W¯a,δ−) to be the numbers of walks inRmfrom the origin with steps in{ei}16i6mdefined by the fact that their last points, and no other one, are “above Hδ” (resp.“above or onHδ”).
Assume1 = am 6 a1 6 a2 6 . . . 6 am−1, and letλ designate the unique positive solution to Pm
i=1λ−ai = 1. If allaiare rational numbers and we writeai =pi/qiin reduced form for eachi, we defineq= lcm(qi). Then the proof of the following theorem is proved along the same lines as described above :
Theorem 4 Letλandqbe defined as above. Then we have the following asymptotics whenδtends to∞:
(i) if at least oneaiis irrational, then
W¯a,δ+ ∼
∞
m−1 lnλ·Pm
i=1aiλ−ai ·λδ and W¯a,δ− ∼
∞
m−1 lnλ·Pm
i=1aiλ−ai ·λδ, (ii) and if allaiare rational, then
Wa,δ¯+ ∼
∞
m−1 q(1−λ−1/q)·Pm
i=1aiλ−ai·λbqδc/q and Wa,δ¯− ∼
∞
m−1 q(λ1/q−1)·Pm
i=1aiλ−ai·λbqδc/q. In fact, the same reasoning shows that similar approximations hold in the irrational case when the steps are allowed to be any finite number of non zero vectors with nonnegative coordinates.
Acknowledgements
I would like to thank Yves Verhoeven who is at the origin of this work and helped me on many occasions during my researches.
References
[CG01] V. Choi and M. J. Golin. Lopsided trees. I. Analyses. Algorithmica, 31(3):240–290, 2001.
Mathematical analysis of algorithms.
[EHO+87] P. Erd˝os, A. Hildebrand, A. Odlyzko, P. Pudaite, and B. Reznick. The asymptotic behavior of a family of sequences. Pacific J. Math., 126(2):227–241, 1987.
[Fel71] William Feller. An introduction to probability theory and its applications. Vol. II. Second edition. John Wiley & Sons Inc., New York, 1971.
[FK74] Michael L. Fredman and Donald E. Knuth. Recurrence relations based on minimization. J.
Math. Anal. Appl., 48:534–559, 1974.
[FS] P. Flajolet and R. Sedgewick. Analytic combinatorics. Book in preparation. Preliminary version available at http://algo.inria.fr/flajolet/Publications/books.html.
[Pip93] Nicholas Pippenger. An elementary approach to some analytic asymptotics. SIAM J. Math.
Anal., 24(5):1361–1377, 1993.