In today’s post, I investigate a simple recurrence relation and show how it is possible to describe its behaviour asymptotically at large times. The relation describing how the series evolves at a time n will depend both on its value at the earlier time n/2 and on whether n is even or odd, which, as we will see, introduces a `period doubling’ behaviour in the asymptotics. The proof will involve defining a Dirichlet generating function for the series, showing that it satisfies a functional equation and has a meromorphic extension to the whole complex plane, and then inverting the generating function with Perron’s formula. Cauchy’s residue theorem relates the terms of the asymptotic expansion to the poles of the meromorphic extension of the Dirichlet series. Such an approach is well-known in analytic number theory, originally used by Riemann to give the explicit formula for the prime counting function in terms of the zeros of the Riemann zeta function. However, Dirichlet generating functions can be applied in many other situations to generate asymptotic expansions (see the references for examples). Although I will concentrate on a specific difference equation here, the techniques described are quite general and also apply to many other kinds of series.
This post grew out of an answer I gave to a question by Byron Schmuland at the math.stackexchange website. To motivate the difference equation, let us start by considering the following Markov chain whose state space is the positive integers, as described in the original question by Byron. The chain begins at state 1, and from state n the chain next jumps to a state uniformly selected from . As time goes on, this chain goes to infinity, with occasional large jumps. In any case, it is quite unlikely to hit any particular large n.
If we define p(n) to be the probability that the chain visits state n, then p(n) goes to zero like c/n for some constant c. In fact,
The question asked on math.stackexchange is to give an analytic proof of this fact. It is possible to prove this using a (tricky) probabilistic method and, as explained by Byron and in the other answers to his question, there are quick analytic proofs of conditional convergence. That is, if np(n) does converge to a limit, then it must be the value given in (1). In this post, I use Dirichlet series to not only answer the original question, but also give the entire asymptotic expansion. I am not aware if the results given here are already known although, as noted, it is very similar to asymptotic expansions used in analytic number theory and to the results of Flajolet and Golin mentioned above. The layout of this post is as follows. First, I briefly discuss the recurrence relation satisfied by p and some of the approaches which can be used, as suggested in the original math.stackexchange question. I will then look at the numerical evidence for the behaviour of p, plotting graphs of the first few asymptotic terms. The result of the numerical simulation is used to propose a full asymptotic expansion. Next, the Dirichlet generating function is introduced and a few of its properties, including a functional equation, are proved. The proof of the asymptotic expansion is then given by applying Perron’s formula to invert the generating function. Finally, I end with a few comments about the proof given here.
First, the description of the Markov process above leads to the following recurrence relation for p(n).
Alternatively, if we take the difference of p(n+1) and p(n) then most of the terms in the summation above cancel, leading to the difference equation
This is just a linear recurrence relation for p, albeit with two complicating factors. First, there is the periodic term which, as we will see, causes a period doubling effect in the asymptotics. Then, there is the dependence on p at the earlier time n/2. If we were to replace p(n/2) by p(n) on the right hand side of (3), this would give a simple first order difference equation, and the entire series would be determined by the value of p at any single time. So the space of solutions to the difference equation for large would form a one-dimensional vector space. However, for (3), knowing the value of p(N) is not enough to find p(n) for . We would also need to be given the values of p at times N-1, N-2,…,N/2. This means that the space of solutions to (3) at arbitrarily large times gives an infinite dimensional space and, consequently, we should not be surprised to find that the asymptotic expansion involves infinitely many independent terms.
A probabilistic argument can be given for the limit (1), as given in the answer by `T..’ to the math.stackexchange question. The increase in the logarithm of the position of the Markov chain at each time is close to uniformly distributed over the interval . This distribution has mean and variance . By the Central Limit Theorem, will be approximately Gaussian with mean and variance . From this, the number of steps taken for X to escape an interval [1,n] will be approximately with fluctuations of order . As the average time spent in the interval [1,n] is , this leads to the asymptotic expression
where is the constant appearing in (1). As it stands, (4) is not quite strong enough to prove the required limit (1). It is strong enough to prove convergence conditionally, however. If np(n) converges to some limit then it will follow that tends to the same limit which, by (4), must be . With a bit of work, it is possible to give an unconditional probabilistic proof of (1), which Byron posted on his home page.
This idea was mentioned by Qiaochu Yuan in his response to the original question, and expanded into a conditional proof of (1) by Byron in the original question. Differentiating again and multiplying by 1-t,
Assuming that np(n) converges to a limit c, we can evaluate both sides of (7) to leading order as t goes to 1,
Plugging these limits back into (7) gives as required. As I show below, to get an unconditional proof, we should replace the generating function by the Dirichlet generating function.
A Numerical Investigation
With the help of a computer, it is easy to simulate p(n) using the recurrence relation (3).
Figure 1 shows two plots of np(n). In the first one, the points are coloured blue for n even and red for n odd (similar to David Speyer’s plot in the math.stackexchange thread linked above). It can be seen that convergence is much faster at even times than at odd times. To see how the series behaves at even times, the second plot only includes those points where n is even, with n a multiple of 4 coloured blue, and n even but not a multiple of 4 coloured red. The simulation suggests that,
- for n odd, np(n) converges to c from below at rate O(1/n).
- for n a multiple of 4, np(n) converges to c from above at rate O(1/n2).
- for n a multiple of 2, but not 4, np(n) converges to c from below at rate O(1/n2).
This suggests the following asymptotic form for p(n)
where has period 2, with , and has period 4 with and . We can go further, and tentatively suggest the following expansion to arbitrary order ,
where is a periodic function of n, with period . Here, has been normalized to 1. In fact, as we will see below there are additional terms in the asymptotic expansion of p, so (8) does not quite hold. However, for now, we can try substituting (8) back into (3) to solve for the terms . Taking , (8) can be considered as a formal power series in 1/n giving,
Expanding the left hand side as a Taylor series in 1/n
and comparing coefficients of gives the following recurrence relation for ,
This defines in terms of for , and the final term on the right hand side will cause the period to double at each step. Knowing , however, tells us nothing about the average value of as n varies, which I will denote by . To obtain this, take the average of (9) over n and, noting that the left hand side goes to zero,
This defines inductively and, in fact, is solved by . Together with (9), this allows us to inductively calculate in terms of for . Doing this and writing for the vector ,
This expansion can be checked by plotting p(n) while successively subtracting out the leading order terms. As can be seen in Figure 2, it converges beautifully to the levels .
However, after there is an oscillating term! This is something that I was not expecting when first plotting this graph. Fortunately, the form of this oscillation can be seen clearly from the plot. It appears to be very close to for constants . This is more conveniently expressed as the real part of a complex power of n, , where and . It is possible to solve for r by requiring that satisfies the recurrence relation (3) to leading order. Replacing the term by its average value of 1/2, the recurrence relation can be approximated by a differential equation
Putting into this gives the relation . This only has two real solutions r=0,1. To find the complex solutions, equating real and imaginary parts gives a pair of simultaneous equations for ,
Looking for solutions with v positive, the first of these equations says that is positive and, then, the second says that is positive. So, must lie in an interval for some nonnegative integer k. Across such an interval, the difference of the two expressions in (11) increases from minus infinity (or, from a positive value if k=0) to . So, (11) has precisely one solution in for each positive integer k. Together with the complex conjugates and the real solutions r=0,1, this lists all solutions to . See, also, Figure 4 below. The complex solution with smallest real part lies in the range and, numerically solving (11) gives . This agrees with the bottom-right plot of Figure 2, showing that the oscillating term decays at rate approximately . To test this, we can try subtracting from p(n) to see if this eliminates the oscillating term. This is done in Figure 3 and subtracting out this term does indeed remove the oscillating term (the coefficient a was calculated by a least-squares fit). In fact, the next asymptotic is visible, where agrees with the value calculated in (10). Subtracting this out too shows that there is a further oscillating term decaying approximately as . This is about as far as we can go with this particular simulation (I used 128 bit floating point arithmetic), as numerical inaccuracies are starting to appear in the plots.
The Asymptotic Expansion
The numerical investigation above suggests the following asymptotic expansion for p(n) up to order , for any real ,
This sum is taken over complex r satisfying and with real part at least one, and over nonnegative integers k. The term is a periodic function of n, with period . The set of with real part at least one and satisfying are plotted in Figure 4. These lie on the intersections of the curve with the real axis and with the set of almost horizontal lines given by the second of equation (11). The points r+k for positive integers k are also plotted. So, each point in Figure 4 corresponds to a term in the asymptotic expansion.
This allows us to calculate inductively in k, and it can be seen that the period does indeed double at each step. It does not directly give us the average value of as n varies. This can be obtained by averaging (13) over n and noting that the left hand side goes to zero.
It still remains to calculate the values of , which will be done below. Although we have not yet proven that the asymptotic expansion (12) holds, we can define a series to satisfy this expansion up to order ,
The Dirichlet Generating Function
The Dirichlet generating function of the series p(n)/n is
which converges uniformly to an analytic function for the real part of s large. As we know that p is bounded by 1, it will in fact converge for all s with positive real part. It can also be seen that as the real part of s goes to infinity. I am looking at the Dirichlet series for p(n)/n here, rather than just p(n), because it will turn out that terms like in the asymptotic expansion will directly relate to poles in the meromorphic expansion of L at –r.
Whereas the standard generating function Q above satisfied a differential equation, the Dirichlet generating function satisfies a functional equation. Multiplying (3) by , summing over n, and expanding in terms of 1/(n+1) on the left hand side
leads to the following functional equation for L,
This expresses L(s) in terms of L(s+k) for positive integers k. As L(s) is defined whenever s has positive real part, (16) extends L to all s with real part greater than -1. Inductively applying (16), then, extends L to a meromorphic function on the whole complex plane. The division by introduces simple poles at the points where this term vanishes, which are the points –r with . Then, (16) will introduce further simple poles at –r–k for positive integers k. Note that there is no pole at s=0, as the right hand side of (16) also vanishes there. So, the poles of the meromorphic extension of L are at the points –r–k as plotted in Figure 4.
By a standard result on Dirichlet series with nonnegative coefficients, the fact that L has no poles in the half plane means that the Dirichet series will also converge absolutely on this region. That is, for all . It is interesting to note that this is implied by basic properties of the Dirichlet generating function but, as the asymptotic expansion will imply much more than this anyway, I don’t make use of this fact here.
Noting that has derivative , the residue of L at -r where can be computed from (16),
At r=1, all the binomial coefficients on the right hand side are zero, giving the residue
There does not seem to be a simple expression for the residues at the other poles, although (17) can be used to compute them to whatever accuracy is desired.
We can also write out the Dirichlet generating function for the truncated asymptotic expansion defined in (14),
This also has a meromorphic expansion to the entire complex plane and the locations and residues of the poles can be determined by the following fact.
- If is periodic with average value then extends to a meromorphic function on the complex plane with a simple pole at s=1 with residue .
This result holds whenever a is a Dirichlet character, so f is a Dirichlet L-function and, since all periodic functions are linear combinations of Dirichlet characters, it also holds for all periodic coefficients. In particular, the Dirichlet generating function extends to a meromorphic function on the whole complex plane with simple poles at the points –r–k with the real part of r at least 1, , and residue . The values of are chosen to match the residues of L at the points –r,
In particular, from (18), . Choosing the coefficients in this way means that the poles of cancel out at the points –r with and .
It is also possible to calculate an approximate functional equation for . Multiplying (15) by and summing over n, we note that the term converges to an analytic function bounded over for any . As above, we expand on the left hand side in terms of 1/(n+1) but, now, use a finite Taylor expansion,
Summing the remainder term over n converges to an analytic function over , any , which is bounded by a multiple of . Choosing gives the functional equation
The remainder term R(s) is an analytic function over and is bounded over , any . Applying (19) iteratively, then, shows that is bounded by a polynomial in |s| over and for the imaginary part of s large enough that doesn’t vanish.
The above argument for will also apply to L, since p also satisfies the approximate difference equation (15). This shows that L(s) satisfies a polynomial bound in s on each half-plane (for the imaginary part of s large enough). Also, applying (19) to the difference and using the fact that have been chosen so that the poles of cancel at those points s with , we see that is an analytic function on .
Inverting the Dirichlet Series and Proof of the Expansion
which holds for any . I find it convenient to differentiate this expression, in the sense of distributions. Doing this, the left hand side becomes a sum of Dirac delta functions centered about each positive integer n with weights p(n), ,
As stated above, this expression is intended in the sense of distributions. That is, if is infinitely differentiable with compact support, (20) states that
The term inside the integral vanishes faster than polynomially in 1/s in any vertical strip , which can be seen using integration by parts
As the Dirichlet generating function L is polynomially bounded on each half-plane for large s, it follows that the integrand on the right hand side of (21) goes to zero faster than polynomially in 1/s, and the integral in (20) is well defined in the sense of distributions on any line not passing through a pole of L.
for any real such that does not contain a pole of L. For a more precise argument, choose and positive constant u, and use Cauchy’s residue theorem to replace the contour integral in (20) by an integral along the lines joining , , , , , plus the sum of the residues of in the rectangle . We know that, after integrating against a smooth function of compact support, goes to zero faster than polynomially in 1/s. So, in the limit as u goes to infinity, the integral along each of the line segments other than the one joining goes to zero. Then, we obtain (22).
Equation (22) holds in the sense of distributions. We can convolve both sides by an infinitely differentiable function with compact support. That is, evaluate (22) at a point xy and integrate against .
The left hand side of this expression is a weighted sum of p(n) for n in a region near x. The integrand of the contour integral on the right hand side consists of a term going to zero faster than polynomially in 1/s multiplied by a term of size . Therefore,
This expression is very close to the asymptotic expansion (12). It differs by replacing p(n) on the left hand side by a `smoothed’ version of p. Also, although the right hand side does have a term corresponding to each of the terms on the right hand side, it does not have any periodic dependence on n. This is because convolving with the smooth function effectively smoothes out this periodic behaviour, replacing by .
There does not seem to be any way that periodic behaviour of the coefficients can come out of a direct application of Cauchy’s residue theorem in this way. So, instead, we can look at the difference , where is the truncated asymptotic expression (14), and try to show that this vanishes at rate . Let us also set . The same argument used to derive (23) can be applied to . However, the Dirichlet generating function of has no poles with real part greater than , so the sum over the residues in (23) drops out,
This holds for any . We can use this to show that . As satisfies the approximate difference equation (14), we can multiply through by to get
Here, I am using to denote the maximum value of over . Now, if was not bounded above by a multiple of then, for any , will eventually exceed K. Letting N be the first time at which this happens, h(N) will equal . Equation (25) shows that can only take steps of size and can only become small (less than K/2, say) after some number steps, for a fixed . It follows that if the smooth function is chosen to be nonnegative with support in then,
However, K can be chosen arbitrarily large, so this contradicts the bound (24). It follows that is bounded above by a multiple of and, by the same argument applied to , it is also bounded below by a multiple of . We have shown that
for any . This is almost the asymptotic approximation (12), although we do not quite have as strong a bound on the remainder term as required. This is easily fixed, by replacing with , so that we can take and, noting that is bounded by a multiple of ,
This is exactly the asymptotic expansion proposed in (12).
It is useful to note why the Dirichlet generating function works in this proof, whereas the standard power series generating function defined in (5) does not. There is a similar inversion formula to (20) for Q, using Cauchy’s integral formula.
where C is any closed curve in the unit disc winding once anticlockwise about the origin. If Q extended to a meromorphic function on some neighbourhood of the unit disc, then we could move the curve C outwards so that it lies on a circle of radius giving an asymptotic expansion up to an exponentially decaying remainder term
However, we know that the series p(n) is not like this. It has asymptotics decaying at rate , which is much slower than exponential decay. It follows that the generating function Q does not have a meromorphic extension, and the kind of argument used above cannot work with Q. We should, therefore, use the correct kind of generating function whose inversion formula can lead to asymptotic terms appropriate to the series in question.
From a slightly different point of view, the generating function Q did not satisfy a functional equation which could directly give us a meromorphic expansion. Instead, it satisfied a differential equation (6). The reason for this is that the 1/n terms on the right hand side of (3) lead to a differential term in the expression for the generating function. On the other hand, multiplying a series by 1/n only causes its Dirichlet generated function to be translated by 1, so we obtain a functional equation (16) capable of generating a meromorphic extension to the whole complex plane.
It was noted above that, because of the p(n/2) term in the recurrence relation (3), it should be no surprise that the asymptotic expansion includes infinitely many independent terms. We can also see how this infinite set of terms arises, by looking at the functional equation (16) for L. The p(n/2) term leads to the in the factor on the left hand side of (16). As has infinitely many zeros, the Dirichlet generating function picks up an infinite sequence on independent poles. If, on the other hand, the recurrence relation only referred to p(n–j) for a finite set of fixed numbers j then the term multiplying L on the left of (16) would have been a polynomial, with finitely many zeros. Then, we would have only obtained a finite sequence of independent terms in the asymptotic expansion.
The proof given above is, largely, quite standard and very similar to other well known proofs of asymptotic expansions. This involves the following steps,
- Define a (Dirichlet) generating function.
- Establish a functional equation.
- Using the functional equation, prove the existence of a meromorphic extension.
- Use Perron’s formula to express the original series as a contour integral.
- Move the line of integration to the left, using Cauchy’s residue theorem to pick up asymptotic terms from the poles of the generating function.
There are, not surprisingly, further technicalities. It is necessary to use a bound on the growth of the generating function in order to bound the contour integrals. Above, I made use of the fact that L(s) is polynomially bounded on each half-plane.
However, there was one further complicating issue in the proof above, requiring a bit of back-and-forth between the Dirichlet series and the approximate recurrence relation (15). This is because, as was noted, there is no way that Cauchy’s residue theorem would give the correct periodic coefficients in the expansion. Instead, we obtained a formula for a smoothed version of the version of the series which averaged out the periodic terms. Applying this to the remainder term in the asymptotic expansion, it was still necessary to go back to the recurrence relation to show that the bound on the smoothed series also implied a similar bound on the original series. It might be possible to avoid this final step by using a different kind of generating function. Maybe, a `double’ generating function involving both a Fourier transform and a Dirichlet series such as,
for complex roots of unity and complex s with positive real part. Alternatively, a generating function involving Dirichlet characters could be another way forwards,
- Michael Drmota and Wojciech Szpankowski. A General Discrete Divide and Conquer Recurrence and Its Applications. Preprint, 2010. Available from Michael Drmota’s homepage.
- Philippe Flajolet and Mordecai Golin. Exact asymptotics of divide-and-conquer recurrences. Lecture notes in Computer Science, 1993, Volume 700, 137-149.
- Fillippe Flajolet and Robert Sedgewick. Analytic Combinatorics. Cambridge University Press, 2009.
- Hsien-Kuei Hwang. Asymptotic expansions of the mergesort recurrences. Acta Informatica, 1998, Volume 35, Number 11, 911-919.