# Lagrange Interpolation - two approaches

I want to ask something about Lagrange-Interpolation Polynomials: Given the following pairs of values:

$p(x_i,y_i): p_0(0, 1), p_1(1.5, 2), p_2(2.5, 2)$

I found two ways of calculating the polynomial:

(a)

$\sum f(x_i)L_i(x)$, where $L_i(x) = \frac{(x-x_0)...(x-x_{i-1}(x-x_{i+1}...(x_i-x_n)}{(x_i-x_0)...(x_i-x_{i-1})(x_i-x_{i+1})...(x_i-x_n)}.$

(b)

$P_n(x) = a_0+a_1x+a_2x^2+...+a_nx^n$

This is equal to:

$\left ( \begin{array}{cccc} 1 & x_0 & x_0^2 &... &x_0^n\\ ...& ...& ...& ...& ... \\ 1& x_n& x_n^2& ...& x_n^n\end{array}\right ) \left( \begin{array}{c}a_0\\ a_1 \\ ... \\ a_n \end{array}\right ) = \left( \begin{array}{c} y_0\\ y_1\\ ...\\ y_n\end{array} \right)$

Can solve for the vector: $(a_0...a_n)^T$

Are this two approaches equivalent?

Thank you very much for your help.

• Yes, they are guaranteed to give the same polynomial. The first one is just not expanded out. – JasonM Jun 12 '16 at 7:15