Next: Newton Interpolation polynomial: Up: Main:Previous: Introduction:



Interpolation

Lagrange Interpolation:

Let us suppose that the given data points $ (x_{i},y_{i}),$ $ i=0,1,2...n$ is coming from a function $ f(x)$. Let us assume that this function $ y=f(x)$ takes the values $ y_{0},y_{1}.......y_{n}$ at $ x_{0},x_{1},.......x_{n}.$ Since there are $ (n+1)$ data points $ (x_{i},y_{i}),$ we can represent the function $ f(x)$ by a polynomial of degree

% latex2html id marker 2040
$\displaystyle \therefore f(x)=C_{n}x^{n}+C_{n-1}x^{n-1}+...+C_{1}x+C_{0}$ (1)

As we have assumed that $ f(x_{i})=y_{i}, i=0,1,2.......n$ i.e. the function $ f(x)$ passes through can be rewritten as:

$\displaystyle y = f(x)= a_{0}(x-x_{1})(x-x_{2})...(x-x_{n})+ a_{1}(x-x_{0})(x-x_{2})...(x-x_{n})+$    

$\displaystyle a_{2}(x-x_{0})(x-x_{1})(x-x_{3})...(x-x_{n})+.......+ a_{n}(x-x_{0})...(x-x_{n-1})$ (2)

$\displaystyle But, y_{i}=f(x_{i})\quad i=0,1,.....n\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad$ (3)

Using (3) for i=0, in (2) we get

$\displaystyle y_{0}=f(x_{0})=a_{0}(x_{0}-x_{1})...(x_{0}-x_{n})$

% latex2html id marker 2056
$\displaystyle \therefore a_{0}=\frac{y_{0}}{(x_{0}-x_{1})...(x_{0}-x_{n})}$ (4.1)


For $ i=1,$ we get

$\displaystyle y_{1}=f(x_{1})=a_{1}(x_{1}-x_{o})(x_{1}-x_{2})...(x_{1}-x_{n})$

% latex2html id marker 2062
$\displaystyle \therefore a_{1}=\frac{y_{1}}{(x_{1}-x_{0})(x_{1}-x_{2})...(x_{1}-x_{n})}$ (4.2)

Similarly for $ i=2.......n-1,$ we get

$\displaystyle a_{i}=\frac{y_{i}}{(x_{i}-x_{0})(x_{i}-x_{1})...(x_{i}-x_{i-1})(x_{i}-x_{i+1})...(x_{i}-x_{n})}$

and for $ i=n,$ we get

$\displaystyle a_{n}=\frac{y_{n}}{(x_{n}-x_{0})...(x_{n}-x_{n-1})}$ (4.3)

Using (4.1)-(4.3) in (2) we get

(5)  

(6)


(5) can be rewritten in a compact form as:

y=$ f(x)$ $\displaystyle =$ $\displaystyle L_{0}(x)y_{0}+L_{1}(x)y_{1}+...........+L_{n}(x)y_{n}$  
  $\displaystyle =$ $\displaystyle \sum\limits_{i=0}^{n}L_{i}(x)y_{i}$  
  $\displaystyle =$ $\displaystyle \sum\limits_{i=0}^{n}L_{i}(x)f(x_{i})\quad
\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad(7.1)$  

where

$\displaystyle L_{i}(x)=\frac{(x-x_{0})(x-x_{1})...(x-x_{i-1})(x-x_{i+1})...(x-x...
...)}{(x_{i}-x_{0})(x_{i}-x_{1})...(x_{i}-x_{i-1})(x_{i}-x_{i+1})...(x_{i}-x_{n})}$ (7.2)


It can be easily noted that

7.3

Let us introduce the product notation as :

$\displaystyle \prod(x)=\prod\limits_{i=0}^{n}(x-x_{i})=(x-x_{0})(x-x_{1})....(x-x_{n})$ (8.1)

(8.2)

Therefore, Lagrange interpolation polynomial of degree n can be written as

