Back to the on-screen lesson ·

Polynomial interpolation

The unique polynomial of least degree through a set of points, the Lagrange and monomial ways of writing it, and the difference between reading it inside the data and outside.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to build the interpolating polynomial through a small set of points, say why it is unique once the degree is bounded, evaluate it between and beyond the nodes, and state what interpolation does and does not guarantee.

2. What you already know

You can solve a small linear system by elimination, and you know that two points determine a line. This lesson is that fact with the number two replaced by $n$, together with the reason the answer is unique.

3. The words this lesson uses

The nodes are the values of $x$ where the data is given; a polynomial interpolates the data when it agrees with it at every node. The Lagrange basis polynomial $\ell_i$ is the one that is $1$ at node $i$ and $0$ at every other. The Vandermonde matrix is the matrix of the linear system for the monomial coefficients. Interpolating means estimating inside the range of the nodes; extrapolating means outside it.

4. Polynomial interpolation

Given $n$ points with distinct $x$ values, there is exactly one polynomial of degree at most $n - 1$ through them. Existence and uniqueness come together from the same argument: writing $p(x) = c_0 + c_1x + \cdots + c_{n-1}x^{n-1}$ and demanding agreement at each node gives $n$ equations in $n$ unknowns whose matrix is a Vandermonde matrix, and its determinant is $\prod_{i<j}(x_j - x_i)$, non-zero precisely because the nodes are distinct. There are several ways to write the same polynomial. The Lagrange form builds it out of the basis polynomials $\ell_i(x) = \prod_{j \neq i}\dfrac{x - x_j}{x_i - x_j}$, each $1$ at its own node and $0$ at the others, giving $p(x) = \sum_i y_i \ell_i(x)$ with no system to solve at all. The monomial form is the coefficient list. They are the same polynomial in different clothes, and the clothes matter: solving the Vandermonde system directly is numerically poor for many nodes, which is why the Lagrange and Newton forms exist. What interpolation guarantees is agreement at the nodes. Between them it is an estimate; beyond them it is an extrapolation governed by the leading term, and the same arithmetic that is trustworthy inside is not outside.

Another way: steps

  1. Check the nodes are distinct.
  2. Choose a form: Lagrange for a one-off evaluation, Newton for adding points later, monomial only for small $n$.
  3. Build the polynomial, and verify it at every node.
  4. Report where the data was, and say so if the evaluation point is outside it.

Another way: example

Through $(0,1)$, $(1,3)$, $(2,9)$: the Lagrange form is $1\cdot\dfrac{(x-1)(x-2)}{2} + 3\cdot\dfrac{x(x-2)}{-1} + 9\cdot\dfrac{x(x-1)}{2}$, which multiplies out to $1 + 2x \cdot 0 + \ldots$ — or, by substituting the nodes into $c_0 + c_1x + c_2x^{2}$ directly, $1$, then $c_1 + c_2 = 2$, then $c_1 + 2c_2 = 4$: so $p(x) = 1 + 2x^{2}$. Check: $1$, $3$, $9$.

5. The mistake to watch for

Passing through the data is the definition of an interpolant, not evidence that it is a good model. A polynomial through ten points hits all ten exactly and may swing violently between them — a fact with a name and a lesson of its own. Judging an interpolant by how well it fits the points it was built from is judging it by the one thing it cannot fail at.

6. Two forms of one polynomial

  1. Through $(0,2)$ and $(1,5)$: the Lagrange form is $2(1 - x) + 5x$.

    Each basis piece is 1 at its own node.

  2. Multiplying out gives $2 + 3x$, the monomial form.

    Same polynomial, different writing.

  3. The Lagrange form needed no system solved; the monomial form is easier to evaluate afterwards.

    Choose by what happens next.

7. Why distinct nodes matter

  1. Two data points at the same $x$ with different $y$ cannot both be hit.

    No polynomial is a relation.

  2. In the Vandermonde matrix those two rows are equal, so the determinant is zero and the system is singular.

    The algebra reports the impossibility.

  3. Nearly equal nodes are the numerical version: the matrix is nearly singular and the coefficients are ill conditioned.

    Distinct is not the same as well separated.

8. Your turn: the interpolant through $(0, 0)$, $(1, 1)$ and $(2, 4)$

  1. Substituting $x = 0$ gives $c_0 = 0$.

  2. Then $c_1 + c_2 = 1$ and $2c_1 + 4c_2 = 4$, so $c_2 = 1$ and $c_1 = 0$.

  3. Your turn: work this step out. Its working is at the end of the packet.

    The interpolant is $x^{2}$ — degree two, as expected, and it would have been degree one had the data been $0$, $1$, $2$.

9. Guided practice

A quadratic $p$ interpolates the data $(0, 1)$, $(1, 4)$ and $(2, 11)$. Fill in the value of $p$ at each node.

Value of xValue of p there
First node0
Second node1
Third node2

10. Guided practice

You have $6$ data points with distinct values of $x$. What can be said about polynomials through them?

11. Practice

Write the interpolant through $(0, 4)$, $(1, 7)$ and $(2, 12)$ as $p(x) = c_0 + c_1 x + c_2 x^{2}$, and give the row of coefficients $(c_0, c_1, c_2)$.

This task has no paper form; do it on a device.

12. Practice

The interpolant through $(0, 1)$, $(1, 4)$ and $(2, 9)$ is $p(x) = 1 + 2x + x^{2}$. Plot its value at $x = -1$ and at $x = 3$.

Plot your answer on the grid:

-2-11234-12-8-4481216202428323640xvalue of p

13. Somewhere new

The same interpolant $p(x) = 3 + 0x + 3x^{2}$, built from data at $x = 0$, $1$ and $2$, is used to predict at $x = 10$. What value does it give?

Answer:

14. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

15. Test question

The interpolant through $(0, 4)$, $(1, 6)$ and $(2, 12)$ is $p(x) = 4 + 0x + 2x^{2}$. Give $p\left(\tfrac12\right)$ and $p\left(\tfrac32\right)$, as fractions where they are not whole numbers.

$p\left(\tfrac12\right) = $ half and $p\left(\tfrac32\right) = $ three-halves

16. What you can do now

You can construct an interpolant, give its coefficients and evaluate it anywhere. Say in your own words why bounding the degree is what makes the polynomial unique.

Working for the steps left to you

8. Your turn: the interpolant through $(0, 0)$, $(1, 1)$ and $(2, 4)$, step 3