In our last lecture, we established that while polynomial interpolation is a powerful idea, the naive approach using the monomial basis is a numerical trap due to the ill-conditioned Vandermonde matrix. The Newton basis provided a much more stable and efficient alternative by constructing the polynomial incrementally.
Today, we will explore another perspective on the same problem: the Lagrange form of the interpolating polynomial. This approach will lead us to a profound insight: the choice of the interpolation points is just as important as the algorithm we use.
The Lagrange Basis: A Different Set of Building Blocks
The Newton basis was constructed to make the system matrix for the coefficients lower triangular. The Lagrange basis is built on an even simpler and more elegant idea.
Recall that we are looking for a polynomial in the space of polynomials of degree at most , , such that . We can write this polynomial as a linear combination of basis functions:
Look closely at this formula. We are using the data values directly as the coefficients. For this to work, the basis functions must have a very special property. When we evaluate this sum at a node , we want to get . This means that for the sum to collapse to just the term , we need to be 1 when and 0 when .
This leads to the definition of the Lagrange cardinal basis polynomials.
Recall: We looked at this in Discrete Math class: Lagrange Interpolation
Definition: Lagrange Cardinal Polynomials
For a given set of distinct nodes , the -th Lagrange cardinal polynomial, , is the unique polynomial of degree that satisfies:
This “picker” property is the defining characteristic of a cardinal basis.
How do we construct such a polynomial? To make equal to zero at all nodes where , the polynomial must contain the factors . This gives us the numerator:
This product is a polynomial of degree that is zero at all the correct nodes. Now, we just need to ensure it equals 1 at . We can achieve this by simply dividing by the value of the numerator at :
/Semester-3/Numerical-Methods-for-Computer-Science/Lecture-Notes/attachments/Pasted-image-20250927124343.png)
The plot on the slide shows the five Lagrange basis polynomials for five nodes. Notice how each polynomial (e.g., the red one) is equal to 1 at its corresponding node and 0 at all other nodes.
The Lagrange Interpolating Polynomial
With this basis, constructing the final interpolating polynomial is trivial. We don’t need to solve any system of equations. The solution is given immediately by the Lagrange form:
This is the same unique interpolating polynomial we found with the Newton method, just expressed in a different basis.
A Beautiful Property: Partition of Unity
The Lagrange basis polynomials have a remarkable property: they sum to one.
Proof: Consider interpolating the constant function . The data values are for all . The unique polynomial of degree that passes through these points is simply the constant polynomial . Using the Lagrange form, this polynomial is . Therefore, the sum of the basis functions must be 1. This is called a “partition of unity.”
The Barycentric Form: A More Stable and Efficient Way to Evaluate
We’ve seen that the Lagrange form provides a beautiful theoretical solution to the interpolation problem:
However, if we try to use this formula directly for computation, we run into two problems:
- Inefficiency: To evaluate at a single point, we must compute each of the Lagrange polynomials . Each involves a product of terms. This leads to a total cost of operations for each point we want to evaluate. If we need to plot the polynomial, this becomes very expensive.
- Numerical Instability: For large , the numerator and denominator in can become very large or very small, leading to potential issues with overflow, underflow, and rounding errors, especially when is far from the interpolation interval.
We need a smarter way to evaluate the same polynomial. This is where the barycentric form comes in. It is not a different polynomial; it is an algebraic rearrangement of the Lagrange form that is far superior for computation.
Derivation: From Lagrange to Barycentric
Let’s start by defining two key components.
1. The Nodal Polynomial, : This is the polynomial whose roots are simply our interpolation nodes.
We can use this to simplify the numerator of our Lagrange polynomial . The product in the numerator is just with the term missing. So, we can write:
2. The Barycentric Weights, : These are constants that depend only on the nodes . The -th weight is defined as:
Notice that the denominator here is exactly the same as the denominator in the original Lagrange polynomial .
Now, let’s substitute these into the Lagrange formula for :
This is already a much cleaner expression. Now, substitute this back into the main Lagrange sum for :
Since does not depend on the summation index , we can factor it out:
This is the first barycentric form. It’s better, but we can make it even more stable.
The final trick comes from the “partition of unity” property we saw earlier: . Let’s rewrite this using our new expression for :
Factoring out gives:
Now, substitute this expression for back into our first barycentric form.
This gives us the final result:
This is the second barycentric form, and it is the state-of-the-art method for evaluating interpolating polynomials.
Intuition: What Does “Barycentric” Mean?
The name “barycentric” comes from the concept of a center of mass (a barycenter). The formula expresses the value of the interpolating polynomial as a weighted average of the data values .
The weights sum to 1. The term acts as a measure of proximity. When the evaluation point is very close to a node , the term becomes huge. This makes the weight for that point approach 1, and all other weights approach 0. Consequently, the value of the polynomial approaches , exactly as it should. The value of the polynomial at any point is a blend of the values at the nodes, with the nearest nodes having the most influence.
Why the Barycentric Form is So Good
Let’s summarize the immense practical advantages of this formula.
Advantages of the Barycentric Form
Efficiency (The “Prep-then-Eval” Strategy): The most expensive part of the process is calculating the barycentric weights . This takes operations. However, the crucial point is that the weights depend only on the nodes , not on the data values . We can perform this expensive calculation once as a pre-computation step. After that, every single evaluation of at a new point costs only operations. This is a massive improvement over the cost of the naive Lagrange form.
Stability: The second barycentric form is numerically much more stable. By dividing the two sums, we cancel out the large, potentially problematic term . This avoids the intermediate calculation of very large or small numbers and makes the formula robust against rounding errors.
Flexibility: Imagine you are an experimentalist who has fixed measurement locations (the nodes are set). You can run your experiment multiple times, getting different sets of data values . With the barycentric approach, you compute the expensive weights just once for your setup. Then, for each new set of measurements, you can find the corresponding interpolating polynomial in just time per evaluation point.
For these reasons, high-quality numerical libraries like SciPy use the barycentric form for their polynomial interpolation routines. It represents the pinnacle of combining theoretical elegance with numerical robustness and efficiency.
/Semester-3/Numerical-Methods-for-Computer-Science/Lecture-Notes/attachments/Pasted-image-20250927130619.png)
The Error in Polynomial Interpolation: How Good Is Our Guess?
We now have powerful tools, the Newton and Barycentric forms, to construct and evaluate the unique interpolating polynomial. But this brings us to the most important question: how good is it? How close is our polynomial model, , to the true, underlying function, , that we are trying to discover?
The answer is given by a fundamental theorem that precisely quantifies the interpolation error.
/Semester-3/Numerical-Methods-for-Computer-Science/Lecture-Notes/attachments/Pasted-image-20250927130741.png)
Theorem 2.2.11 (The Error Formula)
Let be an -times continuously differentiable function. Let be the polynomial of degree at most that interpolates at the distinct nodes . Then for any in the interpolation interval, there exists some (unknown) point within that interval such that the error is given by:
This formula is incredibly revealing. It’s not just an abstract bound; it tells us exactly what the error depends on. Let’s break it down into its three components:
-
The Function’s Smoothness (): This term represents the -th derivative of the true function, evaluated at some mysterious point . We don’t know where is, but we know its magnitude is bounded by the maximum value of the derivative on the interval. Intuition: This term tells us that “wiggly” functions are hard to interpolate. If a function has large higher-order derivatives, it changes direction rapidly, and a low-degree polynomial will struggle to keep up. Smooth, slowly-varying functions with small higher derivatives are easy to interpolate.
-
The Number of Points (): The factorial in the denominator is a powerful force. As we increase the number of interpolation points (and thus the degree ), the factorial grows extremely fast. This suggests that, all else being equal, adding more points should dramatically decrease the error.
-
The Choice of Nodes (): This is the nodal polynomial, . This term depends on the geometry of our measurement points. This is the only part of the error that we, as designers of an experiment or algorithm, can directly control. To minimize the overall error, our goal must be to choose the nodes in a way that makes the magnitude of this product as small as possible across the entire interval.
The Trap of Equidistant Nodes: Runge’s Phenomenon
What is the most natural, intuitive way to choose our measurement points? We space them out evenly. This is called using equidistant nodes. For an interval , we would choose for a fixed step size .
This seemingly sensible choice turns out to be a terrible idea for high-degree polynomial interpolation.
Let’s look at the nodal polynomial term, , for equidistant points. It can be shown that this function is relatively small in the middle of the interval but grows to be enormous near the endpoints. This imbalance means that while the interpolation might be good in the center, the error will explode near the boundaries.
This disastrous effect is known as Runge’s phenomenon. Even for a perfectly smooth and well-behaved function, the interpolating polynomial for equidistant nodes will develop wild oscillations near the ends of the interval as the degree increases.
/Semester-3/Numerical-Methods-for-Computer-Science/Lecture-Notes/attachments/Pasted-image-20250927130901.png)
The plots on slide 8 are the definitive illustration of this failure. They show the error when interpolating a smooth function.
- The red curve (Equidistant) shows the error for equally spaced nodes. In the center, the error is small. But near the boundaries, it explodes into oscillations that are far larger than the function itself. Adding more points would only make these oscillations worse.
- The blue curve (Chebyshev) shows the error for a smarter choice of nodes, which we will discuss next. The error is orders of magnitude smaller and is distributed evenly across the entire interval.
This behavior is quantified by a value called the Lebesgue constant, . It acts as an error amplification factor. The error bound can be stated as:
where is the best possible polynomial approximation to . For equidistant points, the Lebesgue constant grows exponentially with :
An error amplification factor of means the method is completely useless. The rounding errors and approximation errors are magnified to the point of absurdity.
The Peril of High-Degree Interpolation with Equidistant Nodes
Using a high-degree polynomial to interpolate data at equally spaced points is one of the most common and dangerous mistakes in numerical analysis. The result will almost certainly be a wildly oscillating and meaningless curve. The intuition that “more points must mean a better fit” is dangerously wrong in this context.
The Solution: Chebyshev Nodes
So, if not equally spaced, how should we choose the nodes? The error formula points the way: we must choose the nodes to minimize the maximum value of the nodal polynomial, .
You might wanna skip to the 2nd half of the video…
The solution to this minimization problem is given by the Chebyshev nodes. These points are the projections onto the x-axis of equally spaced points on a semicircle.
On the standard interval , the Chebyshev nodes are given by the simple formula:
/Semester-3/Numerical-Methods-for-Computer-Science/Lecture-Notes/attachments/Pasted-image-20250927132412.png)
Notice their distribution: they are clustered more densely near the endpoints of the interval (at -1 and 1) and are sparser in the middle. This non-uniform spacing is precisely what is needed to counteract the polynomial’s tendency to oscillate at the boundaries. It “pins down” the polynomial where it’s most likely to go wild.
The results are dramatic. The Lebesgue constant for Chebyshev nodes grows only logarithmically, , which is extremely slow. This guarantees that as you increase the number of points , the interpolating polynomial will converge to the true function (for any reasonably smooth function).
The Golden Rule of Polynomial Interpolation
If you have the freedom to choose where you take your measurements (i.e., you can plan your experiment), always choose the Chebyshev nodes (or points with a similar clustering at the boundaries). This choice tames the error, defeats Runge’s phenomenon, and ensures that your high-degree polynomial interpolation is a stable, convergent, and powerful numerical tool.
Continue here: 04 Chebyshev Polynomials and Trigonometric (Fourier) Interpolation