$\displaystyle y=f(x)=\sum\limits_{k=0}^{n}L_{k}(x)y_{k}$ (9)


Example 1:
Given the following data table, construct the Lagrange interpolation

polynomial $ f(x)$, to fit the data and find

i 0 1 2 3
$ x_{i}$ 0 1 2 3
$ y_{i}=f(x_{i})$ 1 2.25 3.75 4.25
Solution:

Here .

Lagrange interpolation polynomial is given by

y=$ f(x)$ $\displaystyle =$  
$\displaystyle L_{0}(x)$ $\displaystyle =$  
  $\displaystyle =$ $\displaystyle \frac{(x-x_{1})(x-x_{2})(x-x_{3})}{(x_{0}-x_{1})(x_{0}-x_{2})(x_{0}-x_{3})}$  
  $\displaystyle =$ $\displaystyle \frac{(x-1)(x-2)(x-3)}{(0-1)(0-2)(0-3)}$  
  $\displaystyle =$ $\displaystyle \frac{x^{3}-6x^{2}+11x-6}{-6}$  


$\displaystyle L_{1}(x)$ $\displaystyle =$  
  $\displaystyle =$ $\displaystyle \frac{(x-x_{0})(x-x_{2})(x-x_{3})}{(x_{1}-x_{0})(x_{1}-x_{2})(x_{1}-x_{3})}$  
  $\displaystyle =$ $\displaystyle \frac{(x-0)(x-2)(x-3)}{(1-0)(1-2)(1-3)}$  
  $\displaystyle =$ $\displaystyle \frac{x^{3}-5x^{2}+6x}{2}$  


$\displaystyle L_{2}(x)$ $\displaystyle =$  
  $\displaystyle =$ $\displaystyle \frac{(x-x_{0})(x-x_{1})(x-x_{3})}{(x_{2}-x_{0})(x_{2}-x_{1})(x_{2}-x_{3})}$  
  $\displaystyle =$ $\displaystyle \frac{(x-0)(x-1)(x-3)}{(2-0)(2-1)(2-3)}$  
  $\displaystyle =$ $\displaystyle \frac{x^{3}-4x^{2}+3x}{-2}$  


$\displaystyle L_{3}(x)$ $\displaystyle =$  
  $\displaystyle =$  
  $\displaystyle =$ $\displaystyle \frac{(x-0)(x-1)(x-2)}{(3-0)(3-1)(3-2)}$  
  $\displaystyle =$ $\displaystyle \frac{x^{3}-3x^{2}+2x}{6}$  


% latex2html id marker 2212
$\displaystyle \therefore \quad f(1.25)$ $\displaystyle =$  
  $\displaystyle =$ $\displaystyle L_{0}(1.25)y_{0}+L_{1}(1.25)y_{1}+L_{2}(1.25)y_{2}+L_{3}(1.25)y_{3}$  
  $\displaystyle =$ $\displaystyle (-0.546875).1+(0.8203125)2.25+(0.2734375)3.75+(-0.0390625)4.25$  
  $\displaystyle =$ $\displaystyle 2.650390625$  



Example 2:
Given the following data table, construct the Lagrange interpolation polynomial f(x), to fit the data and find
i 0 1 2 3 4 5
$ x_{i}$ 1980 1985 1990 1995 2000 2005
$ y_{i}=f(x_{i})$ 440 510 525 571 500 600
Solution:
Here $ n=6,\qquad x_{k}=1998$

Lagrange interpolation polynomial is given by
$\displaystyle =$ $\displaystyle \frac{(x-x_{1})(x-x_{2})(x-x_{3})(x-x_{4})(x-x_{5})}{(x_{0}-x_{1})(x_{0}-x_{2})(x_{0}-x_{3})(x_{0}-x_{4})(x_{0}-x_{5})}$
  $\displaystyle =$ $\displaystyle \frac{(x-1985)(x-1990)(x-1995)(x-2000)(x-2005)}{(1980-1985)(1980-1990)(1980-1995)(1980-2000)(1980-2005)}$


