Lagrange Interpolation

Lagrange interpolation is a method for Polynomial Interpolation that constructs a unique polynomial passing through a given set of points using Lagrange basis polynomials.

Formula

Given data points , the Lagrange interpolating polynomial is:

Where are the Lagrange basis polynomials:

Expanded Form

The full formula can be written as:

Lagrange Basis Polynomials

The basis polynomial has the special property:

This ensures that for all data points.

Example: Three Points

For three points :

The interpolating polynomial is then:

Properties

  1. Uniqueness: There is a unique polynomial of degree at most passing through points
  2. Symmetry: The formula treats all points equally
  3. Direct evaluation: No need to build a table (unlike Newton Divided Difference)
  4. Exact at data points: by construction

Advantages

  • Conceptually simple: Direct formula, no iterative computation
  • Symmetric: All data points treated equally
  • Single formula: Entire polynomial expressed in one equation

Limitations

  1. Computational cost: Evaluating at many points is expensive
  2. No incremental updates: Adding new points requires full recomputation
  3. Runge phenomenon: High-degree polynomials oscillate wildly, especially with equispaced points
  4. Poor extrapolation: Should not be used for extrapolation beyond data range
  5. Edge effects: Interpolation quality degrades near endpoints

Behaviour Characteristics

  • Center: Excellent fit in the center of data range
  • Edges: Accuracy degrades toward endpoints
  • Oscillations: Can exhibit large oscillations between points for high-degree polynomials

Comparison to Newton’s Method

Both Lagrange and Newton Divided Difference produce identical polynomials but differ in:

AspectLagrangeNewton
ComputationDirect formulaRecursive table
Incremental updatesRequires full recomputationEfficient incremental updates
SymmetryFully symmetricDepends on point ordering
Evaluation costHigherLower
Conceptual claritySimplerMore complex

Error Analysis

The interpolation error for a function with continuous -th derivative is:

For some in the interval containing and all .

Python Implementation

def lagrange_polynomial(x_value, x_data, y_data):
    """
    Evaluate Lagrange interpolating polynomial at a given point.
    
    Parameters
    ----------
    x_value : float
        Point at which to evaluate the polynomial
    x_data : numpy.ndarray
        Array of x-coordinates
    y_data : numpy.ndarray
        Array of y-coordinates (function values)
        
    Returns
    -------
    float
        Value of the polynomial at x_value
    """
    num_points = len(x_data)
    result = 0.0
    
    for point_index in range(num_points):
        # Compute Lagrange basis polynomial L_i(x_value)
        basis_term = 1.0
        for other_index in range(num_points):
            if other_index != point_index:
                basis_term *= (x_value - x_data[other_index]) / (x_data[point_index] - x_data[other_index])
        
        # Add contribution y_i * L_i(x_value)
        result += basis_term * y_data[point_index]
    
    return result

Applications

  • Function approximation
  • Numerical analysis
  • Computer graphics
  • Scientific computing