TITLE: $Ax=b$ is solvable, then it has the same solutions of $A^TAx=A^Tb$
QUESTION [5 upvotes]: I have to prove that given a matrix $A \in \mathbb{R}_{m\times n}$ and $b \in \mathbb{R}^n$. 
Suppose that the system $Ax=b$ is solvable, x is solution of $Ax=b$ If and only if x is solution of $A^TAx=A^Tb$.
It's easy to show that if x is solution of $Ax=b$ them it is also solution if $A^tAx=A^Tb$, but I can't figure out why I have the other direction even if $A$ doesn't have full rank (that partícular case is easy to solve).

REPLY [2 votes]: $A^T Ax = A^T b \iff  x$ minimizes $\|Ay-b\|_2$. And $Ax=b$ is solvable if and only if this minimum is zero.