 So, before we start new topic of numerical integration, we are going to solve some problems. I will be giving you solutions, but maybe you can find some alternate solutions, which may be even better. Look at the problem that in the interval a b, we have got n plus 1 distinct points. Look at the Lagrange polynomial, which is based on these n plus 1 points. So, the Lagrange polynomial has the property that l i at x j is equal to 1, if i is equal to j and 0, if i not equal to j. We want to show that summation i goes from 0 to n l i x is equal to 1. Since the Lagrange polynomial, they are not defined recursively, induction may not be a good idea. In order to prove this, we are going to use the property that if the function f is a polynomial of degree m, which is less than or equal to n, then when we try to fit a polynomial of degree n or bigger than or equal to n, then the interpolating polynomial is going to be function itself. Here, the interpolating polynomial we know that it is given by p n x is equal to summation f x i l i x i goes from 0 to n. We are interested in showing that summation i goes from 0 to n, l i x is equal to 1. So, the coefficients of l i x should be equal to 1. So, the simplest choice is look at f x is equal to 1. For f x is equal to 1, it is a constant polynomial. So, when you look at p n to be a polynomial of degree less than or equal to n, which interpolates the constant function. So, we have to find the function, then that is going to be the function itself. So, that is the idea. So, choose f x is equal to 1 for x belonging to a b and p n be the interpolating polynomial of degree less than or equal to n such that p n x j is equal to f x j. p n x general form is summation i goes from 0 to n f x i l i x. p n x is going to be equal to 1, function is f x is equal to 1. So, f x i will be equal to 1 and hence we get summation i goes from 0 to n l i x is equal to 1. If instead of f x is equal to 1, we look at f x is equal to x. In that case, for n bigger than or equal to 1, p n will be equal to function itself and that gives us a relation summation x i l i x i goes from 0 to n is going to be equal to x. In a similar fashion, for n bigger than or equal to 2, summation x i square l i x i goes from 0 to n will be x square and so on. Now, look at the second problem. So, we are looking at f x is equal to 1 by x, x in the interval 1 to 2. Then, we want to prove this expression that the divided difference f of x 0 x 1 x n is given by minus 1 raise to n divided by x 0 x 1 x i. In this problem, the induction is going to work. We will be using the recurrence formula for the divided differences. So, for n is equal to 0, when we quickly see that the result is true, assume the result to be true for n is equal to m minus 1 and then using the recurrence formula for the divided differences, one proves the result to be for n is equal to m. So, look at the recurrence relation f of x 0 x 1 x n to be given by the divided difference based on x 1 x 2 x n minus divided difference based on x 0 x n minus 1 and then whole thing divided by x n minus x 0. We are assuming that x 0 x 1 x n these are all distinct points. When you put n is equal to 0, on the left hand side you have got f x 0 and on the right hand side you have got 1 upon x 0 and hence the result is true for n is equal to 0. Now, assume the result for n is equal to m minus 1. Consider divided difference f based on x 0 x 1 x m. We have got this recurrence relation. We are assuming the result to be true for n is equal to m minus 1 and hence we will have f of x 1 x 2 x m to be minus 1 raise to m minus 1 divided by 1 upon or multiplied by 1 upon x 1 x 2 x m f of x 0 x 1 x m minus 1 will be 1 upon x 0 x m minus 1 and then divided by x m minus x 0. Now, when you simplify then you are going to get in the numerator x 0 minus x m in the denominator you have x m minus x 0 and then multiplied by x 0 x 1 x m. So, that adds 1 more minus 1 and then we have got minus 1 raise to m 1 upon x 0 x 1 x m. So, for some functions we can have the divided difference to be given explicitly. Our next problem is you are given a polynomial of degree 4 and you are asked to find two divided differences. One is based on five points and another is based on six points. So, what one can do is construct the two points and construct the divided difference table. You are given the function. So, construct the divided difference table and then find the divided differences, but here one can observe that f is a polynomial of degree 4. We are looking at divided difference based on five points. Our definition of divided difference is look at the individual difference interpolating polynomial which interpolates these five points and look at the coefficient of x raise to 4 in that polynomial. Our function is a polynomial of degree 4. So, interpolating polynomial of degree 4 is going to be the function itself and hence coefficient of x raise to n x raise to 4 in our function that will be the divided difference based on five points. If we look at the six points then we have to look at polynomial of degree 5 which interpolates the given function at those six points. The function is a polynomial of degree 4. So, a polynomial of degree less than or equal to 5 that is going to be the function itself. So, treat our function which is a polynomial of degree 4 as a polynomial of degree 5. That means you add plus 0 into x raise to 5 and now you have to look at the coefficient of x raise to 5 which is going to be 0. Now, the same result one can obtain by using the fact that our function f is sufficiently differentiable then when you look at the divided difference based on five points it is equal to f 4 of c divided by c factorial divided by it should be 4 factorial not c factorial. Then the function is a polynomial of degree 4 and hence when you take the fourth derivative it is going to be constant and that will be nothing but 279. If when you look at the fifth derivative that is going to be 0 and hence the divided difference is equal to 0. So, you can either use the definition or you can use the formula in terms of the derivative. If you try to write down the divided difference you are going to get the same result, but the computations they are going to be missing. So, so far we had obtained upper bounds. Now, let us look at an example where f x is equal to ln x and look at a cubic polynomial of degree less than or equal to 3 interpolating at four points and we want to find a lower bound. So, we have got f x minus p n x and this is equal to f of x 0 x 1 x n x and then multiplied by x minus x 0 x minus x n. So, this we denote by w x. We are looking at f x minus p 3 x. So, that will be f of x 0 x 1 x 2 x 3 x multiplied by w x and this will be f 4 of c x divided by 4 factorial w x. Our function is f x is equal to ln x. x belonging to f x is equal to f of x minus x minus x minus x is equal to 1 by 2. So, we will calculate the fourth derivative of this ln x and now because we want to consider the lower bound for the derivative f 4 c x we will look at the least value and for the w x we are going to x 0 x 1 x 2 x 3 these are given to us. We are going to substitute x to be equal to 3 by 2 and then we are going to get a lower bound. Throughout so far we had always considered upper bound. So, I wanted to show that one can also consider a lower bound. So, that tells us that there is going to be at least this much of error. So, now the computations are straight forward. Now, we have to look at f x minus p 3 x. So, that is f 4 at c x divided by 4 factorial into w x. Then you can verify that the fourth derivative at x will be given by minus 6 by x raise to 4 and we have to look at the least value of this. So, the least value will be obtained when x is equal to 2. So, the least value for f 4 x is going to be 6 upon 2 raise to 4. So, that is going to be 6 upon 16 and then you calculate the value of w of 3 by 2 and that gives you the lower bound for x is equal to 3 by 2. So, we have modulus of f of 3 by 2 minus p 3 of 3 by 2 is going to be bigger than or equal to 1 upon 384. So, it is a lower bound. So, now consider we are again going to consider interpolating polynomial, but now our polynomial is going to interpolate the function and the derivative values. So, suppose our function has a double 0 at some point x 0. So, we have got f x 0 is equal to f dash x 0 is equal to 0 and at some other distinct point x 1. We have got f x 1 is equal to f dash x 1 is equal to f double dash x 1 to be equal to 0. Now, what we want to do is we want to fit a polynomial of degree less than or equal to 5, which is going to interpolate the function value derivative value at x 0, function value derivative value and second derivative value at x 1 and we want a polynomial of degree less than or equal to 5. So, we need one more condition. So, let x 2 be another point which is distinct from x 0 and x 1 and it should interpolate the function at this point. Then we want to find such a polynomial. So, our interpolation points are x 0 is repeated twice, x 1 is repeated twice and x 2 is repeated once. So, the usual way of constructing such a polynomial is you form the divided difference table. Once you have formed the divided difference table, then you look at the value f x 0, then f of x 0, x 1 divided difference and so on and then that is the Newton form, that is how we construct the polynomial. But here, we can give a different proof. Our function, our polynomial it is going to match with the function value and the derivative value at x 0 and the function value and the derivative value both of them they are 0. That means, the polynomial p 5 is going to have a factor x minus x 0 square, it is a double you factorize. Similarly, you look at the point x 1, our polynomial should be such that it vanishes at x 1, it vanishes its derivative vanishes at x 1 and second derivative vanishes at x 1. That means, in our polynomial there should be a factor x minus x 1 cube. So, now look at the polynomial, we have got a factor x minus x 0 square, x minus x 1 cube and it is a polynomial of degree less than or equal to 5. So, now what will be, there will be a coefficient that has to be constant and we are going to determine that constant. So, we can as I said either form divided difference table or you look at the fact that p 5 it has got a double 0 at x 0, triple 0 at x 1. So, we have got look at the factors x minus x 0 square x minus x 1 cube, since it is a polynomial of degree less than or equal to 5, you have to multiply only by a constant. Otherwise, if it was a higher degree polynomial here it would have been a function of x and hence you get this polynomial form. Now, we have to determine alpha. So far we have not used the fact that our polynomial is going to interpolate the given function at x 2 also. So, we have got f x 2 is equal to p 5 x 2 is equal to alpha times put x is equal to x 2. So, x 2 minus x 0 square x 2 minus x 1 cube and that will give you alpha to be equal to f x 2 divided by x 2 minus x 0 square and x 2 minus x 1 cube. It will be a good exercise to try to complete the divided difference table get the various divided differences which are going to come into picture for the p 5 x and see that you are going to get the same result. Now, we will consider one more example or one more problem and then we will go to the next topic of numerical integration. Now, it is a simple example. We are going to look at f x is equal to x square a simple function and then look at the interval n to n plus 1. So, n is a integer or a natural number and what we want to do is we want to find an upper bound. Now, when we consider interpolating polynomials and then we know that the error is in terms of the appropriate derivative of the function evaluated at a point. Now, that point is not known, but look at function f x is equal to x square. We are looking at linear polynomial. So, in the error the second derivative comes into picture and the second derivative for x square it is going to be constant. So, using that fact one just calculates what is an upper bound. So, we have norm of f minus p 1 infinity this will be less than or equal to norm f double dash infinity divided by 8 and then you have got this will be equal to 1 by 4 because we have when we look at norm of f minus p 1 infinity norm to be less than or equal to it is norm f double dash infinity divided by 8 into b minus a square. Our a is capital N b is n plus 1. So, b minus a is equal to 1. So, that is why norm f minus p 1 infinity norm is less than or equal to norm f double dash infinity by 8 and f double dash being equal to 2 it will be 2 by 8 which will be equal to 1 by 4. So, on any interval n to n plus 1 this is going to be the bound. Now, I want to write the first derivative recall what forms of the polynomials we have considered. So, we have power form which is a 0 plus a 1 x plus a n x raise to n. We have got Lagrange form which involves Lagrange polynomials and we have got Newton form. Then we had this error. So, we have f x 0 is equal to f x 0 plus f of x 0 x 1 x minus x 0 plus f of x 0 x 1 x n x minus x 0 x minus x n minus 1 and then the error f of x 0 x 1 minus x n minus 1 and then the error f of x 1 x n x and then x minus x 0 x minus x n. Suppose our points are all identical, then we have proved that f of x 0 x 1 x n in this case we define it to be equal to f n x 0 divided by n factorial. So, thus our this result becomes f x is equal to f x 0 plus f dash x 0 into x minus x 0 plus f double dash x 0 by 2 x minus x 0 square plus f double dash x 0 plus f double f of f n x 0 divided by n factorial x minus x 0 raise to n plus this divided difference is equal to f n plus 1 c x divided by n plus 1 factorial. So, it will be f n plus 1 c x divided by n plus 1 factorial multiplied by x minus x 0 raise to n plus 1. Now, you are familiar with this, this is nothing but Taylor's theorem. So, this is an observation. So, now we are going to start the new topic of numerical integration. Suppose your function f is n divided by n plus 1 c x defined on interval a b and it is continuous. In that case one defines the Riemann integration. For that what one does is looks at the Riemann sum, upper Riemann sum, lower Riemann sum and in terms of those one defines the integral. For a continuous function, we can show that take the interval a b, subdivide it into equal parts, form the Riemann sum by taking any. So, what you have to do is in each interval you look at value, take a point any point and then you look at summation f at c i multiplied by length of the interval. So, the length of the interval will be h, sum it over, take its limit as n tends to infinity and that is going to be our value of integral a to b f x d. So, we have this for a continuous function limit n tending to infinity summation i goes from 0 to n minus 1 h times f of t i. I had told you that you can take any point in the interval t i to t i plus 1. So, let us choose it to be end point t i, form this sum and then take its limit as n tends to infinity our h is b minus a by n. So, what you are doing is you are looking at average and then you are multiplying by b minus a and then you get the limiting value is equal to integral a to b f x d x. So, using this definition one proves many important results and in numerical analysis. Now, suppose I give you a continuous function all continuous functions they are going to be integrable. So, if you are given a continuous function and you are asked tell me what is value of integral a to b f x d x, if not exact value may be some approximate value then you are not going to look at this Riemann sum, take limit as n tends to infinity. So, this is not how one finds the value of the integral. So, then there is a class of functions for which one know how to integrate. So, if you know antiderivative of your function that means I want to find integral a to b f x d x. So, suppose I know another function capital F such that capital F its derivative is going to be my function f. If I do that if I know that then we have got integral a to b f x d x is capital F b minus capital F a. In fact, that is how one calculates the integration that you know integration and differentiation these are opposite process. So, there are some functions for which you can calculate antiderivative. So, one big class is the polynomial functions. So, for polynomial functions we know their antiderivatives. There are also trigonometric functions we know sine x cos x how to integrate exponential x. So, there are there is some class of problems or class of functions rather one can calculate the integral a to b f x d f. So, our idea is that our function we know how to approximate it by polynomials. So, consider approximation of function f by a interpolating polynomial. Integrate that polynomial whatever value you get that you are you will be able to do even using computer. In fact, when we started the polynomial approximation that is what we said that the polynomials they are nice functions you can find the derivative using computer you can find the integral using the computer. So, you calculate the value of the integral and then you are going to get an approximate value of the integration. So, in order to have sufficient accuracy you have to choose n big enough, but we have seen that if your function is only given to be continuous then we do not have a sequence of interpolating polynomials which is going to converge to our function f. So, then that is where now we went to piecewise polynomial approximation. So, why not look at piecewise polynomial approximation? So, on each interval or on each sub interval I will have a polynomial I will integrate that I will add it up and then I will get value of the function. So, that is how one is going to do when you consider a single polynomial then you are going to get basic rule when you are going to look at piecewise polynomials you are going to get what are known as composite rules. So, we are going to consider some of the standard rules which are used in practice. So, here is if your function is a polynomial a 0 plus a 1 x plus a n x raise to n then if you look at capital F x to be equal to a 0 x plus a 1 x square by 2 plus a n x raise to n plus 1 by n plus 1 then it satisfies the property that f dash x is equal to small f x and then this is one of the fundamental theorem of integral calculus that integral a to b f x d x will be nothing but capital F b minus capital F a. So, now let us look at the interpolating polynomial. So, we have this form we have p n interpolates f at x 0 x 1 x n then p n a to b f x d x will be nothing but capital F b minus capital F a. So, p n x is going to be summation f x i l i x i goes from 0 to n where l i is a polynomial of degree n. So, integral a to b p n x d x will be equal to summation i goes from 0 to n f x i integral a to b l i x d x. So, this is going to give us some real number w i. So, you have summation i goes from 0 to n w i f x i note that here there is no dependence on the function. So, this we will do once for all and then we get a formula for integral a to b p n x d x in terms of these w i's and the function values x i. Now, look at the error. So, here we know the error in the interpolating polynomial. So, we have f x is equal to p n x plus a error term. The error term is a function of x. So, you integrate. So, we are going to have integral a to b f x d x is equal to integral a to b p n x d x plus integration of the error. Now, for the error we will be looking at the error and we will be calculating only an upper bound. So, we have modulus of integral a to b f x d x minus integral a to b p n x d x modulus. So, this is exact integral. This will be of the form summation w i f x i i goes from 0 to n. This will be less than or equal to modulus of integral a to b f of x 0 x 1 x n x w x d x, where x i is equal to a to b f of x 0 x 1 w x is x minus x 0 x minus x n. So, this will be less than or equal to norm of f n plus 1 infinity divided by n plus 1 factorial and then we have got b minus a raise to n plus 1 and into b minus a. So, norm of f n plus 1 infinity is coming from this factor. This I am going to dominate by this. So, it will come out of the integration sign. Modulus of w x will be less than or equal to b minus a raise to n plus 1. So, that also will come out of the integration sign and then you will have integral a to b of 1 or a to b d x that is going to give me b minus a. Now, this error which we have obtained, it has got n plus 1 derivative of the function its norm divided by n plus 1 factorial and then we have got b minus a raise to n plus 2. Now, here what has happened is the x 0 x 1 x n they sort of we have lost. We have used crude approximation that x 0 x 1 x n they all lie in the interval a b. So, if our x is varying over the interval a b x minus x j also will vary over the interval a b. Now, the choice of interpolation points that is important. So, we do not want to lose them. So, what will be a better estimate is that w x is a polynomial it is x minus x 0 x minus x 1 x minus x n we can integrate it. So, that integration value that will retain the information about x 0 x 1 x n, but then w x in the error w x is multiplied by n plus 1 derivative of the function divided by n plus 1 factorial. So, I cannot just take it out and integrate. So, for that purpose in order to get a finer bound we are going to prove what is known as mean value theorem for integrals. Also, there will be cases when our if the points are such that for example, suppose you are looking at one point integral and that one point is the midpoint. Then integral a to b x minus x 0 dx that is going to be 0 and using that property one will get a higher order of convergence or a better order of convergence for the corresponding composite rule. So, that is why we do not want to be satisfied with this upper bound it is an upper bound, but we want to have some better upper bound and for that we prove mean value theorem for integrals. So, what it tells us is that suppose you are integrating two functions or you are looking at the product of two functions f x into g x over the interval a b. Our function f suppose it is continuous the other function g what we want is it should be integrable. Continuous functions they are integrable if your function has finite number of discontinuities then also it is integrable. So, our g x should be a integrable function Riemann integration I am always talking about Riemann integration and it should be either bigger than or equal to 0 or less than or equal to 0 throughout the interval. So, one function should be continuous other function should be either bigger than or equal to 0 or less than or equal to 0. If that happens then integral a to b f x into g x dx will be equal to value of f at some point c into integral a to b g x dx. So, remember our error in the integration it was consisting of two parts one was the divided difference based on x 0, x 1, x n, x and we have proved continuity of this function the other term was w x that is x minus x 0, x minus x 1, x minus x n. So, depending on the choice of x 0, x 1, x n it can happen that w x is also is a bigger than or equal to 0 or less than or equal to 0. Look at the linear polynomial which interpolates at the two end points in that case our w x is going to be x minus a into x minus b our x varies over the interval a to b. So, x minus a will be bigger than or equal to 0 x minus b will be less than or equal to 0. So, their product will be less than or equal to 0. So, now if I can take out the divided difference outside the integration by evaluating it at a point then I will have integral a to b w x dx and that value we can calculate. So, let us prove this mean value theorem for integrals. So, we have f is a map from a b to r which is continuous and g is an integrable function such that either g x bigger than or equal to 0 or g x less than or equal to 0. Then there exists a point c in the interval a b such that integral a to b f x g x dx is equal to f of c into integral a to b g x dx. So, this is the theorem we are going to prove now. The proof of this theorem it is going to be based on property of continuous function. Our function f is defined on interval a b closed interval closed and bounded interval a b is defined as f of c into integral a to b and x real values then such a function is going to be bounded. It is going to attain its infimum and supremum. So, supremum is nothing but least upper bound amongst the upper bounds the one which is the smallest. When it attains its upper bound then that is known as maximum and similarly it is going to attain its minimum that is greatest lower bound among the lower bounds whichever is the biggest. So, our function f will have a absolute minimum small m and absolute maximum capital M. So, small m will be less than or equal to f x less than or equal to capital M and then we have intermediate value property that between this small m and capital M our function is going to assume each value. So, this is a crucial property which we are going to use in the proof of this theorem. So, what let me rephrase the property this continuous functions our function f is defined on interval it will be interval a b it will be its range will be small m to capital M. So, it is going to be onto function and any point in the interval small m to capital M that point that is going to be attained. So, our we want to show that integral a to b f x g x d x is equal to f of c into integral a to b g x d a. So, if integral a to b g x d x is not 0 we divide. So, we look at integral a to b f x g x d x divided by f x g x d x divided by integral a to b g x d x and show that it lies between small m and capital M. So, now for the sake of definiteness we will assume g x to be bigger than or equal to 0. If it is less than or equal to 0 some inequality is they will change, but the proof is very much similar. So, let us assume that g x is bigger than or equal to 0 and let small m and capital M denote the absolute minimum and absolute maximum of function f. So, we have m less than or equal to f x less than or equal to capital M g x is bigger than or equal to 0. So, m into g x is less than or equal to f x into g x less than or equal to capital M into g x. Now, you integrate using the property of integration we will have the inequality signs will be preserved and then small m and capital M they do not depend on x. So, they come out of the integration sign and we have small m into integral a to b g x d x less than or equal to integral a to b f x g x d x less than or equal to capital M into integral a to b g x d x. Now, our g we are assuming it to be bigger than or equal to 0 and integrable. So, g need not be continuous. So, integral a to b g x d x it can be equal to 0 even when g x is not identically 0. If g x is identically 0 then of course, integral a to b g x d x is not identically 0. But, because g need not be continuous it can happen that integral a to b g x d x is equal to 0 when g x is not identically 0. Like look at function g x which is equal to 0 if x is not equal to a plus b by 2 and is equal to 1. If x is not equal to a plus b by 2 then x is equal to a plus b by 2. So, g x is not identically 0 and integral a to b g x d x is equal to 0. So, we have small m into integral a to b g x d x this inequality we will look at two cases once when integral a to b g x d x is equal to 0 and other when it is not equal to 0. If this is equal to 0 then we have got 0 here 0 here which will mean integral a to b f x g x d x is equal to 0. So, you can choose c to be any point. The second case will be integral a to b g x d x is strictly bigger than 0. In that case I divide by integral a to b g x d x then the quotient is lying between small m to capital m. So, it has to be equal to f of c. So, that is by the intermediate value theorem and this will mean that integral a to b f x g x d x is equal to f of c multiplied by integral a to b g x d x is equal to f of c multiplied by integral a to b g x d x is equal to f of g x d x that is the mean value theorem for integral and this mean value theorem for integrals we are going to use for calculating the error bounds in various rules. So, now what we are going to do in the next lecture is we will first consider some basic rules which are coming from what are known as Newton codes formula. So, look at the interval a b, subdivide it into equal parts, fit an interpolating polynomial, integrate it and then we give you get a numerical quadrature rule. You are familiar with these rules such as if you choose a constant polynomial and choose the interpolating point to be the end point then what you get is what is known as rectangle rule. If you take the midpoint and consider the constant polynomial what you get is a midpoint rule then if you consider polynomial of degree less than or equal to 1 choose two end points of the interval as your interpolating point you get trapezoidal rule. Then you have got Simpson rule in which case your interpolating points are three points a, b and midpoint a plus b by 2 you are fitting a parabola and then you are integrating. So, that gives you Simpson's rule and then we are going to look at the error in all these formulae. Then from these we go to the composite rules. So, these will be the basic rules then we go to composite rules where each of these basic rule instead of applying them on the whole of interval a b we will apply them on the sub interval that and then the Gaussian rules. So, this thing we will continue next time. Thank you.