Use the Lagrange interpolation formula to find a polynomial \(f\) with real coefficients such that \(f\) has degree \(\leq 3\) and \(f(-1) = -6\), \(f(0) = 2\), \(f(1) = -2\), \(f(2) = 6\).
Solution
The Lagrange interpolation polynomial is \[ \begin{aligned} f(x)=&-6\frac{x(x-1)(x-2)}{(-1)(-2)(-3)} +2\frac{(x+1)(x-1)(x-2)}{(1)(-1)(-2)}\\ &-2\frac{(x+1)x(x-2)}{(2)(1)(-1)} +6\frac{(x+1)x(x-1)}{(3)(2)(1)}. \end{aligned} \] Simplifying gives \[ \boxed{f(x)=4x^3-6x^2-2x+2}. \] Direct substitution gives \(f(-1)=-6\), \(f(0)=2\), \(f(1)=-2\), and \(f(2)=6\).