# Math-Linux.com

Knowledge base dedicated to Linux and applied mathematics.

Home > Mathematics > Interpolation > Lagrange interpolation polynomial

## Lagrange interpolation polynomial

In this section, we shall study the interpolation polynomial in the Lagrange form. Given a set of (n+1) data points and a function f, the aim is to determine a polynomial of degree n which interpolates f at the points in question.

### Interpolation

Given a set of data points , the points defined by are called points of interpolation. The points are the values of interpolation. To interpolate a function , we define the values of interpolation as follows:

### Lagrange interpolation polynomial

The purpose here is to determine the unique polynomial of degree , which verifies

The polynomial which meets this equality is Lagrange interpolation polynomial

where are polynomials of degree that form a basis of

### Properties of Lagrange interpolation polynomial and Lagrange basis

They are the polynomials which verify the following property:

They form a basis of the vector space of polynomials of degree at most equal to

By setting: , we obtain:

The set is linearly independent and consists of vectors. It is thus a basis of .
Finally, we can easily see that:

### Existence and uniqueness of Lagrange interpolation polynomials

Existence.
The proof is shown above. Actually, it corresponds to the construction of Lagrange interpolation polynomial with regard to the basis
of .

Uniqueness. Consider two elements and of which verify

Let . The polynomial has roots which are exactly the since

has then roots and . Therefore,

We have thus shown the existence and uniqueness of Lagrange interpolation polynomial.

### Error in Lagrange interpolation

Assume that and . Let be the closed set defined by (the smallest closed set containing and ).

Theorem.

Proof. There are two possible ways to prove this theorem: 1) the one encountered in The polynomial interpolation in the form of Newton and, 2) the following proof.

If , the problem is over:

Now, assume that and let us define the application as follows:

We also define the application :

is times differentiable and evaluates to zero at the points of the interval . By successively applying Rolle’s theorem, evaluates to zero at a point :

The derivative of can be easily calculated:

By setting , we have:

Therefore

We finally conclude that

Corollary.
Assume that and .

Alternatively stated:

### Example: computing Lagrange interpolation polynomials

Given a set of three data points , we shall determine the Lagrange interpolation polynomial of degree 2 which passes through these points.

First, we compute and :

Lagrange interpolation polynomial is:

### Scilab: computing Lagrange interpolation polynomial

The Scilab function lagrange.sci determines Lagrange interpolation polynomial. encompasses the points of interpolation and the values of interpolation. is the Lagrange interpolation polynomial.

lagrange.sci

function[P]=lagrange(X,Y)//X nodes,Y values;P is the numerical Lagrange polynomial interpolation
n=length(X);// n is the number of nodes. (n-1) is the degree
x=poly(0,"x");P=0;
for i=1:n, L=1;
for j=[1:i-1,i+1:n] L=L*(x-X(j))/(X(i)-X(j));end
P=P+L*Y(i);
end
endfunction

We thus have:

-->X=[0;2;4]; Y=[1;5;17]; P=lagrange(X,Y)
P = 1 + x^2