Least square solutions when $Ax=b$ has no solution I have this linear alegbra question that I don't know how to start.
The question:
$$A = \left( \begin{matrix}1 & -2 \\3 & 1  \\2 & 3  \\\end{matrix}\right ) $$
$$b= \left (\begin{matrix}
        0  \\
        1   \\
        0   \\
        \end{matrix}\right )$$
$$r = \left ( \begin{matrix}
        x \\
        y  \\
        \end{matrix} \right )$$
The matrix equation of $Ar-b$ has no solution because it is inconsistent. If we define the square error to be $\Delta^2 = \delta^T\delta$ where δ=Ar−b, we can still solve the least square sense.
Explain why $\Delta^2$ is a function of x and y and that $\Delta^2 $ is minimised by the solution of $$A^TAr = A^Tb$$
Need some guidance in solving this two parts.

We have
$$A^T A =  \left( \begin{matrix}1&3&2\\-2&1&3 \\\end{matrix}\right )  \left( \begin{matrix}1 & -2 \\3 & 1  \\2 & 3  \\\end{matrix}\right ) = \left ( \begin{matrix} 14 & 7\\ 7 & 14 \end{matrix} \right )$$
and
$$A^T b =  \left( \begin{matrix}1&3&2\\-2&1&3 \\\end{matrix}\right )  \left ( \begin{matrix} 0\\1\\0 \end{matrix} \right )= \left( \begin{matrix} 3\\1 \end{matrix} \right )$$
So we result in a $2\times 2$ linear equation system with an unique solution:
$$\left ( \begin{matrix} 14 & 7\\ 7 & 14 \end{matrix} \right ) r = \left( \begin{matrix} 3\\1 \end{matrix} \right)$$   
So far for the solution. Now why is $\Delta^2$ a function of $r = (x,y)^T$? Well, because the definition says
$$\Delta^2 = (Ar-b)^T (Ar-b) = (Ar)^T(Ar) - (Ar)^T b - b^T Ar + b^Tb = r^T A^TA r - r^T A^Tb - b^T Ar + b^Tb = r^T (A^TAr-2A^Tb) + b^Tb$$
with constant $A, b$. Thus, $\Delta^2 = \Delta^2(r) = \Delta^2(x,y)$. Using the latter expanded form, minimizing $\Delta^2$ is the same as minimizing $r^T A^TAr - 2r^TA^Tb$. The rest is basic calculus.
