Recall our equation from least-squares:

Let’s use the QR factorization: .

Because is upper triangular we have

Thus, we get the equivalent linear system

Let’s solve for :

using .

The final solution is

Recall the normal equation:

The condition number is reduced from

to

This is a huge improvement!

Note that this method requires to be non-singular. This is equivalent to saying that should be full column rank.

The computational cost is .

Least-squares problems, QR factorization, QR using Householder transformations, QR using Givens transformations, Method of normal equation