notesonly.in

One notebook for every subject — open it anywhere.

Log in

Lagrange Interpolation: Formula and Worked Examples

Lagrange interpolation builds the unique polynomial passing exactly through given data points, using special basis polynomials: the i-th equals 1 at the i-th data point and 0 at every other. Multiply each by its data value y_i and add — at each data point only one term survives, so the sum matches every point perfectly.

Lagrange is the theoretical foundation of all polynomial interpolation: the formula needs no linear-system solving — you write it down directly from the points. It also underlies numerical integration (integrating the interpolant gives Newton-Cotes rules) and finite-difference formulas.

Key Concepts

  • Interpolating polynomial: the unique polynomial of degree at most n − 1 passing through n given points (x_i, y_i) with distinct x_i.
  • Lagrange basis polynomial l_i(x): equals 1 at x_i and 0 at all other nodes x_j. It is a product of n − 1 linear factors.
  • Nodes: the x-coordinates of the data points, which must all be different.
  • Interpolation error: if the data comes from a smooth function f, the error at x is f^(n)(ξ)/n! times the product of (x − x_i) over all nodes, for some ξ between the extreme nodes.

Formulas

  • Basis polynomial: l_i(x) = Π_j≠i (x − x_j) / (x_i − x_j).
  • Interpolant: P(x) = Σ_i y_i l_i(x).
  • Error formula: f(x) − P(x) = f^(n)(ξ) / n! · Π_i (x − x_i), assuming f has n continuous derivatives. The error is zero at the nodes and grows between them.
  • Evaluation cost: the direct formula takes about n² operations per point; the barycentric form reduces this to linear time.

Worked Example

Find the quadratic through (1, 2), (2, 5), (4, 17) and evaluate at x = 3. Basis polynomials: l₁(x) = (x − 2)(x − 4)/3; l₂(x) = (x − 1)(x − 4)/(−2); l₃(x) = (x − 1)(x − 2)/6. At x = 3: l₁(3) = −1/3; l₂(3) = 1; l₃(3) = 1/3. Then P(3) = 2(−1/3) + 5(1) + 17(1/3) = 5 + 15/3 = 10. The points lie on y = x² + 1 (1 + 1 = 2, 4 + 1 = 5, 16 + 1 = 17), and 3² + 1 = 10 — confirming the interpolation.

Common Misconceptions

  • "Higher-degree interpolation is always more accurate." With equally spaced nodes, high-degree polynomials can oscillate wildly between points — the Runge phenomenon. More points do not guarantee a better fit.
  • "The interpolant only approximates the data points." It passes through them exactly (up to round-off). The approximation error is between the points, where the polynomial may differ from the true function.
  • "Different methods give different interpolating polynomials." The degree ≤ n − 1 interpolant through n points is unique — Lagrange, Newton divided differences, or solving the Vandermonde system all produce the same polynomial.

Real-World Applications

  • Estimating missing data: filling gaps in sensor readings or financial time series.
  • Computer graphics: drawing smooth curves through control points.
  • Numerical integration: integrating the Lagrange interpolant over an interval produces the trapezoidal and Simpson rules.
  • Cryptography: Shamir's secret sharing splits a secret using polynomial interpolation so only enough shares reconstruct it.

Lagrange interpolation writes the unique degree ≤ n − 1 polynomial through n points directly as Σ y_i l_i(x), with basis polynomials that are 1 at their own node and 0 elsewhere. It is exact at the data points, simple to construct, and the gateway to numerical integration and differentiation formulas.