Transcript for:
Understanding the Trapezoidal Rule

In this lesson, we're going to go over a specific numerical integration method known as the Trapezoidal Rule. The Trapezoidal Rule allows you to estimate the value of a definite integral, which represents the area under a curve. So let's say if we have the curve y is equal to x squared and we wish to estimate the area under the curve from 0 to 10. Use the trapezoidal rule to do so. So let's graph this function. So this is the right side of y equals x squared. And so we want to calculate or estimate the area of the shaded region. Now let's use five sub-intervals or five rectangles to do so. And then we can confirm how close our estimation is. using the exact value of the definite integral. So first we need to calculate delta x, the width of each subinterval. And that's going to be b minus a divided by n. So we're going from 0 to 10. In this case, b is 10, a is 0, and is 5. So the interval is from 0 to 10. 10 divided by 5 is 2, so delta x is 2. Now what I like to do is create a number line from a to b, in this case 0 to 10. And delta x is 2, so the width of each subinterval is going to be 2. Now, I don't know if you saw an earlier video that I created on Riemann sums, left endpoints, right endpoints, and another video on midpoint rule. But if you watch those then, you know my methods when it comes to using a number line. these kinds of problems. Now just to recap, using the left endpoint for a Riemann sums problem, you would have to choose 5 points out of the 6 points listed since n is equal to 5. There's 5 intervals and you would have to choose 5 of the 6 points. So the left endpoint rule, you would use 0, 2, 4, 6, and 8. Now, if you wish to do a Riemann sum problem using the right endpoints, you'd have to use these 5 out of the 6 endpoints. So one of the endpoints you won't be using. I mean one of the points, they're not all endpoints. So you're always going to use 5 out of 6 points if you're using the left endpoint rule or the right endpoint rule or the midpoint rule. So using the right endpoints, it's going to be 2, 4, 6, 8, 10. And now, if you're employing the midpoint rule, you would simply pick the points in the middle, like 1, 3, 5, 7, and 9. For the trapezoidal rule, you should use all six points. You're not going to use five out of the six points. You're going to use all of them. And so that's how the trapezoidal rule differs in one way from using the left endpoint, the right endpoint, or the midpoint rule. Now what is the formula for the trapezoidal rule? The area of the rectangles will be equal to delta x divided by 2. These are the sum of the area of the rectangles. Times f of x, 0. plus 2 times f of x1 plus 2 times f of x2, and then it's going to continue. The second to last one will be 2 f of xn minus 1, and the last one will be just f of xn. So here's what you need to know for the trapezoidal rule. The first one and the last one, these are y values, do not multiply those by 2. All of the y values in the middle, multiply those by 2. And 2 times 1 half will give you 1. Now let's finish this example. So t sub n, where n is 5, we're going to have t sub 5. That's equal to delta x over 2. In this example, delta x we said was 2. It was 10 minus 0 divided by 5. Now what's x0 and x1? Those are the points that we had on the number line. The first x value was 0, and then it went up by twos because delta x is two. So the next one is going to be f of two, but we need to multiply that by two, and then two times f of four plus two times f of six and two times f of eight, but the very last one we're not going to multiply by two. So f of ten is the last one. So keep that in mind. The first and the last one, do not multiply that by two. So never multiply these two y values by 2, but the middle ones you need to do so. So 2 divided by 2 is 1, and keep in mind, f of x is x squared in this problem. So f of 0, that's going to be 0 squared, so that's 0. And then f of 2, 2 squared is 4, 4 squared is 16, 6 squared is 36, 8 squared is 16. 64 and 10 squared is 100 and don't multiply that by 2 now 2 times 4 is 8 2 times 16 is 32 2 times 36 72 2 times 64 is 128 and then plus 100 Now 8 plus 32, that's 40. 72 plus 128, that's 200. And 200 plus 100 is 300 plus 40. This will give us 340. So that's the approximate area under the curve. So now let's calculate the exact answer by evaluating the definite integral. So the exact answer is going to be the integral from a to b, 0 to 10, x squared dx. The antiderivative of x squared is x cubed divided by 3, evaluated from 0 to 10. So if we plug in 10, it's going to be 10 to the 3rd over 3, and then if we plug in 0, that's just going to be 0. 10 times 10 times 10 is 1000, so we have 1000 divided by 3. So the exact answer is 333.3 repeated. And so this represents the area under the curve. As we see in this example, the Trapezoidal Rule did a very good job in approximating the exact answer of the area under the curve. 340 is very close to 333.3. And so, the Trapezoidal Rule is a very good approximation if you wish to evaluate the definite integral or find the area under the curve. Let's work on this word problem. The table below shows the rate at which water flows through a pipe into a storage tank. This rate is measured every 10 minutes. Estimate the amount of water that will accumulate in the first hour using the trapezoidal rule. So we have one of those accumulation problems. The amount that will be accumulated is equal to the definite integral of the water flow rate as a function of t, dt. Now we don't have a function for RT. So we have to estimate this value using the trapezoidal rule. And we have a total of 7 points. And so we have six intervals, so this is going to be T sub 6. So N is 6 in this example. On the interval 0 to 60. So if we calculate delta X, it's going to be B minus A divided by N. So that's 60 minus 0 divided by 6. And so we can see that delta X is 10 minutes. So now using the trapezoidal rule, it's going to be delta x divided by 2 times the first point f of 0, and then plus 2 times f of 10, plus 2 times f of 20. all the way to F of 50. And the last one, we're not going to multiply it by 2. It's just going to be F of 60. 10 divided by 2 is 5. F of 0, based on a table, is 3.8 gallons per minute. Now, if you multiply the minutes... because it was 10 minutes divided by 2 times the gallons per minute you're going to get the amount of water that accumulates into the tank in the unit of gallons Now this is going to be 2 times f , so at 10 the rate is 4.5, and then for f , the rate is 6.2, and then at 30 the rate is 7, and at 40 the rate is 7.5, at 50 it's 6.9, and then at 60 it's simply 6.2, but we're not going to multiply that by 2. Now 2 times 4.5 is 9, 2 times 6.2 is 12.4, 2 times 7 is 14, 2 times 7.5 is 15, 2 times 6.9, that's going to be 13.8, and then plus 6.2. So you can type this into a calculator if you want to. And this will give you 371. And the unit will be in gallons. So that is the amount of water that will accumulate in a tank based on the trapezoidal rule. So this is just an estimate. The exact answer might be different from this one, but it's going to be close to it.