 Hi, we are learning polynomial interpolation of a given data set. In this we have learnt that for a given data set we can always find a polynomial interpolation and such a polynomial interpolation will always be unique for a given data set. This is what we have learnt so far. In this class we will learn two ways to construct such a polynomial interpolation for a given data. One is the Lagrange interpolation and another one is the Newton's interpolation. Let us quickly recall what is an interpolating polynomial for a given data. We are given a data set it means we are given a set of nodes and the corresponding set of values at these nodes. These values may be coming from a function or these values may be generated through some source like experiments right. Now, the question is can we find a polynomial say P n of x such that P n of x i is equal to y i. So, that is what is called the polynomial interpolation more precisely a polynomial P n of x is said to be an interpolating polynomial for the given set of data that is more important. If its degree is less than or equal to n remember from where we are catching this n it is coming from the number of nodes that are given in our data. If you are given n plus 1 nodes starting from the index 0 and goes till n then the degree of the polynomial should be n that is what we have to remember. So, the polynomial P n of x should be of degree less than or equal to n and it also satisfies the interpolation conditions given by this ok. So, if these two conditions are satisfied by a polynomial then that polynomial will be called as the interpolating polynomial for this set of data that is what we have seen in the last class. We have seen that for a given data set there always exist an interpolating polynomial and not only that such an interpolating polynomial is also unique for a given data set that is what we have proved in the last class, but we never constructed such a polynomial in our last class. We only proved the existence by formulating a Wanderman system and showing that the Wanderman matrix is invertible right. Today, we will give two different formulas to construct this polynomials remember although we give two different formulas finally, those two formulas will lead to the same interpolating polynomial for a given set of data why because we have proved that such an interpolating polynomial is unique. It is only that the methods or the form in which we construct the polynomial is different, but they both will lead to same polynomial. Let us start with the first method called Lagrange form of interpolating polynomial well we are given a data set like this. The Lagrange form of interpolating polynomial is given by this formula you can observe that this is the linear combination of some polynomials. How this polynomials are given these are given by L k of x and its expression is given like this, this is nothing but the product. So, product of these terms where you have i here i runs from 0 to n, but it excludes i equal to k that k is sitting here. And this is called the kth Lagrange polynomial note the difference between Lagrange form of interpolating polynomial that is given by this expression and the Lagrange polynomial means this polynomial. You can see that it is a polynomial of degree n why because in this product we have n plus 1 terms, but we are excluding one term here which is nothing but the kth term and that is called the kth Lagrange polynomial. Therefore, the product runs with n plus 1 index, but in between 1 index is removed. So, it has n terms in the product and each term contributes to x therefore, its degree is n and this polynomial is the linear combination of nth degree polynomials. There are n plus 1 such polynomials therefore, this is a polynomial of degree less than or equal to n. Now, we have to prove that it also satisfies the interpolating condition. Once you do that then the uniqueness says that your polynomial interpolation is nothing but this form. Let us try to prove this again I will tell you what we have to prove. Lagrange suggests that the interpolating polynomial will look like this where all this L k's are the Lagrange polynomials. Remember the space of all polynomials of degree less than or equal to n forms a vector space right and we are trying to get our interpolating polynomial as a member from this vector space and you can also show that the Lagrange polynomials form a basis for this space. And therefore, our polynomial P n of x in fact, can be written as the linear combination of this basis elements that is the overall idea behind this. So, as a proof what we will do is first we will show that this expression is nothing but a polynomial of degree less than or equal to n that is not very difficult to show. And next is that we have to show that this q of x which is now a polynomial of degree less than or equal to n satisfies all the interpolation conditions. There by q of x will also be an interpolating polynomial to the given data set. Already we have P n of x as our interpolation polynomial we do not know how it looks like, but that is our assumption that we always have this polynomial for a given set of data. Now we constructed another polynomial like this thanks to Lagrange. Now the uniqueness says that these two should be equal right that is how we will prove this theorem. As the first step we have to prove that q of x is a polynomial of degree less than or equal to n and that I have already told you how to show that you take each Lagrange polynomial you can see that each Lagrange polynomial is actually a polynomial of degree n right. So, that is not very difficult for us to observe from here you can easily observe. And then q is written as a linear combination of all this polynomials of degree n therefore, q itself is a polynomial of degree less than or equal to n. So, that proves the first property of an interpolating polynomial. Let us now try to prove the second property that is q satisfies all the interpolation conditions. How to do that? Again take this Lagrange polynomial L k of x equal to this this is the kth Lagrange polynomial. Let us closely look at this polynomial and try to understand how it looks like. Well I am just writing this expression by just putting this product explicitly instead of using this notation that is all I am doing I am not doing anything. Therefore, you can see that I runs from 0 to n therefore, when I is equal to 0 you have x minus x naught that is coming from here divided by x k minus x naught that is coming from the denominator right into when I equal to 1 the numerator is x minus x 1 and the denominator is x k minus x 1 like that it goes till x k minus x 1. Then you see that we are just excluding the term I is equal to k right we do not want to include that term into our product. Therefore, there is supposed to be one more term x minus x k and similarly here x k minus x k and that is actually removed in a way that is our product in this definition right. Of course, that is quite nice that we have to remove it because otherwise this term would have become 0 it would have made the entire term to be not defined at all right. Therefore, that kth term is actually removed from this product and then it jumps from k minus 1 to k plus 1 and then it goes just like how it went here it goes till x minus x n to x k minus x n. So, this is how the kth Lagrange polynomial looks like. Now, let us take x is equal to x k can you see what happens it means you are putting x is equal to x k here that will get cancelled with this term right. Again here x is equal to x k if you put this term also get cancelled similarly all the terms will get cancelled right and you will get this term equal to 1. It means l k of x k is equal to 1 this is what we are seeing similarly what happens is equal to 1 this is what we are seeing. Similarly, what happens if we take x is equal to some x j for j not equal to k just see what happens if you take x is equal to x j for j not equal to k then see you already excluded k from this term. Therefore, x is equal to 1 therefore, this j will be one of these terms it this jth term will be sitting in this product at some stage right and that will make x j minus x j in the numerator and that will make the entire thing to become 0 right. So, therefore, you can see that l k of x j is equal to 0 when j is not equal to k. So, that is what I am writing here l k of x j equal to 1 if j is equal to k and 0 if j is not equal to k. Now, come back to our polynomial that Lagrange suggested as well this can be written as y not l k of x j is equal to 1. So, l not of x right plus y 1 l 1 of x plus y 2 l 2 of x plus dash dash dash up to y n l n of x right. Now, let us take x is equal to say x 1 what happens here. Then on the left hand side you have q of x 1 and that is equal to l not of x 1. If you see when k is not equal to j then l k of x j is 0 right. Therefore, this term will become 0 and l 1 x 1 will come again when k is equal to j l k of x j is 1. Therefore, this will give us the value 1 and all other will give us the value 0 right and therefore, you will be left out with y 1 right. So, that shows that q of x 1 is equal to y 1 this is just an example I have taken. You can similarly show that q of x not equal to y not and so on. In general you can show that q of x j is equal to y j for each j equal to 0 to n. This is precisely the interpolation condition right. Therefore, you can see that q is a polynomial of degree less than or equal to n and also it satisfies the interpolation conditions. That shows that q of x is an interpolating polynomial. We have p n of x as the interpolating polynomial on one hand. Now, Lagrange suggested a formula and we called it as q of x and we have shown that that formula is also giving an interpolating polynomial. Now, by uniqueness that formula that we got should be equal to p n of x which is the interpolating polynomial. Now, from this theorem what we get is a nice formula to get an interpolating polynomial for the given data set right and it is of course, unique. Therefore, that is the interpolating polynomial for the given data set that is what we understand. Let us take an example. Let us take this nice function if you recall we have taken an example in the last class where interpolating polynomial was not successful in giving a good approximation right. Now, we are taking a nice function f of x equal to e power x. Let us see how the interpolating polynomial works. Now, I can construct and show you because we know one formula to construct the interpolating polynomial. Therefore, we will go to construct the polynomial explicitly to keep our construction very simple I will take only two nodes if I take two nodes I will have to construct the polynomial that is the interpolating polynomial of degree 1 that is linear polynomial right and my aim is to find the value of the exponential function at the point 0.826 which is something in between these two points right. So, I want to find the value of the exponential function at 0.826. The idea is to first construct the linear interpolating polynomial and then construct the linear interpolating polynomial and then find the value of that linear interpolating polynomial at the point 0.826 and just take that as the approximation to the corresponding exponential value that is the idea. Let us now use the Lagrange form of the interpolating polynomial to get the expression for p 1 of x. For that what we have to do is we have to first find the zeroth Lagrange polynomial and then first Lagrange polynomial and then write this linear combination where f of x naught is this and f of x 1 is this value right. So, let us write this what is l naught of x well l naught of x should be x minus x 1 divided by x naught minus x 1. You just see the general formula of l k of x and try to understand why in this case l naught of x is given like this. Similarly, l 1 of x is given like this. Once you get l naught and l 1 you simply write the linear interpolating polynomial as f of x naught l naught of x plus f of x 1 l 1 of x right. So, that is very simple. So, this is the Lagrange form of interpolating polynomial I just simplified it in general you do not need to simplify you can just leave it like this, but I have just simplified it and this is precisely the linear polynomial interpolating the given data set. Now, we are interested in finding e to the power of 0.86 that is what the problem that we post for our self. Now, we will use the interpolating polynomial to get the value and this is a nice story a successful story you can see the relative error in p 1 of x which is the approximate value when compared to the exact value. The relative error is pretty small even for the linear polynomial you see that is the good news for us of course, the function is very good and also the nodes are very close to each other you can see that the nodes are very close to each other that is one good thing and second thing is this function is a very nice function you can see that it is a real analytic function therefore, often it goes well with such approximations that is the idea. Just to have a feeling let us go and insert one more point into our data set previously you had this and this. Now, we are having this x 1 as this and x 2 as this. Now, we have this data set and thereby we will have a quadratic polynomial as our interpolating polynomial for this data set remember this will be different from the previous one because the data set itself is different now. Now, you can construct the quadratic polynomial how will you do that you first have to find l naught of x now it will be x minus x 1 see x naught term you have to leave therefore, x minus x 1 will be there x minus x 2 will be there divided by x naught minus x 1 into x naught minus x 2. Similarly, l 1 of x will have all the terms removing x minus x 1 term that is x minus x naught into x minus x 2 divided by x 1 minus x naught into x 1 minus x naught into x 1 minus x 2. Similarly, l 2 of x is equal to x minus x naught into x minus x 1 divided by x 2 minus x naught into x 2 minus x 1. Once you have this then p 2 of x is nothing, but f of x naught that is this one into l naught of x plus f of x 1 into l 1 plus f of x 2 into l 2 of x. Once you have p 2 of x 1 plus f of x 1 plus f of x 2 into x 1 plus x you plug in x equal to 0.26 and that will give you this value you can see that the relative error is much much smaller than what we have obtained from the linear interpolating polynomial. So, this is a successful story for us in applying the interpolating polynomial to approximate a function at some given nodes. So, this is the discussion about the Lagrange form of interpolating polynomial. Let us now pause on to Newton's form of interpolating polynomial and see how Newton proposes a formula for the interpolating polynomial. Remember whether you apply Lagrange's formula or Newton's formula when you finally simplify that polynomial both these formulas will lead to the same polynomial that is what the uniqueness says. Now, given Lagrange polynomial why are we actually worried about another formula that is the question. If you see Lagrange form of interpolating polynomial is given like this. This is simply the linear combination of the basis element of the space of all polynomials of degree less than equal to n. In that way Lagrange form is very nice especially to use it in doing any theoretical study. On the other hand Lagrange form of interpolating polynomial is not that preferred for computational purpose mainly for one reason that is often we come across a situation where we considered a data set and constructed a polynomial p n of x and then saw that the approximation that we get out of p n of x is not enough for our problem. So, we wanted to have a better approximation therefore, we will include more data into our data set and try to get a higher degree interpolating polynomial. Such situations occur quite often in applications. In such case you see even if you put one point into your data set all the Lagrange polynomials have to be constructed right from the scratch ok. You cannot make use of your effort in computing p n of x in order to compute p n plus 1 of x. All this computational efforts have to be trashed and p n plus 1 of x have to be constructed right from the scratch because all the Lagrange polynomials have to be reconstructed even if you put one node point more into your data set. That is a big disadvantage of writing the interpolating polynomial in the form of the Lagrange. Now that is where Newton's form is quite handy because in the Newton's form what we can do is we can write p n of x equal to p n of x remember this is when you already computed p n of x therefore, this is already known to you plus you will simply put some more extra terms to get the higher degree polynomial p n plus 1 of x. In that way most of your effort is now saved from your previous computation and you have to put new effort only to obtain this extra term. Now the Newton's form of interpolating polynomial is to just see what is this extra term. Well we propose this extra term in this form and the question is why should I put this form? Well you can see that if you propose this form for the extra term then if you put x equal to x naught then this term went to 0 because of this term and then you will be left out with p n of x naught and you know that p n is already an interpolating polynomial for these data and therefore, this p n of x naught will give you y naught and in that way the interpolation condition for p n plus 1 at x naught is readily achieved through p n. Similarly, you can achieve the interpolating condition for x 1, x 2 up to x n if your extra term is like this. Now the only problem is you have to make sure that p n plus 1 of x satisfies the lost interpolation condition that is p n plus 1 of x n plus 1 is equal to y n plus 1. This is the only remaining interpolation condition that we have to ensure, but for that we are including a free variable shear you see that is why we have inserted a free variable C here. Now what you can do is you put x equal to x n plus 1 in this expression remember that may not give any known value to this it will come as its own value when you put p n of x n plus 1 it will not give y n plus 1 because p n is not going to interpolate the node point x n plus 1 it will only interpolate the points x naught to x n only therefore, this will be some value, but then you can choose your C such that p n plus 1 of x n plus 1 is equal to y n plus 1. How will you do that? Well you have to choose your C such that the lost interpolation condition is satisfied that is not very difficult what you will do is you will put instead of p n plus 1 you will put y n plus 1 then you bring this to the other side and all this can then be brought to the other side to get your value for or expression for the unknown C. So, in that way you also obtained the interpolation condition for the lost node. So, that gives us the Newton's form of interpolating polynomial the advantage is that in case if you go to add one more point to an existing data for which you have already computed the interpolating polynomial then Newton's form will help us to just do an extra computation and keep the previously computed interpolating polynomial and to get the higher degree polynomial that is the advantage in the Newton's form. Computationally in this sense Newton's form is little efficient then Lagrange form the Newton's form of interpolating polynomial will look like this where all this a i's are constants that has to be obtained using the interpolation conditions. Let us see how this constants a i are looking like well the Newton's form is proposed in this form now if you put x equal to x naught you can see that all this terms will vanish because all this terms involve x minus x naught right. So, therefore, all this terms will become 0 and you will be left out with a naught and you put x naught and that you force it to be f of x naught or y naught and that is how you will get the value of a naught. So, you can see that a naught depends on the function f and its value at x naught similarly to get a 1 you put x equal to x naught x 1. So, all these terms will go to 0 because all these terms involve x minus x 1 other than these two terms you already know that this is f of x naught right from here you can get a 1 as f of x 1 minus p naught of x 1 see p naught of x 1 is nothing, but f of x naught that is nothing, but a naught that is how it is coming. Therefore, a naught depends only on f of x naught and a 1 depends on f of x 1 and it also depends on the lower degree polynomial. So, this will go on with all the other coefficients a i's a 2 will look like this which will depend on the lower degree polynomial and in general a n is given like this this is what precisely we called as c in our previous slide where a n depends on the immediate lower degree polynomial right. So, this is how the coefficients of the Newton's form of interpolating polynomial is obtained. Therefore, to compute Newton's form of the interpolating polynomial p n for a given data set it is enough for us to compute the coefficients a naught a 1 up to a n right where each coefficients expression is given like this. You can observe that it depends on the immediate lower degree polynomial this is actually again not computationally efficient because in order to compute all this coefficient you have to remember all the lower degree polynomials again that will lead to computationally very expensive algorithm that is again a bad news from the way we have posed the Newton's form of interpolating polynomial. Again I will tell you we need to know all the successive interpolating polynomials in order to construct the coefficients of the Newton's form of the interpolating polynomials. Also we need to evaluate this polynomial remember evaluating polynomial is not that easy it is a very expensive computational cost is involved in that and therefore finally, if you just see the total cost involved in the Newton's form in the way we have posted is no way going to be better than the Lagrange form. Now that seems to be little depressing because we have put effort to construct another form of interpolating polynomial exactly putting what is needed for us and made our polynomial in that way, but still we see that the coefficients involve the lower degree polynomials and that again increased our computational cost right. So, now the question is can we somehow rewrite these coefficients in such a way that we can reduce the computational cost that is the question the answer is s. So, there is another interesting concept called Newton's divided differences. We can see that these a k's are precisely the Newton's divided differences and we can derive a formula for all these divided differences that is all these a k's which does not involve the evaluation of the polynomials of lower degrees that is the good part of the Newton's form. We will discuss the Newton's divided difference formulas in the next class. Thank you for your attention.