I have these sample data points (0,1), (1,4), (2,11), (3,22), and I have to compute the corresponding lagrange polynomial and express it in the form $p(x)= a_nx^n + a_{n-1}x^{n-1}...+a_1x + a_0$
My approach: third order Lagrange polynomial: $ f_3(x)=L_1f(x_1)+L_2f(x_2)+L_3f(x_3)+L_4+f(x_4) $
So to compute $L_1$ I say:
$L_1 = \frac{(x-x2)(x-x3)(x-x4)}{(x1-x2)(x1-x3)(x1-x4)}$
(and for L2, L3, L3, I use same formula with the respective x-values)
This give me a rather "messy" third order polynomial, which I can't see how translate to $p(x)= a_nx^n + a_{n-1}x^{n-1}...+a_1x + a_0$
So, I'm in doubt wether this is this the right approach at all?
Substitute the numerical values of $x_i$ and $f(x_i)$ and expand the polynomials in the numerators of $L$'s. Now you have four cubic polynomials, so simply add the coefficients at corresponding powers of $x$.