euler-maclaurin summation - lancaster university · 2015-04-28 · euler-maclaurin summation notes...
TRANSCRIPT
Euler-Maclaurin summation
Notes by G.J.O. Jameson
The most elementary version
Consider a discrete sum of the form
Sm,n(f) =n∑
r=m
f(r), (1)
where f is a continuous function. Often there is no simple expression for Sm,n(f), but an
approximation is given by the corresponding integral∫ n
mf(x) dx, which can be evaluated
explicitly. Indeed, if f(x) is non-negative and decreasing, then f(r + 1) ≤ f(x) ≤ f(r) for
r ≤ x ≤ r + 1, so
f(r + 1) ≤∫ r+1
r
f(x) dx ≤ f(r).
Combining these inequalities for m ≤ r ≤ n− 1, we obtain
f(m+ 1) + · · ·+ f(n) ≤∫ n
m
f(x) dx ≤ f(m) + · · ·+ f(n− 1),
hence ∫ n
m
f(x) dx+ f(n) ≤ Sm,n(f) ≤∫ n
m
f(x) dx+ f(m). (2)
As an example, when applied to the harmonic sum Hn =∑n
r=11r, this gives log n+ 1
n≤
Hn ≤ log n+ 1.
Here the integral was estimated by successive rectangles determined by constant values
either greater or less than f(x). One would expect to obtain a closer approximation by
applying the trapezium rule on each interval. For this purpose, write
Tr(f) = 12f(r) + 1
2f(r + 1)
and
S∗m,n(f) =n−1∑r=m
Tr(f) = 12f(m) +
n−1∑r=m+1
f(r) + 12f(n), (3)
so that
Sm,n(f) = S∗m,n(f) + 12f(n) + 1
2f(m).
Also, write Jr(f) =∫ r+1
rf(x) dx and
Im,n(f) =
∫ n
m
f(x) dx =n−1∑r=m
Jr(f).
1
It is elementary that if f is convex, then Tr(f) ≥ Jr(f), hence S∗m,n(f) ≥ Im,n(f).
This is a considerable improvement upon (2). But can we find an accurate estimation of the
difference Tr(f)−Jr(f)? For differentiable f (with real or complex values), there is a simple
integral expression for this difference.
EM1. For differentiable f , we have
Tr(f)− Jr(f) =
∫ r+1
r
(x− r − 12)f ′(x) dx. (4)
Proof. Integrate by parts:∫ r+1
r
(x− r − 12)f ′(x) dx =
[(x− r − 1
2)f(x)
]r+1
r−
∫ r+1
r
f(x) dx
= 12f(r) + 1
2f(r + 1)− Jr(f). �
Note that the r occurring in this integral is the same as [x], the integer part of x. With
this trick of notation, we can combine (4) over successive intervals to obtain:
EM2. We have
S∗m,n(f)− Im,n(f) =
∫ n
m
(x− [x]− 12)f ′(x) dx. (5)
This is the most elementary version of the Euler-Maclaurin sum formula, and it has
its uses. However, to make it really effective, we need an estimation of the right-hand side.
To do this, consider first the interval [0, 1]. Write just T (f) and J(f) for T0(f) and J0(f).
Since∫ 1
0(x − 1
2) dx = 0, one senses that there must be a good deal of cancellation in the
right-hand side of (4). An estimate capturing this cancellation is found by integrating by
parts the other way round, as follows:
EM3. We have
T (f)− J(f) = 12
∫ 1
0
(x− x2)f ′′(x) dx. (6)
Hence if m ≤ f ′′(x) ≤M on [0, 1], then
112m ≤ T (f)− J(f) ≤ 1
12M.
Also, for f(x) real or complex, if |f ′′(x)| ≤M on [0, 1], then |T (f)− J(f)| ≤ 112M .
Proof. Taking r = 0 in (4) and integrating by parts, we have
T (f)− J(f) =[
12(x2 − x)f ′(x)
]1
0− 1
2
∫ 1
0
(x2 − x)f ′′(x) dx = 12
∫ 1
0
(x− x2)f ′′(x) dx.
2
The stated inequalities follow, because x− x2 ≥ 0 on [0, 1] and∫ 1
0(x− x2) dx = 1
6. �
By applying the result to f(x+ r), we obtain similar estimations for Tr(f)− Jr(f).
For convex functions, EM3 recaptures the inequality Tr(f) ≥ Jr(f) mentioned above.
The estimations in EM3 are already quite powerful. However, we can do even better
by repeating the integration by parts using the Bernoulli polynomials to select successive
antiderivatives. This is the basic principle of Euler-Maclaurin summation.
The Bernoulli polynomials and numbers
The Bernoulli polynomials are usually defined to be the polynomials Bn(x) appearing
in the expansiontext
et − 1=
∞∑n=0
Bn(x)tn
n!,
but an equivalent definition, more useful for our present purposes, is as follows. Put B0(x) =
1, then
Bn(x) = n
∫ x
0
Bn−1(t) dt+Bn,
where the constant Bn = Bn(0) is chosen to ensure that∫ 1
0Bn(x) dx = 0. The numbers Bn
are called the Bernoulli numbers. So B1(x) = x + B1, where 12
+ B1 = 0, hence B1 = −12
and B1(x) = x − 12. Note that this is the factor appearing in (4) when r = 0. Next,
B2(x) = x2 − x+B2, where 13− 1
2+B2 = 0, hence B2 = 1
6, so that
B2(x) = x2 − x+ 16.
Continuing, we find by easy calculations
B3(x) = x3 − 32x2 + 1
2x = x(x− 1
2)(x− 1),
B4(x) = x4 − 2x3 + x2 − 130
= x2(x− 1)2 − 130,
B5(x) = x5 − 52x4 + 5
3x3 − 1
6x = x(x− 1
2)(x− 1)(x2 − x− 1
3).
Note that B4 = − 130
and B3 = B5 = 0. The stated factorisation of B5(x) is not hard, once
it is recognised that it is zero at 0, 12
and 1.
This notation is now standard, but variations will be found in older books, for example
Bn where we have (−1)n−1B2n.
Note that by the fundamental theorem of calculus, B′n(x) = nBn−1(x).
3
There are numerous identites relating to the Bernoulli polynomials, but here we will
strictly limit our account to the properties needed for Euler-Maclaurin summation. The
reader is at liberty to defer the proofs to another day. For many applications, these properties
are only needed for the first few cases (say as far as B5(x)), and they can be simply spotted
from the explicit formulae given above.
EM4 LEMMA. Suppose that∫ 1
0f(x) dx = 0 and f(1−x) = εf(x), where ε is 1 or −1.
Let F (x) =∫ 1
0f(t) dt. Then
F (1− x) = −εF (x).
Proof. Since∫ 1
0f(x) dx = 0, we have
F (1− x) =
∫ 1−x
0
f(t) dt = −∫ 1
1−x
f(t) dt.
Now substituting t = 1− u, we have
F (1− x) = −∫ x
0
f(1− u) du = −ε∫ x
0
f(u) du = −εF (x). �
EM5. For all n ≥ 1, we have B2n(1− x) = B2n(x) and B2n+1(1− x) = −B2n+1(x). In
particular, B2n(1) = B2n(0) = B2n. Also, B2n+1(x) is zero at 0, 12
and 1.
Proof. Induction. Clearly, B2(1 − x) = B2(x). Assume, for some n ≥ 1, that
B2n(1 − x) = B2n(x). Let F (x) =∫ x
0B2n(t) dt. By EM4, F (1 − x) = −F (x). This implies
that∫ 1
0F (x) dx = 0 (substitute x = 1− y again). By the way B2n+1(x) was defined, it now
follows that B2n+1 = 0 and B2n+1(x) = (2n+ 1)F (x). Hence B2n+1(1− x) = −B2n+1(x), so
B2n+1(1) and B2n+1(12) are both 0. By EM4 again, we now have∫ 1−x
0
B2n+1(t) dt =
∫ x
0
B2n+1(t) dt,
and hence B2n+2(1− x) = B2n+2(x). �
EM6. If n is even, then B2n+1(x) < 0 on (0, 12) and B2n ≤ 0. The opposite inequalities
hold if n is odd.
Proof. From the expressions above, it is clear that B1(x) < 0 and B3(x) > 0 on (0, 12).
For induction, assume now that for a certain even n ≥ 1 we have B2n−1(x) > 0 on (0, 12)
(note that 2n − 1 = 2(n − 1) + 1!). Then B′′2n+1(x) = 2n(2n + 1)B2n−1(x) > 0 on (0, 1
2), so
B2n+1(x) is convex on this interval. Since it is zero at 0 and 12, it follows that B2n+1(x) ≤ 0
on the interval. If it were zero at some point ξ in (0, 12), then by Rolle’s theorem, applied
4
twice, B2n−1(x) would have a zero between 0 and 12, contrary to assumption. Hence also
B2n = 12n+1
B′2n+1(0) ≤ 0. Repetition of this reasoning shows that B2n+3(x) > 0 on (0, 1
2). �
The statements can be combined by stating, for example, (−1)n−1B2n ≥ 0. One can
show that, in fact, strict inequality holds.
EM7. For all x,
Bn(x) =n∑
r=0
(n
r
)Brx
n−r. (7)
In particular,n−1∑r=0
(n
r
)Br = 0. (8)
Proof. Identity (7) holds for n = 1, since B1(x) = x − 12
= B0x + B1. Assume (7) for
n. From the defining formula, we see that the coefficient of xn−r+1 in Bn+1(x) is
(n+ 1)
(n
r
)Br
n− r + 1= Br
(n+ 1
r
).
Also, the constant term is Bn+1. So (7) holds for n+ 1. Identity (8) follows by taking x = 1
and cancelling the term Bn, since Bn(1) = Bn. �
Formula (8) enables us to calculate Bn successively. The next few are B6 = 142
, B8 =
− 130, B10 = 5
66, B12 = − 691
2730.
EM8. For all x,
Bn(2x) = 2n−1(Bn(x) +Bn(x+ 1
2)). (9)
In particular,
Bn(12) = −
(1− 1
2n−1
)Bn. (10)
Proof. It is easily checked that (9) holds for n = 1 Assume it for n− 1. Let
Fn(x) = Bn(2x)− 2n−1(Bn(x) +Bn(x+ 1
2
).
Since B′n(x) = nBn−1(x), we have F ′n(x) = 2nFn−1(x) = 0, so Fn(x) is constant, say cn.
From the fact that∫ 1
0Bn(x) dx = 0, it is clear that
∫ 1/2
0Fn(x) dx = 0. Hence cn = 0. The
case x = 0 gives (10). �
EM9. We have |B2n(x)| ≤ |B2n| for 0 ≤ x ≤ 1.
Proof. By EM7, B′2n(x) has one sign on [0, 1
2] and the opposite sign on [1
2, 1]. Since
B2n(1) = B2n(0), the greatest value of B2n(x) occurs at either 0 or 12. By EM8, it occurs at
x = 0.
5
The Bernoulli numbers appear in the explicit formula for∑n
r=1 rp: later we will show
how this can be derived from Euler-Maclaurin summation. They also appear in the following
expression for ζ(2n):
ζ(2n) = (−1)n−1 B2n
2(2n)!(2π)2n.
We will not prove this identity here (see, for example, [AAR, p. 12]), but we note that since
ζ(2n) → 1 as n→∞, it implies the following asymptotic expression for |B2n|, showing that
these numbers ultimately grow large:
|B2n| ∼2(2n)!
(2π)2n.
(For example, we find that already B30 > 6× 108.)
The general Euler-Maclaurin formula
First, consider the interval [0, 1]. We integrate repeatedly by parts, using 1nBn(x) as the
antiderivative of Bn−1(x). We assume, without repeatedly saying so, that f(x) has enough
derivatives for the formulae stated. The basic expression that emerges is
E2k(n) =:k∑
j=1
B2j
(2j)!f (2j−1)(n). (11)
(Warning: this notation is not standard!) In particular, E2(n) = 12B2f
′(n) = 112f ′(n) and
E4(n) =B2
2f ′(n) +
B4
4!f (3)(n) = 1
12f ′(n)− 1
720f (3)(n).
EM10 PROPOSITION. For all k ≥ 1, we have
T (f)− J(f) = E2k(1)− E2k(0) + ρ2k, (12)
where
ρ2k = − 1
(2k)!
∫ 1
0
B2k(x)f(2k)(x) dx (13)
=1
(2k + 1)!
∫ 1
0
B2k+1(x)f(2k+1)(x) dx. (14)
Proof. Take r = 0 in (4), and integrate by parts, now using 12B2(x) as the antiderivative
of x− 12. Since B2(0) = B2(1) = B2, we obtain
T (f)− J(f) =[
12B2(x)f
′(x)]1
0− 1
2
∫ 1
0
B2(x)f′′(x) dx
= 12B2
(f ′(1)− f ′(0)
)− 1
2
∫ 1
0
B2(x)f′′(x) dx.
6
This is the case k = 1 in (12) and (13). Now assume (12) and (13) for a general k. Then,
since B2k+1(0) = B2k+1(1) = 0,
ρ2k = − 1
(2k + 1)!
[B2k+1(x)f
(2k)(x)]1
0+
1
(2k + 1)!
∫ 1
0
B2k+1(x)f(2k+1)(x) dx
=1
(2k + 1)!
∫ 1
0
B2k+1(x)f(2k+1)(x) dx,
which is (14) for k. Integrating again, we have
ρ2k =1
(2k + 2)!
[B2k+2(x)f
(2k+1)(x)]1
0+ ρ2k+2
=1
(2k + 2)!B2k+2
(f (2k+1)(1)− f (2k+1)(0)
)+ ρ2k+2,
where
ρ2k+2 = − 1
(2k + 2)!
∫ 1
0
B2k+2(x)f(2k+2)(x) dx,
hence (12) and (13) for k + 1. �
To transfer these statements to the interval [r, r + 1], we just apply them to f(x+ r).
With Tr(f) and Jr(f) defined as before, we obtain:
Tr(f)− Jr(f) = E2k(r + 1)− E2k(r) + ρ2k,r,
where
ρ2k,r = − 1
(2k)!
∫ r+1
r
B2k(x− r)f (2k)(x) dx
=1
(2k + 1)!
∫ r+1
r
B2k+1(x− r)f (2k+1)(x) dx.
In the case k = 0, (14) reproduces (4), but (13) does not apply.
The Euler-Maclaurin sum formula is now obtained by combining over these intervals
for m ≤ r ≤ n− 1. The pleasant feature is that cancellation gives
n−1∑r=m
(E2k(r + 1)− E2k(r)
)= E2k(n)− E2k(m).
To express the term B2k(x − r) in a way that does not change with each r, write B̃n(x) =
Bn(x− [x]), the 1-periodic extension of Bn(x) as defined on [0, 1]. We obtain:
EM11 THEOREM. For m < n and k ≥ 1, we have
S∗m,n(f)− Im,n(f) = E2k(n)− E2k(m) +R2k(m,n), (15)
7
where
R2k(m,n) = − 1
(2k)!
∫ n
m
B̃2k(x)f(2k)(x) dx (16)
=1
(2k + 1)!
∫ n
m
B̃2k+1(x)f(2k+1)(x) dx. � (17)
Of course, to replace S∗m,n(f) by Sm,n(f), we simply add 12f(n) + 1
2f(m).
Since |B̃2k(x)| ≤ |B2k|, a simple-minded bound for R2k(m,n) is
|R2k(m,n)| ≤ |B2k|(2k)!
∫ n
m
|f (2k)(x)| dx. (18)
In the complex case, this is the natural estimate to use. In the real case, if f (2k)(x) ≥ 0 on
[m,n], it gives
|R2k(m,n)| ≤ |B2k|(2k)!
[f (2k−1)(n)− f (2k−1)(m)],
which coincides with the modulus of the last term in the sum E2k(n)−E2k(m). However, we
shall see that for functions satisfying this kind of monotonicity condition, one can formulate
an estimation that is both stronger and simpler to state.
It might appear that E2k(n) represents the partial sums of a convergent series, but in
fact this is deceptive, because of the growth of the Bernoulli numbers. Recall that |B2k| ∼2(2k)!/(2π)2k. As an example, if f(x) = 1/x, we have f (2k−1)(n) = −(2k − 1)!/n2k, so
|B2k|(2k)!
|f (2k−1)(n)| ∼ 2(2k − 1)!
(2πn)2k,
which tends to infinity as k →∞, with the minimum occurring when k is about πn. In fact,
the Euler-Maclaurin sum formula is an asymptotic expression, not a convergent series.
Inequalities for completely monotonic functions
We now show that a simple condition for real functions ensures that the error term
R2k(m,n) is either positive or negative, thereby showing that the partial sums E2k(n) −E2k(m) are alternately upper and lower bounds. We say that a real-valued function f is
completely monotonic on [m,n] if it possesses all derivatives and
(CM) (−1)kf (k)(x) ≥ 0 for all k ≥ 0 and m ≤ x ≤ n.
Equivalently, f (2k)(x) ≥ 0 and f (2k+1)(x) ≤ 0 for all k ≥ 0. It follows at once that the even-
numbered derivatives are decreasing and the odd-numbered derivatives increasing. Also, by
8
an easy application of the mean-value theorem, if f is completely monotonic on (0,∞), then
limx→∞ f(k)(x) = 0 for all k ≥ 1.
We say that f satisfies condition (CMk) if (CM) holds as far as the derivative f (k).
The functions 1/xp (for p > 0) are completely monotonic on (0,∞): these are the most
basic examples for our purposes. Another example is e−ax for a > 0.
If f is completely monotonic on (0,∞), then so are f(x + a) and f(x) − f(x + a) for
a > 0.
The principle underlying the desired inequality is pleasantly simple, as follows:
EM12 LEMMA. Suppose that f and g are two functions on [0, 1] such that f(x) is
increasing and g(1− x) = −g(x) for 0 ≤ x ≤ 1, and g(x) ≤ 0 for 0 ≤ x ≤ 12. Then∫ 1
0
f(x)g(x) dx ≥ 0.
If g(x) ≥ 0 on [0, 12], then the inequality reverses.
Proof. The substitution x = 1− y gives∫ 1
1/2
f(x)g(x) dx =
∫ 1/2
0
f(1− y)[−g(y)] dy,
hence ∫ 1
0
f(x)g(x) dx =
∫ 1/2
0
(f(x)− f(1− x)
)g(x) dx.
Now f(x)− f(1− x) ≤ 0 for 0 ≤ x ≤ 12, so if g(x) ≤ 0 on [0, 1
2], then
∫ 1
0f(x)g(x) dx ≥ 0. �
Applied to (4), this reproduces the fact that if f ′(x) is increasing, then T (f) ≥ J(f),
as we saw from EM3.
EM13 THEOREM. If f is completely monotonic on [m,n], then (−1)kR2k(m,n) ≥ 0,
so
S∗m,n(f)− Im,n(f) ≥ E2k(n)− E2k(m). (19)
for even k, and the reverse inequality holds for odd k.
Proof. Consider the interval [0, 1], with the notation of EM10. First, take k even. By
EM5 and EM6, B2k+1(1 − x) = −B2k+1(x) and B2k+1(x) ≤ 0 on [0, 12]. Also, f (2k+1)(x) is
increasing, so by (14) and EM12, we have ρ2k ≥ 0. Applying this to intervals [r, r + 1] and
combining, we obtain R2k(m,n) ≥ 0, hence (19). The opposite holds if k is odd, since then
B2k+1(x) ≥ 0 on [0, 12]. �
9
Clearly, condition (CMk+1) is actually sufficient in this result.
So for even k,
E2k(n)− E2k(m) ≤ S∗m,n(f)− Im,n(f) ≤ E2k−2(n)− E2k−2(m).
By the definitions of E2k(n) and R2k−2(m,n), an equivalent way to state this pair of inequal-
ities isB2k
(2k)![f (2k−1)(n)− f (2k−1)(m)] ≤ R2k−2(m,n) ≤ 0, (20)
together with the reverse inequalities when k is odd.
We remark that if (18) is applied instead of Lemma EM12, the lower bound obtained
in (20) is doubled. This version is presented in some accounts of the topic.
In particular, the case k = 2 (which we will apply repeatedly in examples) can be
stated as follows:
S∗m,n(f)− Im,n(f) = 112
[f ′(n)− f ′(m)]− r2(m,n), (21)
where
0 ≤ r2(m,n) ≤ 1720
[f (3)(n)− f (3)(m)]. (22)
(Here we have written r2(m,n) for −R2(m,n).) From the proof of Theorem EM13, it is clear
that the condition really needed for this is (CM6), to ensure that f (5)(x) is increasing. Of
course, given only that f ′′(x) ≥ 0, we have the more elementary inequality S∗m,n(f) ≥ Im,n(f),
as mentioned after Lemma EM12.
Example 1. Let Ln =∑2n
r=n+11r. With f(x) = 1/x, we have Ln = S∗n,2n(f)− 1
2n+ 1
4n=
S∗n,2n(f)− 14n
. Now In,2n(f) = log 2, also f ′(x) = −1/x2 and f (3)(x) = −6/x4. So by (21),
S∗n,2n(f) = log 2 +1
12
(1
n2− 1
(2n)2
)− rn = log 2 +
1
16n2− rn,
where
0 ≤ rn ≤1
120
(1
n4− 1
(2n)4
)=
1
128n4.
For example, assuming log 2 known, this gives L100 = 0.6906534 to seven d.p. Viewed
the other way round, we can regard it as giving bounds for log 2: with n taken to be only 4,
these bounds are 0.693117 and 0.693148 to six d.p.
10
Estimating the tail of a convergent series
Suppose that f(x) is positive, decreasing and tends to 0 as x → ∞. It follows from
(2) that convergence of the series∑∞
n=1 f(n) is equivalent to convergence of the integral∫∞1f(x) dx. Write S(f) for the sum of the series and Sn(f) =
∑nr=1 f(r) (this is S1,n(f) in
our previous notation), so that S(f)−Sn(f) =∑∞
r=n+1 f(r), the “tail” of the series. Taking
the limit in (2) as n→∞, we see that∫ ∞
m
f(x) dx− f(m) ≤ S(f)− Sm(f) ≤∫ ∞
m
f(x) dx.
For the better estimation given by Euler-Maclaurin summation, we simply let n→∞in EM11 and EM13. In a natural extension of the previous notation, write
S∗m,∞(f) = 12f(m) +
∞∑r=n+1
f(r),
so that S(f) = Sm−1(f) + 12f(m) + S∗m,∞(f).
We state the result for completely monotonic functions, corresponding to EM13. For
such functions, limx→∞ f(k)(x) = 0 for all k ≥ 1, so E2k(n) → 0 as n→∞. Taking the limit
as n→∞ in (19), we have at once:
EM14 THEOREM. Suppose that f is completely monotonic on [1,∞), and∫∞
1f(x)dx
is convergent. Then
S∗m,∞(f) ≥∫ ∞
m
f(x) dx− E2k(m) (23)
for even k, and the reverse inequality holds for odd k.
Again we state specifically the pair of inequalities from the cases k = 1 and k = 2 (the
condition (CM6) is sufficient):
S∗m,∞(f) =
∫ ∞
m
f(x) dx− 112f ′(m)− r2(m,∞), (24)
where
0 ≤ r2(m,∞) ≤ − 1720f (3)(m).
Example 2. Let S =∑∞
n=11n2 , so S = S(f), where f(x) = 1/x2. (Of course, it is well
known that S = π2/6, but our present concern is simply to give bounds for the tail of the
series.) Then∫∞
nf(x) dx = 1
n, also f ′(x) = −2/x3 and f (3)(x) = −24/x5. So
S = Sn−1 +1
2n2+ S∗n,∞,
11
and by (24),
S∗n,∞ =1
n+
1
6n3− rn, (25)
where
0 ≤ rn ≤1
30n5.
For S∗5,∞, this gives bounds 0.2013226 and 0.2013333 to seven d.p. The resulting bounds for
S are 1.6449337 and 1.6449444 (the actual value is 1.6449341).
We leave it to the reader to write out the statement for∑∞
n=1 1/np.
The next example shows how the result can be applied to an alternating series.
Example 3. Catalan’s constant G is defined by
G = 1− 1
32+
1
52− · · · .
We can write it as∑∞
n=0 f(n), where
f(x) =1
(4x+ 1)2− 1
(4x+ 3)2.
Clearly, f is completely monotonic. We have∫ ∞
n
f(x) dx =1
4(4n+ 1)− 1
4(4n+ 3)=
1
2(4n+ 1)(4n+ 3),
hence (24) gives
S∗n,∞ =1
2(4n+ 1)(4n+ 3)+
2
3
(1
4n+ 1)3− 1
(4n+ 3)3
)− rn,
where
0 ≤ rn ≤32
15
(1
(4n+ 1)5− 1
(4n+ 3)5
).
Using the mean-value theorem, we can state the slightly simpler bound rn ≤ 256/[3(4n+1)6].
Partial sums of divergent series; Euler-type constants
Suppose that f(x) is decreasing on [a,∞) and converges to 0 as x → ∞. Write (as
before) Sn(f) =∑n
r=1 f(r), also In(f) =∫ n
1f(x)dx. For r ≥ a, we have f(r+1) ≤
∫ r+1
rf ≤
f(r). This implies that Sn(f) − In(f) is decreasing for n ≥ a, while Sn−1(f) − In(f) is
increasing, so both converge to a limit L as n→∞, and
Sn(f)− f(n) ≤ In(f) + L ≤ Sn(f).
In the case f(x) = 1/x, L is Euler’s constant γ.
12
Since Sn(f) = S∗1,n(f)+ 12f(1)+ 1
2f(n), it follows that S∗1,n(f)− In(f) → L∗ as n→∞,
where L∗ = L− 12f(1). By EM2, we have the expression
L∗ =
∫ ∞
1
(x− [x]− 12)f ′(x) dx. (26)
Convergence of this integral is obvious, providing an alternative proof of the existence of the
limit L∗.
We formulate the more accurate estimation delivered by Euler-Maclaurin summation:
EM15 THEOREM. Suppose that f is completely monotonic on [a,∞) and limx→∞ f(x) =
0. Then Sn(f)− In(f) tends to a limit L as n→∞, and
Sn(f) = In(f) + L+ 12f(n) + E2k(n)−R2k(n,∞), (27)
where R2k(n,∞) is defined as in (17). Also, (−1)kR2k(n,∞) ≥ 0 for n ≥ a.
Proof. By Theorem EM11,
S∗1,n(f)− In(f) = E2k(n)− E2k(1) +R2k(1, n).
As before, E2k(n) → 0 as n → ∞. Also, from the integral representation (17), it is clear
that R2k(1, n) converges to R2k(1,∞). So S∗1,n(f)− In(f) → L∗ as n→∞, where
L∗ = −E2k(1) +R2k(1,∞).
Also, R2k(1,∞) = R2k(1, n) +R2k(n,∞), so by subtraction, we have
S∗1,n(f)− In(f)− L∗ = E2k(n)−R2k(n,∞).
Replacing S∗1,n(f) by Sn(f), we obtain (27). �
Again we state specifically the pair of inequalities (for f satisfying (CM6)) from the
cases k = 1 and k = 2:
Sn(f) = In(f) + L+ 12f(n) + 1
12f ′(n) + rn, (28)
where
0 ≤ rn ≤ − 1
720f (3)(n).
Example 4. Write Hn =∑n
r=11r. Applied to f(x) = 1/x, (28) gives
Hn = log n+ γ +1
2n− 1
12n2+ rn, (29)
13
where
0 ≤ rn ≤1
120n4.
This gives H100 = 5.18737752 to eight d.p. (note that the term rn is less than 10−10),
and the implied bounds for γ, with n = 10, are 0.57721566 and 0.57721649 (compare the
actual value 0.5772156650 . . .).
The next term is −1/252n6. Euler-Maclaurin summation was used by Euler himself
to calculate the first 15 digits of γ. In 1962, Knuth used it to compute 1271 digits. For a
survey of later developments in the computation of γ, see [GS].
Now let Un =∑n
r=11
2r−1. Then Un = H2n −
∑nr=1
12r
= H2n − 12Hn. Applying (29) to
H2n and Hn, we obtain after simplification
Un = 12log n+ log 2 + 1
2γ +
1
48n2+ sn,
where
− 1
240n4≤ sn ≤
1
480n4.
Example 5. Take f(x) = 1/xp, where 0 < p < 1. There is an “Euler-type” constant Lp
for each p. We leave it to the reader to write out (28) explicitly for this case. Just taking
n = 1, we obtain Lp = 12
+ p12− δp, where 0 ≤ δp ≤ 1
720p(p+ 1)(p+ 2).
Example 6. Let f(x) = (log x)m/x, where m ≥ 1. Then f(x) is decreasing when
log x ≥ m. The resulting constant L is called the Stieltjes constant γm. Unlike our previous
examples, f(x) is not completely monotonic on any interval. However, condition (CMk) is
satisfied for large enough x. We focus on the case m = 1. Then f ′(x) = (1− log x)/x2 and
one can check by induction that f (k)(x) ≥ 0 when log x ≥ Hk. We just state the pair of
inequalities given by (28), using only rn ≥ 0. This is valid for log n ≥ H4 (so certainly for
n ≥ 9):
Sn(f) = 12(log n)2 + γ1 +
log n
2n− rn,
where
0 ≤ rn ≤log n− 1
12n2.
Using the full strength of (28) and taking n = 10, one finds that γ1 = −0.07282 to five d.p.
Stirling’s formula
In its integer form, Stirling’s formula states
n! ∼ Cnn+ 12 e−n as n→∞,
14
where C = (2π)1/2 and the notation f(n) ∼ g(n) means that f(n)/g(n) → 1.
Restated in logarithmic form, the statement is equivalent to
log n! = (n+ 12) log n− n+ c+Qn,
where c = 12log(2π) and Qn → 0 as n→∞.
Using Euler-Maclaurin summation with (again) k = 2, we will establish the following
much more accurate version:
EM16 PROPOSITION. We have
log n! = (n+ 12) log n− n+ c+
1
12n− qn, (30)
where
0 ≤ qn ≤1
360n3.
In common with most proofs of Stirling’s formula, we concentrate on showing that (28)
holds for some constant c; the evaluation of c (and C) can then be achieved using the Wallis
product: this can be seen in many books, for example, [AAR, p. 20]). We will not repeat
this part of the proof here.
Note that log n! = Sn(f), where f(x) = log x. Also, Sn(f) = S∗1,n(f) + 12log n. The
proof is similar to Theorem EM15, except that the odd-numbered derivatives are now positive
and the even-numbered ones negative, so the inequality in (22) reverses.
Proof of EM16. Let f(x) = log x, so that f ′(x) = 1/x and f (3)(x) = 2/x3. By (21),
with (22) reversed,
S∗m,n(f)− Im,n(f) =1
12
(1
n− 1
m
)+R2(m,n),
where
0 ≤ R2(m,n) ≤ 1
360
(1
m3− 1
n3
).
So
S∗1,n(f)− In(f) =1
12
(1
n− 1
)+R2(1, n).
Also, R2(1, n) increases with n, since R2(1, n) = R2(1, n − 1) + R2(n − 1, n). So R2(1, n)
tends to a limit R2(1,∞) as n→∞ and
S∗1,n(f)− In(f)− 1
12n= c′ − qn,
15
where c′ = − 112
+R2(1,∞) and
qn = R2(n,∞) ≤ 1
360n3.
Now In(f) = n log n− n+ 1. Adding 12log n and writing c = c′ + 1, we obtain (30). �
Numerical illustration. The value of 10! is 3,628,800. The approximation given by
Cnn+1/2e−n is 3,598,696. The bounds give by (30), to the nearest integer, are 3,628,800 itself
and 3,628,810.
We sketch briefly how similar methods can be used to establish Stirling’s formula for
the gamma function. Details can be seen in [Jam]. Write, as usual, ψ(x) = Γ′(x)/Γ(x).
From Euler’s limit expression for the gamma function, one has ψ(x) = limn→∞ ψn(x), where
ψn(x) = log n−n−1∑r=0
1
r + x.
Applying (21) to f(t) = 1/(t+ x), one shows that
ψ(x) = log x− 1
2x− 1
12x2+ ρ(x),
where 0 ≤ ρ(x) ≤ 1/120x4. A straightforward deduction then gives
log Γ(x) = (x− 12) log x− x+ c+
1
12x− r(x),
where 0 ≤ r(x) ≤ 1/360x3. The method can be adapted to the complex case.
Sums of integer powers
Let S(p, n) =∑n
r=1 rp, where p is a positive integer. Euler-Maclaurin summation
delivers at once the well-known closed expression for S(p, n) in terms of the Bernoulli numbers
(though it should be said that a direct proof is not hard). We rewrite S(p, n) as∑n
r=0 rp,
so, in our standing notation S(p, n) = S0,n(f), where f(x) = xp. Also, for this purpose, it
is helpful to rewrite the definition (11) of E2k(n) to include the odd terms, although in fact
they are zero:
Ek(n) =k∑
j=2
Bj
j!f (j−1)(n).
By Theorem EM11, applied to 2k and 2k + 1, we see that if f (k)(x) = 0 for all x, then
S∗0,n(f) − I0,n(f) = Ek(n) − Ek(0): the remainder term is zero. For f(x) = xp, we have
f (j)(0) = 0 for j ≤ p − 1 and f (p)(n) = f (p)(0) = p!. Now taking k = p + 1 and adding the
term 12np, we conclude:
16
EM17 PROPOSITION. We have
S(p, n) =np+1
p+ 1+ 1
2np +
p∑j=2
Bj
j!p(p− 1) . . . (p− j + 2)np−j+1. (31)
Equivalently,
(p+ 1)S(p, n) = np+1 + 12(p+ 1)np +
p∑j=2
Bj
(p+ 1
j
)np−j+1. � (32)
There are further ways to rewrite this formula. If we consider S(p, n − 1) instead of
S(p, n), then the second term in (31) becomes −12np = B1n
p. Since also B0 = 1, we can
restate (32) as
(p+ 1)S(p, n− 1) =
p∑j=0
Bj
(p+ 1
j
)np−j+1.
Extension of the definition of the zeta function
We now describe an application to the complex case. Following traditional notation in
this subject area, we write the complex number s as σ + it. For s with σ > 1, the Riemann
zeta function is defined by ζ(s) =∑∞
n=1 1/ns. The series does not converge for other s, but
Euler-Maclaurin summation provides a way (admittedly, not the only way) to extend the
definition.
We start with the simplest version, using only EM2 to extend the definition to the
region σ > 0. For some purposes, including the proof of the prime number theorem, this
is quite sufficient. In the case when the series and integral both converge, we can take the
limit as n→∞ in EM2 to obtain
S∗1,∞(f) =
∫ ∞
1
f(x) dx+
∫ ∞
1
B̃1(x)f′(x) dx,
where B̃1(x) = x− [x]− 12. Applied to f(x) = 1/xs, with σ > 1, we have S∗1,∞(f) = ζ(s)− 1
2,
hence
ζ(s) =1
s− 1+
1
2+R0(1,∞, s), (33)
where
R0(1,∞, s) = −s∫ ∞
1
B̃1(x)
xs+1dx. (34)
Now |B̃1(x)| ≤ 12
for all x. Also, |xs+1| = xσ+1, and for σ > 0,∫∞
11/xσ+1 dx converges,
with value 1/σ. So for all s with σ > 0, the integral defining R0(1,∞, s) is convergent,
and we can take (33) and (34) as the definition of ζ(s). Furthermore, we have shown that
|R0(1,∞, s)| ≤ |s|/2σ.
17
While this has given us a definition that works for σ > 0, it does not reveal much about
the nature of the extended function, and is no use at all for computing its value. For these
purposes, we do better by combining with (5), as originally stated for the interval [1, n]. This
gives
S∗1,n(f) =1
s− 1(1− n1−s) +R0(1, n, s),
where R0(1, n, s) is defined as in (34). Subtracting this from (33) (duly allowing for the half
values at 1 and n) and estimating R0(n,∞, s) as above, we obtain:
EM18. For σ > 0,
ζ(s) =n−1∑r=1
1
rs+
1
2ns+n1−s
s− 1+R0(n,∞, s), (35)
and we have
|R0(n,∞, s)| ≤ |s|2σnσ
. �
Of course, when 0 < σ < 1, both Sn(f) and n1−s/(s− 1) diverge as n→∞; however,
their sum converges (with limit ζ(s)): this is another case of an Euler-type constant.
The estimation of R0(n,∞, s) shows that convergence as n → ∞ in (35) is uniform
on sets of the form {s : σ ≥ δ, |t| ≤ T}. This implies the important fact that the extended
function is holomorphic except at the point 1.
One can apply (35) to derive estimations like |ζ(1+it)| ≤ log t+c and ζ(12+it)| ≤ Ct1/2
for suitable c and C (e.g. [Jam2]) Another application, closer to the topic of these notes, is:
EM19. We have
ζ(s)− 1
s− 1→ γ as s→ 1.
Proof. By uniform convergence, as just discussed, R0(1,∞, s) is a continuous function
of s for σ > 0 (including at 1). So by (33),
lims→1
(ζ(s)− 1
s− 1
)= 1
2+R0(1,∞, 1) = 1
2−
∫ ∞
1
B̃1(x)
x2dx.
By (26), with f(x) = 1x, this equates to γ. �
We now show how to extend ζ(s) to the whole complex plane, using EM11 instead
of EM2. Again, let f(x) = 1/xs. The formulae will be kept more pleasant by writing the
derivatives in the form f (k)(s) instead of writing out the expressions explicitly. Initially, let
σ > 1. In (15), taking m = 1 and n→∞, we obtain
ζ(s) =1
s− 1+
1
2− E2k(1) +R2k(1,∞, s), (36)
18
where
R2k(1,∞, s) =1
(2k + 1)!
∫ ∞
1
B̃2k+1(x)f(2k+1)(x) dx. (37)
Now f (2k+1)(x) = c2k+1/xs+2k+1 for a certain coefficient c2k+1, and∫ ∞
1
1
xσ + 2k + 1dx
is convergent when σ > −2k. Also, B̃2k+1(x) is bounded, so the integral in (37) converges
for such s, and we take (36) and (37) as the definition of ζ(s) for such s.
When this process is repeated with 2k + 2 instead of 2k, consistency requires
R2k+2(1,∞, s)−R2k(1,∞, s) = E2k+2(1)− E2k(1) =B2k+2
(2k + 2)!f (2k+1)(1).
This is exactly the result of EM10, combined as before over successive intervals.
To derive the expression corresponding to (35), write (15) for the interval [1, n]:
S∗1,n(f) =1
s− 1(1− n1−s) + E2k(n)− E2k(1) +R2k(1, n, s).
We subtract this from (36) to obtain
ζ(s) =n−1∑r=1
1
rs+
1
2ns+n1−s
s− 1− E2k(n) +R2k(n,∞, s). (38)
We have kept this looking reasonably simple by adhering to our notation E2k(n): if its
definition (11) is substituted, with the derivatives written out, it looks quite complicated!
For σ > −2k + 1, the bound for R2k(n,∞, s) given by (18) is
|R2k(n,∞, s)| ≤ |B2k|(2k)!
|s(s+ 1) . . . (s+ 2k − 1)|(σ + 2k − 1)nσ+2k−1
=|s+ 2k − 1|σ + 2k − 1
u2k−1,
where u2k−1 is the last term in the sum E2k(n). For computation of a value of ζ(s), we might
now take 2k = 4; of course, the calculation is distinctly more laborious than in our previous
examples for real functions. For some worked examples, see [Edw, chap. 6].
A variant based on mid-points
Instead of the trapezium rule, it is equally natural to compare f(r) with Kr(f), where
Kr(f) =∫ r+1/2
r−1/2f(x)dx. When added, this will lead to direct estimations of Sm,n(f), without
having to halve the end values. Note that f(r) is the mid-point estimate for the integral
Kr(f), and will underestimate it when f is convex. This variant of Euler-Maclaurin summa-
tion was described by De Temple and Wang [DTW], though only presented for the particular
case of the harmonic series. I do not know if there are earlier references for it.
19
The starting point is the following analogue of EM1, which we state on the interval
[−12, 1
2] (do not be alarmed by the negative values of x: the result will be applied to f(x+ r)
as before).
EM20. With this notation, we have
f(0)−K0(f) =
∫ 1/2
0
(x− 12)(f ′(x)− f ′(−x)
)dx. (39)
Proof. Write g(x) = f(x) + f(−x), so that g′(x) = f ′(x) − f ′(−x). Note that∫ 1/2
0f(−x) dx =
∫ 0
−1/2f(x) dx, so that
∫ 1/2
0g(x) dx =
∫ 1/2
−1/2f(x) dx = K0(f). Integrate
by parts: ∫ 1/2
0
(x− 12)g′(x) dx =
[(x− 1
2)g(x)
]1/2
0−
∫ 1/2
0
g(x) dx
= 12g(0)−K0(f)
= f(0)−K0(f). �
Now let
F2k(x) =k∑
j=1
B2j(12)
(2j)!f (2j−1)(x). (40)
Recall that the numbers Bn(12) are given by (10).
Corresponding to EM10, we have:
EM21. We have
f(0)−K0(f) = F2k(12)− F2k(−1
2) + σ2k, (41)
where
σ2k = − 1
(2k)!
∫ 1/2
0
B2k(x)(f (2k)(x) + f (2k)(−x)
)dx (42)
=1
(2k + 1)!
∫ 1/2
0
B2k+1(x)(f (2k+1)(x)− f (2k+1)(−x)
)dx. (43)
If f is completely monotonic on [−12, 1
2], then (−1)k−1σ2k ≥ 0.
Proof. Continue to write g(x) = f(x) + f(−x). Note that g′(0) = 0. Integrating by
parts in (39), we obtain
f(0)−K0(f) =[
12B2(x)g
′(x)]1/2
0− 1
2
∫ 1/2
0
B2(x)g′′(x) dx
= 12B2(
12)g′(1
2)− 1
2
∫ 1/2
0
B2(x)g′′(x) dx.
20
This is the case k = 1 in (41) and (42). Now assume (41) and (42) for a general k. Then,
since B2k+1(0) = B2k+1(12) = 0,
σ2k = − 1
(2k + 1)!
[B2k+1(x)g
(2k)(x)]1/2
0+
1
(2k + 1)!
∫ 1/2
0
B2k+1(x)g(2k+1)(x) dx
=1
(2k + 1)!
∫ 1/2
0
B2k+1(x)g(2k+1)(x) dx,
which is (43) for k. Integrating again, we have
σ2k =1
(2k + 2)!
[B2k+2(x)g
(2k+1)(x)]1/2
0+ σ2k+2
=1
(2k + 2)!B2k+2(
12)g(2k+1)(1
2) + σ2k+2,
where
σ2k+2 = − 1
(2k + 2)!
∫ 1/2
0
B2k+2(x)g(2k+2)(x) dx,
hence (41) and (42) for k + 1.
If f is completely monotonic on [−12, 1
2], then (−1)k−1B2k+1(x) ≥ 0 and f (2k+1)(x) ≥
f (2k+1)(−x), so g(2k+1)(x) ≥ 0, on [0, 12]. (We do not need Lemma EM12.) �
We now transfer to the interval [r− 12, r+ 1
2] and combine to derive the variant Euler-
Maclaurin sum formula corresponding to Theorem EM11. An expression for the remainder
term can be derived from (42) or (43), but it is not very pleasant. Instead of spelling it out,
we just state the simpler version for completely monotonic functions.
EM22 THEOREM. If f is completely monotonic on [m− 12, n+ 1
2], then
Sm,n(f)−∫ n+1/2
m−1/2
f(x) dx = F2k(n+ 12)− F2k(m− 1
2) + T2k(m,n), (44)
where (−1)k−1T2k(m,n) ≥ 0. �
Inserting the values B2(12) = − 1
12and B4(
12) = 7
240, we see that F2(x) = − 1
24f ′(x) and
F4(x) = − 1
24f ′(x) +
7
5760f (3)(x).
So the cases k = 1 and k = 2 in (44) can be written as
Sm,n(f)−∫ n+1/2
m−1/2
f(x) dx = − 1
24
(f ′(n+ 1
2)− f ′(m− 1
2))
+ T2(m,n), (45)
where
0 ≤ T2(m,n) ≤ 7
5760
(f (3)(n+ 1
2)− f (3)(m− 1
2)).
21
For the tail of a convergent series, this gives, corresponding to (24):
Sm,∞(f) =
∫ ∞
m−1/2
f(x) dx+ 124f ′(m− 1
2) + T2(m,∞),
where 0 ≤ T2(m,∞) ≤ − 75760
f (3)(m− 12). For S =
∑∞n=1
1n2 , with m = 6, this gives bounds
1.6449284 and 1.6449342.
Now consider the situation of Theorem EM15. Taking m = 1 in (44) and considering
the limit as n→∞, we have
Sn(f)−∫ n+1/2
1/2
f(x) dx→ L∗ as n→∞,
where
L∗ = −F2k(12) + T2k(1,∞).
Now T2k(1,∞) = T2k(1, n) + T2k(n,∞), so, taking the difference, we have
Sn(f)−∫ n+1/2
1/2
f(x) dx− L∗ = F2k(n+ 12) + T2k(n,∞).
For the harmonic series, the conclusion is
Hn = log(n+ 12) + γ +
1
24(n+ 12)2− sn,
where
0 ≤ sn ≤7
960(n+ 12)4.
Compare this with (29). The term 1/2n has been absorbed into the log term, resulting
(arguably) in an estimation which is at least as natural. The impled bounds for γ, again
with n = 10, are 0.57721506 and 0.57721567.
References
[AAR] George E. Andrews, Richard Askey and Ranjam Roy, Special Functions,Cambridge Univ. Press (1999).
[DTW] Duane W. De Temple and Shun-Hwa Wang, Half integer approximations for thepartial sums of the harmonic series, J. Math. Anal. Appl. 160 (1991), 149–156.
[Edw] H. M. Edwards, Riemann’s Zeta Function, Academic press (1974).
[GS] Xavier Gourdon and Pascal Sebah, The Euler constant γ, athttp://numbers.computation.free.fr/Constants/constants.html
[Jam1] G. J. O. Jameson, A simple proof of Stirling’s formula for the gamma function,Math. Gazette 99 (2015).
[Jam2] G. J. O. Jameson, The Prime Number Theorem, Cambridge Univ. Press (2003).
[Olv] F. W. J. Olver, Asymptotics and Special Functions, Academic Press (1974).
22