CHAPTER 07.02: TRAPEZOIDAL RULE: Multiple Segment Rule: Derivation   So let's go ahead and do that.  So what the derivation will involve is that, let's suppose if you have this function, and what you're going to do is you want to integrate any function from point a to point b, you're going to break it up into n equal segments, so you're going to have b minus a, which is the width of the segment, and you're going to divide it by n, where n is the number of segments, so n is the number of segments. So that's what you're going to do.  So once you have that . . . once you have done that, that means that the distance between each of the segments will be h, so this will be a plus h, this will be a plus 2 h, and the last point which you're going to see here will be a plus n minus 1 times h, because the last point, of course, is b, which is a plus n times h, so that's how you'll be able to look at what those individual numbers are.  Now, what you are doing is that you're going to draw a trapezoid right here, then you're going to take another one, draw a trapezoid there, then you're going to take the last one, let's suppose, you're going to draw a trapezoid there, and there’ll be several trapezoids which will be going from this a plus 2 h to a plus n minus 1 h, depending on what the value of n is.  So all we're doing is the same thing as we did in the example, you are breaking up  the interval going from a to b into n equal segments, and you're going to find out the area of this trapezoid, the first trapezoid, then the second trapezoid, and then the third trapezoid, and the last trapezoid, and you're going to add them all up to be able to come up with the formula for the multiple segment trapezoidal rule. So you have the integral going from a to b, f of x, dx is going to be broken into n integrals.  So that'll be exactly equal to, going from a to a plus h, that'll be the first integral, so it's going from a to a plus h, that's the lower limit, that's the upper limit, then the next one is going from a plus h to a plus 2 h, and then you'll have the last one, which is going from a plus n minus 1 h, because that's just h away from b, to the left of b, f of x, dx. So keep in mind that going from here to here, there is no approximation involved, this is just calculus, that you are taking the integral going from a to b, and you are breaking it up into n equal intervals of integration, but there's no approximation involved . . . involved in here.  However, the approximation will be involved now when I approximate this integral by a single segment by a single segment trapezoidal rule, this particular integral by a single segment trapezoidal rule, and this last one also by the single segment trapezoidal rule, and all the ones which are in between there. So that's where the approximation will come from.  So let's look at what that approximation will be, it'll be equal to the width of the interval, which is simply h, because you're going from a to a plus h, so the width of the interval is just h, times the value of the function at a, plus the value of the function at a plus h, because those are the limits of the integral there, and this next one also, the width of the interval will be h, because you're going from a plus h to a plus 2 h, so you will get f of a plus h, plus f of a plus 2 h, divided by 2, plus all the way up to h times the value of the function at a plus n minus 1 h, plus f of b, divided by 2, that's what you're going to get for these individual intervals which you have.  Keep in mind that there are several intervals which you have to calculate here, I'm not showing all of them, but that's what you will have to do.  So you can very well see that h divided by 2 is a common number here, h, 2, h, 2, h, 2, is a common multiple here, we're going to take that out, and then you have to recognize that f of a is only here once.  f of a is only here once, however, f of a plus h is once here and once here, so that becomes 2 f of a plus h, and then f of a plus 2 h will be once here and once in the next term, which I have not shown here, but that will be also 2, 2 times f of a plus 2 h, and then we'll go all the way up to f of b. So you can very well see that you have these terms, let me just go ahead and show you some more terms.  Let me just erase this here, and we'll have plus going up to plus 2 times f of a plus n minus 1 times h, because this term, which is at this argument, will also have a term in the term before, they'll be the same, exactly the same argument of the function will be in the term right before this one, so that'll be also twice, but f of b will be only once, because it's the last interval there. So what you are seeing here is that this h is b minus a, divided by 2 n, because h is b minus a, divided by n, because h is the width of each segment, which will be b minus a, divided by n, the 2 is coming from here, then you have f of a, plus 2, I'm going to put outside, but there'll be a summation, i is equal to 1 to n minus 1, f of a plus i h, and the reason why you're getting a summation here is because it's a plus h, a plus 2 h, all the way up to a plus n minus 1 h.  So the only thing which is changing is the argument of . . . the coefficient of h, it's 1 here, 2 here, n minus 1 here, so that's why we contract it into a summation, i going from 1 to n minus 1, f of a plus i h, plus f of b, and that is the formula for the multiple segment trapezoidal rule. So again, what you're going to find out is that it is very similar to what happened previously, in terms of the averages, that this is the width of the interval, and this number here, or this expression here, is some average value of the function.  And then somebody might say, hey, I've got f of a here, but you've got 2 times the function evaluations at n minus 1 points.  You've got n minus 1 function evaluations taking place, but they are represented twice, so that makes it one time here . . . one time here, 2 times n minus 1 times here, and one time here, and that makes it 2 n. So these function summations which are being done are being done 2 n times, and then you are dividing the function summation by s n, which gives you some average value of the function, and then you are multiplying it by the width of the interval. And that's the end of this segment.