### Video Transcript

In this video, weβll learn how to
approximate definite integrals using the trapezoidal rule and estimate the error
when using it. Youβve probably already seen that
the exact area between a curve and the π₯-axis can be found by performing a definite
integral of the function that describes that curve between the two points youβre
interested in. When approximating the integrals
and therefore the area, we commonly use rectangles. These are known as midpoint sums
and Riemann sums. In this video, weβre going to
investigate how using trapezoids can actually often give a better approximation than
rectangular sums that use the same number of subdivisions. And then derive a formula for what
is commonly known as the trapezoidal rule.

Letβs imagine weβre wanting to
approximate the area between the curve given by the function π of π₯ equals eight
minus two π₯ squared plus three π₯ and the π₯-axis. Bounded by the lines given by π₯
equals zero and π₯ equals two. At this point, we have a few
different methods. We might use a midpoint sum,
whereby we break the area up into rectangles. Letβs say two of these and to find
the height of the rectangle as the value of the function at the midpoint of each
interval. Well, that is one method. But letβs consider the shape of the
curve. Wouldnβt it make sense to choose a
different shape than a rectangle? Well, we can actually try
trapezoids.

Letβs assume we want to use four
subintervals now. Our trapezoids would look a little
something like this. Notice that this does indeed appear
to give a better approximation than using rectangles. And we can use the formula for the
area of the trapezoid to calculate the total area between the curve and the
π₯-axis. This is a half times π plus π
times β. Where π and π are the lengths of
the parallel sides of the trapezoid. And β is the height between
them. We can see by observation that the
height of each of our trapezoids is equal to the width of the subinterval. Here, thatβs 0.5 units.

We can use the equation of our
curve to work out the lengths of each of the parallel sides. And it can be useful to include a
table at this stage. Somewhat counterintuitively with
four subintervals, weβll have five columns. And in fact, thatβs always the
case. We will always have one more column
than the number of subintervals. The length of the first parallel
side in the first trapezoid is given by π of zero. Thatβs eight minus two times zero
squared plus three times zero, which is eight. The second parallel side in this
first trapezoid is eight minus two times 0.5 squared plus three times 0.5, which is
nine. π of one is eight minus two times
one squared plus three times one, which, despite a poorly drawn graph, is also
nine. And in a similar way, we obtain π
of 1.5 to be this height here. And thatβs eight. And π of two to be this height
here. And thatβs six.

Weβll now calculate the area of
each of the trapezoids. The first trapezoid has an area of
a half times eight plus nine times 0.5, which is 4.25 square units. The second has an area of a half
times nine plus nine times 0.5, which is 4.5 square units. The third has an area of a half
times nine plus eight times 0.5, which is once again 4.25. And our final trapezoid has an area
of a half times eight plus six times 0.5, which is 3.5 square units. The sum of these is 16.5. And we know that we commonly use
definite integration to evaluate the area under the curve. So we can say that an approximation
to the definite integral evaluated between zero and two of eight minus two π₯
squared plus three π₯ is equal to 16.5. Well, this is all fine and
well. But you might be thinking, surely
there must be a quicker way of performing this calculation. And youβd be in luck; there is. Letβs take a generic function π of
π₯ and split it into π subintervals.

Weβll say that the height of each
trapezium is Ξπ₯. We saw that the lengths of the
parallel sides of the first trapezoid are found by substituting our first value of
π₯ and our second value of π₯ into the function. So we can say that π one is equal
to a half times π of π₯ nought plus π of π₯ one times Ξπ₯. Similarly, our second trapezoid
will have an area of a half times π of π₯ one plus π of π₯ two times Ξπ₯. Our third will have an area of a
half times π of π₯ two plus π of π₯ three times Ξπ₯. And only continue until the πth
trapezoid, which will have an area of a half times π of π₯ π minus one plus π of
π₯ π times Ξπ₯.

The total area under the curve and
therefore an estimate for the definite integral of π of π₯ between the first
π₯-value and the last π₯-value is the sum of these. When finding their sum, we can
factor a half and Ξπ₯. And we obtain the total area of the
trapezoids to be Ξπ₯ over two times π of π₯ nought plus π of π₯ one plus another
π of π₯ one. Plus all the way up to π of π₯ π
minus one plus another π of π₯ π minus one plus π of π₯ π.

