Given \( n \) distinct real values \( x_1, x_2, \ldots x_n \) and \( n \) real values \( y_1, y_2, \ldots y_n\) (not necessarily distinct), the **Lagrange Interperloation Formula** gives a polynomial \(P\) with real coefficients satisfying \( P(x_i)=y_i\) for \( i \in \{ 1,2, \ldots n \} \).

To describe polynomial \(P\), we first solve the following problem: Given \( n\) distinct real values \( x_1, x_2, \ldots x_n \), does there exist a polynomial \( f\) with real coefficients satisfying \( f(x_1)=1 \) and \( f(x_i)=0 \) for all values of \( i \neq 1\)?

By the Remainder-Factor Theorem, if such a polynomial exists, then for all \( i\neq 1\), \( (x-x_i) \) must be a factor of the polynomial. Consider the polynomial \( g(x) = \prod \limits_{i=2}^n (x-x_i) \). This satisfies the conditions \( g(x_i)=0 \). Now let \( F = g(x_1) \). Then since \( F \neq 0 \) (using the condition that the \(x_i\) are distinct), we may divide by \( F\) to obtain polynomial \(f(x) = \frac{g(x)}{F}\). We have \( f(x_i) = \frac {g(x_i)}{F} = 0 \) and \( f(x_1) = \frac {g(x_1)} {F} = 1\), giving the polynomial desired.

Let \( P_j(x_j)\) be the polynomial with real coefficients satisfying \( P_j (x_j)=1\) and \( P_j (x_i)=0\) for all \( i \neq j\). Then, \( P(x) = \sum y_i P_i(x) \) is a polynomial with real coefficients satisfying \( P(x_i)=y_i\) for all \( i \in \{ 1,2, \ldots n \} \).

## Worked Examples

## 1. If we want to find a polynomial that satisfies

\[ P(1)=1, P(2)=4, P(3)=1, P(4)=5,\] what are the polynomials \( P_1(x), P_2(x), P_3(x), P_4(x), P(x)\)?

Let \( f(x) = (x-2)(x-3)(x-4)\). Then

\[ f(1) = (-1)(-2)(-3)=-6 \text{, so } P_1(x) = -\frac {1}{6}(x-2)(x-3)(x-4).\]

Let \( f(x) = (x-1)(x-3)(x-4)\). Then

\[ f(2) = (1)(-1)(-2) = 2 \text{, so } P_2 (x) = \frac {1}{2} (x-1)(x-3)(x-4).\]

Let \( f(x) = (x-1)(x-2)(x-4)\). Then

\[ f(3) = (2)(1)(-1) = -2 \text{, so } P_3 (x) = -\frac {1}{2} (x-1)(x-2)(x-4). \]

Let \( f(x) = (x-1)(x-2)(x-3)\). Then

\[ f(4) = (3)(2)(1) = 6 \text{, so } P_4 (x) = \frac {1}{6} (x-1)(x-2)(x-3). \]

Hence,

\[ P(x) = 1\times (-\frac {1}{6})(x-2)(x-3)(x-4) + 4\times \frac {1}{2} (x-1)(x-3)(x-4)\] \[ + 1\times (-\frac {1}{2}) (x-1)(x-2)(x-4)+ 5 \times \frac {1}{6} (x-1)(x-2)(x-3). \]

## 2. Show that if we require the polynomial in Lagrange's Interpolation Formula to have degree at most \( n-1\), then there is a unique polynomial satisfying the conditions. Show further that this polynomial is \( P(x)\) itself.

Suppose two polynomials \( R(x)\) and \( S(x)\) satisfy the conditions of Lagrange's Interpolation Formula and have degree at most \( n-1\). Consider the polynomial \( T(x) = R(x)-S(x)\). By the conditions, we have \( T(x_i) = R(x_i)-S(x_i) = y_i-y_i=0\). Hence, by the Remainder-Factor Theorem,, for all values of \( i\), \( (x-x_i)\) must be a factor of \( T(x)\). Since the \( x_i\) are distinct, we have \( T(x) = U(x) \prod \limits_{i=1}^n(x-x_i)\). If \( U(x)\) is not the zero polynomial, then the degree on the right hand side is at least \( n\), while the degree on the left hand side is at most \( n-1\), which is a contradiction. Thus, \( U(x)=0\), and so \( T(x)=0\), which gives \( R(x)=S(x)\). Hence, there is a unique polynomial which satisfies the conditions in the question. It is clear that each of the \( P_i(x)\) has degree at most \( n-1\) (it can have degree 0 if \( y_i=0\)). Hence, since \( P(x)\) is the linear combination of these polynomials, it also has degree at most \( n-1\).

