$\newenvironment {prompt}{}{} \newcommand {\thanks }{} \newcommand {\and }{\unskip ,} \newcommand {\thanksmark }{} \newcommand {\thanksgap }{} \newcommand {\HyperFirstAtBeginDocument }{\AtBeginDocument } \newcommand {\epstopdfsetup }{\setkeys {ETE}} changed the theorem header of amsthm failed\MessageBreak }}} \newcommand {\GetTitleStringSetup }{\setkeys {gettitlestring}} \newcommand {\Sectionformat }{#1}$$% This file was *autogenerated* from first.sagetex.sage with % sagetex.py version 2015/08/26 v3.0-92d9f7a %5951e380212ba343c6c71eb198820c6a% md5sum of corresponding .sage file (minus "goboom","current_tex_line",and pause/unpause lines)$
We frequently need to fit functions to data.

In this activity we will explore polynomial interpolation of data.

You should know that two points determine a straight line. We will generalize this to show that $$ points determine a parabola, $$ points determine a 3rd degree polynomial, and in general $$ points determine a unique $$ degree polynomial which pass through (or interpolate) the data points.

### Digging deep into one example

Using any technique you want, try to find a quadratic polynomial

whose graph passes through the points

By plugging in $$, $$, and $$ into the polynomial, we obtain three equations in three unknowns:

$$

Solving this system of linear equations yields

$$

so $$

If you solved the last problem by solving a system of three linear equations in three unknowns by hand, you probably had a slightly painful time. You could imagine that interpolating more data points using higher degree polynomials could be even more painful.

Thankfully, Linear Algebra will come to the rescue!

Sometimes generalizing and abstracting a problem can actually help you solve it.

Before learning how to solve the totally general problem of interpolating $$ points with a degree $$ polynomial, we will resolve our original example problem using some new ideas.

Let $$ be the vector space of real polynomials of degree two. Consider the function $$ defined by

Just to check and make sure you understand how $$ works, please compute the following:
Prove that $$ is a linear transformation.

Compute the matrix $$ of $$ with respect to the basis $$ on $$ and the standard basis $$.

The columns of $$ are the images of the basis vectors.
Thus
Just to test that your matrix really works, use matrix multiplication to find $$ again. Did you get the same answer?
Yes No
Expressed in the basis $$, the coordinate vector of the polynomial $$ is $$. So we can compute $$ by applying $$ to $$.

This agrees with our original computation.

So far we have only rephrased the problem: we haven’t really done anything to help us solve it.

Here is the key idea:

Choosing the right basis makes life awesome

So we will search for a basis of $$ which makes the job of finding interpolating polynomials easier. If we could find polynomials $$, $$, and $$ which satisfy $$, $$ and $$, then the problem would be resolved by the linearity of $$. To see this, note that (if we have already found such polynomials) then we can find a polynomial passing through $$ and $$ simply by using $$.

Did you actually try and see if $$ does interpolate those points?
Yes No
Find $$, $$, and $$.
Let’s focus on $$. We need to find a quadratic polynomial $$ with $$, $$ and $$. Do you remember something about the relationship between roots of polynomials and linear factors (probably from Algebra 2 in high school, or from polynomial ring theory if you have taken an Abstract Algebra class)?
Since $$ has $$ and $$ as roots, it must have $$ and $$ as linear factors.
Since $$ is a quadratic, $$ for some constant $$. You can determine this constant by using the condition that $$.
So

Can you use this same thought process to figure out $$ and $$

Now use this new basis to confirm your answer to the original problem.

Is $$ the same as the polynomial you found at the beginning of the activity?
yes No

We have done a lot of work, and it has a payoff. Now if I had some different data points, I could use this new basis to ease computation of an interpolating polynomial. For instance:

Find the second degree polynomial which interpolates $$ and $$

### Generalizing to arbitrary quadratic interpolation

Now we will replay the whole story to solve a more general question:

Which quadratic interpolates the points $$?

As before, we will

• Define a linear transformation $$ by $$
• Find a basis $$ of $$ with $$, $$ and
• Then $$ will pass through the points $$ and $$.
$$ has roots at $$ and $$, and has $$. Using your knowledge of roots and factors, this should be enough to determine $$.

Can you identify the pattern to find $$ and $$?

Using these, you should now be able to ‘‘easily’’ find a quadratic polynomial which interpolates the points $$.

The solution will be $$, where $$, $$, and $$.
Computing, we find that

### Generalizing to an arbitrary number of points

Now we can generalize to any number of points!

• We want to find a polynomial of degree $$ which interpolates the points $$.
• Define a linear map $$ by $$
• Find a basis $$ of $$ with the property that $$.
• In particular, since $$ has $$ as roots, then we must have

• Thus $$ solves the interpolation problem.
• Putting it all together,

is the unique polynomial of degree $$ which passes through the points $$

This final formula is called the Lagrange Interpolation Formula

Find the unique polynomial of degree three which passes through the points $$

Using the Lagrange Interpolation Formula, the answer is