Now we can simplify this a little
further to obtain the general formula for the trapezoid rule using π
subintervals. We combine all the π of π₯ ones,
all the π of π₯ twos, all the way through to all the π of π₯ π minus ones. The rule is Ξπ₯ over two times π
of π₯ nought plus π of π₯ π plus two times everything else. π of π₯ one plus π of π₯ two all
the way through to π of π₯ π minus one. And Ξπ₯ can be obtained really
easily. Itβs π minus π divided by π,
where π and π are the beginning and end of our interval. And our values for π₯ subscript π
are found by adding π lots of Ξπ₯ to the lower limit of our interval. Thatβs π plus πΞπ₯. Weβre now going to have a look at
the application of this rule.

Use the trapezoidal rule to
estimate the definite integral between zero and two of π₯ cubed with respect to π₯
using four subintervals.

Remember, the trapezoidal rule says
that we can find an approximation to the definite integral between the limits of π
and π of π of π₯ by using the calculation Ξπ₯ over two times π of π₯ nought plus
π of π₯ π plus two lots of π of π₯ one plus π of π₯ two all the way through to
π of π₯ π minus one. Where Ξπ₯ is equal to π minus π
over π. And π₯ subscript π is equal to π
plus π times Ξπ₯.

Letβs break this down and just
begin by working out the value of Ξπ₯. Contextually, Ξπ₯ is the width of
each of our subintervals. In this case, weβre working with
four subintervals. So we could say that π is equal to
four. π is the lower limit of our
integral. So π is equal to zero, where π is
the upper limit. And thatβs equal to two. Ξπ₯ is therefore two minus zero
over four, which is one-half or 0.5. The values for π of π₯ nought and
π of π₯ one and so on require a little more work. But we can make this as simple as
possible by adding a table.

Itβs useful to remember that there
will always be π plus one columns required in the table. So here, thatβs four plus one,
which is five. We have five columns in our
table. The π₯-values run from π to
π. Thatβs zero to two. And the ones in between are found
by repeatedly adding Ξπ₯, thatβs 0.5, to π, which is zero. Thatβs 0.5, one, and 1.5. And that gives us our four strips
of width 0.5 units. Weβre then simply going to
substitute each π₯-value into our function. We begin with π of zero. Thatβs zero cubed, which is
zero. Next, we have π of 0.5. Thatβs 0.5 cubed, which is
0.125. π of one is one cubed, which is
still one. And we obtain the final two values
in a similar manner. π of 1.5 is 3.375. And π of two is eight. And thatβs the tricky bit done
with. All thatβs left is to substitute
what we know into our formula for the trapezoidal rule.

Itβs Ξπ₯ over two, which is 0.5
over two, times the first π of π₯ value plus the last π of π₯ value. Thatβs zero plus eight plus two
lots of everything else. Thatβs two times 0.125 plus one
plus 3.375. And that gives us a value of 17
over four. So using four subintervals, the
trapezoidal rule gives us the estimate to the definite integral of π₯ cubed between
zero and two to be 17 over four. Now where possible, this can be
checked in a number of ways. You could evaluate a Riemann or
midpoint sum or here simply perform the integration.

When we integrate π₯ cubed, we get
π₯ to the fourth power divided by four. Evaluating this between the limits
of zero and two gives us two to the fourth power divided by four minus zero to the
fourth power divided by four, which is 16 over four. And thatβs really close to the
answer we got, suggesting weβve probably performed our calculations correctly.

Weβll now consider an example which
involves a consideration on accuracy.

Estimate the definite integral
between the limits of one and two of π to the power of π₯ over π₯ dπ₯, using the
trapezoidal rule with four subintervals. Approximate your answer to two
decimal places.

Remember, the trapezoidal rule says
that we can find an estimate for the definite integral of some function π of π₯
between the limits of π and π by performing the calculation Ξπ₯ over two times π
of π₯ nought plus π of π₯ π plus two times π of π₯ one plus π of π₯ two all the
way through to π of π₯ π minus one. Where Ξπ₯ is π minus π over π,
where π is the number of subintervals. And π₯ π is π plus π lots of
Ξπ₯. Weβll begin then just simply by
working out Ξπ₯. Contextually, Ξπ₯ is the width of
each of our subinterval. Here weβre working with four
subintervals. So π is equal to four. π is equal to one. And π is equal to two. Ξπ₯ is therefore two minus one over
four, which is a quarter or 0.25. Thatβs the perpendicular height of
each trapezoid.

