$$ A= \begin{pmatrix} 1 & 5\\ 2 & -2\\ -1 & 1 \end{pmatrix} $$
$$ b= \begin{pmatrix} 3 \\ 2 \\5 \end{pmatrix} $$
this is another one of those least square solution problems which are a pain to compute by hand, so i will skip most of the computation and show the results
To find the least square solution, i am supposed to use this equation.
$x = inverse(A^TA) * A^Tb $
and this is what i got for x = [1/3 , 8/15] , this is the least square solution
now i am being asked to find the distance from Ax to b
and i think im supposed to use the formula
||b - Ax||
is this the correct formula to find the distance between Ax and b?
the result i got was 5.36656, i need someone to check this for me
As a student of mathematics, it is very beneficial to learn a programming like mathematical programming language like MATLAB or Mathematica so you can check your work. For example, using MATLAB, we compute
So yes, you are right.