Clear[XY, n]; 
f[x_]:=1 + Sin[10 x]; 
pt[x_]:= 10+ (x-1)/14; 
n=15;
XY=N[Table[{pt[i], f[pt[i]]},  {i, 1,n}],10];

A = Table[{1, XY[[i,1]], XY[[i,1]]^2,
  XY[[i,1]]^3, XY[[i,1]]^4,
  XY[[i,1]]^5,XY[[i,1]]^6},{i, 1,n}];
b = Table[ XY[[i,2]], {i,1,n}];
MatrixForm[A];

ATA = Transpose[A].A ;
ATb = Transpose[A].b ; 
 MatrixForm[ATA]; 
 MatrixForm[ATb];

Clear[LU];
LU=GaussLU[ATA];
a1=N[GaussSol[LU,ATb], digit]

least1[x_] =a1[[1]] + a1[[2]]x + 
  a1[[3]]x^2+a1[[4]]x^3+a1[[5]]x^4+ 
  a1[[6]] x^5 + a1[[7]] x^6

Clear[nodes,gp1]
nodes=ListPlot[XY,PlotStyle->
  PointSize[.02],
DisplayFunction->Identity]; 
gp1=Plot[least1[x],{x,10,11},
   DisplayFunction->Identity];
Show[nodes, gp1,DisplayFunction->
   $DisplayFunction]

Clear[GS,B]
GS=GramSchmidt[A];
B= Transpose[GS] . b; 
a2 = BackSub[t,B]

least2[x_] = a2[[1]] + a2[[2]]x + 
  a2[[3]]x^2 + a2[[4]]x^3 +a2[[5]]x^4+
  a2[[6]]x^5 + a2[[7]]x^6

Clear[gp2]
gp2=Plot[least2[x],{x, 10, 11},DisplayFunction->Identity];
Show[nodes, gp2,DisplayFunction->
  $DisplayFunction]

error1=Sum[(least1[pt[i]]-f[pt[i]])^2, 
  {i, 1,15}]//N

error2=Sum[(least2[pt[i]]-f[pt[i]])^2, 
  {i, 1,15}]//N

a1

a2

norm[a1-a2]

eigens = Eigenvalues[ATA];
Cond[ATA] = Max[Abs[eigens]] /
    Min[Abs[eigens]]

Clear[f];
f[x_]=Fit[XY, {1,x,x^2, x^3, x^4,
    x^5, x^6}, x]

Clear[dots, least];
dots = ListPlot[XY,PlotStyle->{PointSize[0.02]},DisplayFunction->
    Identity];
least= Plot[f[x],{x,10,11}, 
    DisplayFunction->Identity];
Show[least, dots, DisplayFunction->
 $DisplayFunction,
PlotLabel->txt,AxesLabel->{"x","y  "}]