

Calculus: Deriving the Trapezoidal Rule



You Might Also Like

About this Lesson

  • Type: Video Tutorial
  • Length: 12:36
  • Media: Video/mp4
  • Use: Watch Online & Download
  • Access Period: Unrestricted
  • Download: MP4 (iPod compatible)
  • Size: 136 MB
  • Posted: 06/26/2009

This lesson is part of the following series:

Calculus (279 lessons, $198.00)
Calculus: Techniques of Integration (28 lessons, $40.59)
Calculus: Numerical Integration (2 lessons, $3.96)






About this Author

2174 lessons




Recent Reviews

This lesson has not been reviewed.
Please purchase the lesson to review.
This lesson has not been reviewed.
Please purchase the lesson to review.

Techniques of Integration
Numerical Integration
Deriving the Trapezoidal Rule Page [1 of 3]
Now actually people really do need to evaluate integrals in the real world. It's absolutely true, and especially in the more scientific type endeavors. If one is doing engineering type work, or any kind of scientific thing, or even in like economics and so forth, integration is constantly used. Now the question is will you see an economist actually integrating something by parts or partial fractions or something like that? The answer is probably not, because since we are in the 21^st century, there are ways of actually figuring out the values of integrals, especially definite integrals. And this is sort of known as numerical integration. And computers are great for this, because computers can do things really fast. See now, as fast as you can type, I can actually have the computer work just about that fast. So, for example, if you want to actually evaluate a definite integral, there are programs out there that will, when you plug in the function and then the endpoints, give you an extremely accurate estimate for the actual value. And it can be almost as accurate as you want. And there's even software out there that will formally try to integrate things. So if you actually put in a function, it will actually try to spit out an indefinite integral, and actually give you an anti-derivative. Those programs are a little bit more sophisticated. And sometimes, of course, it can't work, because as we talked about a lot, most functions cannot be integrated.
So if you want to numerically approximate the value of a definite integral, there are a lot of ways of doing it. One way, outside of using the computer--In fact you might be saying how in fact does the computer actually use it? One way is to go back to the basic definition of the integral, which is to put in a whole bunch of very, very thin rectangles and actually estimate the area under the curve by adding up a whole bunch of rectangles. So suppose you have this area right here. So you have a curve A to B. One way to estimate this area, the orange area is just to put in a whole bunch of rectangles. So you put in a whole bunch of rectangles. I won't put in too many just so we can sort of see them. There are a whole bunch of rectangles. We can find the area of each rectangle. That's actually really, really easy. Boy this looks like fire, doesn't it? It's a fiery area. And you can then find the area of each of these rectangles, add them up, and that will give you a pretty good approximation to the area under the curve. In fact, if you use finer and finer rectangles, you'll get a better and better approximation. And in fact, if you take the limit, and put in infinitely many rectangles, and they sort of have almost a zero thickness at all, in fact in the limit they have zero thickness, you get the exact area, which is the integral we're after. So you can approximate it very well by using the rectangles.
But in fact there's another technique, which will even provide a better approximation. And that's called the trapezoidal rule, trapezoidal method, for actually figuring out or estimating the value of certain definite integrals. So the idea is, instead of putting in rectangles, let's put in a different shape. Let's put in trapezoids. So let me try to draw in some trapezoids and show you how this would look. You see as good as this is, there is a lot of error. So what if we did this, just connected these two points together. And then here connected these two points together. And then here connected these two points together. And then here connected these two points together. What I'm doing is I have a whole bunch of trapezoids. By the way, in case you forgot what a trapezoid is, it's just a four-sided thing, where two of the sides are parallel. That's all. So if you now allow me no longer to have horizontal tops, but allowed the tops to go from one endpoint to the next endpoint, well then you can do a lot better. In fact you can see that that green shape really hugs the curve a lot better, and in fact, is a much better approximation. And if you were doing this numerically, you would get a better numerical approximation.
How can you actually figure out what the area of all those little trapezoids are? Well all you've got to do, of course, is figure out the area of one trapezoid and then just add them up as you go through. So what's the area of a trapezoid? I'm going to remind you about that. So here is just a regular, vanilla trapezoid here. So again these two sides are parallel. And these two sides might be parallel, in which case we have a rectangle. So a rectangle is a special case of the trapezoid. But trapezoids might have a funny top like this. What's the area of it? Well the area of a rectangle we sort of know. It's just base times height. And what about this thing? Well if you think about this, this really is a rectangle in disguise. And let me show you what I mean.
Suppose I take this trapezoid and I cut it right in half. Let me mark it for you right now live. So I'm going to mark that half-line. So that's now half. And what if I now just trim off, give a little snip right here, and cut off this little excess right here. If I cut off that little excess, watch what happens. If I cut it here, then I can take that and actually put it right to here, and it's going to fit in absolutely perfectly. And look what I get. I get a rectangle again. There you go. So you get a perfect rectangle. So in fact really hidden in here is a perfect rectangle. So we know the area of a rectangle is base times height. But now we've got to figure out what is base and what is height. In fact, let me put this back the way I really should have it given the picture here. So we originally had this thing here. We popped off the top, turned it around and stuck it back here. So it doesn't change the base at all. The base isn't changed. It's just the height that changed, didn't it? So what's the height? The height is sort of the height right in the middle. And if I put this back, you can see that it's bigger than the left side, and it's smaller than the right side. But it's right in the middle, so it's actually the average. So all I have to do is figure out this length, figure out that length, and find the average of those two numbers, which means I just add them up and divide by two.
So, in fact, the area of this guy, if I draw this here now, suppose that I know that this is y[1]. That's the height of this. And this is y[2]. That's the height of this. And suppose that this is just something here. I'll call it x. Then the area of that after you flip the top and turn over, is just going to be equal to, well it's going to be base times this middle height. So that's base, well that's now x, times the middle height. So that's the average of these two numbers. So I add up y[1] + y[2], and then divide by 2. And that's the area of this. And you can even see visually that, if you just cut this off and move it to here, you get a perfect rectangle.
So if you're going to sum them up, what would a formula look like for this thing? Well let's see. Suppose that I start here at A. Let me call this now x[1]. And then I go x[2], x[3], x[4] and so forth. These are all the integrals, and I go down to the very last one, let's say x[n] for the last one. And now what I want to do is figure out the area of each of these pieces. Now let's pretend that the base of each rectangle is the same. So I cut up this little interval here between A and B into n equal pieces. That means that each base, each value here, is going to be what? Well the whole thing, which is B - A, so the base equals B - A, that's the entire base, but I'm putting in n rectangles. Therefore I should divide by n. If I divide by n, that will tell me what the base is.
What about the height? Well the heights are changing all over the place. I just have all these different trapezoids. So how do I figure out the height? All I do is take the average. If I take the average, what's the value here? If I'm at x1, this height is f(x[2]). And if I look at the height here, that's f(x[2]). And so what I see here is that, for the average height of this first trapezoid, that would be f(x[1]) + f(x[2]). So I take this length and that length and take the average, find that thing right in the middle. So that's the height, and I multiply it by the base. And that will give me the area of that first piece. Now what about the average height of the second one? Well let's do that. That would be , again, the average. And the average would be f(x[2]) + f(x[3]), so a similar looking formula, and so on down the line. So what happens when I multiply each of these through by the base and figure out this green approximation? If I do that, you'll see what we get.
So the green approximation will become, in fact, the trapezoidal rule would look like this, that the area is approximately equal to the base of each. And the base of each we said is going to be . And then we have to multiply it by all the heights. And so what are all the heights? Well these are all these values. So in fact, I will have every single place. I can just factor out the . Pull the right out in front here like that. Then I have f(x[1]) + f(x[2]). And then I add f(x[2]), the next average, + f(x[3]). And can you see what the next average would be? The next average would be f(x[3]) + f(x[4]). And of course I have to divide by 2, but there's the 2 out there. And you just keep doing this until you get down to the very last one, which will be f(x[n-1]), and the penultimate one, + f(x[n]).
So that's the approximation for the area. Each of these things, this divided by that 2 gives me the height. And this represents the base everywhere. But look. There's a lot of simplification. Here's f(x[2]) + f(x[2]). So I've got two of them. f(x[3]) + f(x[3]) I've got two of them. And that makes sense, because every trapezoid that you look at here, I'm going to count that height twice, once when I'm finding the average of this trapezoid, and then once when I find the average of the adjacent trapezoid. So every inside height will be counted twice. The only heights not counted twice are those endpoint ones. They're only counted once when I average just for that trapezoid and just for this trapezoid. But everyone else gets averaged twice. So, in fact, I could write the formula this way (f f(x[2])+2f(x[3])+2 f(x[4])...and so forth all the way down to 2f(x[n-1]). But then that last term, just like the first term, is special. And I just have one of them, so I have + F(x[n]) And this is known as the trapezoid rule. And that gives you a really good approximation, especially if you make those bases of the trapezoids really, really small.
There are a lot of other methods. For example, there's a rule called "Simpson's Rule," which also allows you to come up with really good estimates for areas under curves. I'll see you at the next lecture.

Embed this video on your site

Copy and paste the following snippet: