CHAPTER 07.05: GAUSS QUADRATURE RULE: Complete Derivation of Two Point Gaussian Quadrature Rule: Part 1 of 3   In this segment, we're going to derive the two-point Gauss quadrature rule. So what we want to be able to derive is that if somebody gives us the integral going from -1 to +1, and this is approximately equal to, in the two-point rule, c1 times the value of the function at x1, plus c2 times the value of the function at x2.  What we want to be able to derive is that how do we get c1 equal to 1, c2 equal to 1, x1 equal to -1 divided by square root of 3, and x2 equal to 1 divided by square root of 3.  So what we want to be able to show is that for the two-point Gauss quadrature rule, that this is the form of the two-point Gauss quadrature rule, where the weights, c1 and c2, are both 1, and x1 is equal to this quantity, and x2 is equal to this quantity, and if you look at the handbooks, they might write it as 0.5773, and they might write this number a 0.5773, negative here, positive here, with just four in the decimal notation. So let's go ahead and see that how we can go ahead and derive this particular formula here. So what we want to be able to do is, we have the integral going from 1 to . . . -1 to +1, and we are approximating it as c1 times f of x1, plus c2 times f of x2, and what we want to be able to do is that we want to be able to get this formula to gives us exactly the same results as a third . . . as the integral of a third-order polynomial. The reason why we want to be able to do that is because we've got four choices here to be able to find the approximate value of the integral going from -1 to +1.  So what I'm going to do is I'm going to choose my function, f of x, to be a0, plus a1 x, plus a2 x squared, plus a3 x cubed, and what I want to be able to do is to be able to figure out that whatever I get from integral calculus for integrating this function from -1 to +1, I want to get the same thing when I go ahead and use this particular formula, and that's how I'll be able to derive the values of c1, c2, x1, and x2.  So if I look at it from an integral calculus point of view, if I want to integrate this third-order polynomial from -1 to +1, what do I . . . what do I get there?  So in this case, I use my integral calculus, I get a0 times x, plus a1 times x squared by 2, plus a2 times x cubed by 3, plus a3 times x to the power 4, divided by 4, from -1 to +1. And so from here, I will get, when I put x equal to 1 and -1, I'll get 2, for here, when I put x equal to 1 and -1, I'll get 0, and a2, when I put it here, I get minus . . . or plus 2 by 3, and when I put it here, I get 0 as the contribution. The reason why I'm not putting 0 here, because a1 times 0 will be 0, is because later on I have to equate the coefficients of a0, a1, and a2, and a3, so that's how I'm showing you that this is what I get as exactly the value of the integral going from -1 to +1 by using my integral calculus class.  Now, if I want to now have the formula give me the same, this particular formula here to give me the same result as what I have gotten by using integral calculus, I do need to show that what the equivalent is there.  So if I look at c1 times f of x1, plus c2 times f of x2, what is it when I write down the value of the function at x1 and x2 there? So I'll get c1 times a0, plus a1 times x1, plus a2 times x1 squared, plus a3 times x1 cubed, so that is the value of the function which I am going to get at x1 if I am going to choose a third-order polynomial with arbitrary constants there, plus c2 times a0, plus a1 times x2, plus a2 times x2 squared, plus a3 times x2 cubed, that's what I'm going to get for the value of the function at x2, when I plug it in here. What I'm going to do is I'm going to separate out the terms of a0, for example, a0 terms are c1 plus c2 here, a1 terms here are c1 times x1, plus c2 times x2, and I will tell you in a little bit why I am separating out these terms of a0, a1, and so on and so forth, plus a2, the terms are c1 x1 squared, plus c2 x2 squared, and then your a3 terms are c1 x1 cubed, plus c2 x2 cubed, that's what you get for . . . get for the formula itself that the . . . I'm going to use the c1 times f of x1, plus c2 times f of x2, and this is what I get as the equivalent expression when I substitute the values of x equal to x1 and x equal to x2 in my expression there. So what I have now is that these are the coefficients of a0, a1, a2, and a3, and what I want to be able to is I want this to be same as . . . so I want this here to be same as what I got from my integral calculus class, which is a0 times . . . a0 times 2, plus a1 times 0, plus a2 times 2 divided by 3, plus a3 times 0, this is what I obtain from my integral calculus.  And what I want this expression to give me the same result as this expression, because I want my formula to be exact for the third-order polynomial.  So since a0, a1, a2, and a3 are arbitrary constants in the third-order polynomial.  That means that the coefficients of a0, the coefficients of a1, the coefficients of a2, and the coefficients of a3 have to be exactly the same, only then I can identically say that, hey, those two will give me the same expression for an arbitrary third-order polynomial.  So what that means that c1 plus c2 has to be equal to w, this c1 times x1 plus c2 times x2 has to be equal to 0, and this c1 x1 squared plus c2 x2 squared has to be equal to 2/3, and this c1 x1 cubed plus c2 x2 cubed has to be equal to 0, and that's how it's going to work out.  So I'll have c1 plus c2 equal to 2, I'll have c1 x1 plus c2 x2 equal to 0, I'll have c1 x1 squared plus c2 x2 . . . x2 squared equal to 2/3, and I'll have c1 x1 cubed, plus c2 x2 cubed equal to 0. So what you are basically seeing that I have four equations, one, two, three, and four equations, so I have four equations and four unknowns, and the unknowns are what?  c1, c2, x1, x2.  So in these four equations which I have just been able to derive by equating the coefficients which I get from my formula with the coefficients which I am getting from the exact integral calculus, I am able to find out four equations here, one, two, three, four, where the four unknowns are c1, c2, x1, and x2. But the thing to realize is that these are not simple four equations, four unknowns, they are four equations which are nonlinear in nature, so they are four simultaneous equations, but they are all four simultaneous nonlinear equations, the only linear equation is the first one, but once you have this equation and this equation and this equation, this becomes a set of four simultaneous nonlinear equations which we need to solve.  So when we have four simultaneous nonlinear equations, or when we have nonlinear equations, the possibilities are endless, you can have no solution, you can have a unique solution, or you can have multiple solutions.  So that's what we need to figure out, that what kind of solution, acceptable solution do these four equations and four unknowns have, where the four unknowns are the two arguments and the two weights given to the functions, and that's something which we will see in the next segment.