In more general terms, what we have done here is to approximate a given function \( f(x) \) with a polynomial of a certain degree. One can show that given \( n+1 \) distinct points \( x_0,\dots, x_n\in[a,b] \) and \( n+1 \) values \( y_0,\dots,y_n \) there exists a unique polynomial \( P_n(x) \) with the property $$ \begin{equation*} P_n(x_j) = y_j\hspace{0.5cm} j=0,\dots,n \end{equation*} $$