CHAPTER 07.02: TRAPEZOIDAL RULE: Derivation

 

In this segment, we're going to derive the trapezoidal rule of integration. Trapezoidal rule is one of the basic ways of finding the approximate value of an integral.  So let's suppose somebody tells you that, hey, I want you to find the value of an integral which is of this particular form, that the function, or the integrand, is given to you, which is this, so we call this as the integrand, that's the lower limit of integration, and this here is called the upper limit of integration. So somebody is asking you to calculate the value of the integral of the function f of x, which is the integrand, from a to b.  So if we want to find it approximately, one of the things which we can so is . . . so let's go ahead and look at it graphically.  So let's suppose if I have a function like this, and somebody says, hey, I want you to integrate from a to b, so this is my function f of x, as a function of x, and says, hey, this is b, let's suppose.  So you have the value of the function here, you have the value of the function here, actually the area under the curve is all the one . . . all the area which is from a to b under this curve here. But in trapezoidal rule, what you are basically doing is you are drawing a straight line . . . you're drawing a straight line from the value of the function at a here to the value of the function at b here, so basically these coordinates here, the coordinate here is a, comma, f of a, and the coordinate here is b, comma, f of b.  So what you are trying to do is you're trying to find the area under the curve. So the area under the curve of this straight line would be this area of the trapezoid, because this shape which you are seeing here is basically that of a trapezoid. And the reason why you are doing this, somebody might say, hey, why are you trying to draw a straight line going from point a to point b?  It is, when we talk about numerical integration, the reason why we are approximating our original function by this particular straight line, let's suppose, is mainly because we know how to integrate under a straight line, because a straight line is a first-order polynomial, and from your integral calculus class, you already know how to integrate under a straight line, or under a linear polynomial function.  So that's what the bottom line is about doing numerical integration, that you're approximating the function, the original function, which you may or may not be able to find exactly, by some other function, of which you know how to find the integral.  So let's go ahead and derive what trapezoidal rule is, so basically we have to find out what this area under the curve is, under this curve going from point a to point b.  So since this is a trapezoid, I can just write it as the area of a trapezoid.  So what is the definition, or what is the formula for the area of the trapezoid?  It's simply the average of the length of the parallel sides, so sum of the length of parallel sides.  So if you take the sum of the length of the parallel sides, you take the average of them two, which basically means that you are dividing it by 2, and you multiply it by the perpendicular distance between the parallel sides. So that's what you are doing, you are going to multiply it by the perpendicular distance between the parallel sides.  So in this case, the parallel are the value of the function at a, plus the value of the function at b, those are the two parallel sides.  So you're going to take the length of that one side, which is f of a, length of the other side, which is f of b, we'll divide it by 2, because that's the average, and then you multiply it by b minus a, because that's the distance between the parallel sides.  So your trapezoidal rule formula is basically becoming a to b, the integral of f of x from a to b is simply approximately equal to b minus a, times the value of the function at a, plus the value of the function at b, divided by 2, okay?  So this is the approximate formula for the . . . for the trapezoidal rule, it's b minus a, which is the width of the interval, times the average value of the function at a and b.  So you can also look at it this way is that this particular term here is actually some average value of the function, it's not the exact average value of the function, this is some approximate value of the f-bar in a, comma, b, because you're only taking two points from a . . . a to b, the one at a and the one at b, dividing by 2, and getting some approximate value of the average value of the function in a, b.  In fact, you will have to take infinite number of points of points if you want to get the exact average value of the function from a to b.  In that case, that would give you the exact value of the integral.  Why is that so?  The reason for that is as follows, because if you remember your integral calculus class, the average value of the function from point a to point b is given by the value of the area under the curve from point a to point b, divided by b minus a. So in that case, the exact value of the integral can also be viewed as the exact average value of the function from point a to point b, times b minus a.  In this trapezoidal rule, what we are doing is we are approximating that average value of the function by the value of the function at a, plus the value of the function at b, divided by 2, because in order to be able to calculate this exact average value of the function, I can also do it on a point by point basis, like I'm doing it here, but I'll have to choose infinite number of points from point a to point b.  You can derive trapezoidal rule formula, also by using calculus.  So I showed you a geometrical proof, or geometrical method of showing how trapezoidal rule is derived. Let's go ahead and see how we can go about calculating it by using calculus and geometry.  Now, let me call it method 2. So basically what we have is the integral going from a to b, f of x dx, and what we are approximating it by is a straight line, and I'm going to call it f1 of x, 1 standing for first-order polynomial, that's why I'm calling it f1 of x.  So because, that's what I mentioned in the beginning, is that trapezoidal rule can also be viewed as that you are approximating the value of the function by some other function which you know how to find the integral of.  So what that means is that f1 of x is nothing but the straight line, so I can just write down the equation for the straight line, which will be f of b minus f of a, divided by b minus a, times x minus a, plus f of a, that is the equation of the straight line which is going from point a to point b.  If you want to use a straight line definition of y is equal to m x, plus c as you might be familiar with, go ahead and use that one, and you will come up with the same value of the formula.  So the formula will turn out to be the same, just the expressions will be different.  This is a direct way of showing what the formula for the straight line is, by simply calculating the slope, multiplied by x minus a, plus adding the value of the function at this particular point.  This basically comes from your Newton's divided difference polynomial formula, if you are of interest, let me write this down, I can say from Newton's divided difference formula, and this formula is given in many handbooks also, for the equation of a straight line.  So all I have to do is I'm going to substitute that.  So a to b, f of x dx is approximated by the value of the function f1 of x, which is the straight line.  So I get a to b, f of b, minus f of x, divided by b minus a, times x minus a, plus f of a, dx.  So I'm just substituting the equation for the straight line for f1 of x, and that gives me f of b, minus f of a, divided by b minus a, times x minus a, whole squared, divided by 2, because that's the integral of x minus a, plus f of x times x, and the lower limit, of course, is a, and the upper limit is b.  Now, if you substitute the values of a and b in there, you're going to get exactly b minus a, times the value of the function at a, plus the value of the function at b, divided by 2. So this is just another way of finding out the trapezoidal rule.  If you look at the textbook notes for trapezoidal rule, you will find five different ways of deriving the trapezoidal rule, which I would strongly recommend for you to go through all those methods. And that's the end of this segment.