# Least-squares problem with Householder transformation

We need to find a linear function $f(x)=a_1x+a_0$ such that $\sum_{i=1}^4(f(x_i)-y_i)^2$ is minimal. $x_1=-2,x_2=-1,x_3=0,x_4=1,$ and $y_1=1,y_2=2,y_3=0,y_4=1$.

So, if I am right, I need to solve the least-squares problem for $$A=\begin{bmatrix}1 & -2\\1 & -1\\ 1&0\\1&1\end{bmatrix},b=\begin{bmatrix}1\\2\\0\\1\end{bmatrix}$$ and our "$x$"$=\begin{bmatrix}a_0\\a_1\end{bmatrix}$.

Is it correct so far?

I'm asking because the results I get on paper are questionable.

• There is a typo in the last row and second column of $A$. It should be $1$. May 5, 2017 at 15:50
• Thanks, I've corrected my mistakes. May 5, 2017 at 15:58
• Then you apply the least squares formula $x=(A^TA)^{-1}A^Tb$... May 6, 2017 at 22:22