QR Decomposition Application

1. The problem statement, all variables and given/known data
Okay so I'm supposed to find the least squares solution of a set of equations, which I can do, but it adds that I must use QR decomposition. I don't really know how to apply QR decomposition to this problem.

Problem: Find the least squares solution of
$$x_1 + x_2 = 4$$
$$2x_1+x_2 = -2$$
$$x_1 - x_2 = 1$$

Use your answer to find the point on the plane spanned by (1,1,2) and (1,-3,1) that is closest to (1,4,3).

2. Relevant equations

3. The attempt at a solution
 PhysOrg.com science news on PhysOrg.com >> Ants and carnivorous plants conspire for mutualistic feeding>> Forecast for Titan: Wild weather could be ahead>> Researchers stitch defects into the world's thinnest semiconductor
 Forget the least squares stuff for a moment. Find the QR factorization of A, so we have A = QR. For least squares, you need to solve the equation $A^TAx = A^Tb$ right? So substitute in A = QR to get $(QR)^T(QR) = R^TQ^TQR$. The whole gimmick of orthonormal matrices such as Q is that $Q^TQ = I$, so we have $A^TAx = R^TRx = (QR)^Tb$. So $R^TRx= R^TQ^Tb$. sp the least squares equation comes down to $Rx = Q^Tb$. But R is invertible, so the least squares solution is just $$x = R^{-1}Q^Tb$$