 we are learning quadrature formulas to obtain an approximation to a given integral on a bounded interval a to b. In this today, we will learn a commonly used method called Gaussian quadrature rule. Gaussian quadrature rule generally gives a better approximation to the integral a to b f of x dx when compared to the other quadrature rules that we have derived so far. Let us see how to get this better approximation. Well, if you recall the quadrature rules that we have derived so far are of this form where x naught x 1 up to x n are given to us. Once we are given the nodes then the unknowns are only the weights w naught w 1 up to w n. In the last class we have seen that we can use a method called method of undetermined coefficients to obtain these weights. Of course, we can also obtain these weights by directly integrating the Lagrange polynomials in the interpolating polynomial of the function f of x. But in the method of undetermined coefficients we have another approach to find these weights by imposing the condition that this quadrature rule finally gives us the exact value if the integrand f happens to be a polynomial of degree less than or equal to n right. So, this is what the condition we impose to get the weights. Once you impose this condition this is equivalent to imposing the same condition on the corresponding monomial basis right that is what we did in the last class. In fact, it is possible to derive a quadrature formula in such a way that it gives us the exact value of the integral if the polynomial is of degree less than or equal to 2 n plus 1. Can you see how we can achieve this? Just think why we need to impose this condition that is why we need to impose that the quadrature formula gives us the exact result for polynomials of degree less than or equal to n because in that way you have n plus 1 elements in the monomial basis and here also you have n plus 1 unknowns right. So, that is how we are matching the number of unknowns with the number of equations in the system and getting a closed system of equations. Now, if you understand this logic then you can understand how to get this condition on our quadrature formula that is we now want our quadrature formula to be exact for polynomials of degree less than or equal to 2 n plus 1. How can we achieve that? Well why you have to fix the nodes you also consider the nodes to be unknowns that is the idea behind getting this condition. So, now we will not fix the nodes, but we will also obtain the nodes as well as the weights. In that way how many unknowns are there? Let us think about that you have n plus 1 unknowns coming from the weights and you have n plus 1 unknowns coming from the set of nodes right. In that way you have 2 n plus 2 unknowns therefore you can impose the condition that the quadrature formula will be exact for polynomials of degree less than or equal to 2 n plus 1. In that way the corresponding monomial basis will have 2 n plus 2 elements in it they are 1 x x square up to x to the power of 2 n plus 1 right there are 2 n plus 2 elements in the basis and that can lead to a system of equations having 2 n plus 2 equations you have 2 n plus 2 unknowns therefore there is a scope to solve this system to get all these unknowns. So, that is the basic idea of this improved version and that is called the Gaussian quadrature rule. Let us make it more precise you want to evaluate this integral for that you are using this quadrature rule which can give us an approximate value to this integral. Now in this process what are all the unknowns that we have to choose well we have to choose all the weights they are not given to us, but we have to obtain them and also now we have to obtain all the nodes. Previously nodes are given to us, but now we are not going to take the nodes as per our choice, but we will also obtain this nodes as the part of the method. Therefore, you have 2 n plus 2 unknowns we have to impose the condition that this quadrature formula will be exact that is it gives you the exact value of the integral as long as the integrand f is a polynomial of degree now less than or equal to 2 n plus 1 1 less because your monomial basis will have 1 x up to say if your polynomial degree is n then it goes up to n therefore you have n plus 1 right. So, if you are going up to 2 n plus 1 then it has 2 n plus 2 members and therefore, you will get 2 n plus 2 equations on the other hand you have 2 n plus 2 unknowns therefore, you can solve this system to get these unknowns that is the idea. Remember in order to keep our calculations simple we will impose this idea on the integral minus 1 to 1 remember our aim is to find a quadrature rule for the integral a to b f of x dx for any a less than b right, but in this calculation we will always restrict ourselves to the interval minus 1 to 1 keep this in mind we will first derive the formula once you have the formula for this integral that is integral over minus 1 to 1 then we can use certain transformation to get the integral over any given interval a to b that is the idea this restriction is purely because our calculations will become relatively simple in this case that is why we are doing this. So, let us try to derive the Gaussian rules for the integral minus 1 to 1 f of x dx later we will transform it to any integral a to b f of x dx let us keep this restriction in mind and go ahead. So, what we are going to do is we want to evaluate this integral and we want our quadrature rule in this form we will assume that this quadrature rule gives exact value if the integrand f happens to be a polynomial of degree less than or equal to 2 n plus 1 that is equivalent to imposing this condition on the monomial basis only that is we will impose the condition that this quadrature formula is exact for the integrants 1 x x square up to x to the power of 2 n plus 1. So, that is the final condition that we will be imposing right. Now, you see you choose a n that is all do not go to choose the nodes different n leads to different quadrature rules n equal to 0 will give you a quadrature rule for n equal to 0 and similarly n equal to 1 gives a quadrature rule n equal to 2 gives a quadrature rule like that as you go on increasing the values of n you in fact, get a better and better approximation to your integral all these methods are called Gaussian quadrature rules only. Let us try to derive the quadrature rule for n is equal to 0 remember this is the general form of the quadrature rule and we want to take n is equal to 0 here right in that way our quadrature rule will look like this and what is the condition that we have to impose now well we have to impose that this is exactly equal to that is what I am writing here the quadrature rule if the integrand f happens to be a polynomial of degree 2 n plus 1 right n is equal to 0 therefore, it is polynomial of degree less than or equal to 1 that gives us 2 elements in the corresponding monomial basis that is 1 and x therefore, you have to get the weight w naught and the node x naught by imposing the condition that the quadrature formula gives exact value if f is equal to 1 that is this and f is equal to x that gives us this expression. Now, from here you can get a pair of equations each coming from these conditions you see now we do not have a linear system because the unknowns are x naught and x 1 and they are not appearing linearly in this equation therefore, in the Gaussian quadrature rule what you get is finally, a non-linear system of equations that is 1 level difficult in the case of Gaussian rules when compared to the quadrature rules that we derived in the previous idea right there we are given the nodes therefore, the unknowns are only w's and in that way it gives us a system of linear equation, but that is not the case here you will get non-linear system of equations, but in the present case it is very easy to solve this non-linear system. In fact, you can easily check that it leads to w naught equal to 2 and x naught equal to 0 and in that way the quadrature rule finally, reduces to this expression. So, what it says is the Gaussian rule for n is equal to 0 for the integral minus 1 to 1 f of x dx remember this is a particular case 1 minus 1 to 1 f of x dx is given like this. If you recall we have come across this method already in one of our previous classes what is that well you can go back and see that this is what precisely we called as the midpoint rule remember the midpoint rule is b minus a into f of the midpoint of the interval a plus b by 2 right in the present case the midpoint is 0. So, that is what is this and b minus a is precisely 2 here in this particular integral minus 1 right therefore, what you get as the Gaussian rule for n equal to 0 is precisely the midpoint rule that is what is interesting here. Let us go to the next case now we will take n equal to 1 and see how the Gaussian rule with n equal to 1 looks like again in this case we have to take our general quadrature rule and put n is equal to 1 in that to get this expression. So, this is the general form of the quadrature rule that we are interested in the present case here we have to obtain the weights w naught w 1 and also the nodes x naught and x 1 right therefore, you have to impose the condition that your quadrature formula will be exact for all polynomials of degree less than equal to 3 therefore, your monomial basis will now contains the elements 1 x x square and x cube for each we will get a non-linear equation. Let us see how it comes when you take f of x identically equal to 1 you get this equation when f of x equal to x you get this equation f of x equal to x square you get this equation and finally, f of x equal to x cube gives you this equation you can see that you have 4 equations it is a system of non-linear equations and you somehow have to solve this system you can see that w naught equal to w 1 equal to 1 and x naught equal to minus 1 by root 3 and x 1 equal to 1 by root 3 will solve this system of non-linear equations therefore, the Gaussian rule with n is equal to 1 is given by this formula now as you go on increasing n the number of non-linear equations will also increase in your system and also their expressions are quite complicated and thereby solving their system of non-linear equations will also become more difficult one can go for certain non-linear solvers like Newton's method and so on, but we will not give any weightage for such problems we will just stop our derivation of Gaussian rules only up to n is equal to 1 however, we will just give an idea of how to go about with n equal to 2 3 and so on in general for n in general we need to obtain the weights and the nodes such that you can approximate the integral minus 1 to 1 f of x dx by this quadrature formula for that we have to impose the condition that this quadrature formula will be exact for polynomials of degree less than equal to 2 n plus 1 right because we have 2 n plus 2 unknowns in our problem ok. So, those non-linear systems in general are given by this expression and therefore, you have to solve this non-linear system that is a quite difficult task and once you solve this non-linear system and get the weights and the nodes then you have the Gaussian rule for that given n ok. So, n equal to 2 3 and so on one can go on deriving, but we will not give any weightage in our course we will only restrict ourselves to n is equal to 0 and n is equal to 1 in our course, but the idea should be clear how to go for higher values of n well we have derived the Gaussian rule. So, for only for those integrals over the interval minus 1 to 1 right. Now, let us see how to generalize it to any given interval a to b this can be achieved by this simple change of variable formula that can take the interval minus 1 to 1 to any interval a to b right. So, you just have to impose this change of variable into your integral you are interested in finding the integral a to b f of x dx, but you have the Gaussian rule only for integral minus 1 to 1 right that is you have only the Gaussian rule defined for this kind of integrals that is integral over minus 1 to 1, but that is not a serious problem because you can write this integral a to b f of x dx as b minus a by 2 into the integral that is comfortable for us to apply the Gaussian rule right. Now, remember if you want to evaluate an approximate value of this integral you should not put the Gaussian rule for this f, but you have to put the Gaussian rule for this function that is the only extra information that you have to remember when you are applying Gaussian rule on any integral a to b f of x dx students make this mistake quite often they just take this f and apply the Gaussian quadrature rule for this f only you should not do that you should apply it to this integrant therefore, the Gaussian quadrature rule should be applied to this integral and then you multiply it with this number in order to get an approximate value of this integral using Gaussian rule that is 1 extra work you have to do you should not forget that. Let us try to evaluate the integral 0 to 1 1 by 1 plus x dx remember our integral is not over minus 1 to 1 therefore, you first have to carefully use the change of variable which we have shown in this slide and obtain this function with a equal to 0 and b equal to 1 now and then apply the Gaussian rule ok. So, in the present case the change of variable happens to be x equal to t plus 1 by 2 therefore, this is the given integral and that should be now rewritten in this form and then apply the Gaussian quadrature rule for this integral remember that is what I am just emphasizing do not apply the Gaussian quadrature rule for this integral this is wrong ok you apply the Gaussian quadrature rule for this integral. So, that is you use this formula this is the Gaussian quadrature rule for n equal to 1 similarly for n equal to 0 also you can do what is f now f is not the one which is given to us, but f is the one which you obtained after putting the change of variable right that is 1 by t plus 3 and that gives you this value ok. So, this one transformation that you have to do without forgetting and that is very important you see what is the mathematical error involved in this calculation it is something given like this well again I am give you a caution that although I am calling it as mathematical error ideally it is actually the total error ok. Let us see how the mathematical error estimate looks like we can obtain an estimate in the case of Gaussian rule. Let us assume that f is a continuous function defined on an interval a to b and you have some n and you also obtain the Gaussian rule for that given n then the mathematical error involved in the Gaussian rule with that n is denoted by m e n of f and you can estimate the mathematical error by this inequality ok. Where this rho is nothing, but the infimum over all degrees q less than or equal to 2 n plus 1 infinite norm of f minus q remember you should go back to our previous classes and see what this infinite norm means it is nothing, but maximum over mod f of x minus q of x right x belongs to the interval a to b that is what is mean by this notation and we call it as maximum norm or infinite norm ok. So, what you are doing is you are taking all the polynomials of degree less than or equal to 2 n plus 1 and obtaining the maximum norm of that minus f and then taking the infimum over all those numbers and that is what is called as rho 2 n plus 1 of f and the upper bound of the mathematical error involved in the Gaussian quadrature rule is given like this. Let us see how to prove this it is not very difficult assume that the infimum is achieved at some polynomial which is denoted by q star 2 n plus 1 it is a polynomial of degree less than or equal to 2 n plus 1 right then rho 2 n plus 1 of f is precisely equal to this because infimum of this is what is the definition of rho and we are taking that infimum to be achieved at q star right therefore, if you take the infinite norm of f minus q star that will be exactly equal to this number right that is by definition and now look at the mathematical error of f you can see that the mathematical error involved in the Gaussian quadrature rule evaluating the integral of f is written like this why it is so because this is actually equal to 0 because by the derivation Gaussian quadrature rule gives you the exact value for all polynomials of degree 2 n plus 1 right and q star is a polynomial of degree less than or equal to 2 n plus 1 therefore, Gaussian quadrature rule gives you the exact integral value that means the mathematical error involved in the value obtained from the Gaussian quadrature rule for q star is exactly equal to 0 right so what I am doing is precisely the mathematical error in f is equal to the mathematical error in f minus 0 that is all I am putting I am not putting anything extra here right therefore, this is always true now you just check that the mathematical error involved in the Gaussian quadrature rule for the integrand f plus g is nothing, but the mathematical error involved in the Gaussian quadrature rule with integrand f plus the mathematical error with integrand g ok so this is very simple to check it comes directly from the linear property of the integral in fact right now I will use this simple property in this expression and that tells me that I can write this expression like this right so I am just having this of course with a minus sign here and that I am writing like this with a minus sign here that is what I am doing and now we can see that the mathematical error in f minus q star can be written like this this is precisely the definition of the mathematical error this is the exact value minus the quadrature rule that is the Gaussian quadrature rule is this so this is exact value and this is the approximate value so that is the mathematical error right now let us take the modulus on both sides and use the triangle inequality for the modulus and then take the maximum norm on this integrand I am doing all this in one step you can see that the right hand side in fact can be written like this after taking a modulus with less than or equal to sign ok so you are just dominating modulus of this by this quantity you can easily check this what I am doing I am just taking the modulus and using the triangle inequality for the modulus and I am also using the condition that a to b f of x dx modulus is less than or equal to a to b mod f of x dx this is also a property that is well known for the integrals I am using that also here I am first taking modulus here and then pushing this modulus inside the integral and then dominating this term by its maximum that is how I am having the maximum norm here and then what remains is integral a to b dx right that is nothing but b minus a and you can also see that this term can be dominated by this that is not a difficult thing of course you take the modulus and then take the modulus inside the summation ok and then you get this I hope you can do this to this and then without any problem and now you can see that all this weights with the modulus will sum to the length of the interval b minus a so that is what is very interesting once you put this into this term you will see that you will get back the inequality that we want to prove remember this is what we have taken as rho 2 n plus 1 right and this will be another b minus a therefore b minus a plus b minus a will be 2 times b minus a that is what precisely we want to show and this gives us an estimate of the mathematical error involved in the Gaussian quadrature rule with this we will end our class thank you for your attention.