Fitting parabola to data set using inner products

87 Views Asked by At

I need to find $P(x) = ax^2 +bx + c$ that fits the following data set: $$P(1) = 2\\P(2) = 3\\P(3) = 4$$

using the least squares method. That is, we need to minimize

$$\min \sum_{i=0}^2 (y_i -(ax_i^2 + bx_i + c))^2$$

I don't know how but somehow, using polynomial projections I can see that

$$\langle y-(ax^2 + bc + c), 1\rangle = 0\\\langle y-(ax^2 + bc + c), x\rangle = 0\\\langle y-(ax^2 + bc + c), x^2\rangle = 0$$

can anyone explain me this part?

which leads us to

$$\begin{bmatrix} \langle x^2,1\rangle & \langle x,1\rangle & \langle 1,1\rangle\\ \langle x^2,x\rangle & \langle x,x\rangle & \langle 1,x\rangle \\ \langle x^2,x^2\rangle & \langle x,x^2\rangle & \langle 1,x^2\rangle \end{bmatrix}\begin{bmatrix}a \\ b \\ c\end{bmatrix} = \begin{bmatrix}\langle y,1 \rangle\\\langle y,x \rangle\\\langle y,x^2 \rangle\end{bmatrix}$$

If we use the inner product:

$$\langle f,g\rangle = \sum_{i=0}^2f_i g_i$$

we end up with

$$\begin{bmatrix} 14 & 6 & 3\\36 & 14 & 6 \\ 98 & 36 & 14 \end{bmatrix}\begin{bmatrix}a \\ b \\ c\end{bmatrix} = \begin{bmatrix}9 \\ 20 \\ 50\end{bmatrix}$$

which leads to $a=0,b=1,c=1$ which is not the polynomial I wanted.

Attention: please do not use derivatives and equate to $0$, I need to solve this using projections and inner products