 Today, we are going to consider polynomial interpolation. It is one of the important topic in this course, because many of the later developments they are going to depend on this polynomial interpolation. For example, when we look at numerical integration, then we will be replacing function by interpolating polynomial and integrate the polynomial. Similar idea will be used for numerical differentiation, which in turn will be used for solution of differential equations. And also for root finding, when we have a non-linear function and we want to find it is 0, then we will be using polynomial approximation. So, our function f is defined on closed interval a, b. It takes real values. As such, it is not necessary that it should be continuous. Just defined on interval a, b will do, but let us assume f to be continuous. Suppose, you have got x 0, x 1, x n. These are the distinct points in interval a, b. Then, the problem is to find a polynomial p n of degree less than or equal to n, such that p n agrees with the given function f at these n plus 1 points. We are going to show existence and uniqueness of such a polynomial. So, first let us look at the case, when n is equal to 0. That means, we have got 1 point in the interval a, b and we want to find a constant polynomial. So, we have say function, suppose it is of this type. It has got a graph like this. This is interval a, b and this is point x 0. So, we want to find a constant function, such that p 0 at x 0 is equal to f x 0. So, it is immediate that such a polynomial is going to be p 0 x is equal to f x 0 for all x belonging to interval a, b. So, that means, we are looking at the value here and then we are just considering the constant function. Now, let us look at the case, when n is equal to 1. That means, you have got 2 points x 0 and x 1 in the interval a, b. So, here is our function and then you are looking at 2 points x 0 and x 1. What we want is a linear polynomial. That means, polynomial of degree less than or equal to 1. So, it is immediate that you just look at the values here and then join by straight line. So, that is going to be p 1 x. Now, let us look at a general case. Here, we will have n plus 1 distinct points and then we will be fitting a polynomial of degree less than or equal to n, which agrees with our function f at this n plus 1 points. So, for that we will construct what are known as Lagrange polynomials and in terms of the Lagrange polynomials we will be writing our function or polynomial p n. So, if you have got x 0, x 1, x n, these are our n plus 1 interpolation points. Look at Lagrange polynomial defined as l i x is equal to x minus x 0, x minus x i minus 1, x i minus x i minus 1, x i minus x i minus 1, x minus x i plus 1 and then x minus x n divided by x i minus x 0, x i minus x i minus 1, x i minus x i plus 1 and the last bracket will be x i minus x n. From the numerator, the only bracket which is missing is x minus x i. So, there are going to be n brackets and hence l i will be a polynomial of exact degree n. If I look at l i at x i, then it is going to be equal to 1 because you will have in the numerator x i minus x 0, x i minus x i minus 1, x i minus x i plus 1 and x i minus x n. So, it is same as the denominator. So, l i at x i will be 1, l i at x j will be 0 if j not equal to i because there will be bracket x minus x j appearing in the numerator. So, l i Lagrange polynomial it is of exact degree n, l i at x i is 1 and l i at x j is equal to 0 if j not equal to i. Now, using these Lagrange polynomials, we are going to write the interpolating polynomial interpolating given function at these n plus 1 points. Our interpolating polynomial, it is going to be summation f x i l i x, i goes from 0 to n. Even though l i is a polynomial of exact degree n, depending on our function f, the interpolating polynomial p n is going to be of degree less than or equal to n. That means it can happen that p n is a polynomial of degree strictly less than n, even though the Lagrange polynomials they are of exact degree n. So, here we have our l i x to be product j goes from 0 to n, j not equal to i, x minus x j divided by x i minus x j. And we have seen that l i at x i is 1, l i at x i is 1, l i at x j is equal to 0 if j not equal to i and i is 0, 1 up to n. So, there are n plus 1 Lagrange polynomials. Now, consider p n x which is equal to summation f x i l i x, i going from 0 to n. So, I am multiplying l i x by f x i, f is function which is defined on interval a b, taking real values and we assume it to be continuous. So, now p n at x j is going to be equal to f of x j, because when I put x is equal to x j, l i x j will be equal to 1 only when i and j they are the same values, all other values they will be 0. So, p n at x j is equal to f x j, j is equal to 0, 1 up to n. So, thus we have proved existence of n and n is equal to n interpolating polynomial. Now, I am saying existence of n interpolating polynomial, because we have not yet proved its uniqueness. So, now let us prove the uniqueness, for the uniqueness suppose you have got two polynomials p n and q n, both of degree less than or equal to n, then and they are interpolating. So, p n at x j will be equal to f x j, is equal to q n of x j. So, p n is a polynomial of degree less than or equal to n, q n is another polynomial of degree less than or equal to n, they will vanish at point p n minus q n, which also will be a polynomial of degree less than or equal to n, it will vanish at x 0, x 1, x n. So, polynomial of degree less than or equal to n, if it has got n plus 1 distinct 0's, then such a polynomial has to be a 0 polynomial. Let us recall the factorization theorem, which we had mentioned in the last lecture. So, suppose p n is a polynomial of degree n, then by the fundamental theorem of algebra, it has got at least one root. So, p n at z 1 is equal to 0 for some z 1 belonging to c. Now, we write p n x as x minus z 1 into q n minus 1 x, since p n is a polynomial of degree n, q n minus 1 will be a polynomial of degree n minus 1. Now, q n minus 1 will have a root, it can be either root z 1 or it can be some other root. So, continuing this process, we get p n x to be equal to x minus z 1 raise to m 1, x minus z k raise to m k multiplied by a constant, where m 1 plus m 2 plus m k is equal to n. So, we say that p n has exactly n roots counted according to their multiplicity, z 1 is counted to be a root of multiplicity m 1. From this factorization theorem, one can say that a polynomial of degree n has exactly n 0's, counted according to their multiplicities. So, a non-zero polynomial of degree less than or equal to n, it will have at most n distinct 0's. When I say that a polynomial of degree n, then it is automatically a non-zero polynomial. So, here a non-zero polynomial of degree less than or equal to n, it is going to have at the most n distinct 0's. As a consequence of this, if a polynomial of degree less than or equal to n has more than n 0's, then it is a 0 polynomial. So, it is this result that we are going to use to show uniqueness of the interpolating polynomial. So, suppose p n and q n are two polynomials of degree less than or equal to n, which interpolate given function f at this n plus 1 points. Thus p n at x j is equal to f of x j is equal to q n of x j, for j is equal to 0 1 up to n. Now, this implies that p n minus q n at x j is equal to 0 and p n minus q n is a polynomial of degree less than or equal to n. Hence, it has to be a 0 polynomial and thus p n x is equal to q n x. So, this proves uniqueness of the interpolating polynomial. So, now, once we have got n plus 1 distinct points, we choose the interpolation points, then there is going to be a unique interpolating polynomial p n, which agrees with our function f at this n plus 1 points. Now, this uniqueness, it tells us that, suppose f is a polynomial of degree m, where m is less than n. Then, if I am looking at interpolating polynomial of degree less than or equal to n interpolating at n plus 1 points, then this interpolating polynomial will be nothing but our function f, because for the interpolating polynomial we have got two criteria. It should be a polynomial of degree less than or equal to n, which is less than or equal to n, and it should agree with our function at n plus 1 points. If f is a polynomial of degree m, which is less than n, then it satisfies the first criteria that it is a polynomial of degree less than or equal to n, and it agrees with our function everywhere. So, in particular at n plus 1 point. So, if you have got f to be a polynomial of degree m, which is less than or equal to n, and x 0, x 1, x n, these are distinct points in interval a, b. So, let p n be equal to f. Then, p n at x is equal to f at x for all x in the interval a, b, and this implies that p n at x j is less than or equal to n, and this implies that f is equal to f of x j, j is equal to 0, 1 up to n, and degree of p n, which is equal to m, it is less than or equal to n. So, f itself is the interpolating polynomial. Now, this is the property we were talking about, that whether it reproduces polynomials, that means if your function itself is a polynomial of degree less than or equal to n, then its approximation from the space of polynomials of degree less than or equal to n should be the function itself, and we had seen that for the Bernstein polynomials, this property does not hold. Even for f x is equal to x square, our Bernstein polynomial is less than or equal to n, it was not equal to the polynomial itself. So, interpolation has got this desirable property, that it reproduces polynomials. Now, let us look at the expression for p n x. We have the Lagrange form, where explicitly we are writing p n x is equal to summation f x i, l i x, i going from 0 to n. So, it is a compact form, you have like you will be able to evaluate, suppose I want to evaluate p n x at some point, evaluate l i x at that particular point, then multiply by f x i add it up, that is going to give you value of your polynomial p n at that point. Only thing is this Lagrange form computationally it is not very efficient, because suppose I have got interpolating polynomial interpolating at x 0, x 1, x n. Now, I want to add one more point, suppose x n plus 1 is a distinct point from the x 0, x 1, x n. In that case whatever work I have done for calculating p n x, that it should be useful. Here what happens is we have to start again a new, that means the formula which we are writing, it is not a recursive formula. So, let me explain, suppose I have points x 0, x 1, x n, n plus 1 distinct points. I have Lagrange polynomial l i x product x minus x j divided by x i minus x j, j going from 0 to n. And our p n x is summation f x i l i x i going from 0 to n. Now, I look at n plus 2 distinct points. In this new set of distinct points, these are already they were there here. And then I am just adding one extra point, but then if I want to write it in this form, then I will have to look at the Lagrange polynomial corresponding to this n plus 2 points. So, it will be l i tilde x to be product j going from 0 to n plus 1, x minus x minus x j here j not equal to i, j not equal to i x i minus x j. And then p n plus 1 x will be equal to summation i goes from 0 to n plus 1, f x i l i tilde x. So, it is a totally different formula. It is not that I have got p n x. So, it is a polynomial of degree n. Now, p n plus 1 will be a polynomial of degree n plus 1 or less than or equal to n plus 1. So, I do not add just one more term. I have to do all the work again. So, it is not a recursive formula. So, that is why what we are going to do is, we are going to define divided difference and then using the divided difference the interpolating polynomial will be written in what is known as Newton form. See, our interpolating polynomial it is unique. So, Lagrange form or Newton form the polynomial will be same. It is just we will be writing it in a different basis or we are writing it differently. So, now let me define the divided difference. We know that p n is the unique interpolating polynomial interpolating given function at x 0, x 1. This is a polynomial of degree less than or equal to n. So, write it in power form. That means, write it as p n x is equal to a 0 plus a 1 x plus a 2 x square plus a n x raise to n. Now, whatever is the coefficient of x raise to n in p n x that is going to be our divided difference based on x 0, x 1, x n. So, here we have got p n is a polynomial of degree less than or equal to n. So, p n x will be of the form a 0 plus a 1 x plus a n x raise to n. Since, it is a polynomial of degree less than or equal to n, this a n it can be 0. So, coefficient of x raise to n which is equal to a n that is our divided difference based on x 0, x 1 up to x n. p n was unique interpolating polynomial such that p n at x j is equal to f of x j, j is equal to 0 1 up to n. Now, if you look at this definition of divided difference, what matters is the set of interpolating points x 0, x 1 up to x n. The order of x 0, x 1, x n that is not important. Collectively, we have to look at the interpolating polynomial whatever is coefficient of x raise to n that is our f of x 0, x 1, x n. If our function f is a polynomial of degree m which is less than n, then we have seen that f is equal to p n and then the divided difference it will be 0 for this function which is a polynomial of degree m. So, if you have got f to be a polynomial of degree m less than n, we have got x n. These are the n plus 1 interpolation points, then we have seen that this implies that p n is equal to f. Now, f is a polynomial of degree m. So, it will be a 0 plus a 1 x plus a m x raise to n. So, it will be m and then m is less than n. So, it will be plus 0 into x raise to m plus 1 plus 0 into x raise to n and by definition f of x 0, x 1, x n, this is going to be coefficient of x raise to n. So, this is going to be 0. So, for the divided difference we have these two important properties that it is independent of the order of points x 0, x 1, x n, x n, x n and it is if your function f is a polynomial of degree m and you are looking at n plus 1 distinct points, where n is bigger than m, then the divided difference is going to be 0. Divided difference is independent of the order of x 0, x 1, x n and if f is a polynomial of degree m, which is less than n, then the divided difference is equal to 0. Now, next we want to look at the recurrence relation that suppose I have got divided difference based on say x 0, x 1, x n, then whether the divided difference is equal to 0, then divided difference based on n plus 2 points can be expressed as a divided difference based on n plus 1 points that is the recurrence relation or let me write. So, the recurrence relation for divided difference is f of x 0, x 1, x n, this is going to be equal to f of x 1, x 2 up to x n minus f of x 0, x n minus 1 divided by x n minus x 0, here are n plus 1 points. So, this is divided difference of f based on n plus 1 points. This we are expressing as divided difference based on n points, here you have got x 1, x 2, x n, here you have got x 0, x 1, x n minus 1 and then divided by x n minus x 0. When you consider divided difference based on 1 point f x 0, this is going to be equal to f of x 0, because what we have to do is, we have to look at p 0 x, p 0 x is going to be f x 0 and then the coefficient the constant term is equal to f x 0. So, f of x 0 is equal to f x 0, f of x 0, x 1, this is going to be equal to f of x 1 minus f of x 0 divided by x 1 minus x 0. So, once we prove this recurrence relation, then you will have f of x 0, x 1 to be f x 1 minus f x 0 divided by x 1 minus x 0. So, perhaps you are familiar with this formula that f of x 0, x 1 is equal to f x 1 minus f x 0 divided by x 1 minus x 0 and then one defines recursively. Now, here independence of the, that the divided difference is independent of order, it can be seen easily for the divided difference based on x 0 and x 1, but for the higher orders it is not very evident. So, there are advantages of defining the divided difference the way we have done, that it is the coefficient of x raise to n in the unique interpolating polynomial, but if that is our definition, then we have to prove the recurrence relation. Once we prove the recurrence relation, then we can write down the divided difference table and then we can see how suppose I have already found the interpolating polynomial p n and if I want to add one more interpolating point, then what I have to do is to this p n I have to just add one more point and this recurrence relation will be also useful in finding the error between the function and the interpolating point. So, let us first show the recurrence relation. So, we have got say points x 0, x 1 up to x n minus 1 and x n. So, here look at a polynomial q n minus 1. Now, this is the function which interpolates your given function at these points. So, q n minus 1 x j will be equal to f of x j for j is equal to 0, 1 up to n minus 1. This is polynomial of degree less than or equal to n minus 1. I look at the set of points x 1, x 2 up to x n. So, again there are n points. So, let p n minus 1 be interpolating polynomial such that p n minus 1 x j is equal to f of x j for j is equal to 1, 2 up to n. So, I have got a polynomial which interpolates function at x 0, x 1, x n minus 1, another polynomial which interpolates the given function at x 1, x 2, x n. What I am interested in is finding a polynomial which interpolates the given function at x 0, x 1, x n. So, using these two polynomials, I am going to construct such a polynomial. So, let us look at or let us define p n x to be equal to this q n minus 1 at x n is not equal to f x n. So, let me write the coefficient of q n minus 1 as x n minus x and the polynomial p n minus 1 does not in x 0, x n minus 1 interpolates the given function at x 0. So, it will be I write this as x minus x 0 p n minus 1 x and then I divide by x n minus x 0. So, when I look at p n at x 0, there will be no contribution from here x n minus x 0 will get cancelled with this x n minus x 0 and we will have p n at x 0 to be equal to q n minus 1 at x 0 which is equal to f x 0. Similarly, when I look at p n at x n, there will be no contribution from here x n minus x 0 will get cancelled. So, I am left with p n minus 1 x n and p n minus 1 x n is f x n. This p n q n minus 1 is a polynomial of degree less than or equal to n minus 1. I am multiplying by x n minus x. So, this term will be a polynomial of degree less than or equal to n. This is a polynomial of degree less than or equal to n minus 1 multiplying by x minus x 0. So, this also will be a polynomial of degree less than or equal to n. So, thus our p n will be a polynomial of degree less than or equal to n, which interpolates the given function at x 0 and x n. Now, it will also interpolate at remaining points. So, let us see that part. So, we have p n at x j will be x n minus x j at q n minus 1 x j at q n minus 1 x j plus x j minus x 0 p n minus 1 x j and divided by x n minus x 0 1 less than or equal to j less than or equal to n minus 1. So, these are the common interpolating points for q n minus 1 and p n minus 1. So, q n minus 1 x j will be f x j p n minus 1 x j also will be f x j and hence we will have x n minus x j into f x j plus x j minus x 0 f x j divided by f x j plus x j minus x 0 f x j divided by x n minus x 0. Now, x n minus x j plus x j minus x 0. So, that will give us x n minus x 0 that gets cancelled and you are left with f of x j. So, thus we have constructed a polynomial p n x. We had a polynomial q n minus 1 which interpolated given function at x 0 x 1 x n minus 1. We had another polynomial p n minus 1 which interpolated given function at x 1 x 2 x n using these we constructed a new polynomial p n which interpolated the given function at x 0 x 1 up to x n. The reason we did this was we want to consider or we want to prove a recurrence relation for the divided difference and the divided difference is the coefficient of x raise to n in the interpolating polynomial. So, thus here we have we have constructed p n x and now p n minus 1 x j is equal to f x j q n minus 1 x j is equal to f x j. So, using that you get p n x j is equal to f x j for j is equal to 0 1 up to n p n interpolates f at x 0 x 1 x n. So, the coefficient of x raise to n in p n x that is going to be our divided difference based on x 0 x 1 x n. When you look at this expression the coefficient of x raise to n in p n x will be q n minus 1 is a polynomial of degree less than or equal to n. So, you multiply by x. So, it will be coefficient of x raise to n minus 1 in q n minus 1 x and then there will be a contribution from here also. So, minus coefficient of x raise to n minus 1 in p n minus 1 x divided by x n minus x 0. This is the coefficient divided difference based on x 0 x 1 x n. This coefficient will be divided difference based on x 1 x 2 x n and this coefficient will be divided difference based on x 0 x 1 x n minus 1. So, thus we have got this recurrence relation that f of x 0 x 1 x n will be equal to f of x 1 x 2 x n minus f of x 0 x n minus 1 divided by x n minus x 0. Here x n was extra here x 0 was extra and we divide by x n minus x 0. Now, we have got this recurrence relation for the divided difference. So, for the 0 th one one defines f x 0 is equal to f x 0. Then f of x 0 x 1 will be nothing but f x 1 minus f x 0 divided by x 1 minus x 0 and then so on. Now, what we want to do is whether we can write the divided difference in terms of the function values. Our divided difference f it is important that it depends on your function f and it depends on the interpolation points x 0 x 1 x n and that is it. So, whether I can write a formula for f of x 0 x 1 x n in terms of the function value. So, that is possible. What we are going to do is we will look at the interpolating polynomial in terms of the Lagrange form. When we proved existence of interpolating polynomial then we said that look at this formula this is the interpolating polynomial it is p n x is equal to summation f x i a like. Now, in this we will look at the coefficient of x raise to n whatever will be the coefficient of x raise to n that is going to be the divided difference f of x 0 x 1 x n. So, we have p n x is equal to summation f x i l i x i going from 0 to n l i x is product j going from 0 to n x minus x j divided by x i minus x j j not equal to i. So, this is our l i x. Now, in l i x coefficient of x raise to n that is going to be equal to 1 upon product of this denominator. So, it will be 1 upon product j going from 0 to n x minus x j j not equal to i. When we consider x minus x 0 x minus x j minus 1 and then x j minus x minus x n divided by this x i minus x 0 up to x i minus x n except the term that j not equal to i it is one term is missing. So, when I look at coefficient of. So, we have got n brackets we are looking at coefficient of x raise to n. So, in order to get x raise to n from each bracket we have to choose x. So, that is why coefficient of x raise to n is going to be this much and then this is coefficient of x raise to n in l i x coefficient of x raise to n in p n x will be multiply this coefficient by f x i and then add it up. So, that is what will give us the value for the divided difference based on x 0 x 1 x n. So, now, we will write this coefficient of x raise to n in l i x in a more compact form and then we will write the expression for f of x 0 x 1 x n in terms of the function value. So, for that purpose we define this new function w x it is x minus x 0 x minus x 1 x minus x n it contains all the brackets here the bracket x minus x i is missing here we take all the brackets then you take the derivative. So, use the product rule and then you will have the derivative this w dash at x i when you evaluate then it is going to be product j goes from 0 to n x i minus x j j not equal to i there are going to be various terms only one term will not have the factor x minus x i. So, w dash at x i is this product and then coefficient of x raise to n in l i x that was precisely this. So, this is going to be 1 upon w dash x i this is coefficient of x raise to n in l i x we are interested in coefficient of x raise to n in p n x. So, we will multiply by f x i and add it up. So, p n x is this. So, coefficient of x raise to n in p n x will be summation i goes from 0 to n f x i upon w dash x i. So, this is nothing, but the divided difference summation i goes from 0 to n f x i upon w dash x i. So, we have proved certain properties of the divided difference the first property was it is independent of the order of points x 0 x 1 x n as I said it depends, but it does not depend on the order. If your function is a polynomial of degree m and you are taking divided difference based on n plus 1 points where n is strictly bigger than m then the divided difference is going to be 0. Then we proved a important relation and that is the recurrence relation for the divided difference and now the fourth property is that expression for the divided difference in terms of the function values. Now, there are some more important properties of the divided difference they are going to be linearity that means if I look at function alpha f plus g its divided difference will be alpha times alpha times alpha times divided difference of f plus divided difference of g. So, that will be linearity property then there is going to be continuity that this f the divided difference it is going to be continuous function of its variable. Then we will show that this divided difference f of x 0 x 1 x n it is going to be equal to nth derivative evaluated at some point c divided by n factorial. In order to define the divided difference we do not even need function to be continuous just the function should be defined on interval a b, but suppose your function happens to be n times differentiable then the divided difference based on n plus 1 points that is going to be equal to f n c divided by n factorial and this result is generalization of mean value theorem. We know that f x 1 minus f x 0 divided by x 1 minus x 0 is equal to f dash of c and this is the divided difference based on x 0 x 1. So, in next lecture we will prove some of these properties we will look at the error and then we will see how the divided difference allows us to build polynomials. So, thank you.