Calculus Of One Real Variable – By Pheng Kim Ving 
11.1 
1. Motivation 
Suppose we wish to evaluate the definite integral:
_{}
of f. That's why
we spent a considerable amount of time in the last several sections
investigating the various techniques
of integration.
Now, the fundamental theorem of calculus is of no help for
finding the definite integral if we can't find the corresponding
indefinite integral, or if f(x) is unknown and only its values at a
finite number of points in [a, b] are determined by
experiment. In this case, we're willing to settle for a numerical approximation
or estimate of the exact value of the
definite integral. This is the motivation for the development of the methods of
approximate numerical integration.
Go To Problems & Solutions Return To Top Of Page
2. The Rectangular Rule 
Let f be a
function continuous on [a, b] and n a positive
integer. See Fig. 2.1. Divide [a, b] into n
subintervals of equal
length. In Fig. 2.1, we take n = 5 as an
example. The endpoints of the subintervals are x_{0}, x_{1}, x_{2}, ..., x_{n}, where
Fig. 2.1 The Rectangular Rule. 
a = x_{0} < x_{1} < x_{2} < ... < x_{n}
= b. The 1st subinterval is [x_{0}, x_{1}], the 2nd is [x_{1}, x_{2}], ..., the nth is [x_{n}_{–1}, x_{n}]. The ith
subinterval is [x_{i}_{–1}, x_{i}], for i = 1, 2, ..., n.
The length of each subinterval is (b – a)/n. Let c_{i} be the midpoint of the
ith
subinterval [x_{i}_{–1}, x_{i}]. Suppose we know the
values of f at those n
midpoints. Let y_{i} = f(c_{i}).
By Section
9.2 and
Section
9.3 we can take the Riemann sum:
that is:

Let:
a. Calculate the exact value of I
using the fundamental theorem of calculus.
b. Calculate an approximate value of I using the
rectangular rule with 4 subintervals.
c. What's the difference between the exact and approximate values?
Solution
c. The difference between the exact and approximate values is 624.80 – 604.25 = 20.55.
EOS
Go To Problems & Solutions Return To Top Of Page
3. The Trapezoidal Rule 
Let f be
continuous on [a, b].
See Fig. 3.1. Again divide [a, b] into n
subintervals of equal length (b – a)/n with
endpoints a = x_{0} < x_{1} < x_{2} < ... < x_{n} = b.
In Fig. 3.1 we take an example of n = 5.
Suppose we know the values of f at
Fig. 3.1 The Trapezoidal Rule. 
these n + 1
endpoints. Let y_{i} = f(x_{i}),
for i = 0, 1, 2, ..., n. Join the two points (x_{0}, y_{0}) and (x_{1}, y_{1}) by a line segment, then
the 2 points (x_{1}, y_{1}) and (x_{2}, y_{2}) by a line
segment, and so on. Let g(x) be the equation of the graph formed by all
these
line segments. The graph of g(x) is used to approximate the graph of f(x). So the
definite integral:
Note that m(x_{1} – x_{0}) = y_{1} – y_{0} because y_{1} = y_{0} + m(x_{1} – x_{0}) because the equation of the line is y = y_{0} + m(x – x_{0}) and
the point (x_{1}, y_{1}) is on that
line.
Similarly:
It follows that:

Approximation [3.1] is the trapezoidal rule. The pattern of the coefficients of the y_{i}'s is 1, 2, 2, ..., 2, 1.
To apply approximation [3.1] we have to find the y_{i}'s for i = 0, 1, 2, ..., n,
so we have to find the (n + 1)
endpoints x_{i}'s of
the subintervals. Since the length of each subinterval is (b – a)/n, those endpoints are:
Make sure that x_{n} = b. If that's not the case, something is wrong, so check your calculations, starting from x_{0}.
Fig. 3.2 Error Bound. 
Consider the trapezoidalrule approximation [3.1]. There's a
theorem in a branch of mathematics called numerical
analysis which says that if f is twice
differentiable on [a, b], then there exists c
in [a, b]
such that the error in
approximation [3.1] is ((b – a)^{3}/12n^{2}) f ''(c), ie:
That is, an error bound in the approximation is M(b – a)^{3}/12n^{2}:

This error bound is inversely proportional to the square of the
number of subintervals n. As
expected, it decreases (thus
the approximate value approaches the exact value) rapidly as n increases.
Let:
a. Estimate the value of I utilizing the trapezoidal rule with 4 subintervals.
b. Find an error bound for this estimation. In Example 2.1 the exact value of I is 624.80. Determine the error. Is it within
bound?
Solution
a. The length of each subinterval is (5 – 1)/4 = 1. The endpoints x_{i}'s of the subintervals and the values y_{i}'s
of the
integrand at them are:
The error is 624.80 – 666 = – 41.2. Now – 41.2 = 41.2 < 100, thus yes the error is within bound.
EOS
Go To Problems & Solutions Return To Top Of Page
4. Simpson's Rule 
In the rectangular rule, we approximate the graph of f by horizontal line segments, ie, linear
functions y = k,
and each
line segment usually meets the graph of f a 1 point.
In the trapezoidal rule, we approximate the graph of f
by general line
segments, ie, linear functions y = mx + k, and each
line segment usually meets the graph of f at 2
points. We can expect
to do better by approximating the graph of f by
parabolic arcs, ie, quadratic functions y = Ax^{2} + Bx + C. Each parabolic
arc meets the graph of f at 3
points. That's the basis of Simpson's Rule.
First we'll show that given any three points P_{0}(x_{0}, y_{0}), P_{1}(x_{1}, y_{1}), and P_{2}(x_{2}, y_{2}) in the plane such that x_{0} < x_{1} < x_{2} and
x_{1} – x_{0} = x_{2} – x_{1} (x_{1} is the midpoint of [x_{0}, x_{2}]), there exists a parabola going thru them and we'll
calculate the definite
integral of the function represented by that parabola over [x_{0}, x_{2}]. See Fig.
4.1. Let h = x_{1} – x_{0} = x_{2} – x_{1} > 0. For the
sake of simplification, translate the xy coordinate
system horizontally x_{1} units to get
the XY coordinate system. In the XY
system, the coordinates of P_{0} are (– h, y_{0}), those of P_{1 }are (0, y_{1}), and those of
P_{2} are (h, y_{2}). Note that the Ycoordinate
of every point in the plane is the same as its ycoordinate.
Let y = AX^{2} + BX + C, where A, B, and C are constants, be
the equation of a parabola in the XY system. There
exists a parabola that goes thru the 3 points P_{0}(– h, y_{0}), P_{1}(0, y_{1}),
and P_{2}(h, y_{2}) iff the system of equations:
So, since the system of equations has a solution, such a parabola does indeed exist.
For the definite integral we have:
This value of the definite integral in the XY system is the same as it is in the xy system. In Fig. 4.1, the area of the
colored region is the same quantity whether the region is considered as being
in the XY system or in the xy system.
Fig. 4.1 Parabolic Arc Thru 3 Points. 
Fig. 4.2 
Now let f be
continuous on [a, b].
Divide [a, b]
into an even number n
of subintervals of equal length (b – a)/n with
endpoints a = x_{0} < x_{1} < x_{2} < ... < x_{n} = b.
Refer to Fig. 4.2, where we take n = 6 as an
example. Let y_{i} = f(x_{i}) for i = 0,
1, 2, ..., n. Join the 3 points (x_{0}, y_{0}), (x_{1}, y_{1}), and (x_{2}, y_{2}) by a
parabolic arc, then the 3 points (x_{2}, y_{2}), (x_{3}, y_{3}), and (x_{4},
y_{4}) by a parabolic arc, and so on. The arcs cover successive pairs of consecutive subintervals. That's why n
must be
even. We approximate the graph of f by the
graph formed by these parabolic arcs. Thus, recalling that the length of each
subinterval is (b – a)/n, the approximations of the definite integrals
of f over each of these pairs of
subintervals are:
Thus, adding them up we obtain the approximation of the definite integral of f over [x_{0}, x_{n}] = [a, b]:

Same as Finding The Endpoints in Part 3.
This is similar to Error
Bounds in Part 3; refer to it for more details. For Simpson's rule approximation
[4.1] there's a
theorem in numerical analysis that assures that if f
is 4 times differentiable on [a, b], then there exists c
in [a, b]
such
that the error in the approximation is:
That is:

