 #jsDisabledContent { display:none; } My Account | Register | Help Flag as Inappropriate This article will be permanently flagged as inappropriate and made unaccessible to everyone. Are you certain this article is inappropriate?          Excessive Violence          Sexual Content          Political / Social Email this Article Email Address:

Lagrange interpolation

Article Id: WHEBN0002084245
Reproduction Date:

 Title: Lagrange interpolation Author: World Heritage Encyclopedia Language: English Subject: Collection: Publisher: World Heritage Encyclopedia Publication Date:

Lagrange interpolation

In numerical analysis, Lagrange polynomials are used for polynomial interpolation. For a given set of distinct points $x_j$ and numbers $y_j$, the Lagrange polynomial is the polynomial of the least degree that at each point $x_j$ assumes the corresponding value $y_j$ (i.e. the functions coincide at each point). The interpolating polynomial of the least degree is unique, however, and it is therefore more appropriate to speak of "the Lagrange form" of that unique polynomial rather than "the Lagrange interpolation polynomial", since the same polynomial can be arrived at through multiple methods. Although named after Joseph Louis Lagrange, who published it in 1795, it was first discovered in 1779 by Edward Waring and it is also an easy consequence of a formula published in 1783 by Leonhard Euler.

Lagrange interpolation is susceptible to Runge's phenomenon, and the fact that changing the interpolation points requires recalculating the entire interpolant can make Newton polynomials easier to use. Lagrange polynomials are used in the Newton–Cotes method of numerical integration and in Shamir's secret sharing scheme in cryptography.

Definition

Given a set of k + 1 data points

$\left(x_0, y_0\right),\ldots,\left(x_j, y_j\right),\ldots,\left(x_k, y_k\right)$

where no two $x_j$ are the same, the interpolation polynomial in the Lagrange form is a linear combination

of Lagrange basis polynomials

where $0\le j\le k$. Note how, given the initial assumption that no two $x_i$ are the same, $x_j - x_m \neq 0$, so this expression is always well-defined. The reason pairs $x_i = x_j$ with $y_i\neq y_j$ are not allowed is that no interpolation function $L$ such that $y_i = L\left(x_i\right)$ would exist; a function can only get one value for each argument $x_i$. On the other hand, if also $y_i = y_j$, then those two points would actually be one single point.

For all $j\neq i$, $\ell_j\left(x\right)$ includes the term $\left(x-x_i\right)$ in the numerator, so the whole product will be zero at $x=x_i$:

$\ell_\left\{j\ne i\right\}\left(x_i\right) = \prod_\left\{m\neq j\right\} \frac\left\{x_i-x_m\right\}\left\{x_j-x_m\right\} = \frac\left\{\left(x_i-x_0\right)\right\}\left\{\left(x_j-x_0\right)\right\} \cdots \frac\left\{\left(x_i-x_i\right)\right\}\left\{\left(x_j-x_i\right)\right\} \cdots \frac\left\{\left(x_i-x_k\right)\right\}\left\{\left(x_j-x_k\right)\right\} = 0.$

On the other hand,

In other words, all basis polynomials are zero at $x=x_i$, except $\ell_i\left(x\right)$, for which it holds that $\ell_i\left(x_i\right)=1$, because it lacks the $\left(x-x_i\right)$ term.

It follows that $y_i \ell_i\left(x_i\right)=y_i$, so at each point $x_i$, $L\left(x_i\right)=y_i+0+0+\dots +0=y_i$, showing that $L$ interpolates the function exactly.

Proof

The function L(x) being sought is a polynomial in $x$ of the least degree that interpolates the given data set; that is, assumes value $y_j$ at the corresponding $x_j$ for all data points $j$:

$L\left(x_j\right) = y_j \qquad j=0,\ldots,k$

Observe that:

1. In $\ell_j\left(x\right)$ there are k terms in the product and each term contains one x, so L(x) (which is a sum of these k-degree polynomials) must also be a k-degree polynomial.
2. $\ell_j\left(x_i\right)$

= \prod_{m=0,\, m\neq j}^{k} \frac{x_i-x_m}{x_j-x_m}

We consider what happens when this product is expanded. Because the product skips $m = j$, if $i = j$ then all terms are $\frac\left\{x_j-x_m\right\}\left\{x_j-x_m\right\} = 1$ (except where $x_j = x_m$, but that case is impossible, as pointed out in the definition section—in that term, $m=j$, and since $m\neq j$, $i\neq j$, contrary to $i=j$). Also if $i \neq j$ then since $m \neq j$ does not preclude it, one term in the product will be for $m=i$, i.e. $\frac\left\{x_i-x_i\right\}\left\{x_j-x_i\right\} = 0$, zeroing the entire product. So

1. $\ell_j\left(x_i\right)$
= \delta_{ji} = \begin{cases}


1, & \text{if } j=i \\ 0, & \text{if } j \ne i \end{cases}

where $\delta_\left\{ij\right\}$ is the Kronecker delta. So:

$L\left(x_i\right) = \sum_\left\{j=0\right\}^k y_j \ell_j\left(x_i\right) = \sum_\left\{j=0\right\}^\left\{k\right\} y_j \delta_\left\{ji\right\} = y_i.$

Thus the function L(x) is a polynomial with degree at most k and where $L\left(x_i\right) = y_i$.

Additionally, the interpolating polynomial is unique, as shown by the unisolvence theorem at polynomial interpolation article.

