ArticleslgStudy

science

Lagrange polynomial

Lagrange polynomial is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Lagrange polynomial rather than just read about it. In short: In numerical analysis, the Lagrange interpolating polynomial is the unique polynomial of lowest degree that interpolates a given set of data. Given a data set of coordinate pairs ⁠(xj,yj)⁠, the ⁠xj⁠ are called nodes and the ⁠yj⁠ are called values.

Lagrange polynomial — main illustration
Lagrange polynomial — illustration

Key takeaways

  • Lagrange polynomial belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Lagrange polynomial to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Lagrange polynomial from memory before moving on to harder problems.

Reference excerpt

In numerical analysis, the Lagrange interpolating polynomial is the unique polynomial of lowest degree that interpolates a given set of data. Given a data set of coordinate pairs ⁠(xj,yj)⁠, the ⁠xj⁠ are called nodes and the ⁠yj⁠ are called values. The Lagrange polynomial ⁠L(x)⁠ which interpolates the data assumes each value at the corresponding node, ⁠L(xj)=yj⁠. If there are ⁠k+1⁠ data pairs, the Lagrange polynomial has degree ⁠≤k⁠. Although named after Joseph-Louis Lagrange, who published it in 1795, the method was first discovered in 1779 by Edward Waring. It is also an easy consequence of a formula published in 1783 by Leonhard Euler. 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. For equispaced nodes, Lagrange interpolation is susceptible to Runge's phenomenon of large oscillation. In matrix theory, Lagrange polynomials are also related to the evaluation of matrix functions and eigenspace projection via Frobenius covariants.

Definition Given a set of ⁠k+1⁠ nodes {x0,x1,…,xk}, which must all be distinct, ⁠xj≠xm⁠ for indices ⁠j≠m⁠, the Lagrange basis for polynomials of degree ⁠≤k⁠ for those nodes is the set of polynomials {ℓ0(x),ℓ1(x),…,ℓk(x)} each of degree ⁠k⁠ which take values ⁠ℓj(xm)=0⁠ if ⁠m≠j⁠ and ⁠ℓj(xj)=1⁠. Using the Kronecker delta this can be written ⁠ℓj(xm)=δjm⁠. Each basis polynomial can be explicitly described by the product: ℓj(x)=(x−x0)(xj−x0)⋯(x−xj−1)(xj−xj−1)(x−xj+1)(xj−xj+1)⋯(x−xk)(xj−xk)=∏0≤m≤km≠jx−xmxj−xm|. Notice that the numerator ⁠∏m≠j(x−xm)⁠ has ⁠k⁠ roots at the nodes {xm}m≠j while the denominator ⁠∏m≠j(xj−xm)⁠ scales the resulting polynomial so that ⁠ℓj(xj)=1⁠. The Lagrange interpolating polynomial for those nodes through the corresponding values {y0,y1,…,yk} is the linear combination: L(x)=∑j=0kyjℓj(x). Each basis polynomial has degree ⁠k⁠, so the sum ⁠L(x)⁠ has degree ⁠≤k⁠, and it interpolates the data because ⁠L(xm)=∑j=0kyjℓj(xm)=∑j=0kyjδmj=ym⁠. The interpolating polynomial is unique. Proof: assume some polynomial ⁠M(x)⁠ of degree ⁠≤k⁠ interpolates the data. Then the difference ⁠M(x)−L(x)⁠ is zero at ⁠k+1⁠ distinct nodes {x0,x1,…,xk}. But the only polynomial of degree ⁠≤k⁠ with more than ⁠k⁠ roots is the constant zero function, so ⁠M(x)−L(x)=0⁠, or ⁠M(x)=L(x)⁠. 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.

