I know, I know, whats with all the Lagrange in my blog posts? Well, the guy was awesome! In fact so, awesome that someone else, Edward Waring in 1779, named his work after him: Langrangian Polynomials

What are these mystical polynomials, you ask? Well, let’s try asking a question, and see if you can solve it.

**I have the points (3,4), (-1, 4), (8,2), and (6,-3). Find any polynomial that goes through these points.**

Now, you may attempt this problems multiple ways. Some might approach it using calculus, others might approach it using geometry, some might still approach in some other way. In reality, we can solve this problem using pure algebra.

**Oh, and by the way, Lagrangian polynomials are simply the lowest degree polynomial that satisfies the above equation. For now, let’s just focus on getting any polynomial**.

Ok, so how do we go about this? Well let’s try inventing a polynomial that has the first point (3,4) on it, and then add more as necessary. How can we do this? Well, consider the below polynomial.

y = (x+1)(x-8)(x-6)

When looking at this polynomial, we notice that if we try plugging in values the x-values for the other points, namely (-1,4), (8,2), and (6,3), we get 0. We can see this below.

Plugging in x = -1: y = (-1 + 1)(-1-8)(-1-6) = 0*-9*-7 = 0

Plugging in x = 8: y = (8+1)(8-8)(8-6) = 9*0*2 = 0

Plugging in x = 6: y = (6+1)(6-8)(6-6) = 7*-2*0 = 0

This is quite fascinating. It seems that this polynomial will return 0 for all the other points. We did this on purpose and you will see why soon. Now let’s try plugging in for x = 3

Plugging in x = 3: y = (3+1)(3-8)(3-6) = 4*-5*-3 = 60

We can see that the point (3,60) lies on this polynomial, but we want the point (3,4), so to adjust for that we can multiply the polynomial by \frac{4}{60}. So our new polynomial is

y =\frac{4}{60}(x+1)(x-8)(x-6)

**Wow!** So we have created a polynomial that has (3,4) on it and whenever we plug in for the x-coordinates of the other points, we get 0. So why is this important?

Well consider making a similar polynomial for another point. Let’s just choose (6,3). If we go through the same process of making all the other x-coordinates of the other points but (6,3) equal to 0, we get

y =(x+1)(x-8)(x-3)

Plugging in x = 6: y = (6+1)(6-8)(6-3) = 7(-2)(-3) = 42

y = \frac{3}{-42}(x+1)(x-8)(x-3)

Well let’s try adding our new polynomial to our original polynomial. Let’s see what happens.

y = \frac{4}{60}(x+1)(x-8)(x-6) + \frac{3}{-42}(x+1)(x-8)(x-3)

When we plug in x = 3, you notice the second term becomes 0, and thus we are left with our original polynomial, meaning it will go to 4. Similarly, if we plug in x = 6, our first polynomial becomes 0, and our second polynomial acts as intended. If you notice, we essentially created **independent terms** for each point, so that if you plug in the x-coordinate of a point into its respective term, it gives its y-value, while the other terms go to 0. If we simply, repeat this process for our other two points we get

y = \frac{4}{60}(x+1)(x-8)(x-6) + \frac{3}{-42}(x+1)(x-8)(x-3) + \frac{2}{90}(x+1)(x-6)(x-3) + \frac{4}{-252}(x-3)(x-8)(x-6)

Believe it or not, this is our Lagrangian polynomial for the set of points we had. Notice, that it is very easy to generalize the pattern, by simply creating a term for each point that correctly outputs the right y-coordinate and makes all other points go to 0. How interesting! (I won’t write the summation and formal generalization of the problem simply because it makes a simple concept look more complicated than it has to be)

In fact, what Lagrangian polynomials are taking advantage of is called orthogonality. With respect to our problem each term doesn’t interfere with the other terms, and whenever we have that concept apply, we say we have a basis comprised of our independent terms. If you want to understand orthogonality and the concept of a basis, I suggest you try learning Linear Algebra. These concepts are very overarching in math, and to some extent, the idea of a basis (as well as a linear combination) is what really makes math so applicable to so many different problems. Isn’t this cool? We used high overarching concepts in a relatively simple manner. Now, I shall simplify the above polynomial and plot it.

Oh, by the way, notice that if we have N points, we will have an N-1 degree polynomial. That’s the lowest degree possible for such a problem.

Simplified polynomial

y =\frac{x^3}{630} - \frac{19x^2}{315} + \frac{23x}{210}+\frac{146}{35}

And here is the graph of the associated polynomial for proof that it does work!

That’s really it! Below I linked some resources related to Lagrangian Polynomials. I hope you are staying safe during these times and that this was a fun little excursion into math for you! As always, that was quite a nice “byte” of math! Check out my blog post on a simpler quadratic formula if you are interested! Lagrangian Polynomials are great!

Also, here are some great technology products, I would like to recommend. If you already are planning on buying these products, then buying it here will give me a small commission to keep this blog running at no cost to you! Thanks!:

- Roku Express HD Streaming Media Player 2019
- Echo Dot (3rd Gen) – Smart speaker with clock and Alexa – Sandstone
- Portable Charger Anker PowerCore 20100mAh – Ultra High Capacity Power Bank with 4.8A Output and PowerIQ Technology, External Battery Pack for iPhone, iPad & Samsung Galaxy & More (Black)
- All-New Fire 7 Tablet (7″ display, 16 GB)

byteofmath.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to ("byteofmath.com” (amazon.com)).

**Resources**

http://wmueller.com/precalculus/families/lagrange.html

https://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html

https://www.quora.com/What-is-a-basis-in-linear-algebra

https://math.stackexchange.com/questions/2195513/what-exactly-is-a-basis-in-linear-algebra