The Core Problem: What Happens Between the Measurements?
Let’s begin with a simple, practical scenario. Imagine you have a set of precise measurements. These could be the altitude of a drone at specific times, the pressure inside an engine cylinder at different crank angles, or the value of a stock at the close of each day. You have a set of points:
You know the value at these points. But the crucial question is: what is the value between these points? If you plot these points on a graph, your brain almost automatically connects them, imagining a smooth curve passing through them. The task of interpolation is to make this imagined curve mathematically concrete.
/Semester-3/Numerical-Methods-for-Computer-Science/Lecture-Notes/attachments/Pasted-image-20250923180140.png)
The Interpolation Task: A Formal Statement
Given a set of data points for , where all the are distinct, the goal is to find a function that satisfies the interpolation conditions:
We are assuming our measurements are exact for now. The case of noisy data, where the curve shouldn’t necessarily pass through every point, is a problem of regression or approximation, which we’ll discuss later.
The First Idea: Just Connect the Dots
The most straightforward way to create a curve is to draw straight lines between consecutive points. This is called piecewise linear interpolation. It’s simple and intuitive.
However, as was pointed out in the lecture, this approach has a significant drawback: the resulting function has sharp corners at each data point. It is continuous, but it is not differentiable at the points . For many physical systems, like the trajectory of a drone, we expect a smooth path without instantaneous changes in direction. We need a smoother solution.
The Framework: Choosing Our Reality from Function Spaces
The problem is that there are infinitely many possible smooth curves that can pass through a given set of points. How do we choose just one? We need a systematic approach.
This is where the idea of function spaces comes in. We assume that our discrete measurements are just samples from some “true” but unknown underlying function, let’s call it . This function lives in some vast, infinite-dimensional space of functions, . For example, could be the space of all continuous functions, .
Since a computer cannot work with an infinite-dimensional object, we must simplify. We choose a much smaller, finite-dimensional subspace, let’s call it , and search for our solution only within that subspace. This is a modeling choice. We are saying, “I don’t know what the true function is, but I’m going to assume it can be well-approximated by a function from my chosen simple family, .”
Basis Functions: The Building Blocks of Our Model
How do we define this simpler space ? We define it with a basis. Just as the vectors form a basis for 3D space, we can choose a set of basis functions to span our function space .
Any function in our chosen space can then be written as a unique linear combination of these basis functions:
The interpolation problem is now transformed from a vague search for a “function” into a concrete, algebraic problem: find the specific coefficients that make our model satisfy the interpolation conditions.
The choice of basis is the most critical decision we will make. It defines the character of our solution and the difficulty of finding it.
- Polynomials: A natural choice for smooth functions.
- Trigonometric Functions (Sines and Cosines): The ideal choice for periodic phenomena. This leads to Fourier analysis and the Fast Fourier Transform (FFT), one of the most important algorithms ever developed.
- Splines: Piecewise polynomials that are smoothly connected. These are used everywhere in computer graphics and engineering design.
For now, we will focus on the simplest and most fundamental choice: polynomials.
Polynomial Interpolation: The Naive Approach (and Why It Fails)
Let’s try to find a single polynomial that passes through all of our data points. To satisfy conditions, we need degrees of freedom. This leads us to choose a polynomial of degree at most .
The Monomial Basis
The most obvious basis for the space of polynomials of degree is the monomial basis: . Our interpolating polynomial is then:
To find the coefficients , we enforce the interpolation conditions for each point. This gives us a system of linear equations.
/Semester-3/Numerical-Methods-for-Computer-Science/Lecture-Notes/attachments/Pasted-image-20250923180255.png)
This system, , involves the Vandermonde matrix. In theory, this matrix is invertible as long as the points are distinct, which means a unique solution for the coefficients exists.
What is a Vandermonde Matrix?
A Vandermonde matrix is a very structured matrix that shows up whenever you express a polynomial in the monomial basis and enforce interpolation conditions. For interpolation points , it looks like this:
Each row corresponds to plugging one into the polynomial, and each column corresponds to one power of .
Why does it show up here? Because when we write
and demand , we are literally saying:
for each . If you stack these equations for all , you get the matrix-vector system .
Why are Vandermonde matrices “bad”? Two main reasons:
- Ill-conditioning: The determinant of involves products of differences . If the are close to each other or is large, the determinant becomes very small, meaning the matrix is nearly singular. That makes numerical inversion unstable: small errors in input create huge errors in output.
- Growth of powers: In each row, you have powers like . For moderately large , these numbers can explode or vanish depending on the size of . This amplifies rounding errors when working in floating-point arithmetic.
In short: Vandermonde matrices are the unavoidable result of using the monomial basis in interpolation, but they are numerically treacherous.
Problem solved? Not at all. This approach is a numerical disaster.
Why the Monomial Basis is a Trap
- Computational Cost: Solving the dense Vandermonde system with Gaussian elimination costs operations. For many points, this is far too slow.
- Numerical Instability: The Vandermonde matrix is famously ill-conditioned. This means it is “almost singular.” Tiny rounding errors in your input data get magnified into enormous errors in the computed coefficients. As the lecturer stated, for even a moderate number of points, the results are “brutal schlecht” (brutally bad) and “völlig sinnlos” (completely senseless). Standard numerical software will even warn you not to trust the solution.
Even if we could find the coefficients exactly, evaluating the polynomial in its standard form is also prone to numerical issues. A much more stable and efficient method for evaluation is Horner’s Schema, which uses a nested form:
This reduces the number of multiplications and is less susceptible to overflow and rounding errors.
A Better Way: The Newton Basis
The failure of the monomial basis does not mean polynomial interpolation is a bad idea. It means we chose the wrong building blocks. We need a smarter basis.
The Newton form of the interpolating polynomial is built on a beautifully simple, incremental idea. Imagine you are receiving your data points one by one.
- First point : The simplest polynomial that passes through this point is a constant function, a polynomial of degree 0:
- Second point : We want to find that passes through both points. We can write it as a correction to our previous polynomial: The correction term must be zero at so we don’t mess up our first condition. The simplest way to ensure this is to include a factor of . So, we try: We find the constant by enforcing .
- Third point : We update again. The correction term must now be zero at both and . The simplest way is to include factors of and : We find by enforcing .
This incremental process defines the Newton basis functions:
The interpolating polynomial is then written in the Newton form:
The coefficients are called divided differences.
/Semester-3/Numerical-Methods-for-Computer-Science/Lecture-Notes/attachments/Pasted-image-20250923180317.png)
The divided differences are defined recursively and represent the leading coefficient of the polynomial interpolating a subset of the points.
- 0-th order:
- k-th order:
The coefficients in the Newton form are the divided differences along the top diagonal of the computation table: .
Good video to grasp the concept…
Why the Newton Basis is Superior
This approach elegantly solves the problems of the monomial basis.
- Efficient and Stable Coefficient Calculation: If we write out the interpolation conditions using the Newton basis, the resulting system matrix is lower triangular.
A triangular system is trivial to solve. We can find the coefficients using forward substitution in only operations, which is much faster than and, more importantly, is numerically stable. - Adaptive: If a new data point arrives, we don’t have to start from scratch. We simply keep our existing polynomial and add one new term, . We only need to compute one new row in the divided difference table. This is impossible with the monomial basis, where every single coefficient would change.
Summary: Monomial vs. Newton Basis
Feature Monomial Basis () Newton Basis () System Matrix Vandermonde (Dense, Ill-conditioned) Lower Triangular (Well-conditioned) Cost to find coeffs. Adding a new point Requires complete re-computation Easy and efficient update Practical Use Avoid! For theoretical use only. Recommended. Stable and efficient.
The Newton form of the interpolating polynomial provides a practical, stable, and efficient method for polynomial interpolation, addressing the severe shortcomings of the naive monomial approach.
Continue here: 03 Polynomial Interpolation using Lagrange Form, Barycentric Lagrange Form, Runge’s Phenomenon, Chebyshev Nodes