How do you find the least square solution of this system? The problem is:
Find the least square solution of $Ax=b$ if $$A = \begin{pmatrix}1 & 2\\1 & 3\\1 & 4 \end{pmatrix} \text{     and     }b = \begin{pmatrix}2\\3\\2\end{pmatrix}.$$ I have $x = (A^TA)^{-1}A^Tb$ 
$$x = \begin{pmatrix}5&7&9\\7&10&13\\9&13&17\end{pmatrix}^{-1} \times \begin{pmatrix}7\\21\end{pmatrix}$$
Can someone tell me if I am on the right track at figuring this out?

$A^TA$ in your case should be a $2 \times 2$ matrix. $$A^T A = \begin{pmatrix} 1 & 1 & 1\\ 2 & 3 & 4 \end{pmatrix} \begin{pmatrix} 1 & 2\\ 1 & 3\\ 1 & 4\end{pmatrix} = \begin{pmatrix} 3 & 9 \\ 9 & 29 \end{pmatrix}$$
Hence your $x^{ls}$ is obtained by solving $$A^TAx^{ls} = A^Tb$$ i.e. $$\begin{pmatrix} 3 & 9 \\ 9 & 29 \end{pmatrix} \begin{pmatrix} x^{ls}_1 \\ x^{ls}_2 \end{pmatrix} = \begin{pmatrix} 1 & 1 & 1\\ 2 & 3 & 4 \end{pmatrix}\begin{pmatrix} 2 \\ 3 \\ 2 \end{pmatrix} = \begin{pmatrix} 7 \\ 21\end{pmatrix}$$ This give us the solution $$x^{ls} = \begin{pmatrix} 7/3 \\ 0\end{pmatrix}$$
