I recently started playing with the book 📖 “Riemann’s Zeta Function” by H.M. Edwards. In chapter 6 he introduces Euler-Maclaurin summation, a concept that has allowed Danish mathematician Jørgen Pedersen Gram to find the first list of 15 non-trivial zeros of the Riemann Zeta function in 1903. I will repeat parts of Edwards’ arguments here and use this blog post to introduce Euler-Maclaurin summation in my own words (in fact I will heavily quote from the book). I will not yet connect this with calculating zeros of the Zeta function, it might be the topic of a future post. I will, however, add some pictures and reference the Python code that I’ve used to generate those pictures (https://mybinder.org/v2/gh/ahartel/rzf.git/HEAD).
As the initial example, Edwards choses the sum which is part of the series
, whose elusive evaluation was known as the Basel problem before Euler solved it in 1735, discovering exactly Euler-Maclaurin summation on the way.
A first, crude approximation
Evaluating efficiently (and approximately) certain infinite sums, like for example the Riemann Zeta function, is exactly what Euler-Maclaurin summation is useful for. For our concrete example S as defined above, we might first observe that we can approximate the sum by an area under the curve of . To get a feeling for this, let’s start by plotting it.
The bars in Figure 1 are clearly overestimating the area under the red curve, i.e., the sum is overestimating the integral of . Or, to put the other way around, the integral is underestimating our sum. But, as a next step, we can observe that
which goes by the name “trapezoidal rule“. Here’s what it looks like:
The new way to choose the height of the bars is certainly a better approximation to the integral. But remember that our goal is not to approximate the integral but rather to have the integral approximate our sum. To connect the integral, the trapezoidal rule and our initial sum S, we can observe the following:
Which we obtain by applying the trapezoidal rule and then adding the “fringe” terms. Let’s write this down in a more general form:
This gives a first approximation of
.
The real value is slightly higher, but we’ll get to that later.
Defining the error term
Now, looking again at Figure 2, we might try to find a formula for the shark-fin-shaped differences between the curve and the bars. These differences alter between positive and negative sign because first the red curve starts higher than the first bar, then crosses it to run through the bar, just to repeat that pattern with smaller amplitude with the next bar and so on.
It turns out that the missing term in equation (1) is the last term in the following equation:
I must admit that I find Edwards’ derivation of this term slightly hard to follow but here’s how we can convince ourselves that it makes sense once we know it:
Now we can apply equation (2) to our series S. Visually this looks like the following picture:
Now, to make any use of this new term for our estimation of the value of , we must observe the following: As can be seen from equation (2) and as can hardly be seen in Figure 3, the first positive fin’s area is slightly larger than the first negative fin’s area which has itself a larger (but negative) area than the third fin. Thus, the sum of all fins but the first one will be something negative and, therefore, the value of the integral in the last term of (2) is certainly smaller than the area under the first positive fin:
Thus, S lies between our previous estimate of 0.09505 and 0.09530.
Expanding the error term
In this last part of this article, we will derive a series that approximates the error term that we have introduced in the last section. Our starting point will be an intermediate result of last section’s derivation of the error term:
.
And from there, repeated integration by parts will yield the final Euler-Maclaurin summation formula.
The final formula will contain the Bernoulli numbers, that I have described in a previous post. To see how these arise, we first need to introduce the Bernoulli polynomials. These are defined via . I.e., they are polynomials that when integrated from
to
give x raised to the n-th power. If we just assume that for example
is an arbitrary polynomial in x of degree 3 then this definition allows us to find its coefficients and thus
.
By differentiating the definition, we can find the following relations which then allow us to find to
from
. These relations are:
and
which shows that
satisfies the definition of
and hence that
.
These allow us to find ,
and
.
Now that we have a basic definition of the Bernoulli polynomials, we can identify in equation (3) and repeatedly integrate by parts. Due to the relations we found for the Bernoulli polynomials, this turns out to yield integrals of increasing Bernoulli polynomials times increasing derivatives of
. One step as an example:
The sum collapses and what remains is the following: .
Stopping here, gives us a term that is equal to .
The remaining term is less than
because of the following estimate:
Here, we have again used the declining-alternating-shark-fin-area argument from last section and have estimated the term by its first positive bump. See the next figure for a plot of the integrand:
As a last estimate of S, we can now say, with our last estimate, that and therefore
which is correct to 6 places.
Repeating this process (and adding in some insights about the Bernoulli polynomials and the closely related Bernoulli numbers which I will not repeat here) we obtain the following Euler-Maclaurin summation formula:
For the error term, it is worth noting that it is not greater than about twice the size of the last term omitted. So as long as the terms in the summation formula are decreasing so is the error term.
As a last step, I want to point out that we can’t estimate by adding the first 9 terms that we have omitted so far. These are
and they add up to
. Thus, our estimate would be
. But, comparing this to the known value of
we see that the real value does not fall into the boundaries that out naive estimate gives. The reason for why this fails might be the topic of a future blog post. But let me finish by noting that it does not not work because we cannot apply Euler-Maclaurin summation to the zeta function but because we have not chosen our parameters correctly.