Fiveable

🔢Numerical Analysis I Unit 6 Review

QR code for Numerical Analysis I practice questions

6.2 Lagrange Interpolation Formula

6.2 Lagrange Interpolation Formula

Written by the Fiveable Content Team • Last updated August 2025
Written by the Fiveable Content Team • Last updated August 2025
🔢Numerical Analysis I
Unit & Topic Study Guides

Lagrange Interpolation Formula is a powerful tool for constructing polynomials that pass through given data points. It uses unique basis polynomials to create a linear combination weighted by y-values, ensuring exact interpolation.

This method is crucial in numerical analysis, offering a closed-form solution without solving equations. However, it can be prone to oscillations with high-degree polynomials, leading to alternatives like spline interpolation for larger datasets.

Lagrange Interpolation Formula

Formula Definition and Characteristics

  • Lagrange interpolation formula constructs a unique polynomial passing through a given set of data points
  • Expresses interpolating polynomial as linear combination of Lagrange basis polynomials weighted by y-values of data points
  • Degree of Lagrange interpolating polynomial at most n-1 (n data points)
  • Guarantees exact interpolation through all given data points
  • Provides closed-form expression for interpolating polynomial without solving equations
  • Formula: P(x)=i=0nyiLi(x)P(x) = \sum_{i=0}^n y_i \cdot L_i(x)
    • P(x) interpolating polynomial
    • yi y-values of data points
    • Li(x) Lagrange basis polynomials

Formula Derivation

  • Involves constructing basis polynomials zero at all data points except one where it equals 1
  • Steps in derivation:
    • Define n+1 data points (x0, y0), (x1, y1), ..., (xn, yn)
    • Construct Lagrange basis polynomial Li(x) for each point
    • Ensure Li(xi) = 1 and Li(xj) = 0 for j ≠ i
    • Form linear combination of basis polynomials weighted by y-values
  • Resulting formula satisfies interpolation conditions by construction
  • Uniqueness proven by polynomial degree and number of constraints

Applications and Limitations

  • Used in various fields (numerical analysis, computer graphics, signal processing)
  • Suitable for small to moderate sets of data points
  • Prone to Runge's phenomenon for high-degree polynomials with equidistant points
  • Alternatives for large datasets or to avoid oscillations (spline interpolation, Chebyshev interpolation)
  • Computational complexity O(n^2) for n data points, limiting scalability for very large datasets

Lagrange Basis Polynomials

Definition and Properties

  • Fundamental building blocks of Lagrange interpolation formula
  • For n+1 data points, n+1 Lagrange basis polynomials exist (L0(x), L1(x), ..., Ln(x))
  • Each Li(x) constructed to be 1 at xi and 0 at all other data points xj (j ≠ i)
  • General form: Li(x)=j=0,jinxxjxixjL_i(x) = \prod_{j=0, j\neq i}^n \frac{x - x_j}{x_i - x_j}
  • Denominator (xi - xj) ensures Li(xi) = 1 and acts as normalizing factor
  • Product of (x - xj) terms in numerator guarantees Li(x) = 0 at other data points
  • Construction depends only on x-coordinates, independent of y-values
Formula Definition and Characteristics, Linear interpolation - Wikipedia