## 3. Given \( n\) distinct complex values \( x_1, x_2, \ldots x_n\) and \( n\) (not necessarily distinct) complex values \( y_1, y_2, \ldots y_n\), does there exist a polynomial with complex coefficients satisfying \( P(x_i)=y_i\) for all values of \( i\)?

Solution: Repeat the above discussion by replacing "real" with "complex". Then \( P(x)= \sum y_i P_i(x) \) is a polynomial with complex coefficients.

## Comments

Sort by:

TopNewest@Calvin Lin Many a time I have seen people using Lagrange Multipliers[edit] where I generally use AM-GM. How is that done? And how do we find the next term of 1,2,3,4,5,? be Lagrange Interpolation? Trevor said me that it's something weird which I don't remember. Thanks! – Satvik Golechha · 2 years, 5 months ago

Log in to reply

Are you asking about Method of Differences? If so, MOD only works when the values that you are given are consecutive (constant width apart), whereas LI is much more general and works for any set of \( x \) values. E.g. find a quadratic polynomial such that \( f(1) = 1, f(2) = 2, f(10) = 11\) would be easy with LI, but hard with MOD. – Calvin Lin Staff · 2 years, 5 months ago

Log in to reply

And Trevor once told me that by Lagrange Interpolation, the next term in the sequence 1,2,3,4,5,6, __ is something like \(\sqrt{\pi}^{100i\cos{2.9}}\). I don't get how. @Calvin Lin – Satvik Golechha · 2 years, 5 months ago

Log in to reply

can you please elaborate – Kartica Modi · 3 years ago

Log in to reply

i only understood a bit of it, can you please elaborate it..... – Dheeraj Agarwal · 3 years, 3 months ago

Log in to reply

We make a polynomial with 4 "parts"

\([p(x-a)(x-b)]+[q(x-a)(x-c)]+[r(x-b)(x-c)]\)

Note how each part (I've separated them by []) have different 0's. The first part has 0's at x=a,b. Now, we plug in d into the function for x. Notice also how everyother part of the function becomes 0 when plugging in 0.

Let's say we want a function going through (1,2), (2,3), and (3,5)

In this case, a=1, b=2, c=3

\(y=(x-a)(x-b)+q(x-a)(x-c)+r(x-b)(x-c)\)

\(y=p(x-1)(x-2)+q(x-1)(x-3)+r(x-2)(x-3)\)

Plugging in x=a=1

\(y=p(1-1)(1-2)+q(1-1)(1-3)+r(1-2)(1-3)\)

\(y=p(\color{\blue}{0})(-1)+q(\color{\blue}{0})(-2)+r(-1)(-2)\)

\(y=2r\)

Remember, we want our function to go through (1,2), so y=2

\(2=2r\Rightarrow r=1\)

Now we have

\(y=p(x-1)(x-2)+q(x-1)(x-3)+\color{green}{1}(x-2)(x-3)\)

Repeating this process for x=2

\(y=p(2-1)(2-2)+q(2-1)(2-3)+r(2-2)(2-3)\)

\(y=p(1)(\color{blue}{0})+q(1)(-1)+r(\color{blue}{0})(-1)\)

\(y=-q\)

In this case y=3

\(3=-q\Rightarrow q=-3\)

Now we have

\(y=p(x-1)(x-2)+(\color{green}{-3})(x-1)(x-3)+1(x-2)(x-3)\)

Finally, repeating this for x=3, we know that the second and third parts of our eq will be 0 so I won't show those parts.

\(y=p(2)(1)\)

We want our function to go through (3,5), so y=5.

\(5=2p\Rightarrow p=\frac{5}{2}\)

Thus our function is

\(y=\frac{5}{2}(x-1)(x-2)-3(x-1)(x-3)+(x-2)(x-3)\) – Trevor Arashiro · 2 years, 5 months ago

Log in to reply