Given a linear system of equations $y=Ax$, the solution to the Lest Squares problem is the vector $\hat{x}$ that minimices the vector $r=y-A\hat{x}$. In my case, I am working in a problem in which I want to minimice the difference between the vector $r^{2}$ (this is, the vector of the elements of $r$ square) and a vector $m$ in which all the elements of the vector have the same value. I am trying to derive the expression but I got nothing. Does someone know how to do it?
Thanks!!