This error bound is inversely proportional to the fourth
power of the number of subintervals n. As
expected, it decreases
(thus the approximate value approaches the exact value) very rapidly as n increases (in steps multiple of 2; remember, n
must be even).
Remark that if f^{ (}^{4)}(x) = 0 identically on (ie, for all x in) [a, b], then we can take N
= 0, thus an error bound is 0, which
means that the approximate value is exactly equal to the exact value. Thus, the
Simpson'srule approximation of any cubic
function f(x) = Ax^{3} + Bx^{2} + Cx + D, for which f ^{(4)}(x) = 0 for all real number x,
using any even number n
of
subintervals provides the exact value
of the definite integral. This is surprising, because we approximate a
polynomial of
degree 3 by one of degree 2 and using as few as 2 subintervals also gives the
exact value of the definite integral of the
polynomial of degree 3.
Similar to Finding An Error Bound of Part 3.
Let:
a. Approximate the value of I employing Simpson's rule with 4 subintervals.
b. Find an error bound for this approximation. In Example 2.1 the exact value of I is 624.80. Determine the error. Is it
within bound?
Solution
a. The length of each subinterval is (5 – 1)/4 = 1.
The endpoints x_{i}'s
of the subintervals and the values y_{i}'s
of the
integrand at them are:
Thus yes the
error is within bound.
EOS
An error bound is 8/15 = 0.533333.... If we round its
decimal representation, eg to 2 decimal places, we must round it up
to 0.54, not down to 0.53, because 0.54 is certain to be a bound while 0.53
isn't, since 0.53 < 0.533333... < 0.54 or
0.53 < 8/15 < 0.54. Similarly, if we round it to 1 decimal place, we must
round it up to 0.6, or if we round it to 3 decimal
places, we must round it up to 0.534.
Go To Problems & Solutions Return To Top Of Page
5. Comparisons Of The Rules 
We gather together here all 3 approximation rules for convenient comparison:
rectangular rule, y_{i} = f(c_{i}), c_{i}'s are midpoints of subintervals:
As for the comparison of accuracy, Examples 3.1 and 4.1
suggest that Simpson's rule generates a much smaller error
bound and thus provides a much more accurate approximation than does the trapezoidal
rule. For a given value of n,
error bounds [5.3] and [5.5] show that Simpson's rule generates a much smaller
error bound than does the trapezoidal
rule, which means that Simpson's rule gives a much better approximation than
does the trapezoidal rule, if  f^{
(}^{4)}(x) isn't
too much bigger than  f ''(x) (which implies that N
isn't too much bigger than M )
and n is sufficiently large. For a
given value of n, we expect the rectangular rule
and the trapezoidal rule to provide roughly the same degree of accuracy.
Since Simpson's rule is generally, though not always, better than the other 2
rules and practically requires no more work
than them for any given value of n, it's a
recommended choice.
Problems & Solutions 
1. Let:
a.
Calculate the exact value of I.
b. Approximate I using the rectangular rule with 5 subintervals.
Calculate the error in the approximation.
c. Approximate I using the trapezoidal rule with 5
subintervals. Find an error bound for the approximation. Calculate
the error. Is it within bound?
d. Approximate I using Simpson's rule with 2 subintervals. Find
an error bound for the approximation. Calculate the
error. Is it within bound? The
approximate value is exactly equal to the exact value because the integrand is
a cubic
function.
Solution
Error: 63.75 – 61.875 = 1.875.
The error is 63.75 – 67.5 = –3.75. Now –3.75 = 3.75 < 10, thus yes the error is within bound.
d. The length of each subinterval is (4 – (–1))/2 =
5/2. The endpoints x_{i}'s
of all the subintervals and the values y_{i}'s
of
the integrand at them are:
We have (d^{4}/dx^{4}) x^{3} = (d^{3}/dx^{3}) (3x^{2}) = (d^{2}/dx^{2}) (6x) = (d/dx) (6) = 0. Hence an error bound is 0. The error
is
63.75 – 63.75 = 0. It's within bound.
2. Let:
Estimate I using the following rules with the indicated
number n of subintervals. Find an error
bound in the estimation
in each case.
a. The
trapezoidal rule, n = 10.
b. Simpson's rule, n = 4.
Solution
Thus:
b. The left endpoint of the first subinterval is x_{0} = 0. The length of each subinterval is (1 – 0)/4 =
0.25. So the
endpoints x_{i}'s
of all the subintervals and the values y_{i}'s
of f at them are:
3. A function f is unknown but experiment has determined its following values.
Solution
The best approximation is obtained when the number of all
the available subintervals of equal length is even and all of
them are used, 8 in this case. So:
4. Prove, by using f(x) = x^{2} over [0, 1] to
create a counterexample, that the constant 12 in the error bound formula for
the trapezoidalrule approximation
can't be improved (increased).
Note
Proof By CounterExample. To prove that the statement
“ the constant 12
in the error bound formula for the
trapezoidalrule approximation can be improved ” is false, we find an example in which the
constant 12 can't be improved.
Such an example is called a counterexample, and a proof using a
counterexample is called, well, proof by
counterexample.
Solution
Hence the size of the exact error is equal to the found
error bound, which must therefore be the smallest possible error
bound. This means that the constant 12 can't be increased or improved.
5. Prove, by using f(x) = x over
[–1, 1] to create a counterexample, that Simpson's rule isn't always better
than the
rectangular and trapezoidal rules.
(For the definition of a proof by counterexample see note in problem & solution 4.)
Solution
Let:
which isn't equal to the exact value.
So Simpson's rule isn't always better than the rectangular and trapezoidal rules.
Return To Top Of Page Return To Contents