Find the interpolating polynomial of degree $3$ that interpolates $f(x) = x^3$ at the nodes $x_0=0, x_1 = 1, x_2=2, x_3 = 3$.

Here are my workings below

The basic Lagrange polynomials are:

$$L_0(x) = \frac{(x-1)(x-2)(x-3)}{(0-1)(0-2)(0-3)}$$

$$L_1(x) = \frac{(x-0)(x-2)(x-3)}{(1-0)(1-2)(1-3)}$$

$$L_2(x) = \frac{(x-0)(x-1)(x-3)}{(2-0)(2-1)(2-3)}$$

$$L_3(x) = \frac{(x-0)(x-1)(x-2)}{(3-0)(3-1)(3-2)}$$

Then the interpolating polynomial is:

$$P(x) = L_0(x)+(1)^3L_1(x)+(2)^3L_2(x)+(3)^3L_3(x)$$

Am I allowed to find the interpolating polynomial using these basic lagrange polynomials? and is my $P(x)$ correct? I wasn't sure if the first term should be $L_0(x)$?

  • $\begingroup$ You would get $$P(x) = 0+ 0.5 (x-3.) (x-2.) (x+0.)-4. (x-3.) (x-1.) (x+0.)+4.5 (x-2.) (x-1.) (x+0.) = x^3$$ $\endgroup$
    – Moo
    Oct 30, 2018 at 16:20
  • 1
    $\begingroup$ You're allowed to do Lagrange interpolation, and you're probably allowed to do all sorts of complicated things, but you'd be better off if you just observe that the given $f(x)=x^3$ is already a polynomial of degree 3. $\endgroup$ Oct 30, 2018 at 16:33
  • $\begingroup$ sorry I made a mistake, you are correct $\endgroup$
    – mt12345
    Oct 30, 2018 at 16:58
  • $\begingroup$ @Moo sure, if you could add what error you can expect when using this interpolating polynomial to approximae $f(x) = x^3$ at $x=\frac{1}{2}$ that would be great $\endgroup$
    – mt12345
    Oct 30, 2018 at 21:07
  • 1
    $\begingroup$ It is already there. Regards $\endgroup$
    – Moo
    Oct 30, 2018 at 21:42

1 Answer 1


Your calculations are correct.

The final result is

$P_3(x) = 0.0 + 0.5 (x-3) (x-2) (x+0)-4 (x-3) (x-1) (x+0)+4.5 (x-2) (x-1) (x+0) = x^3$

The formula for the error bound is given by:

$$E_n(x) = {f^{(n+1)}(\xi(x)) \over (n+1)!} \times (x-x_0)(x-x_1)...(x-x_n)$$

So, we have

$$E_3(x) = {f^{(4)}(\xi(x)) \over 4!} \times (x-0)(x-1)(x-2)(x-3)$$

The fourth derivative of $f(x) = x^3$ is zero, so $E_3(x) = 0$.

The reason for this is if $f(x) = $ polynomial of degree $M$ where $M \le N$, then $$f^{(n)}(x) = 0 \implies E_n(x) = 0 ~\forall~ x$$

Therefore $P_3(x)$ is an exact representation of $f(x) = x^3$.

  • $\begingroup$ one question, did you use my lagrange calculations above to find $p_3(x)$ or did you use another formula? $\endgroup$
    – mt12345
    Oct 30, 2018 at 21:44
  • $\begingroup$ I used the same approach, but used code I wrote to get my result, but yours is the same (I verified it). There are other approaches too. You can check your result using Wolfram Alpha also. $\endgroup$
    – Moo
    Oct 30, 2018 at 21:46
  • $\begingroup$ okay I didn't know if I could use lagrange to get that polynomial or not $\endgroup$
    – mt12345
    Oct 30, 2018 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.