Characteristics and Behavior

  • Degree of each basis polynomial is n (one less than number of data points)
  • Sum of all basis polynomials equals 1 for any x (partition of unity property)
  • Basis polynomials are orthogonal at data points
  • Shape of basis polynomials affected by distribution of data points
    • Evenly spaced points lead to symmetric basis polynomials
    • Unevenly spaced points result in asymmetric basis polynomials
  • Oscillatory behavior increases with polynomial degree (related to Runge's phenomenon)

Construction Process

  • Steps to construct Lagrange basis polynomial Li(x):
    • Initialize Li(x) = 1
    • For each j ≠ i, multiply Li(x) by (x - xj) / (xi - xj)
    • Repeat for all data points to obtain final Li(x)
  • Example for 3 data points (x0, x1, x2):
    • L0(x) = ((x - x1) / (x0 - x1)) * ((x - x2) / (x0 - x2))
    • L1(x) = ((x - x0) / (x1 - x0)) * ((x - x2) / (x1 - x2))
    • L2(x) = ((x - x0) / (x2 - x0)) * ((x - x1) / (x2 - x1))

Interpolation with Lagrange Formula

Interpolation Process

  • Evaluate Lagrange interpolation polynomial P(x) at arbitrary point x
  • Steps for interpolation:
    • Calculate each Lagrange basis polynomial Li(x) at desired point x
    • Multiply each Li(x) by corresponding y-value
    • Sum products to obtain interpolated value
  • Can interpolate within or outside range of given data points
    • Extrapolation (outside range) may lead to large errors
  • Accuracy depends on smoothness of underlying function and distribution of data points
  • Exact at given data points but may exhibit oscillatory behavior for high-degree polynomials

Accuracy and Error Analysis

  • Sources of interpolation error:
    • Runge's phenomenon for high-degree polynomials with equidistant points
    • Roundoff errors in floating-point calculations
    • Ill-conditioning for closely spaced data points
  • Error bounds can be derived using Taylor series expansion
  • Interpolation error generally decreases as number of data points increases
  • Choice of interpolation points affects accuracy
    • Chebyshev nodes often provide better results than equidistant points
    • Clustered points near boundaries can reduce oscillations
Formula Definition and Characteristics, Graphs of Polynomial Functions | College Algebra

Advanced Techniques and Modifications

  • Barycentric form of Lagrange interpolation for improved numerical stability
  • Use of orthogonal polynomials (Chebyshev, Legendre) as basis functions
  • Adaptive selection of interpolation points to minimize error
  • Regularization techniques to reduce oscillations in high-degree interpolation
  • Combination with other interpolation methods (splines) for piecewise interpolation

Lagrange Interpolation Algorithm

Algorithm Implementation

  • Choose data structure to represent set of data points (x, y)
    • Arrays, lists, or custom classes (Point) for efficient storage and access
  • Implement function to calculate individual Lagrange basis polynomials Li(x)
    • Input: set of x-coordinates, index i, target x-value
    • Output: value of Li(x) at target x
  • Develop main interpolation function:
    • Input: data points (x, y), target x-value
    • Output: interpolated y-value
  • Use nested loops to compute:
    • Product terms in Lagrange basis polynomials
    • Weighted sum of interpolation formula
  • Implement error handling:
    • Check for duplicate x-coordinates
    • Ensure sufficient data points (at least 2)
    • Handle potential division by zero

Optimization Techniques

  • Precompute and store constant terms reused in multiple calculations
    • Products of (xi - xj) in denominators of basis polynomials
  • Implement vectorized version of algorithm for improved performance
    • Utilize libraries (NumPy) for efficient array operations
  • Use Horner's method for polynomial evaluation to reduce multiplications
  • Employ barycentric form of Lagrange interpolation for numerical stability
  • Implement caching mechanisms for repeated interpolations on same dataset

Example Implementation (Python)

  • Basic Lagrange interpolation function:
</>Python
def lagrange_interpolation(x, y, x_interp):
    n = len(x)
    y_interp = 0
    for i in range(n):
        li = 1
        for j in range(n):
            if i != j:
                li *= (x_interp - x[j]) / (x[i] - x[j])
        y_interp += y[i] * li
    return y_interp
  • Usage:
</>Python
x_data = [0, 1, 2, 3]
y_data = [1, 2, 4, 8]
x_interp = 1.5
y_interp = lagrange_interpolation(x_data, y_data, x_interp)
print(f"Interpolated value at x = {x_interp}: {y_interp}")
Pep mascot
Upgrade your Fiveable account to print any study guide

Download study guides as beautiful PDFs See example

Print or share PDFs with your students

Always prints our latest, updated content

Mark up and annotate as you study

Click below to go to billing portal → update your plan → choose Yearly → and select "Fiveable Share Plan". Only pay the difference

Plan is open to all students, teachers, parents, etc
Pep mascot
Upgrade your Fiveable account to export vocabulary

Download study guides as beautiful PDFs See example

Print or share PDFs with your students

Always prints our latest, updated content

Mark up and annotate as you study

Plan is open to all students, teachers, parents, etc
report an error
description

screenshots help us find and fix the issue faster (optional)

add screenshot

2,589 studying →