Main idea

Solving an interpolation problem leads to a problem in linear algebra where we have to solve a matrix. Using a standard monomial basis for our interpolation polynomial we get the Vandermonde matrix. By choosing another basis, the Lagrange basis, we get the much simpler identity matrix = δi,j which we can solve instantly: the Lagrange basis inverts the Vandermonde matrix.

This construction is the same as the Chinese Remainder Theorem. Instead of checking for remainders of integers modulo prime numbers, we are checking for remainders of polynomials when divided by linears.

Examples

Example 1

Find an interpolation formula for ƒ(x) = tan(x) given this set of known values:



\begin{align} x_0 & = -1.5 & & & & & f(x_0) & = -14.1014 \\ x_1 & = -0.75 & & & & & f(x_1) & = -0.931596 \\ x_2 & = 0 & & & & & f(x_2) & = 0 \\ x_3 & = 0.75 & & & & & f(x_3) & = 0.931596 \\ x_4 & = 1.5 & & & & & f(x_4) & = 14.1014. \end{align}

The Lagrange basis polynomials are:

$\ell_0\left(x\right)=\left\{x - x_1 \over x_0 - x_1\right\}\cdot\left\{x - x_2 \over x_0 - x_2\right\}\cdot\left\{x - x_3 \over x_0 - x_3\right\}\cdot\left\{x - x_4 \over x_0 - x_4\right\}$
            ={1\over 243} x (2x-3)(4x-3)(4x+3)

$\ell_1\left(x\right) = \left\{x - x_0 \over x_1 - x_0\right\}\cdot\left\{x - x_2 \over x_1 - x_2\right\}\cdot\left\{x - x_3 \over x_1 - x_3\right\}\cdot\left\{x - x_4 \over x_1 - x_4\right\}$
            = {} -{8\over 243} x (2x-3)(2x+3)(4x-3)

$\ell_2\left(x\right)=\left\{x - x_0 \over x_2 - x_0\right\}\cdot\left\{x - x_1 \over x_2 - x_1\right\}\cdot\left\{x - x_3 \over x_2 - x_3\right\}\cdot\left\{x - x_4 \over x_2 - x_4\right\}$
            ={3\over 243} (2x+3)(4x+3)(4x-3)(2x-3)

$\ell_3\left(x\right)=\left\{x - x_0 \over x_3 - x_0\right\}\cdot\left\{x - x_1 \over x_3 - x_1\right\}\cdot\left\{x - x_2 \over x_3 - x_2\right\}\cdot\left\{x - x_4 \over x_3 - x_4\right\}$
            =-{8\over 243} x (2x-3)(2x+3)(4x+3)

$\ell_4\left(x\right)=\left\{x - x_0 \over x_4 - x_0\right\}\cdot\left\{x - x_1 \over x_4 - x_1\right\}\cdot\left\{x - x_2 \over x_4 - x_2\right\}\cdot\left\{x - x_3 \over x_4 - x_3\right\}$
            ={1\over 243} x (2x+3)(4x-3)(4x+3).


Thus the interpolating polynomial then is

\begin\left\{align\right\}L\left(x\right) &= \left\{1\over 243\right\}\Big\left(f\left(x_0\right)x \left(2x-3\right)\left(4x-3\right)\left(4x+3\right) \\

& {} \qquad {} - 8f(x_1)x (2x-3)(2x+3)(4x-3) \\ & {} \qquad {} + 3f(x_2)(2x+3)(4x+3)(4x-3)(2x-3) \\ & {} \qquad {} - 8f(x_3)x (2x-3)(2x+3)(4x+3) \\ & {} \qquad {} + f(x_4)x (2x+3)(4x-3)(4x+3)\Big)\\ & = 4.834848x^3 - 1.477474x. \end{align}

Example 2

We wish to interpolate ƒ(x) = x2 over the range 1 ≤ x ≤ 3, given these three points:



\begin{align} x_0 & = 1 & & & f(x_0) & = 1 \\ x_1 & = 2 & & & f(x_1) & = 4 \\ x_2 & = 3 & & & f(x_2) & =9. \end{align}

The interpolating polynomial is:

\begin\left\{align\right\}

L(x) &= {1}\cdot{x - 2 \over 1 - 2}\cdot{x - 3 \over 1 - 3}+{4}\cdot{x - 1 \over 2 - 1}\cdot{x - 3 \over 2 - 3}+{9}\cdot{x - 1 \over 3 - 1}\cdot{x - 2 \over 3 - 2} \\[10pt] &= x^2. \end{align}

Example 3

We wish to interpolate ƒ(x) = x3 over the range 1 ≤ x ≤ 3, given these 3 points:

 $x_0=1\,$ $f\left(x_0\right)=1\,$ $x_1=2\,$ $f\left(x_1\right)=8\,$ $x_2=3\,$ $f\left(x_2\right)=27\,$

The interpolating polynomial is:

\begin\left\{align\right\}

L(x) &= {1}\cdot{x - 2 \over 1 - 2}\cdot{x - 3 \over 1 - 3}+{8}\cdot{x - 1 \over 2 - 1}\cdot{x - 3 \over 2 - 3}+{27}\cdot{x - 1 \over 3 - 1}\cdot{x - 2 \over 3 - 2} \\[8pt] &= 6x^2 - 11x + 6. \end{align}