Polynomial Interpolation Made Easy

The Lagrangian way of doing interpolation
Photo by Ash from Modern Afflatus on Unsplash

Wow, this is my 100th story! As a topic, I have chosen something about one of my favorite mathematicians… or should I say, physicists? I’m talking about Joseph-Louis Lagrange.

It’s a well-known and plausible fact that for every 𝑁 different points in the plane, you can choose exactly one polynomial of degree (at most) 𝑁−1 that goes through all the 𝑁 points. For example, two different points determine a straight line uniquely. Three points determine a parabola, and so on. Often, the process of determining the interpolating polynomial is taught in a rather tedious way like this: you have 𝑁 points, set up a general polynomial of degree 𝑁−1:

Equation 1

Then plug in your 𝑁 points and you get a system of 𝑁 equations with 𝑁 unknowns

that you have to solve. So far, so good, so cumbersome. There is a much easier way. It’s Lagrange’s way. The only thing you have to know has already been mentioned. 𝑁 points determine a polynomial of degree (at most) 𝑁−1 uniquely . What’s so important about “uniquely”? Well, it says there is only one. And consequently, it’s the same in whatever form you may want to write it. You can write in the form of Equation 1. But you can also write it in factorized form with all its roots appearing. Or you can write it in still some other equivalent form. And that’s the way that Lagrange has taken.

Consider three distinct points

We know that there is a unique parabola (polynomial of degree 2) that goes through all the three points. We just need a clever way of writing it down to make sure that it does go through all the points. Consider the expression

with some constant 𝑐_1.

What happens, if we plug in 𝑥_1?

What happens, if we plug in x_2?

And similarly for the remaining point.

We have just found a way to make a polynomial go through a specific point! How? Well, just choose

and we get

so that if we plug in 𝑥=𝑥_1, we get

This approach can be used to switch on and off all the desired points that we want the polynomial to go through. We simply do the same for all the points and add:

If you plug in 𝑥_1, the second and third terms are switched off by the numerators. If you plug in 𝑥_2, the first and third terms are switched off, and so on.

Now, this is a sum of three polynomials of 𝑥 of degree 2. So, altogether, it is still a polynomial of degree 2. And since the polynomial going through the desired points is unique, it must be the interpolating polynomial that we are looking for, just in a special form. No equation system needs to be solved! And best of all: it can be generalized immediately to 𝑁 points. For points

you can immediately write down the unique interpolating polynomial of degree 𝑁−1:

And that’s the classical Lagrange formula for interpolating polynomials. When I first met it, I had a hard time remembering it. Usually, as so often in mathematics, the theorem is stated and then proved. But often, the proof is not really helpful in understanding the theorem. So I tried to rediscover the formula on my own and this is the key to letting it stick in the memory, at least for me. As soon as I found out the idea of how to find it (the idea described in this post), it’s no problem at all to reconstruct the formula within a minute or so.