How to interpolate?

An example of a polynomial f(X) R[X] such that the corresponding function R -> R satisfies f(1) = 2 and f(2) = 5, is f(X) = X2 + 1, but also 3X - 1. One can look for such a polynomial as follows. Choose a degree, preferably equal to the number of interpolation points minus 1; but let us now take 2. Then write f(X) = f0 + f1 X + f2X2 and substitute the given values. This leads to the following system of linear equations:

f 0 + f 1 · 1 + f 2 · 12 = 2,

f 0 + f 1 · 2 + f 2 · 22 = 5.

Solving it gives f 0 = 2r - 1, f 1 = 3 - 3r and f2 = r, with r R, so that there are many polynomials with the required properties.

It also depends on the degree how many polynomials you find. No polynomials of degree 0 do the job, exactly one polynomial of degree 1 works, and an infinite number of degree 2. This is in accordance with the theorem, applied for n = 2.