I have a question about dealing polynomials using matrix For example, let's say we find a constant function that is closest to $y=x^4$ on the interval $0\leq x\leq1$. Then we solve matrix
$ \begin{bmatrix}(1,1) & (1,x)\end{bmatrix}$$\begin{bmatrix}C \\ 0 \end{bmatrix}= $ $\begin{bmatrix}(1,x^4) \end{bmatrix}$
and integrate $(1,1)=\int _{0}^{1}dx=1$ and $(1,x^4)=\int _{0}^{1}x^{4}dx=\dfrac{1}{5}.$ Thus we get $C=\dfrac{1}{5}$
That's how I was instructed to do routinely without understanding.
I want to know what the ordered pairs $(1,1)$ $(1,x)$ actually mean in that matrix and why we are integrating on the interval and why $(1,1)$ equals to $\int _{0}^{1}dx$ and $(1,x^4)$ to $\int _{0}^{1}x^{4}dx$.
Not only that, it seems to me they use the matrix $\begin{bmatrix} (1,1) & (1,x)&\dots \\(x,1)&(x,x)&\dots\\(x^2,1)&(x^2,x)&\dots\\ \vdots & \vdots \end{bmatrix}$ when they deal with such polynomials problems. Where did that matrix come from and how? Why did they construct that matrix with such ordered pairs?
 A: A comment: you don't need a $1\times 2$ matrix, $1\times 1$ will do:
$$
[\langle 1,1\rangle][C]=[\langle 1,x^4\rangle]
$$
has all the information you need.
The setup. To start with we have to know what "closest" means, that is we need to say what we mean by the distance between two functions $f,g$ both defined on $[0,1]$. We have an inner product defined on the space of functions, namely $\langle f,g\rangle:=\int_{0}^{1} f(x)g(x)dx.$ The square of the distance between $f$ and $g$ is defined as $\langle f-g,f-g\rangle$, which simplifies to $\langle f,f\rangle -2\langle f,g\rangle+\langle g,g\rangle$. (This is just like the cosine rule when we are dealing with ordinary vectors.)
Constant Function. We want to find a constant function $x\mapsto C$ which is closest to the function  $x\mapsto x^4$.
The square of the distance  between these functions is $C^2 \langle 1,1\rangle -2C \langle 1,x^4\rangle +\langle x^4,x^4\rangle$. For a minimum we must find the derivative and equate it to $0$, that is we need to solve $2C\langle 1,1\rangle -2C \langle 1,x^4\rangle=0$. This gives $C=\frac{\langle 1,x^4\rangle}{\langle 1,1\rangle}=\frac{1}{5}$ as you know.
Linear Function. Now suppose we wanted to find the linear function $x\mapsto A+Bx$ closest to $x^4$.
The distance squared is $\langle A+Bx, A+Bx\rangle -2\langle A+Bx,x^4\rangle -\langle x^4,x^4\rangle.$ If we crunch this out we see it is equal to
$$
A^2\langle 1,1\rangle 
+2AB\langle 1,x\rangle
+B^2 \langle x,x\rangle
-2A\langle 1,x^4\rangle
-2B\langle x,x^4\rangle
+\langle x^4,x^4\rangle.
$$
This time we need to differentiate with respect to $A$ and to $B$ and set both equal to $0$. This gives us two equations, and (after we do the calculation) we can write it in matrix terms
$$
\begin{bmatrix}\langle 1,1\rangle & \langle x,1\rangle\\
\langle 1,x\rangle & \langle x,x\rangle\end{bmatrix}
\begin{bmatrix}A \\ B \end{bmatrix}=
\begin{bmatrix}\langle 1,x^4\rangle \\ \langle x,x^5\rangle\end{bmatrix}
$$
The general case.  All this can be generalised but I am going to leave that for you to explore.