The values for π of π₯ nought and
π of π₯ one and so on require a little more work. But we can make this as simple as
possible by including a table. We recall that there will always be
one more π of π₯ value than the number of subintervals. So here, thatβs going to be four
plus one, which is five π of π₯ values. The π₯-values themselves run from
π to π. Thatβs here from one to two. And the ones in between are found
by repeatedly adding Ξπ₯, thatβs 0.25, to π, which is one. So these values are 1.25, 1.5, and
1.75. And that gives us our four strips
of width 0.25 units. Weβre then going to substitute each
π₯-value into our function.

Here, weβre going to need to make a
decision on accuracy. Whilst the question tells us to use
an accuracy of two decimal places, thatβs only for our answer. A good rule of thumb is to use at
least five decimal places. We begin with π of one. Thatβs π to the power of one over
one, which is 2.71828, correct to five decimal places. We have π of 1.25, which is π to
the power of 1.25 divided by 1.25. Thatβs, correct to five decimal
places, 2.79227. We repeat this process for 1.5. π of 1.5 is 2.98779. π of 1.75 is 3.28834. And π of two is 3.69453 rounded to
five decimal places. All thatβs left is to substitute
what we know into our formula for the trapezoidal rule. Itβs Ξπ₯ over two. Thatβs 0.25 over two times π of
one. Thatβs 2.71828 plus π of two. Thatβs 3.69453 plus two lots of
everything else essentially. Thatβs 2.79227, 2.98779, and
3.28834. That gives us 3.0687, which,
correct to two decimal places, is 3.07.

Itβs useful to remember that we can
check whether this answer is likely to be sensible by using the integration function
on our calculator. And when we do, we get 3.06 correct
to two decimal places. Thatβs really close to the answer
we got, suggesting weβve probably performed our calculations correctly. And so an approximation to the
integral evaluated between one and two of π to the power of π₯ over π₯ dπ₯ is
3.07.

In our final example, weβre going
to look at how to find the error in our approximation. Itβs outside the scope of this
video to look at where this comes from. But the formula weβll use is given
by. The absolute value of the error is
less than or equal to π times π minus π cubed over 12π squared. And this could be used when the
second derivative of the function is continuous. And π is an upper bound for the
modulus of the second derivative over the closed interval π to π.

a) For π equals four, find the
error bound for the trapezoidal rule approximation of the definite integral of one
over π₯ evaluated between one and two. And b) How large should we take π
in order to guarantee that the trapezoidal rule approximation for the integral of
one over π₯ between one and two is accurate to within 0.0001?

We can see that weβre going to need
to work out π double prime of π₯, the second derivative of the function one over
π₯. Letβs alternatively write π of π₯
as π₯ to the power of negative one. Then π prime of π₯, the first
derivative, is negative π₯ to the power of negative two. And π double prime of π₯ is two π₯
to the power of negative three or two over π₯ cubed. We know that π₯ is greater than or
equal to one and less than or equal to two. And that tells us that one over π₯
must be less than or equal to one.

So letβs consider what this tells
us about the absolute value of the second derivative of π of π₯. Well, itβs the absolute value of
two over π₯ cubed. So that must be less than or equal
to two over one cubed, which we know is two. So weβre going to take π as being
equal to two since this is the upper bound for the second derivative in this
question. π is one and π equals two. And weβre told in the question that
π is equal to four. And this means the absolute value
of our error is less than or equal to two times two minus one cubed over 12 times
four squared, which is roughly equal to 0.01041 and so on. We can therefore say that the
absolute value for the error is less than 0.01042, correct to five decimal
places.

Then, for part b of this question,
weβre going to use what we did in part one. This time though, weβre trying to
work out the value of π. So we say that the absolute value
of our error is less than or equal to two times two minus one cubed over 12 times π
squared, which simplifies to one over six π squared. We need this to be less than
0.0001. So we form the inequality one over
six π squared is less than 0.0001. And we solve for π. By rearranging, we obtain the
inequality π squared is greater than one over 0.0006. And then we find the square root of
both sides. We donβt here need to worry about
the negative square root of one over 0.0006. As we know, by definition, that π
must be a positive number. So we obtain π to be greater than
40.824. For us to be able to guarantee that
the approximation is accurate to within 0.0001, weβre going to let π be equal to
41.

In this video, weβve learned that
the trapezoidal rule approximation could be used to approximate definite
integrals. We obtained the formula for the
trapezoidal rule approximation as shown. And we saw that, under certain
circumstances, we can establish the error involved in these approximations by using
this formula.