$$ \newcommand{\qed}{\tag*{$\square$}} \newcommand{\span}{\operatorname{span}} \newcommand{\dim}{\operatorname{dim}} \newcommand{\rank}{\operatorname{rank}} \newcommand{\norm}[1]{\|#1\|} \newcommand{\grad}{\nabla} \newcommand{\prox}[1]{\operatorname{prox}_{#1}} \newcommand{\inner}[2]{\langle{#1}, {#2}\rangle} \newcommand{\mat}[1]{\mathcal{M}[#1]} \newcommand{\null}[1]{\operatorname{null} \left(#1\right)} \newcommand{\range}[1]{\operatorname{range} \left(#1\right)} \newcommand{\rowvec}[1]{\begin{bmatrix} #1 \end{bmatrix}^T} \newcommand{\Reals}{\mathbf{R}} \newcommand{\RR}{\mathbf{R}} \newcommand{\Complex}{\mathbf{C}} \newcommand{\Field}{\mathbf{F}} \newcommand{\Pb}{\operatorname{Pr}} \newcommand{\E}[1]{\operatorname{E}[#1]} \newcommand{\Var}[1]{\operatorname{Var}[#1]} \newcommand{\argmin}[2]{\underset{#1}{\operatorname{argmin}} {#2}} \newcommand{\optmin}[3]{ \begin{align*} & \underset{#1}{\text{minimize}} & & #2 \\ & \text{subject to} & & #3 \end{align*} } \newcommand{\optmax}[3]{ \begin{align*} & \underset{#1}{\text{maximize}} & & #2 \\ & \text{subject to} & & #3 \end{align*} } \newcommand{\optfind}[2]{ \begin{align*} & {\text{find}} & & #1 \\ & \text{subject to} & & #2 \end{align*} } $$
In this section, we will present a procedure for converting any list of linearly independent vectors into a list of orthonormal vectors that preserves spans. Applying this procedure to the columns of a matrix and encoding the correspondence between the two lists of vectors as the product of two matrices yields the QR factorization, one of the most important factorizations in applied linear algebra.
Let be a list of linearly independent vectors. Define , and for , let
Then is orthonormal, and .
When applied to a list of linearly dependent vectors, one of the will equal . Gram-Schmidt can therefore be used to determine whether a list of vectors is linearly dependent.
Let be full rank, , and let denote the columns of . Running Gram-Schmidt on the columns of yields a list of vectors satisfying
where , for , and for . This relation can be expressed succintly as , where has columns and is an upper triangular matrix with entires . This decomposition is called the reduced QR factorization of .
With a slight modification to the Gram-Schmidt procedure, we can obtain a QR factorization for rank-deficient matrices , , . Run Gram-Schmidt on the columns of as before. However, whenenver (i.e., whenever is in ), do not form and instead continue to . In this fashion, we obtain with orthonormal columns and an upper triangular such that (the -th column of is taken to be the coordinates of with respect to the columns of ).
Let , , . The full QR factorization of is formed as follows: construct , as described in the previous section, and relabel them as , . Let be the columns of . Extend this list to an orthonormal basis of to obtain , and let be the matrix whose columns are . The full QR factorization of is written as
where is the block matrix of , and the block matrix of .
Here are some important properties of the QR factorization:
Note. The QR factorization is typically only defined for tall-and-skinny matrices, i.e., matrices with more rows than columns. For a matrix , attempting to do a QR factorization would yield
The rightmost matrix (which has rows and columns) is not upper triangular.