Полином от първа степен:

A=(({{5, 10}, {10, 30}}));b={8,20};
LinearSolve[A,b]

%//N

P1[x_]:=0.4x+0.8
xt={0,1,2,3,4};
yt={1,2,1,0,4};
R1=(Sqrt[(∑_(i=1)^5)(((yt[[i]]-P1[xt[[i]]]))^2)])

Полином от втора степен:

A2=(({{5, 10, 30}, {10, 30, 100}, {30, 100, 354}}));b2={8,20,70};
LinearSolve[A2,b2]

%//N

{1.6571428571428573`,-1.3142857142857143`,0.42857142857142855`}

P2[x_]:=(3/7)(x^2)-(46/35)x+(58/35)
R2=(Sqrt[(∑_(i=1)^5)(((yt[[i]]-P2[xt[[i]]]))^2)])

%//N

Задача, подобна на изпитна:

phi[x_]:=Sin[2x]
xt=Table[2+j*0.1,{j,5,20}]
yt = phi[xt]
NN = Length[xt]

(∑_(i=1)^NN)xt[[i]]

xt^2

xt*yt

A=(({{NN, (∑_(i=1)^NN)xt[[i]]}, {(∑_(i=1)^NN)xt[[i]], (∑_(i=1)^NN)(((xt[[i]]))^2)}}))

b={(∑_(i=1)^NN)yt[[i]],(∑_(i=1)^NN)xt[[i]]yt[[i]]}