Mathematics Previous page   Next Page

QR Factorization

An orthogonal matrix, or a matrix with orthonormal columns, is a real matrix whose columns all have unit length and are perpendicular to each other. If Q is orthogonal, then

The simplest orthogonal matrices are two-dimensional coordinate rotations.

For complex matrices, the corresponding term is unitary. Orthogonal and unitary matrices are desirable for numerical computation because they preserve length, preserve angles, and do not magnify errors.

The orthogonal, or QR, factorization expresses any rectangular matrix as the product of an orthogonal or unitary matrix and an upper triangular matrix. A column permutation may also be involved.

or

where Q is orthogonal or unitary, R is upper triangular, and P is a permutation.

There are four variants of the QR factorization- full or economy size, and with or without column permutation.

Overdetermined linear systems involve a rectangular matrix with more rows than columns, that is m-by-n with m > n. The full size QR factorization produces a square, m-by-m orthogonal Q and a rectangular m-by-n upper triangular R.

In many cases, the last m - n columns of Q are not needed because they are multiplied by the zeros in the bottom portion of R. So the economy size QR factorization produces a rectangular, m-by-n Q with orthonormal columns and a square n-by-n upper triangular R. For our 3-by-2 example, this is not much of a saving, but for larger, highly rectangular matrices, the savings in both time and memory can be quite important.

In contrast to the LU factorization, the QR factorization does not require any pivoting or permutations. But an optional column permutation, triggered by the presence of a third output argument, is useful for detecting singularity or rank deficiency. At each step of the factorization, the column of the remaining unfactored matrix with largest norm is used as the basis for that step. This ensures that the diagonal elements of R occur in decreasing order and that any linear dependence among the columns is almost certainly be revealed by examining these elements. For our small example, the second column of C has a larger norm than the first, so the two columns are exchanged.

When the economy size and column permutations are combined, the third output argument is a permutation vector, rather than a permutation matrix.

The QR factorization transforms an overdetermined linear system into an equivalent triangular system. The expression

is equal to

Multiplication by orthogonal matrices preserves the Euclidean norm, so this expression is also equal to

where y = Q'*b. Since the last m-n rows of R are zero, this expression breaks into two pieces

and

When A has full rank, it is possible to solve for x so that the first of these expressions is zero. Then the second expression gives the norm of the residual. When A does not have full rank, the triangular structure of R makes it possible to find a basic solution to the least squares problem.


Previous page  LU Factorization Matrix Powers and Exponentials Next page

© 1994-2005 The MathWorks, Inc.