We want to fit
$f(x) = a_0 + a_1 *x + a_2 * x^2 + ... + a_n * x^n$
to the data $(x_i,f(x_i))$ for $i = 0 ... n.$
It will give rise to the following system
$ A a = b $
Here $ a = [ a_1 a_2 a_3 ... a_n]$
$ A = [ 1 x_0 x_0^2 ... x_0^n ; 1 x_1 x_1^2 ... x_1^n ; 1 x_2 x_2^2 ... x_2^n ; ... ; 1 x_n x_n^2 ... x_n^n]$
and
$ b = [f(x_0) f(x_1) f(x_2) ... f(x_n)].$
What are explict expression for $a_i$?
You are essentially asking for an explicit formula for the inverse of a Vandermonde matrix. See the formula on ProofWiki, for instance.