Assume that we have
- An interval $[a,b]$
- A function $f(x)$ that is continuous on $[a,b]$
- $n+1$ distinct points $a = x_0<x_1<x_2<\cdots<x_n = b$
- And $f(x_0),f(x_1),\ldots,f(x_n)$
Now we want to find the polynomial $$P(x)=a_0+a_{1}x+a_{2}x^2+\cdots+a_{n}x^n$$ which satisfies the conditions $$P(x_i)=f(x_i) \qquad for \qquad i=0,1,\ldots,n$$ Substituting the conditions, we obtain the system of equations $$a_{0}+a_{1}x_{0}+a_{2}x^{2}_{0}+\cdots+a_{n}x^{n}_{0}=f(x_0)$$ $$a_{0}+a_{1}x_{1}+a_{2}x^{2}_{1}+\cdots+a_{n}x^{n}_{1}=f(x_1)$$ $$\vdots$$ $$a_{0}+a_{1}x_{n}+a_{2}x^{2}_{n}+\cdots+a_{n}x^{n}_{n}=f(x_n)$$ Solution of this system of equations is unique, or $P(x)$ exists because the Vandermonde's determinant $$ \begin{pmatrix} 1 & x_{0} & x^{2}_{0} & \cdots & x^{n}_{0} \\ 1 & x_{1} & x^{2}_{1} & \cdots & x^{n}_{1} \\ \vdots & & & & \\ 1 & x_{n} & x^{2}_{n} & \cdots & x^{n}_{n} \\ \end{pmatrix} = \prod_{i,j=0, i>j}^n(x_i-x_j) \neq 0 $$ Assume $n=2$, then we want to determine $$P_{2}(x)=a_{0}+a_{1}x+a_{2}x^{2}$$ where $a_0,a_1,a_2$ are arbitary constants that satisfies the conditions $$f(x_0)=P_{2}(x_0), f(x_1)=P_{2}(x_1) \quad and \quad f(x_2)=P_{2}(x_2)$$ Now we have $$f(x_0)=a_{0}+a_{1}x_{0}+a_{2}x^{2}_{0}$$ $$f(x_1)=a_{0}+a_{1}x_{1}+a_{2}x^{2}_{1}$$ $$f(x_2)=a_{0}+a_{1}x_{2}+a_{2}x^{2}_{2}$$ Eliminating $a_0,a_1,a_2$ we obtain $$ \begin{pmatrix} P_2(x) & 1 & x & x^{2} \\ f(x_0) & 1 & x_0 & x^{2}_{0} \\ f(x_1) & 1 & x_1 & x^{2}_{1} \\ f(x_2) & 1 & x_2 & x^{2}_{2} \end{pmatrix} = 0 $$ Expanding the determinant, we obtain $$P_2(x)C_0-f(x_0)C_1+f(x_1)C_2-f(x_2)C_3=0$$ where $$ C_0=\begin{pmatrix} 1 & x_0 & x^{2}_{0} \\ 1 & x_1 & x^{2}_{1} \\ 1 & x_2 & x^{2}_{2} \end{pmatrix} = (x_0-x_1)(x_1-x_2)(x_2-x_0) $$ $$ C_1=\begin{pmatrix} 1 & x & x^{2} \\ 1 & x_1 & x^{2}_{1} \\ 1 & x_2 & x^{2}_{2} \\ \end{pmatrix} = (x-x_1)(x_1-x_2)(x_2-x) $$ $$ C_2=\begin{pmatrix} 1 & x & x^{2} \\ 1 & x_0 & x^{2}_{0} \\ 1 & x_2 & x^{2}_{2} \end{pmatrix} = (x-x_0)(x_0-x_2)(x_2-x) $$ $$ C_3=\begin{pmatrix} 1 & x & x^{2} \\ 1 & x_0 & x^{2}_{0} \\ 1 & x_1 & x^{2}_{1} \end{pmatrix} = (x-x_0)(x_0-x_1)(x_1-x) $$ Therefore $$P_2(x)=\frac{C_1}{C_0}f(x_0)-\frac{C_2}{C_0}f(x_1)+\frac{C_3}{C_0}f(x_2)$$ $$=\frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)}f(x_0)+\frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)}f(x_1)+\frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)}f(x_2)$$ $$=l_0(x)f(x_0)+l_1(x)f(x_1)+l_2(x)f(x_2)$$ I understand the above, but how eliminating $a_0,a_1,a_2$ to obtain $$ \begin{pmatrix} P_2(x) & 1 & x & x^{2} \\ f(x_0) & 1 & x_0 & x^{2}_{0} \\ f(x_1) & 1 & x_1 & x^{2}_{1} \\ f(x_2) & 1 & x_2 & x^{2}_{2} \end{pmatrix} = 0 $$ whereas we know $P_2(x),f(x_0),f(x_1)$ and $f(x_2)$ are not coefficients?
Reference: Numerical Methods For Scientific And Engineering Computation By M.K. Jain
I think you should have:
$\left( \begin{array}{ccc} 1 & x_0 & x_0^2 \\ 1 & x_1 & x_1^2 \\ 1 & x_2 & x_2^2 \end{array} \right)\left( \begin{array}{ccc} a_0 \\ a_1 \\ a_2 \end{array} \right)=\left( \begin{array}{ccc} f(x_0) \\ f(x_1) \\ f(x_2) \end{array} \right)$, then you solve for the coefficients right?