The following theorem asserts that the average value of a continuous function over an interval [a, b] is actually assumed by the function at some intermediate pointc.
5.5.1 First Mean Value Theorem for Integrals. Iff is continuous on [a, b], then there existsc∈(a, b)such that
1 b−a
Z b a
f =f(c).
Proof. Apply the mean value theorem for derivatives and the fundamental theorem of calculus to the functionG(x) :=Rx
a f(t)dt.
The next theorem is a weighted average generalization of 5.5.1.
5.5.2 Weighted Mean Value Theorem for Integrals. Letf be continuous on [a, b] and letg∈ Rba. Ifg does not change sign in[a, b], then there exists c∈[a, b]such that
Z b a
f g=f(c)Z b a
g. (5.15)
Proof. We may assume thatg ≥0 on [a, b], soRb
a g ≥0. Suppose first that Rb
ag= 0. IfC is an upper bound for|f|on [a, b], then
Z b a
f g ≤
Z b a
|f|g≤C Z b
a
g= 0,
132 A Course in Real Analysis hence both sides of (5.15) are zero. Now assume thatRb
ag >0. Letm=f(xm) and M = f(xM) denote the minimum and maximum values off on [a, b].
Sincemg≤f g≤M g, m
Z b a
g≤ Z b
a
f g≤M Z b
a
g, hence
m≤ Z b
a
f g Z b
a
g
≤M.
An application of the intermediate value theorem completes the proof.
5.5.3 Second Mean Value Theorem for Integrals. Letf be continuous and g differentiable and monotone on [a, b] with g0 ∈ Rba. Then there exists c∈[a, b]such that
Z b a
f g=g(a)Z c a
f+g(b)Z b c
f.
Proof. LetF(x) =Rx
a f. Integrating by parts, Z b
a
f g=Z b a
F0g=F(b)g(b)− Z b
a
g0F.
Sinceg is monotone, the sign ofg0 does not change, hence, by 5.5.2, there existsc∈[a, b] such that
Z b a
g0F=F(c)Z b a
g0=F(c)[g(b)−g(a)]. Therefore,
Z b a
f g=F(b)g(b)−F(c)[g(b)−g(a)] =g(a)F(c) +g(b)[F(b)−F(c)], which is the assertion of the theorem.
Remarks. (a) Because derivatives have the intermediate value property (Exercise 4.2.25), the monotonicity requirement ongwill be satisfied ifg06= 0
on [a, b].
(b) The second mean value theorem for integrals holds under the less restrictive hypotheses thatf is integrable andgis monotone. A proof may be
found in [3]. ♦
Riemann Integration on R 133 Exercises
1. Let 0≤ a < band let f be continuous on [√ a,√
b]. Prove that there existsc∈[a, b] such that
1 2
Z b a
f(√
x)dx=a Z
√c
√a
f(x)dx+b Z
√ b
√c
f(x)dx.
2. Let 0< a < b and letf be continuous on [b−1, a−1]. Prove that there existsc∈[a, b] such that
Z b a
f(1/x)dx=b2 Z 1/c
1/b
f(x)dx+a2 Z 1/a
1/c
f(x)dx.
3.S Let f be continuous on [0,1]. Prove that there existsc ∈[1/2,√ 3/2]
such that Z π/3
π/6
f sinx
dx= 2
√3 Z c
1/2
f(x)dx+ 2Z
√3/2
c
f(x)dx.
4. Letf be continuous on [0,1]. Prove that there existsc∈[0,1] such that Z π/4
0
f tanx
dx=Z c 0
f(x)dx+1 2
Z 1 c
f(x)dx.
5. Letf andg be continuous on [a, b]. Show that there existsc∈(a, b) such that
g(c)Z b a
f =f(c)Z b a
g.
6. Prove: Iff is continuous,g∈ Rba, andmis lower bound forg, then there exist c, d∈[a, b] such that
Z b a
f g=f(c)Z b a
g+m(b−a)[f(d)−f(c)].
7.S Prove the following variant of the second mean value theorem for integrals: Letf, g∈ Rba withg≥0. Ifm≤f ≤M on [a, b], then there existsc∈[a, b] such that
Z b a
f g=m Z c
a
g+M Z b
c
f.
Hint.Consider G(x) :=mRx
a g+MRb xg.
134 A Course in Real Analysis
8. Let g have a nonnegative integrable derivative on [0,1] withg(0) = 0 andg(1) = 1. Show that there existsc∈[0,1] such that
Z 1 0
xng(x)dx= 1−cn+1 n+ 1 .
9.S Letg have a nonnegative integrable derivative on [0, π] withg(0) = 0 andg(π) = 1. Show that there existsc∈[0, π] such that
Z π 0
g(x) sinx dx= cosc+ 1.
10. Letg be twice differentiable on [a, b] withg00<0 andg00∈ Rba, and let f be continuous ong([a, b]). Show that ifg0≥m >0 and|f| ≤M, then
Z b a
f0◦g ≤2M
m .
Hint.Use the second mean value theorem for integrals.
*5.6 Estimation of the Integral
Integrals that cannot be evaluated exactly may be approximated by various numerical methods. Of course, an integral may always be approximated by a Riemann sum; however, unless the intermediate points of the subintervals are chosen judiciously, a Riemann sum usually offers only a coarse approximation of the integral. In this section we discuss three techniques, thetrapezoidal rule, themidpoint rule, andSimpson’s rule, that yield good numerical estimates of an integral.
The approximation techniques are given in order of increasing precision.
For each of these, we use partitions of the form
xk=a+khn, k= 0,1, . . . , n, wherehn:= b−a
n . (5.16)
The integralRb
a f is then estimated by replacingf on the interval [xk, xk+1] by a simpler functionfk. The approximation is therefore
Z b a
f(x)dx≈
n−1
X
k=0
Z xk+1 xk
fk(x)dx.
Theerror in the approximation is simply the difference between the left and right sides. The main goal in the approximation schemes described below is
Riemann Integration on R 135 to obtain, for a given class of functions, the sharpest upper bound for the magnitude of the error
The reader may wish to compare the error bounds in the three approxima- tion techniques described below with the error bound for the approximation given by the Riemann sum
Rn =b−a n
f(x0) +f(x1) +ã ã ã+f(xn−1)
. (5.17)
By Exercise 5.3.21, for functionsf with a bounded derivative one has in general only the first order error bound
Z b a
f−Rn
≤hn(b−a)kf0k∞,
implying that a good estimate requires a largen. Here, for a bounded function gon [a, b],
kgk∞:= sup{|g(x)| : a≤x≤b},
Trapezoidal Rule Let
Pk := (xk, f(xk)) = (xk, yk), k= 0,1, . . . , n, (5.18) where the points xk are given in (5.16). The trapezoidal rule uses the line segment fromPk toPk+1 to approximatef on [xk, xk+1], k= 0,1, . . . n−1.
Thus the approximating functionfk is given by
fk(x) =yk+mk(x−xk), xk≤x≤xk+1, mk := yk+1−yk
xk+1−xk. A simple calculation shows that
Z xk+1
xk
fk= hn
2 (yk+1+yk), The sum
Tn:=
n−1
X
k=0
Z xk+1 xk
fk = hn
2 y0+ 2y1+ã ã ã+ 2yn−1+yn is then used to approximateRb
a f. Iff >0,Tn may be realized as the sum of areas of trapezoids. (See Figure 5.7.)
5.6.1 Trapezoidal Rule. Iff ∈ Rba, thenlimnTn =Rb
a f. Moreover, iff00 exists and is continuous on[a, b], then the following error estimate holds:
Z b a
f−Tn
≤ h2n
12(b−a)kf00k∞.
136 A Course in Real Analysis
x0 x1 x2 x3 x4 x5
f
x6 x
FIGURE 5.7: Trapezoidal rule approximation.
Proof. For the Riemann sumRn in (5.17), Rn−Tn= b−a
2n
f(x0)−f(xn)= b−a 2n
f(a)−f(b)
→0, henceTn= (Tn−Rn) +Rn→Rb
a f.
To obtain the error estimate, consider the function gk(x) := f(x)−fk(x)
(x−xk)(x−xk+1) = f(x)−yk−mk(x−xk) (x−xk)(x−xk+1) ,
which has singularities at xk and xk+1. Since both the numerator and the denominator vanish at these points, the singularities may be removed using l’Hospital’s rule. Therefore, gk(x) has a continuous extension to [xk, xk+1].
Since (x−xk)(x−xk+1) does not change sign on [xk, xk+1], by the weighted mean value theorem for integrals (5.5.2) there exists a pointzk ∈[xk, xk+1] such that
Z xk+1
xk
[f(x)−fk(x)]dx=Z xk+1
xk
gk(x)(x−xk)(x−xk+1)dx
=gk(zk)Z xk+1 xk
(x−xk)(x−xk+1)dx
=−gk(zk)h3 6 . It follows that
Z b a
f(t)dt−Tn=
n−1
X
k=0
Z xk+1 xk
[f(x)−fk(x)]dx=−h3n 6
n−1
X
k=0
gk(zk). (5.19) Now fixx∈(xk, xk+1) and defineψ(z) on [xk, xk+1] by
ψ(z) =f(z)−fk(z)−gk(x)(z−xk)(z−xk+1).
Sinceψhas distinct zerosx,xk, andxk+1, Rolle’s theorem applied twice shows
Riemann Integration on R 137 thatψ00 has a zero vk ∈(xk, xk+1). It follows that f00(vk) = 2gk(x). Sincex was arbitrary,
|gk(x)| ≤12kf00k∞ for allx∈[xk, xk+1]. From this and (5.19) we see that
Z b a
f(t)dt−Tn
≤nh3n
12 kf00k∞= h2n
12(b−a)kf00k∞.
Midpoint Rule Let
xk:= xk+xk+1
2 =a+ k+12hn
, k= 0,1, . . . , n−1,
where the pointsxk are given in (5.16). The midpoint rule uses the constant function
fk(x) =f(xk), xk ≤x≤xk+1,
to approximatef on [xk, xk+1]. This amounts to approximatingRb
af by Rie- mann sums Mn, where the intermediate points are the midpoints of the intervals:
Mn= b−a n
f(x0) +f(x1) +ã ã ã+f(xn−1) .
f
a x1 x2 x2 x3
x1 x3 x
x0 b
FIGURE 5.8: Midpoint rule approximation.
5.6.2 Midpoint Rule. If f00 exists and is continuous on [a, b], then the following error estimate holds:
Z b a
f−Mn
≤h2n
24(b−a)kf00k∞.
138 A Course in Real Analysis Proof. The function
gk(x) =f(x)−f(xk)−f0(xk)(x−xk) (x−xk)2
has a double singularity atxk, which may be removed by applying l’Hospital’s rule twice and defininggk(xk) to be the resulting limit. Since
f(x)−f(xk)−f0(xk)(x−xk) =gk(x)(x−xk)2
and Z xk+1
xk
(x−xk)dx= 0, we see that
Z xk+1 xk
[f(x)−f(xk)]dx=Z xk+1 xk
gk(x)(x−xk)2dx.
Since (x−xk)2 has constant sign on [xk, xk+1], the weighted mean value theorem for integrals implies that the integral on the right equals
gk(zk)Z xk+1 xk
(x−xk)2dx=gk(zk)h3n 12 for some pointzk ∈[xk, xk+1]. Therefore,
Z xk+1 xk
[f(x)−f(xk)]dx=gk(zk)h3n
12. (5.20)
Now fixx∈[xk, xk)∪(xk, xk+1]. By Taylor’s theorem, there exists a point ξk ∈[xk, xk] such that
f(x) =f(xk) +f0(xk)(x−xk) +f00(ξk)
2 (x−xk)2.
Solving forf00(ξk) we see thatf00(ξk) = 2gk(x). Therefore,|gk(x)| ≤ kf00k∞/2 for allx∈[xk−1, xk+1], hence from (5.20),
−h3n
24|f00k∞≤ Z xk+1
xk
[f(x)−f(xk)]dx≤h3n 24|f00k∞. Summing, we obtain
−nh3n
24 kf00k∞≤ Z b
a
f(x)dx−Mn≤ nh3n
24 kf00k∞, which is the assertion of the theorem.
Note that the estimates in both the trapezoidal rule and the midpoint rule are exact for all linear functionsf, since thenf00= 0.
Riemann Integration on R 139 Simpson’s Rule
Simpson’s rule assumesn= 2min (5.16) and uses a parabola through each triple of points
(Pk−1, Pk, Pk+1), k= 2j+ 1, j= 0, . . . , m−1, Pk:= (xk, f(xk)) = (xk, yk), to approximate f. To obtain the rule, observe that any polynomialp(x) of
x0 x1 x2 x3 x4
x f
FIGURE 5.9: Simpson’s rule approximation.
degree≤2 may be written in the form
p(x) =bk(x−xk−1)(x−xk) +ck(x−xk−1) +dk, (5.21) where
bk= p(xk+1)−2p(xk) +p(xk−1)
2h2 ,
ck= p(xk)−p(xk−1)
h , and
dk=p(xk−1).
It follows that the unique polynomial pk of degree≤2 that passes through the pointsPk−1,Pk, andPk+1 is obtained by choosing
bk=bk(f) := f(xk+1)−2f(xk) +f(xk−1)
2h2 ,
ck=ck(f) := f(xk)−f(xk−1)
h , and
dk=dk(f) :=f(xk−1). (5.22) With this choice, one readily calculates
Sn,k:=Z xk+1
xk−1
pk(x)dx=hn
3 [yk−1+yk+1+4yk], k= 2j+1, j= 0,ã ã ã, m−1, which is taken as an approximation ofRxk+1
xk−1 f. Note that the approximation is exact for all polynomialsf of degree≤2, since such a polynomial may be
140 A Course in Real Analysis
written in the form (5.21). Summing this result, we see that the integral of the approximating function on [a, b] is
Sn:= b−a
3n y0+ 4y1+ 2y2+ 4y3+ 2y4+ã ã ã+ 2yn−2+ 4yn−1+yn . 5.6.3 Simpson’s Rule. If f ∈ Rba, then limnSn =Rb
a f. Moreover, if f(4) exists and is continuous on[a, b], then the following error estimate holds:
Z b a
f −Sn
≤ h4n(b−a)kf(4)k∞
180 .
Proof. Set
Rn0 := y0+y2+ã ã ã+yn−2
(2hn) and R00n:= y1+y3+ã ã ã+yn−1 (2hn). These are Riemann sums forf on [a, b] and
6Sn = 2R0n+ 4R00n+ (b−a)(2hn). It follows thatSn→Rb
af.
To obtain the error estimate, let f(4) be continuous on [a, b] and denote the errors by
En,k=Z xk+1 xk−1
f(x)dx−Sn,k and En=
m−1
X
j=0
En,2j+1=Z b a
f(x)dx−Sn. We show that there exists a pointξk∈[xk, xk+1] such that
En,k =−h5nf(4)(ξk)
90 . (5.23)
It will follow that
|En| ≤ mh5nkf(4)k∞
90 =h4n(b−a)kf(4)k∞
180 ,
proving the theorem.
To verify (5.23), fix kand choose a point inx∗k ∈(xk−1, xk)∪(xk, xk+1).
For any functiong, define a functionLg on [xk−1, xk+1] by
(Lg)(x) =ak(g)(x−xk−1)(x−xk)(x−xk+1) +bk(g)(x−xk−1)(x−xk) +ck(g)(x−xk−1) +dk(g),
wherebk(g),ck(g), anddk(g) are defined as in (5.22) andak(g) is chosen so that (Lg)(x∗k) =g(x∗k). ThenLgis the unique polynomial of degree≤3 passing through the four points
xk−1, g(xk−1)
, xk, g(xk)
, xk+1, g(xk+1)
, and x∗k, g(x∗k) .
Riemann Integration on R 141 Note that the coefficients in the definition ofLare linear functions ofg, hence Litself is a linear function. Furthermore,Lg=g for all polynomials of degree
≤3. Since
(Lf)(x) =ak(f)(x−xk−1)(x−xk)(x−xk+1) +pk(x)
and Z xk+1
xk−1
(x−xk−1)(x−xk)(x−xk+1)dx= 0, we see that Z xk+1
xk−1
Lf =Z xk+1 xk−1
pk =Sn,k.
By Taylor’s formula with integral remainder (Exercise 4.6.3), there exists a polynomialT3(x) of degree≤3 such that
f(x) =T3(x) +R3(x), where R3(x) := 1 3!
Z x xk−1
(x−t)3f(4)(t)dt.
The remainder may be written R3(x) = 1
3!
Z xk+1 xk−1
qt(x)f(4)(t)dt where qt(x) :=
((x−t)3 ift≤x 0 ift > x.
Since
Lf =LT3+LR3=T3+LR3=f−R3+LR3, we see that
En,k=Z xk+1
xk−1
(f−Lf) =Z xk+1
xk−1
(R3−LR3).
In the remaining calculations, for ease of notation we assume that [xk−1, xk+1] = [−h, h]. By Fubini’s theorem for continuous functions,
Z h
−h
R3(x)dx= 1 3!
Z h
−h
f(4)(t)Z h
−h
qt(x)dx dt
= 1 4!
Z h
−h
f(4)(t)(h−t)4dt. (5.24) Also, becauseL is linear,
(LR3)(x) = 1 3!
Z h
−h
f(4)(t)(Lqt)(x)dt.6 Therefore, by Fubini’s theorem,
Z h
−h
(LR3)(x)dx= 1 3!
Z h
−h
f(4)(t)Z h
−h
(Lqt)(x)dx dt. (5.25)
6This may be proved using the dominated convergence theorem. (See Exercise 11.3.??)
142 A Course in Real Analysis Now, by definition of L,
(Lqt)(x) =at(x+h)x(x−h) +bt(x+h)x+ct(x+h) +dt, where
bt=qt(h)−2qt(0) +qt(−h)
2h2 , ct=qt(0)−qt(−h)
h , and dt=qt(−h). Sinceqt(−h) = 0 andqt(h) = (h−t)3,t∈[−h, h],
Z h
−h(Lqt)(x)dx=23h3bt+ 2h2ct= 13h[(h−t)3+ 4qt(0)]. (5.26) From (5.24), (5.25), and (5.26),
Z h
−h
(f −Lf) =Z h
−h
(R3−LR3) = 1 72
Z h
−h
f(4)(t)α(t)dt, (5.27) where
α(t) := 3(h−t)4−4h[(h−t)3+ 4qt(0)]. Recalling the definition ofqt(0), we see that
α(t) =
((t−h)3(3t+h) + 16ht3 if−h≤t≤0,
(t−h)3(3t+h) if 0≤t≤h. (5.28) Thus ift≥0,
α(−t) = (t+h)3(3t−h)−16ht3 and α(t) = (t−h)3(3t+h). (5.29) The cubic polynomials in (5.29) are easily seen to be equal at the conveniently chosen pointst= 0,±h,2hand therefore must be identical. Thusαis an even function oft so (5.28) may be rewritten
α(t) =
((t+h)3(3t−h) if−h≤t≤0, (t−h)3(3t+h) if 0≤t≤h.
Taking derivatives, we see thatαis decreasing on [−h,0] and increasing on [0, h]. Sinceα(−h) =α(h) = 0, it follows thatα≤0 on [−h, h]. By (5.27) and the weighted mean value theorem for integrals, for some pointξ∈[−h, h] we have
Z h
−h
(f−Lf) =f(4)(ξ) 72
Z h
−h
α(t)dt= f(4)(ξ) 36
Z h 0
(t−h)3(3t+h)dt=−h5f(4)(ξ) 90 . The same result holds forEn,k, with the pointξdepending onk. This completes the proof of the theorem.
Riemann Integration on R 143 Comparison of the Approximations
Table 5.3 below gives the errors R2
1 x−1dx−An, rounded to 10 decimal places, whereAn is the approximation. Theleft point rule simply refers to approximation by the Riemann sumRn. The exact value of the integral, up to 10 decimal places, is ln 2 =.6931471805. . .
TABLE 5.3: A comparison of the methods.
Method n= 4 n= 8
Left Point Rule .1836233710 .0927753302 Trapezoidal Rule -.0038766290 -.0009746698 Midpoint Rule .0019272893 .0004866265 Simpson’s Rule -.0001067877 -.00000735011