Barycentric form Each Lagrange basis polynomial ⁠ℓj(x)⁠ can be rewritten as the product of three parts, a function ⁠ℓ(x)=∏m(x−xm)⁠ common to every basis polynomial, a node-specific constant ⁠wj=∏m≠j(xj−xm)−1⁠ (called the barycentric weight), and a part representing the displacement from ⁠xj⁠ to ⁠x⁠: ℓj(x)=ℓ(x)wjx−xj By factoring ⁠ℓ(x)⁠ out from the sum, we can write the Lagrange polynomial in the so-called first barycentric form: L(x)=ℓ(x)∑j=0kwjx−xjyj. If the weights ⁠wj⁠ have been pre-computed, this requires only ⁠𝒪(k)⁠ operations compared to ⁠𝒪(k2)⁠ for evaluating each Lagrange basis polynomial ⁠ℓj(x)⁠ individually. (See Big O notation.) The barycentric interpolation formula can also easily be updated to incorporate a new node ⁠xk+1⁠ by dividing each of the ⁠wj⁠, ⁠j=0…k⁠ by ⁠(xj−xk+1)⁠ and constructing the new ⁠wk+1⁠ as above. For any ⁠x⁠, ∑j=0kℓj(x)=1 because the constant function g(x)=1 is the unique polynomial of degree ≤k interpolating the data {(x0,1),(x1,1),…,(xk,1)}. We can thus further simplify the barycentric formula by dividing L(x)=L(x)/g(x): L(x)=ℓ(x)∑j=0kwjx−xjyj/ℓ(x)∑j=0kwjx−xj=∑j=0kwjx−xjyj/∑j=0kwjx−xj. This is called the second form or true form of the barycentric interpolation formula. This second form has advantages in computation cost and accuracy: it avoids evaluation of ℓ(x); the work to compute each term in the denominator wj/(x−xj) has already been done in computing (wj/(x−xj))yj 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 xj, catastrophic cancelation would ordinarily be a problem for the value (x−xj), however this quantity appears in both numerator and denominator and the two cancel leaving good relative accuracy in the final result. Using this formula to evaluate L(x) at one of the nodes xj will result in the indeterminate ∞yj/∞; computer implementations must replace such results by L(xj)=yj. Each Lagrange basis polynomial can also be written in barycentric form: ℓj(x)=wjx−xj/∑m=0kwmx−xm.

A perspective from linear algebra Solving an interpolation problem leads to a problem in linear algebra amounting to inversion of a matrix. Using a standard monomial basis for our interpolation polynomial L(x)=∑j=0kxjmj, we must invert the Vandermonde matrix (xi)j to solve L(xi)=yi for the coefficients mj of L(x). By choosing a better basis, the Lagrange basis, L(x)=∑j=0kℓj(x)yj, we merely get the identity matrix, δij, which is its own inverse: the Lagrange basis automatically inverts the analog of the Vandermonde matrix. More explicitly, let ⁠L⁠ be the inverse Vandermonde matrix such that: L=(L00⋯L0n⋮⋱⋮Ln0⋯Lnn). The Lagrange basis polynomial ⁠ℓj(x)⁠ can be expressed directly using the columns of ⁠L⁠: ℓj(x)=L0j+L1jx+⋯+Lnjxn. This construction is analogous to 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. Furthermore, when the order is large, Fast Fourier transformation can be used to solve for the coefficients of the interpolated polynomial. In numerical practice, directly computing ⁠L⁠ by inverting the Vandermonde matrix is generally avoided because Vandermonde matrices are notoriously ill-conditioned. 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; one approach to circumvent these errors is to convert floating-point values into exact rational numbers and perform the inversion in exact rational arithmetic.

… excerpt ends here. Continue reading the full article.

Illustrations