$\displaystyle L_{0}(x_{k})={L_{0}(1998)}$ $\displaystyle =$ $\displaystyle \frac{(1998-1985)(1998-1990)(1998-1995)(1998-2000)(1998-2005)}{(-5)(-10)(-15)(-20)(-25)}$
  $\displaystyle =$ $\displaystyle \frac{13.8.3.(-2).(-7)}{-(375000)}$
  $\displaystyle =$ $\displaystyle -\frac{4368}{375000}=-0.011648$


$\displaystyle =$ $\displaystyle \frac{(x_{k}-x_{0})(x_{k}-x_{2})(x_{k}-x_{3})(x_{k}-x_{4})(x_{k}-x_{5})}{(x_{1}-x_{0})(x_{1}-x_{2})(x_{1}-x_{3})(x_{1}-x_{4})(x_{1}-x_{5})}$
  $\displaystyle =$ $\displaystyle \frac{(1998-1980)(1998-1990)(1998-1995)(1998-2000)(1998-2005)}{(1985-1980)(1985-1990)(1985-1995)(1985-2000)(1985-2005)}$
  $\displaystyle =$ $\displaystyle \frac{18.8.3.(-2).(-7)}{5(-5)(-10)(-15)(-20)}=0.08064$


$\displaystyle =$ $\displaystyle \frac{(1998-1980)(1998-1985)(1998-1995)(1998-2000)(1998-2005)}{(1990-1980)(1990-1985)(1990-1995)(1990-2000)(1990-2005)}$
  $\displaystyle =$ $\displaystyle \frac{18.13. 3 .(-2)(-7)}{10.5.(-5)(-10).(-15)}$
  $\displaystyle =$ $\displaystyle -0.26208$


$\displaystyle =$ $\displaystyle \frac{(1998-1980)(1998-1985)(1998-1990)(1998-2000)(1998-2005)}{(1995-1980)(1995-1985)(1995-1990)(1995-2000)(1995-2005)}$
  $\displaystyle =$ $\displaystyle \frac{18.13.8.(-2)(-7)}{15.10.5(-5)(-10)}$
  $\displaystyle =$ $\displaystyle 0.69888$


$\displaystyle =$ $\displaystyle \frac{(1998-1980)(1998-1985)(1998-1990)(1998-1995)(1998-2005)}{(2000-1980)(2000-1985)(2000-1990)(2000-1995)(2000-2005)}$
  $\displaystyle =$ $\displaystyle \frac{18.13.8.3.(-7)}{20.15.10.5(-5)}$
  $\displaystyle =$ $\displaystyle 0.52416$


$\displaystyle =$ $\displaystyle \frac{(1998-1980(1998-1985)(1998-1990)(1998-1995)(1998-2000)}{(2005-1980)(2005-1985)(2005-1990)(2005-1995)(2005-2000)}$
  $\displaystyle =$ $\displaystyle \frac{18.13.8.3.(-2)}{25.20.15.10.5}=-0.029952$


% latex2html id marker 2360
$ \therefore \hspace{0.5in} f(1998)=\sum\limits_{i=0}^{5}L_{i}(1998)y_{i}$



Note: Given a set of data points . Suppose we are interested in evaluating $ f(x)$ at some intermediate point to a desired level of accuracy. Directly using the entire data set of size n may not only be computationally economical but may also turn out to be redundant. Naturally one would like to use an interpolating polynomial of optimal degree. Since this is not known apriori, one may start with and if it was enough then move onto and so on i.e. slowly increase the no. of the interpolating points (or) data points $ x_{0},x_{1}..x_{k}$ so that will be close to $ f(x)$. In this context the biggest disadvantage with Lagrange Interpolation is that we cannot use the work that has already been done i.e. we cannot make use of while evaluating . With the addition of each new data point, calculations have to be repeated. Newton Interpolation polynomial overcomes this drawback.

Exercise: Using the following data, construct the Lagrange Interpolation Polynomial

(1) ,

(2)



Next: Newton Interpolation polynomial:Up: Main: Previous: Introduction: