On the non-uniqueness of the QR factorization

527 Views Asked by At

I learned in class about the QR-factorization, and I got to know two algorithms to calculate it; using the Gram–Schmidt process and Householder transformations.

My issue is that those two processes don't seem to always yield the same result for the same matrix - for example, consider the following matrix:

$A := \begin{bmatrix} 3 & -6 \\ 5&-8 \\ 0 & 1 \end{bmatrix}$

Using the Gram-Schmidt process, I arrive at the following decomposition:

$A = QR = \begin{bmatrix} \frac{3}{5} & 0 \\ \frac{4}{5}& 0 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 5 & -10 \\ 0& 1 \end{bmatrix}$

But using Householder transformations, I get a different result:

$A = Q^\prime R^\prime = \begin{bmatrix} -\frac{3}{5} & 0 & \frac{4}{5} \\ -\frac{4}{5}& 0 & -\frac{3}{5}\\ 0 & -1 & 0 \end{bmatrix}\begin{bmatrix} -5 & 10 \\ 0& -1 \\ 0 & 0 \end{bmatrix} $

Now, I do understand that the QR decomposition is not unique, but what confuses me is that even the dimensions of the resulting matrices are different. Why is this the case? Does this have any real consequences when I am asked to choose one of those algorithms? Does this cause stability issues?