Lagrange polynomial: This image shows, for four data points (@media screen{html.skin-theme-clientpref-night .mw-parser-output div:not(.notheme)>.tmp-color,html.skin-theme-clientpref-night .mw-parser-output p>.tmp-color,html.skin-theme-clientpref-night .mw-parser-output table:not(.notheme) .tmp-color{color:inherit!important}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output div:not(.notheme)>.tmp-color,html.skin-theme-clientpref-os .mw-parser-output p>.tmp-color,html.skin-theme-clientpref-os .mw-parser-output table:not(.notheme) .tmp-color{color:inherit!important}}.mw-parser-output .texhtml{font-family:"Nimbus Roman No9 L","Times New Roman",Times,serif;font-size:118%;line-height:1;font-variant-numeric:lining-nums tabular-nums;font-kerning:none}.mw-parser-output .texhtml .texhtml{font-size:100%}.mw-parser-output .texhtml-big{font-size:165%}.mw-parser-output .mvar{font-style:italic}@media(min-width:420px){.mw-parser-output .texhtml{white-space:nowrap}}(−9, 5), (−4, 2), (−1, −2), (7, 9)), the (cubic) interpolation polynomial L(x) (dashed, black), which is the sum of the scaled basis polynomials y0ℓ0(x), y1ℓ1(x), y2ℓ2(x) and y3ℓ3(x). The interpolation polynomial passes through all four control points, and each scaled basis polynomial passes through its respective control point and is 0 where x corresponds to the other three control points.
This image shows, for four data points (@media screen{html.skin-theme-clientpref-night .mw-parser-output div:not(.notheme)>.tmp-color,html.skin-theme-clientpref-night .mw-parser-output p>.tmp-color,html.skin-theme-clientpref-night .mw-parser-output table:not(.notheme) .tmp-color{color:inherit!important}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output div:not(.notheme)>.tmp-color,html.skin-theme-clientpref-os .mw-parser-output p>.tmp-color,html.skin-theme-clientpref-os .mw-parser-output table:not(.notheme) .tmp-color{color:inherit!important}}.mw-parser-output .texhtml{font-family:"Nimbus Roman No9 L","Times New Roman",Times,serif;font-size:118%;line-height:1;font-variant-numeric:lining-nums tabular-nums;font-kerning:none}.mw-parser-output .texhtml .texhtml{font-size:100%}.mw-parser-output .texhtml-big{font-size:165%}.mw-parser-output .mvar{font-style:italic}@media(min-width:420px){.mw-parser-output .texhtml{white-space:nowrap}}(−9, 5), (−4, 2), (−1, −2), (7, 9)), the (cubic) interpolation polynomial L(x) (dashed, black), which is the sum of the scaled basis polynomials y0ℓ0(x), y1ℓ1(x), y2ℓ2(x) and y3ℓ3(x). The interpolation polynomial passes through all four control points, and each scaled basis polynomial passes through its respective control point and is 0 where x corresponds to the other three control points.
Lagrange polynomial: Polynomial interpolation suffers from significant oscillations near the endpoints (Runge's phenomenon) when using equidistant nodes. The oscillation is much smaller when using Chebyshev nodes.
Polynomial interpolation suffers from significant oscillations near the endpoints (Runge's phenomenon) when using equidistant nodes. The oscillation is much smaller when using Chebyshev nodes.

Worked examples

Example 1 — a first encounter with Lagrange polynomial

Start with the simplest possible case. Write down what Lagrange polynomial claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Lagrange polynomial before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Lagrange polynomial ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Lagrange polynomial

In research
Lagrange polynomial appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Lagrange polynomial in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Lagrange polynomial is common in secondary-school and first-year university syllabi. It links to neighbouring topics Interpolation, Polynomials, so understanding it makes those chapters shorter.
In everyday life
Look for Lagrange polynomial outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Lagrange polynomial” →

How to study Lagrange polynomial in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Lagrange polynomial means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Lagrange polynomial out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Lagrange polynomial in simple terms?

In numerical analysis, the Lagrange interpolating polynomial is the unique polynomial of lowest degree that interpolates a given set of data. Given a data set of coordinate pairs ⁠(xj,yj)⁠, the ⁠xj⁠ are called nodes and the ⁠yj⁠ are called values.

Why does Lagrange polynomial matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Lagrange polynomial?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Lagrange polynomial.

Tags

  • Interpolation
  • Polynomials

Keep exploring