Lagrange polynomial
In numerical analysis, the Lagrange interpolating polynomial is the unique polynomial of lowest degree that interpolates a given set of data.[src] Given a data set of coordinate pairs , the are called nodes and the are called values.[src] The Lagrange polynomial which interpolates the data assumes each value at the corresponding node, .[src] If there are data pairs, the Lagrange polynomial has degree .[src] Although named after Joseph-Louis Lagrange, who published it in 1795, the method was first discovered in 1779 by Edward Waring.[src] It is also an easy consequence of a formula published in 1783 by Leonhard Euler.[src] Uses of Lagrange polynomials include the Newton–Cotes method of numerical integration, Shamir's secret sharing scheme in cryptography, and Reed–Solomon error correction in coding theory.[src] For equispaced nodes, Lagrange interpolation is susceptible to Runge's phenomenon of large oscillation.[src] Lagrange polynomials are also related to matrix eigenspace projection via Frobenius covariants.[src]
In numerical analysis, the Lagrange interpolating polynomial is the unique polynomial of lowest degree that interpolates a given set of data.[src] Given a data set of coordinate pairs , the are called nodes and the are called values.[src] The Lagrange polynomial which interpolates the data assumes each value at the corresponding node, .[src] If there are data pairs, the Lagrange polynomial has degree .[src] Although named after Joseph-Louis Lagrange, who published it in 1795, the method was first discovered in 1779 by Edward Waring.[src] It is also an easy consequence of a formula published in 1783 by Leonhard Euler.[src] Uses of Lagrange polynomials include the Newton–Cotes method of numerical integration, Shamir's secret sharing scheme in cryptography, and Reed–Solomon error correction in coding theory.[src] For equispaced nodes, Lagrange interpolation is susceptible to Runge's phenomenon of large oscillation.[src] Lagrange polynomials are also related to matrix eigenspace projection via Frobenius covariants.[src] ==Definition== Given a set of nodes which must all be distinct, for indices , the Lagrange basis for polynomials of degree for those nodes is the set of polynomials \textstyle \{\ell_0(x), \ell_1(x), \ldots, \ell_k(x)\} each of degree which take values if and .[src] Using the Kronecker delta this can be written .[src] Each basis polynomial can be explicitly described by the product: \begin{aligned} \ell_j(x) &= \frac{(x-x_0)}{(x_j-x_0)} \cdots \frac{(x-x_{j-1})}{(x_j-x_{j - 1})} \frac{(x-x_{j+1})}{(x_j-x_{j+1})} \cdots \frac{(x-x_k)}{(x_j-x_k)} \\[8mu] &= \prod_{\begin{smallmatrix}0\le m\le k\\ m\neq j\end{smallmatrix}} \frac{x-x_m}{x_j-x_m} \vphantom\Bigg|.[src] \end{aligned} Notice that the numerator has roots at the nodes \textstyle \{x_m\}_{m \neq j} while the denominator scales the resulting polynomial so that .[src] The Lagrange interpolating polynomial for those nodes through the corresponding values \{y_0, y_1, \ldots, y_k\} is the linear combination: L(x) = \sum_{j=0}^{k} y_j \ell_j(x).[src] Each basis polynomial has degree , so the sum has degree , and it interpolates the data because .[src] The interpolating polynomial is unique.[src] Proof: assume some polynomial of degree interpolates the data.[src] Then the difference is zero at distinct nodes But the only polynomial of degree with more than roots is the constant zero function, so , or .[src] The unique interpolating polynomial can alternatively be constructed using Newton polynomials as an alternative basis, or generalized to Hermite interpolating polynomials when there are confluent nodes.[src] ==Barycentric form== Each Lagrange basis polynomial can be rewritten as the product of three parts, a function common to every basis polynomial, a node-specific constant (called the barycentric weight), and a part representing the displacement from to : \ell_j(x) = \ell(x) \dfrac{w_j}{x - x_j} By factoring out from the sum, we can write the Lagrange polynomial in the so-called first barycentric form: L(x) = \ell(x) \sum_{j=0}^k \frac{w_j}{x-x_j}y_j.[src] If the weights have been pre-computed, this requires only operations compared to for evaluating each Lagrange basis polynomial individually.[src] (See Big O notation.) The barycentric interpolation formula can also easily be updated to incorporate a new node by dividing each of the , by and constructing the new as above.[src] For any , \sum_{j=0}^k \ell_j(x) = 1 because the constant function g(x) = 1 is the unique polynomial of degree \leq k interpolating the data We can thus further simplify the barycentric formula by dividing \begin{aligned} L(x) &= \ell(x) \sum_{j=0}^k \frac{w_j}{x-x_j}y_j \Bigg/ \ell(x) \sum_{j=0}^k \frac{w_j}{x-x_j} \\[10mu] &= \sum_{j=0}^k \frac{w_j}{x-x_j}y_j \Bigg/ \sum_{j=0}^k \frac{w_j}{x-x_j}.[src] \end{aligned} This is called the second form or true form of the barycentric interpolation formula.[src] This second form has advantages in computation cost and accuracy: it avoids evaluation of \ell(x) ; the work to compute each term in the denominator w_j/(x-x_j) has already been done in computing \bigl(w_j/(x-x_j)\bigr)y_j and so computing the sum in the denominator costs only k addition operations; for evaluation points x which are close to one of the nodes x_j , catastrophic cancelation would ordinarily be a problem for the value (x-x_j) , however this quantity appears in both numerator and denominator and the two cancel leaving good relative accuracy in the final result.[src] Using this formula to evaluate L(x) at one of the nodes x_j will result in the indeterminate \infty y_j/\infty ; computer implementations must replace such results by L(x_j) = y_j.[src] Each Lagrange basis polynomial can also be written in barycentric form: \ell_j(x) = \frac{w_j}{x-x_j} \Bigg/ \sum_{m=0}^k \frac{w_m}{x-x_m}.[src] ==A perspective from linear algebra== Solving an interpolation problem leads to a problem in linear algebra amounting to inversion of a matrix.[src] Using a standard monomial basis for our interpolation polynomial L(x) = \sum_{j=0}^k x^j m_j , we must invert the Vandermonde matrix (x_i)^j to solve L(x_i) = y_i for the coefficients m_j of L(x) .[src] By choosing a better basis, the Lagrange basis, L(x) = \sum_{j=0}^k \ell_j(x) y_j , we merely get the identity matrix, \delta_{ij} , which is its own inverse: the Lagrange basis automatically inverts the analog of the Vandermonde matrix.[src] More explicitly, let be the inverse Vandermonde matrix such that: L = \begin{pmatrix} L_{00} & \cdots & L_{0n} \\ \vdots & \ddots & \vdots \\ L_{n0} & \cdots & L_{nn} \end{pmatrix}.[src] The Lagrange basis polynomial can be expressed directly using the columns of : \ell_j(x) = L_{0j} + L_{1j} x + \cdots + L_{nj} x^n.[src] This construction is analogous to the Chinese remainder theorem.[src] Instead of checking for remainders of integers modulo prime numbers, we are checking for remainders of polynomials when divided by linears.[src] Furthermore, when the order is large, Fast Fourier transformation can be used to solve for the coefficients of the interpolated polynomial.[src] In numerical practice, directly computing by inverting the Vandermonde matrix is generally avoided because Vandermonde matrices are notoriously ill-conditioned.[src] As the number of nodes or their degree increases, their condition number grows exponentially, making direct matrix inversion numerically unstable and highly sensitive to floating-point errors.[src] ==Example== We wish to interpolate f(x) = x^2 over the domain 1 \leq x \leq 3 at the three nodes \begin{align} x_0 & = 1, & & & y_0 = f(x_0) & = 1, \\[3mu] x_1 & = 2, & & & y_1 = f(x_1) & = 4, \\[3mu] x_2 & = 3, & & & y_2 = f(x_2) & =9.[src] \end{align} The node polynomial \ell is \ell(x) = (x-1)(x-2)(x-3) = x^3 - 6x^2 + 11x - 6.[src] The barycentric weights are \begin{align} w_0 &= (1-2)^{-1}(1-3)^{-1} = \tfrac12, \\[3mu] w_1 &= (2-1)^{-1}(2-3)^{-1} = -1, \\[3mu] w_2 &= (3-1)^{-1}(3-2)^{-1} = \tfrac12.[src] \end{align} The Lagrange basis polynomials are \begin{align} \ell_0(x) &= \frac{x - 2}{1 - 2}\cdot\frac{x - 3}{1 - 3} = \tfrac12x^2 - \tfrac52x + 3, \\[5mu] \ell_1(x) &= \frac{x - 1}{2 - 1}\cdot\frac{x - 3}{2 - 3} = -x^2 + 4x - 3, \\[5mu] \ell_2(x) &= \frac{x - 1}{3 - 1}\cdot\frac{x - 2}{3 - 2} = \tfrac12x^2 - \tfrac32x + 1.[src] \end{align} The Lagrange interpolating polynomial is: \begin{align} L(x) &= y_0 \cdot \ell_0(x) + y_1 \cdot \ell_1(x) + y_2 \cdot \ell_2(x) = x^2.[src] \end{align} In (second) barycentric form, L(x) = \frac {\displaystyle \sum_{j=0}^2 \frac{w_j}{x-x_j}y_j} {\displaystyle \sum_{j=0}^2 \frac{w_j}{x-x_j}} = \frac {\displaystyle \frac{\tfrac12}{x - 1} + \frac{-4}{x - 2} + \frac{\tfrac92}{x - 3}} {\displaystyle \frac{\tfrac12}{x - 1} + \frac{-1}{x - 2} + \frac{\tfrac12}{x - 3}}.[src] ==Notes== ) when using equidistant nodes.[src] The oscillation is much smaller when using Chebyshev nodes.[src] The Lagrange form of the interpolation polynomial shows the linear character of polynomial interpolation and the uniqueness of the interpolation polynomial.[src] Therefore, it is preferred in proofs and theoretical arguments.[src] Uniqueness can also be seen from the invertibility of the Vandermonde matrix, due to the non-vanishing of the Vandermonde determinant.[src] But, as can be seen from the construction, each time a node changes, all Lagrange basis polynomials have to be recalculated.[src] A better form of the interpolation polynomial for practical (or computational) purposes is the barycentric form of the Lagrange interpolation (see below) or Newton polynomials.[src] Lagrange and other interpolation at equally spaced points, as in the example above, yield a polynomial oscillating above and below the true function.[src] This behaviour tends to grow with the number of points, leading to a divergence known as Runge's phenomenon; the problem may be eliminated by choosing interpolation points at Chebyshev nodes.[src] The Lagrange basis polynomials can be used in numerical integration to derive the Newton–Cotes formulas.[src] ==Remainder in Lagrange interpolation formula== When interpolating a given function by a polynomial of degree at the nodes x_0,\dots, x_k we get the remainder R(x) = f(x) - L(x) which can be expressed as \begin{align} R(x) &= f[x_0,\ldots,x_k,x] \ell(x) \\[1ex] &= \ell(x) \frac{f^{(k+1)}(\xi)}{(k+1)!}, & x_0 where f[x_0,\ldots,x_k,x] is the notation for divided differences.[src] Alternatively, the remainder can be expressed as a contour integral in complex domain as \begin{align} R(x) &= \frac{\ell(x)}{2\pi i} \int_C \frac{f(t)}{(t-x)(t-x_0) \cdots (t-x_k)} dt \\[1ex] &= \frac{\ell(x)}{2\pi i} \int_C \frac{f(t)}{(t-x)\ell(t)} dt.[src] \end{align} The remainder can be bound as |R(x)| \leq \frac{(x_k-x_0)^{k+1}}{(k+1)!}\max_{x_0 \leq \xi \leq x_k} |f^{(k+1)}(\xi)|.[src] === Derivation=== Clearly, R(x) is zero at nodes.[src] To find R(x) at a point define a new function F(x) = R(x)-\tilde{R}(x) = f(x)-L(x)-\tilde{R}(x) and choose \tilde{R}(x) = C\cdot\prod_{i=0}^k(x-x_i) where C is the constant we are required to determine for a given x_p .[src] We choose C so that F(x) has k+2 zeroes (at all nodes and x_p ) between x_0 and x_k (including endpoints).[src] Assuming that f(x) is k+1 -times differentiable, since L(x) and \tilde{R}(x) are polynomials, and therefore, are infinitely differentiable, F(x) will be k+1 -times differentiable.[src] By Rolle's theorem, F^{(1)}(x) has k+1 zeroes, F^{(2)}(x) has k zeroes...[src] F^{(k+1)} has 1 zero, say where Explicitly writing F^{(k+1)}(\xi) : F^{(k+1)}(\xi)=f^{(k+1)}(\xi)-L^{(k+1)}(\xi)-\tilde{R}^{(k+1)}(\xi) L^{(k+1)}=0,\tilde{R}^{(k+1)}=C\cdot(k+1)![src] (Because the highest power of x in \tilde{R}(x) is k+1 ) 0=f^{(k+1)}(\xi)-C\cdot(k+1)![src] The equation can be rearranged as C=\frac{f^{(k+1)}(\xi)}{(k+1)!} Since F(x_p) = 0 we have R(x_p)=\tilde{R}(x_p) = \frac{f^{k+1}(\xi)}{(k+1)!} \prod_{i=0}^k(x_p-x_i) ==Derivatives== The th derivative of a Lagrange interpolating polynomial can be written in terms of the derivatives of the basis polynomials, L^{(d)}(x) := \sum_{j=0}^{k} y_j \ell_j^{(d)}(x).[src] Recall (see above) that each Lagrange basis polynomial is \begin{aligned} \ell_j(x) &= \prod_{\begin{smallmatrix}m = 0\\ m\neq j\end{smallmatrix}}^k \frac{x-x_m}{x_j-x_m}.[src] \end{aligned} The first derivative can be found using the product rule: \begin{align} \ell_j'(x) &= \sum_{\begin{smallmatrix}i=0 \\ i\not=j\end{smallmatrix}}^k \Biggl[ \frac{1}{x_j-x_i}\prod_{\begin{smallmatrix}m=0 \\ m\not = (i , j)\end{smallmatrix}}^k \frac{x-x_m}{x_j-x_m} \Biggr] \\[5mu] &= \ell_j(x)\sum_{\begin{smallmatrix}i=0 \\i\not=j\end{smallmatrix}}^k \frac{1}{x-x_i}.[src] \end{align} The second derivative is \begin{align} \ell_j(x) &= \sum_{\begin{smallmatrix}i=0 \\ i\ne j\end{smallmatrix}}^{k} \frac{1}{x_j-x_i} \Biggl[ \sum_{\begin{smallmatrix}m=0 \\ m\ne(i,j)\end{smallmatrix}}^{k} \Biggl( \frac{1}{x_j-x_m} \prod_{\begin{smallmatrix}n=0 \\ n\ne(i,j,m)\end{smallmatrix}}^{k} \frac{x-x_n}{x_j-x_n} \Biggr) \Biggr] \\[10mu] &= \ell_j(x) \sum_{0 \leq i The third derivative is \begin{align} \ell_j(x) &= \ell_j(x) \sum_{0 \leq i and likewise for higher derivatives.[src] Note that all of these formulas for derivatives are invalid at or near a node.[src] A method of evaluating all orders of derivatives of a Lagrange polynomial efficiently at all points of the domain, including the nodes, is converting the Lagrange polynomial to power basis form and then evaluating the derivatives.[src] f(\mathbf{x}) = \sum_{i=0}^{U-1} \alpha_i {\mathbf x}^{\mathbf{k}_i} be a degree- d polynomial on n variables, where U = \binom{n+d}{n} is the number of terms and {\mathbf x}^{\mathbf{k}_i} = \prod_{j=0}^{n-1} x_j^{k_{ij}}.[src] Let then M be the U \times U matrix with elements M_{ab} = \mathbf{t}_a^{\mathbf{k}_b} for some set of points \{\mathbf{t}_i\}_{i=0}^{U-1} .[src] This set of points uniquely determines the polynomial f iff \Delta:=\det(M) \neq 0 .[src] In this case we can construct the Lagrange basis as follows: \ell_i(\mathbf{x}) = \frac{\Delta_i(\mathbf{x})}{\Delta}, where \Delta_i(\mathbf{x}) is the determinant of the matrix M^{(i)}(\mathbf{x}) with elements M^{(i)}(\mathbf{x})_{ab} = \delta_{ai}\mathbf{x}_a^{\mathbf{k}_b} + (1-\delta_{ai})\mathbf{t}_a^{\mathbf{k}_b}.[src] Then it holds that f(\mathbf{x}) = \sum_{i=0}^{U-1} f(\mathbf{t}_i) \ell_i( {\mathbf x}) ==Finite fields== The Lagrange polynomial can also be computed in finite fields.[src] This has applications in cryptography, such as in Shamir's Secret Sharing scheme.[src] ==See also== Neville's algorithm Newton form of the interpolation polynomial Bernstein polynomial Carlson's theorem Lebesgue constant The Chebfun system Table of Newtonian series Frobenius covariant Sylvester's formula Finite difference coefficient Hermite interpolation ==References== ==External links== ALGLIB has an implementations in C++ / C# / VBA / Pascal.[src] GSL has a polynomial interpolation code in C SO has a MATLAB example that demonstrates the algorithm and recreates the first image in this article Lagrange Method of Interpolation — Notes, PPT, Mathcad, Mathematica, MATLAB, Maple Lagrange interpolation polynomial on www.math-linux.com Excel Worksheet Function for Bicubic Lagrange Interpolation Lagrange polynomials in Python[src]
86 sentences · 86 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Lagrange polynomial." encyclopegia.org, 2026, https://encyclopegia.org/wiki/lagrange-polynomial. Accessed 04 December 2026.
Chicago
"Lagrange polynomial." encyclopegia.org. Accessed December 4, 2026. https://encyclopegia.org/wiki/lagrange-polynomial.
APA
encyclopegia.org. (2026). Lagrange polynomial. Retrieved December 4, 2026, from https://encyclopegia.org/wiki/lagrange-polynomial
Accessed December 4, 2026 · CC BY-SA 4.0 · citation page · JSON
Claims
| Predicate | Value | Source |
|---|---|---|
| publication date | 1795 | Wikipedia |
| publication date | 1783 | Wikipedia |