Associated Topics || Dr. Math Home || Search Dr. Math

### Lagrange Polynomial Interpolation

```
Date: 08/08/97 at 14:08:29
From: Chun Wang
Subject: Lagrange polynomial interpolation

Dear Dr. Math:

I looked all over on the internet for the textbook DEFINITION of
Lagrange ploynomial interpolation, but I couldn't find it. Would
you be so kind as to give me the definition and a brief example of how
it works? A link will also do. I am only interested in the basics.
Thanks. I really appreciate it.

Sincerely,
Chun
```

```
Date: 08/14/97 at 13:13:04
From: Doctor Rob
Subject: Re: Lagrange polynomial interpolation

Lagrange interpolation is a method of finding a polynomial y = f(x)
which passes through a specified set of n points (x(i),y(i)),
1 <= i <= n, in the plane.  There is only one condition on the points,
and that is that they should all have different x-coordinates, that
is, x(i) = x(j) if and only if i = j.  The polynomial is defined as
follows.

For 1 <= j <= n, let

p(j,x) = PRODUCT (x - x(i)).
i<>j

This is zero at every one of the n points except x(j), where it is
nonzero.  Then set

n
y = f(x) = SUM y(j)*p(j,x)/p(j,x(j)).
j=1

This polynomial has the property that f(x(i)) = y(i) for every i.
It is nominally a polynomial of degree n-1.

As an example, let's try it on two points (x(1),y(1)) and (x(2),y(2)).
Then p(1,x) = x - x(2), and p(2,x) = x - x(1).  Now

y = f(x)
= y(1)*[x-x(2)]/[x(1)-x(2)] + y(2)*[x-x(1)]/[x(2)-x(1)]
= x*[y(1)-y(2)]/[x(1)-x(2)] + [x(1)*y(2)-x(2)*y(1)]/[x(1)-x(2)]

y - y(2)
= x*[y(1)-y(2)]/[x(1)-x(2)] + [x(2)*y(2)-x(2)*y(1)]/[x(1)-x(2)]
= x*[y(1)-y(2)]/[x(1)-x(2)] - x(2)*[y(1)-y(2)]/[x(1)-x(2)][y-y(2)]/
[y(1)-y(2)]
= [x-x(2)]/[x(1)-x(2)]

This is the equation of the line through the two points.

Here is a numerical example with three points (-2,5), (0,1), and
(3,7).

Then

p(1,x) = (x-0)*(x-3) = x^2 - 3*x,
p(2,x) = (x+2)*(x-3) = x^2 - x - 6,
p(3,x) = (x+2)*(x-0) = x^2 + 2*x.

Now

y = f(x) = 5*(x^2-3*x)/10 + 1*(x^2-x-6)/(-6) + 7*(x^2+2*x)/15
= (4/5)*x^2 - (2/5)*x + 1
= (4*x^2 - 2*x + 5)/5

Let's check it:

f(-2) = (16 + 4 + 5)/5 = 5,
f(0) = (0 + 0 + 5)/5 = 1,
f(3) = (36 - 6 + 5)/5 = 7.

-Doctor Rob,  The Math Forum
Check out our web site!  http://mathforum.org/dr.math/
```
Associated Topics:
High School Basic Algebra
High School Equations, Graphs, Translations

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search