CHAPTER 07.03: SIMPSON'S 1/3RD RULE: Derivation   In this segment, we're going to talk about Simpson's 1/3rd rule of integration.  We're going to derive the formula for Simpson's 1/3rd rule of integration.  Now, again, what we are trying to do is we are trying to numerically find out what the value of a definite integral here is, that we have a function which is given to us, as a function of x, and what we want to be able to do is we want to be able to find out the approximate area under the curve, from point a to point b, and that's what we are trying to do by using numerical integration.  In Simpson's 1/3rd rule of integration, what you are doing is that, as opposed to trapezoidal rule, you would choose point a and point b, and draw a straight line going from point a to point b, and find out the area under the curve. In the Simpson's 1/3rd rule, what you are doing is that you're going to choose another point, you're going to choose a point which is the midpoint between a and b.  And you're going to choose the midpoint between a and b, and you're going to say, hey, I'm going to choose three points to approximate my function. In the trapezoidal rule, we use only two points to approximate the function, which is this point and this point here, and draw the straight line through it, and find out the area under that straight line, but here, if we're going to choose three points, one is point a, point b, and the midpoint between the lower limit of integration and the upper limit of integration, we can find that we can draw a second-order polynomial which goes through that.  So this is the second-order polynomial which will go through those two points exactly, of that particular function.  So the function which you are trying to now draw, which is a second-order polynomial, does go through the values of the function at point a the point a plus b, divided by 2, and point b, and you're going to come up with a second-order polynomial, this 2 is standing for the second-order polynomial, you'll be able to derive the second-order polynomial.  Now, all of us know how to find the value of an integral of a second-order polynomial, and whatever that integral will turn out to be, it's not going to be exact, but it is going to be approximate, and it'll give you the value of the approximate value of the integral.  So let's go ahead and see what kind of formula do we get when we start doing that.  So what we are trying to do is we are trying to find this second-order polynomial, which I call f2 of x, and it will be a second-order polynomial, it will be a0, plus a1 x, plus a2 x squared, that's the general form of a second-order polynomial. And of course, this is valid between a and b. And since we have three coefficients now unknown in this second- order polynomial, a0, a1, and a2, we will need to have three equations and three unknowns to be able to find out what these three coefficients are.  And since we already know that this particular polynomial is going through the three points of the function, we can use that information to be able to find a0, a1, and a2.  So what I mean by that is that I know that the polynomial at point a is same as the value of the function at a, so I will get my first equation by substituting x equal to a, so that gives me my first equation.  The second equation comes from the fact that at the midpoint, the polynomial goes through the value of the function at the midpoint, which is f at a plus b, divided by 2, so that will give me the second equation, that I can substitute the value of x to be a plus b, divided by 2. And then I also know that the polynomial which I have drawn through those three points, also goes through the third point of the function, which is at b, and again, I'll substitute the value of x to be b, and I'll get my third equation. So basically what I have is I have my one equation here, my second equation is here, and my third equation is here.  So those are my three equations, I have first equation where the function, the second order polynomial is going through the value of the function at a, then this is going at the value of the function at a plus b, divided by 2, and the value of the function at b.  So I've got three equations, three unknowns, and let me go ahead and write them in the matrix form, I'm not going to solve them for you, but I'm going to give you the solution for completion sake. So if I write them in the matrix form, in order to show you what the unknowns are, the unknowns are a0, a1, and a2. The coefficient matrix now for the three equations, I have 1 here, a here, and a squared here, then I have 1 here, a plus b, divided by 2 here, a plus b, divided by 2, whole squared here, then I have 1 here, b here, and b squared here, so that makes the coefficient matrix, and everything is known in this particular coefficient matrix, because I know what the lower and upper limit of the integration are, those are a and b.  Then on the right-hand side, I have the value of the function at a, the value of the function at a plus b, divided by 2, and the value of the function at b, and those . . . these are known also, because I know what function I want to integrate under, so I know the value of the function at a, a plus b, divided by 2, and b, in fact, I know  the value of the function at every point between a and b, but I know specifically what those values are, because I know what the function is.  So you're going to solve these three equations, three unknowns, and there are several ways of solving these three equations, three unknowns, you can use the classical Gaussian elimination technique to do that, symbolically of course, or you can use Cramer's rule, and all kinds of other methods to be able to find out what a0, a1, and a2 are. So I took the short route, or maybe the easy way out, I just put this all in Maple, and solved these three equations, three unknowns, and this is what I have found out for each of the unknowns, I've got a0 equal to this expression.  Now, this is a long expression, but I'm just showing it to you for completion. So that's what I get for a0.  For a1, I have a similar expression, each of the values of the function have some coefficient associated with it. So that's for a1. And for a2, I have a similar expression, where there is something associated with each of the values of the function, a coefficient, 2 times f of a, minus 4 times the value of the function at a plus b, divided by 2, plus 2 f of b, divided by b minus a, whole squared.  What you've got to appreciate, the fact is that all these unknowns, a0, a1, and a2, in the second-order polynomial, only involve the lower and upper limit of integration, and the values of the function at the three points.  So everything is known on the right-hand side of these expressions here.  So, in order to be able to find out what the value of the integral is, this integral which I am trying to find, it is approximately equal to the value of the integral under the second-order polynomial, which is f2 of x dx, and then from here I get a to b, a0, plus a1 x, plus a2 x squared.  Now, if I had time, I would substitute the value of a0, a1, and a2 which I just got, but since it's a very lengthy expression, I'm just going to give you the final expression for . . . in terms of a0, a1, and a2, so that's what I get by doing exact integration. And now what I'm going to do is, after I have done the integration by using my integral calculus knowledge, I'm going to substitute the values of a0, a1, and a2, which I obtained previously, and this is what I'm going to get, I'm going to get b minus a, divided by 6, times the value of the function at a, plus the 4 times the value of the function at a plus b, divided by 2, plus f of b. So you can see that this simplifies quite a bit, once we substitute the values of a0, a1, and a2, which I obtained in terms of the lower limit of integration and the upper limit of integration, a and b, and the values of the functions at these three points, this is what it simplifies to. Now, why is it called 1/3rd rule?  It's because you are basically dividing the segment . . . the interval from a to b into . . . into two segments, because you have a midpoint here, and if you call this to be h, and this also, which is h, so h is simply b minus a, divided by 2, then if you substitute it there, this is what you're going to get, you're going to get the integral of a to b, f of x dx is approximately equal to h divided by 3, and the rest of the expression is the same. So instead of h is b minus a, divided by 2, that means instead of this, you can substitute h divided by 3, so you have this 1 divided by 3 in the expression there, and that's why this is called the Simpson's 1/3rd rule, because of the 3 in the denominator there, where h is the segment width . . . half of segment width, because it's the difference between the two points which you have chosen for your integration.  So this is the formula for the Simpson's 1/3rd rule.  And that's the end of this segment.