# Very confused with interpolating polynomials

I have a problem from my homework that I completely botched, and no matter what I do I end up with the wrong answer. Here's the problem:

For a given function $f(x)$ let $x_0 = 0, x_1=0.6, x_2 = 0.9$. Construct interpolation polynomials of degree at most one and at most two to approximate $f(0.45)$, and find the absolute error.

Where $f(x) = \sqrt{1 + x}$

So lets start with the first case (linear)

from the formula for lagrange polynomials you get:

$L_0(x) = \frac{x - x_1}{x_0 - x_1} = \frac{x - 0.6}{0 - 0.6} = -\frac{x-0.6}{0.6}$

Then

$L_1(x) = \frac{x-x_0}{x_1 - x_0} = \frac{x - 0}{0.6 - 0} = \frac{x}{0.6}$

Then the linear polynomial is

$P_1(x) = L_0(x)f(x_0) + L_1(x)f(x_1) = -\frac{x-0.6}{0.6} (1) + \frac{x}{0.6}(1.26491)$

Simplifying:

$P_1(x) = .44151x + 1$

Then I find that $|f(x) - P_1(x)| = 0.00547946$, which does not at all agree with the book answer. What am I doing wrong?

Are you trying to find $|f(x)-P_1(x)|$ at $x=0.45$?
If so, then $f(0.45)\approx 1.204159$ and $P_1(0.45)\approx 1.198683$ and $|f(0.45)-P_1(0.45)|\approx 0.005476$. Does this agree with the book answer?
• After reviewing my work above, I see the same thing as you. Though the book suggests $P_1(x) = .467251x + 1$, which ends up slightly worse than our approximation. I'm not sure how the book got this, and I'm wondering if this is riddled with typos. – John Oct 10 '14 at 5:50
• I get $P_1(x)\approx 0.44151844... x+1$. – Joel Reyes Noche Oct 10 '14 at 5:52