QR decomposition
Given the QR decomposition, the minimization problem is easily solved by noting that