 Today, we are going to consider approximation by polynomials of a continuous function. If the function is sufficiently differentiable, then we can look at the Taylor series expansion and truncate the Taylor series and obtain an approximating polynomial. For Taylor series expansion, we need function to be differentiable and we will need to know the value of the derivatives. So, we will look at Bunstein approximation using for a continuous function using Bunstein polynomials and we will see what are the advantages and disadvantages of this approximation. Then we will consider best approximation and lastly we will look at polynomial interpolation for a given function f which is continuous on a closed and bounded interval a b. So, our setting is going to be c a b which is vector space of real valued continuous functions defined on interval a b and the infinity norm or the maximum norm of a continuous function is maximum of modulus of f x when x varies over interval a b. A polynomial p n x in the power form it is written as a 0 plus a 1 x plus a n x raise to n where a 0 a 1 a n these are real numbers. So, we are going to look at real valued functions and our polynomials are going to be real polynomials. So, the coefficients a 0 a 1 a n they belong to R and x varies over R. If coefficient of x raise to n a n is not equal to 0 then that will be a polynomial of exact degree n and if n is equal to 0 then the degree of the polynomial is going to be strictly less than n. The derivative of p n is given by a 1 plus 2 a 2 x plus n a n x raise to n minus 1. So, thus to store the information about p n we need to store the coefficients a 0 a 1 a n in computer. For the derivative the coefficients a 1 a 2 a n they come into picture and if you look at indefinite integral then it is given by a 0 x plus a 1 x square by 2 plus a n x raise to n plus 1 by n plus 1 plus there will be constant of integration. So, once again what we need is only the coefficients and the derivative of a polynomial is a polynomial of 1 degree less and indefinite integral is again a polynomial with 1 degree higher. So, now the first thing we are going to look at is Taylor series expansion. We had already looked at the Taylor's theorem. So, our function f will be defined on closed interval a b and we assume that the first n derivatives and function f they are continuous on closed interval a b. We assume that nth derivative is differentiable on open interval a b that means our function n plus first derivative exists on open interval a b. Under these conditions what we get is f of x is given by f of c plus f dash c into x minus c plus f n c upon n factorial x minus c raise to n plus this is the remainder term the expression in blue that is a polynomial. Our point c is fixed x is very small. So, we are considering over interval a b and the remainder that is a function of x. The disadvantage of this polynomial approximation is it is going to be a good approximation in neighborhood of c. What we are interested in is approximation of our function by a polynomial on whole of the interval a b. So, this is not ideal approximation of our function f and another thing is that we need to know the derivative values. Now, many times in practice what is known is value of the function, but wanting to know the derivative values that is not possible for all functions but then we have got the well known Weierstrass theorem. So, this Weierstrass theorem tells us that if you have a continuous function defined on closed interval a b then there exists a sequence of polynomials p n which approximates your f in the infinity norm that means you have got a sequence of polynomials p n converging to f uniformly. Now, in numerical analysis just the statement of the type there exists is not of much use. What we should be able to do is construct it like given a function f whether we can construct the polynomial sequence of polynomials p n which converges to f uniformly. Now, fortunately it is possible to write down the explicit expression for p n which approximates the given function f and what we need for writing this is value of the function not the derivative the derivatives they do not come into picture. In fact, our function f may not be differentiable function is continuous on closed interval a b then there exists a sequence of polynomials p n converging to f in the uniform norm. So, here is the Weierstrass theorem f is a real valued function which is continuous then there exists a sequence of polynomials p n x such that norm of f minus p n infinity this is tending to 0 as n tends to infinity. So, in contrast to the Taylor's theorem where we had approximation in the neighborhood of c. So, here you have approximation over whole of interval a b. Now, this sequence p n. So, there are various proofs of this theorem, but we also have a constructive proof and in the constructive proof the polynomials p n they are given by Bernstein polynomials. So, for the sake of simplicity we will take interval a b to be interval 0 to 1 afterwards by a fine change of variable one can take care of the case when the function f is defined on interval a b. So, our function f is defined on interval 0 1 it takes real values and it is continuous. So, Bernstein polynomial it is given by I denote it by b n f at x to be summation k going from 0 to n n factorial divided by k factorial n minus k factorial n minus k factorial factorial value of our function f at point k by n x raise to k 1 minus x raise to n minus k. So, this is going to be a polynomial in x these are some real numbers f of k by n that is going to be fixed and what we have is x raise to k 1 minus x raise to n minus k. So, it will be a polynomial of degree less than or equal to n whether it is of degree n or not that will depend on our function f. Now, this is going to be our p n x and norm of f minus p n infinity norm will tend to 0 as n tends to infinity. We are going to calculate the Bernstein polynomial for three special functions and those functions are f x is constant function 1 f x is equal to x and f x is equal to x square. For these three functions we will show that norm of f minus b n f it is infinity norm tends to 0 and n tends to infinity. Then this map which associates your function f to this Bernstein polynomial we will see that it is a linear map and it is positive. That means, if f is bigger than or equal to 0 implies our polynomial also is going to be bigger than or equal to 0 and then we will appeal to what is known as Karoukin theorem. So, let us first calculate the Bernstein polynomials for special functions 1 x x square and show convergence for these three special functions. So, we have b n f at x to be summation k going from 0 to n n factorial by k factorial n minus k factorial f of k by n x raise to k 1 minus x raise to n minus k. If our function f is constant function f x is equal to 1 then b n f at x will be summation k going from 0 to n n c k that is n factorial upon k factorial n minus k factorial x raise to k 1 minus x raise to n minus k which is nothing but binomial series expansion of x plus 1 minus x whole thing raise to n. So, this is going to be equal to 1. So, when f x is equal to 1 b n f x also is equal to 1 for n bigger than or equal to 0 and hence norm of f minus b n f it is infinity norm is going to be 0. So, we have got convergence next let us look at function f x is equal to x. So, when you consider f x is equal to x then f of k by n is going to be k by n and hence you will get b n f at x to be summation k going from 0 to n n factorial by k factorial n minus k factorial now f of k by n is k by n x raise to k 1 minus x raise to n minus k. Because of the presence of this k the term k is equal to 0 will not contribute and hence I can write this as summation k going from 1 to n n factorial and you have got n here so 1 n will get cancelled and you are left with n minus 1 factorial k and k factorial. So, that will give us k minus 1 factorial n minus k factorial x raise to k 1 minus x raise to n minus k. Now, what we are going to do is we are going to take 1 x common then you have here summation k goes from 1 to n. So, let me substitute l is equal to k minus 1 when k varies from 1 to n l will vary from 0 to n minus 1 n minus 1 factorial divided by k minus 1 is l. So, it will be l factorial then n minus k factorial so that will be n minus 1 minus l factorial l is k minus 1. So, it is same I have taken 1 x out. So, what I am left with is x raise to k minus 1 so that will be x raise to l and then 1 minus x raise to n minus 1 minus l. So, this is equal to x raise to n minus 1 and now you have summation l goes from 0 to n minus 1 n minus 1 c l x raise to l 1 minus x raise to n minus 1 minus l. So, this is going to be x plus 1 minus x raise to n minus 1 the binomial series expansion. So, it is going to be equal to x this will be for n minus n bigger than or equal to 1 and when I look at b 0 f at x when you have got n is equal to 0 then that is going to be 0. So, for n bigger than or equal to 1 the approximating polynomial b n f x is equal to x. So, once again norm of b n f minus f it is infinity norm will be 0 for n bigger than or equal to 1. What we want is norm of b n f minus f it should tend to 0 as n tend to infinity. So, except for the first term you have got a constant sequence and now let us look at the function f x is equal to x square. So, we had for f x is equal to x the Bunstein polynomial was function itself and then we had for f x is equal to x again we had Bunstein polynomial to be equal to function itself for n is equal to 1 onwards. Now, when you look at f x is equal to x square then it will not be. So, but still what we are interested in is norm of f minus b n f whether it tends to 0 for f x is equal to x square and then that is going to be true. We will be using again the same idea write down the Bunstein polynomial for function f x is equal to x square and then try to manipulate the terms and get an expression for Bunstein polynomial for function x square. So, here is our Bunstein polynomial general form we are looking at f x is equal to x square. So, b n f at x for this function will be summation k going from 0 to n n factorial by k factorial n minus k factorial f of k by n is going to be k square by n square x raise to k 1 minus x raise to n minus k. So, that is the Bunstein polynomial for function f x is equal to x square. Now, presence of k will make the contribution of the term k is equal to 0 to be 0. So, we have got summation k going from 1 to n n factorial and n square. So, cancel 1 n. So, you have got n minus 1 factorial k factorial and k square so cancel 1 k. So, it will be k minus 1 factorial n minus k factorial 1 k by n got cancelled. So, you are left with k divided by n and now this k let me write as k minus 1 plus 1 x raise to k 1 minus x raise to n minus k which is going to be equal to. Now, I will first look at this k minus 1 this k minus 1 and this k minus 1 factorial. So, this will get cancelled and you will have summation I am looking at first the term k minus 1 by n and then I will look at the term 1 by n because of k minus 1 the contribution from k is equal to 1 is going to be 0. So, it will be summation k going from 2 to n n minus 1 factorial divided by k minus 2 factorial n minus k factorial and then you have got 1 by n because this k minus 1 got cancelled with k minus 1 factorial x raise to k 1 minus x raise to n minus k. So, this is 1 term other term will be plus 1 by n summation k going from 1 to n n minus 1 factorial k plus 1 by n summation k going from 1 to n n minus 1 factorial by k minus 1 factorial n minus k factorial and then you have got x raise to k 1 minus x raise to n minus k. Here in the second term I can take x common and then as before you have summation k goes from 1 to n n minus 1 c k minus 1 here it will be x raise to k minus 1 here it is 1 minus x raise to n minus k. So, when I take x out what I have got is this summation is nothing but binomial series expansion of x plus 1 minus x raise to n minus 1 and hence it is going to be equal to 1. Look at the first term here I have got n minus 1 factorial. So, that I will write as n minus 2 factorial into n minus 1 and take out this n minus 1 and n out. So, let us do it and see what expression we get for f x is equal to x square. So, we have got for f x is equal to x square b n f at x is equal to from the first one I have got n minus 1 by n and let me take out x square common. So, here I am taking x square common I have summation k going from 2 to n n minus 2 factorial k minus 2 factorial n minus k factorial x raise to k minus 2 and 1 minus x raise to n minus k. That is this term and this term as I said earlier it will be 1 by n x and then x plus 1 minus x raise to n minus 1. So, this is for f x is equal to x square. So, now I get b n f at x to be n minus 1 by n x square it is this term plus 1 by n x which is going to be equal to n by n and x square. So, it will be x square and then plus 1 by n x minus 1 by n x square so it will be plus 1 by n x into 1 minus x our f x is x square. So, when I look at modulus of f x minus b n f at x this is going to be 1 by n modulus of x into 1 minus x and hence norm of f minus b n f its infinity norm is going to be maximum of this when x belongs to 0 to 1 the maximum will occur when x is equal to half. So, it is going to be 1 by 4 n. So, this tends to 0 as n tends to infinity. So, now I am going to take this as 1 by n minus 1 for the 3 functions f x is equal to 1 x and x square we have seen that we have got convergence of f minus b n f its infinity norm to 0. So, here is the result when you have got f x is equal to 1 then we saw that b n f at x that is equal to 1 for n bigger than or equal to 0. So, norm of f minus b n f infinity norm is equal to 0 for all n if you look at f x is equal to x then the Bernstein polynomial is equal to x for n bigger than or equal to 1 and for 0 when n is equal to 0 b 0 f x is equal to 0. So, the norm of f minus b n f infinity norm is equal to 0 for n bigger than or equal to 1 for the function f x is equal to x square you do not have b n f to be equal to f eventually, but what you have is f minus b n f its infinity norm is going to be 1 by 4 n and this tends to 0 as n tends to infinity. So, we are interested in the convergence of f minus b n f its norm to 0 for all continuous functions for the 3 functions 1 x and x square we have proved that the norm tends to 0. So, now what we are going to show is that the map which takes f to b n f that map is a linear map and if f x is bigger than or equal to 0 then b n f the approximating polynomial also will be bigger than or equal to 0 for all x belonging to 0 to 1. And then we will appeal to Karaukin theorem for deducing convergence for all continuous function. So, once again let us look at the Bernstein polynomial it is b n f at x is equal to summation n c k value of f at k by n x raise to k 1 minus x raise to n minus k k going from 0 to n. If I look at b n of alpha f plus g at x. So, f and g are 2 functions defined on interval 0 to 1 continuous function. So, f and g are 2 functions defined on interval 0 to 1 continuous function alpha is the real number this will be summation k goes from 0 to n n c k alpha f plus g it is values at k by n x raise to k 1 minus x raise to n minus k. Now, this will be equal to alpha f plus g at k by n will be alpha times f of k by n plus g of k by n. So, let us take alpha common and split the sums. So, this will be alpha times summation k going from 0 to n n c k value of f at k by n x raise to k 1 minus x raise to n minus k plus summation k going from 0 to n n c k value of g at k by n x raise to k 1 minus x raise to n minus k. So, this is alpha times Bernstein polynomial of f at k by n x raise to k at x plus Bernstein polynomial of g at x. So, b n of alpha f plus g is going to be alpha times b n f plus b n g that is the linearity of map b n which associates f to b n f and now, let us look at positivity. Suppose, our function f is greater than or equal to 0 that means, f x is bigger than or equal to 0 for all x belonging to 0 to 1. If that is the case so, f x bigger than or equal to 0 that will imply that f of k by n is bigger than or equal to 0 for k is equal to 0 1 up to n. If I fix x 0 in the interval 0 to 1, then b n f at x 0 will be summation k going from 0 to n n c k x 0 raise to k 1 minus x raise to 1 minus x 0 raise to n minus k multiplied by f of k by n minus k. This coefficient it is a constant I am fixing x 0. So, let me call it beta k this beta k is going to be bigger than or equal to 0 because our x 0 is in the interval 0 to 1. If beta k is bigger than or equal to 0, then our b n f at x 0 is greater than or equal to 0 and f is going to be bigger than or equal to 0 and thus f bigger than or equal to 0 implies b n f is bigger than or equal to 0. So, now, we have got b n to be a map from c 0 1 to c 0 1 such that b n of alpha f plus g is equal to alpha times b n f plus b n g when alpha varies over real numbers and f g belong to c 0 1 not 0 1 it should be c 0 1 and f bigger than or equal to 0 implies b n f to be bigger than or equal to 0. So, that is a positive map and here is Karoukin theorem which says that if you have p n to be a map from c 0 1 to c 0 1 which is a positive linear map and if norm of p n f minus f infinity norm tends to 0 for 3 functions 1 x x square then norm of p n f minus f it is infinity norm tends to 0 for each f belonging to c 0 1. So, it is a very interesting theorem that we want continuity or we want convergence for all continuous functions. Now, this convergence will be assured provided you can show convergence for 3 simple functions just the function constant function 1 function x and then function x square but of course, our map should be linear and it should be a positive map. So, we have already proved the convergence for these 3 functions and which will tell us that you have the convergence of Bernstein polynomials for each f belonging to c 0 1. So, now, we have got we have a constructive way given a function defined on interval 0 to 1 which is continuous I know how to write down its Bernstein polynomial it is just that look at the value of f of k by n and then multiply by n c k x raise to k 1 minus x raise to n minus k and sum it over. Now, mathematically it is a very elegant proof and nice constructive proof but then one is interested also knowing how fast it is going to converge because when you are use going to use computer then you are allowed only finite number of steps. In mathematics it is fine what I want is as n tends to infinity. Now, this is one of the disadvantage of this polynomial approximation that the convergence is going to be very slow. So, here is the fact that we had seen that for function f x is equal to x square the error is going to be 1 upon 4 n. So, suppose I want the error to be less than 10 raise to minus 6. So, this will be assured provided 1 upon 4 n is less than 10 raise to minus 6 that means my n should be bigger than 25 into 10 raise to 4. So, that means n should be bigger than this number. So, the convergence is very slow. Our function f is so simple it is f x is equal to x square and then I want the polynomial approximation and I want to write it down. So, I want the error to be less than 10 raise to minus 6. So, it is really a modest requirement and then I need to choose n to be so big such a ridiculously high number as such when I am looking at function f x is equal to x square. The polynomial approximation is going to be just take it itself is a polynomial, but then this Bernstein polynomial it tells us a way that given a function f construct it in this fashion. So, what it does not do is it does not reproduce polynomials. If the function is polynomial then the best approximation is just take the polynomial itself as your approximation. So, the two disadvantages of this Bernstein polynomial approximation is that the convergence is very slow and it does not reproduce polynomial. It means if the function is polynomial then eventually my polynomial approximation should be polynomial itself when I have got f x is equal to x square. If I want its approximation by constant polynomial then of course there will be some error for linear also there will be error, but when I want approximation for x square by quadratic polynomials then it should be a quadratic polynomial and it does not happen with this recipe. So, why not look at the best approximation that means I fix a degree say degree n is equal to 10 and then among the polynomials of degree less than or equal to 10 I choose the polynomial p n star which has got the least error because after all what I am interested in is the error in the maximum norm. So, among the polynomials of degree less than or equal to n if I can choose the polynomial which has got the least error then I am doing my best and when I do such a thing then already I know that Bernstein polynomials they converge. So, I will have convergence also and I will have convergence as fast as it is possible, but then the question of construction comes that when you are doing numerical analysis we do not want just existence we should be able to construct the error should converge to 0 at a reasonably fast rate. So, you have the best approximation. So, there exists a unique polynomial p n star of degree less than or equal to n such that norm of f minus p n star is less than or equal to minimum of norm of f minus p n. So, you are taking minimum over all polynomials of degree less than or equal to n. So, you are doing your best because the Bernstein polynomials they converge and f minus p n star infinity norm it will be less than or equal to norm of f minus b n f. So, convergence is assured, but here the computation of p n star that needs an iteration technique and that is known as the second algorithm of Remy's. So, the problem comes with the construction that not just there exists. Now, whether this best approximation whether it will reproduce the polynomials. Yes, if my f is itself a polynomial of degree n then the minimum error will be when I choose p n star is equal to f. So, it reproduces polynomials it gives you convergence as fast as it is possible, but then the computation needs iteration technique that means you do not have a formula for writing p n star in terms of f. So, we have considered Taylor series expansion in which case what we needed was the derivative values and also the Taylor formula is in terms of value of the function and the derivative at a fixed point c. We are interested in the error over the whole interval a b. The Taylor series will be efficient in the neighborhood of c, but as you go away from c the error will increase and then the knowledge of derivative needed. So, that is why we looked at Bernstein polynomials which gives you approximation to all continuous functions, but the convergence is very slow. So, you look at the best approximation in case of best approximation you have to resort to iteration techniques. So, the problem is with construction. So, now that brings us to interpolation polynomials. Now, what we are going to do is our function f is defined on interval a b to r. Suppose I give you one point x 0 and find a constant polynomial which matches with function value at that point x 0 and it is nothing, it is just the constant polynomial. If I look at two points x 0 and x 1 look at the value of f x 0 and f x 1, then I am going to join by straight line I will get a linear polynomial. And in general if I have got n plus 1 distinct points in interval a b, then what we are going to show is that there exists a unique polynomial of degree less than or equal to n such that p n x j is equal to f of x j for j is equal to 0, 1 up to n. Now, once again you have to worry about there exists, but here one can write down explicitly the polynomial. So, this is fine, then you are going to have a unique polynomial of degree less than or equal to n. So, if your function f is itself a polynomial of degree n, then your p n is going to be equal to f, because if the function is a polynomial of degree less than or equal to n. And if I choose p n is equal to f, then it will interpolate my given function not only at this n plus 1 distinct points, but at all points. So, it is going to reproduce the polynomials like if f x is equal to x square, if I choose three points, then the interpolating polynomial that means you are fitting a parabola and your interpolating polynomial will be same as the function. So, no problem with the construction, it reproduces the polynomial polynomial. So, it would not happen like in case of Bernstein polynomials f x is equal to x square, when your Bernstein polynomial it give you something, there was error, whereas here when I will consider three or more points my p n is going to be equal to f. So, it is going to reproduce the polynomial. So, now comes the question of convergence. So, suppose I am choosing interpolation points. So, for a constant polynomial I will need one point, in order to fit a linear polynomial I will need two points, in order to fit a parabola p 2 I will need three points. And in order to fit a polynomial of degree less than or equal to n I will need n plus 1 distinct points. So, every time you have to specify the points and then we can fit a polynomial. So, suppose I choose this set of points by some rule for example, take the equidistant points. Then the question is whether for every f belonging to C A B this sequence of interpolating polynomials f minus p n norm infinity tends to 0 as n tends to infinity. Unfortunately, this is not true. See your interpolating polynomials they are going to depend on your interpolation points. So, if I take equidistant points like first take the midpoint of interval A B, then take the end points, then divide it into three equal parts and take two equal parts and take the end points and so on. So, then one feels that maybe this is not the best way of choosing interpolation points do it some other way. But what one can show is no matter how you choose these points there will always exist a continuous function for which this error will not tend to 0. For some specific functions it will tend to 0, but whether for each f. So, I choose the interpolation points I fit a polynomial then norm of f minus p n infinity will not tend to 0 for each f belonging to C A B. So, there is always a trade off that sometimes for the interpolation points it was nice you can construct, then you will have the polynomials they will be reproduced, but then the problem is with the convergence. Now, still the polynomial interpolation they are going to be used and the reason is that even though interpolating polynomials have no convergence as such one should not work with high degree polynomials. When we talked about the good algorithm then one of the criteria was stability and I had said I will comment about it little later. So, here is what happens when you deal with high degree polynomial, here is a polynomial of degree 7 it has got roots 1 2 3 4 5 6 7 now if you expand it is going to be x raise to 7 minus 28 x raise to 6 etcetera. Now, if I change this minus 28 to minus 28.002. So, if I change this minus 28 to minus 28 I am making a very small change, but then the roots which were 5 and 6 they become complex and that becomes minus 5.459 plus or minus 0.540 i. So, a small change then it makes a lot of difference in the result and that is the stability problem. So, then the what we are going to do is we are going to use low degree polynomials we will try to choose our interpolation points in a way best we can and then we can go to piecewise polynomials. So, the topic of our next lecture is going to be polynomial interpolation. Thank you.