Linear Algebra: VIII Gram-Schmidt and QR Decomposition

Gram–Schmidt and QR Decomposition


Suppose that $\{ \vec{v}_1, \ldots, \vec{v}_n \}$ is a set of linearly independent column vectors in $\mathbb{R}^n$, and let $A$ be an $n$ by $n$ square matrix:


$$ A = [\vec{v}_1 \ \cdots \ \vec{v}_n] $$

Then the Gram--Schmidt process produces an orthonormal basis


$$ \{ \hat{q}_1, \ldots, \hat{q}_n \} $$

which can be written as the $n$ by $n$ orthonormal matrix:


$$ Q = [\hat{q}_1 \ \cdots \ \hat{q}_n] $$

Let $\hat{v}_1$ be a unit vector. Then the vector


$$ (I - \hat{v}_1 \hat{v}_1^\top)\hat{v}_2 $$

Is orthogonal to $\hat{v}_1$ since


$$ \hat{v}_1^\top (I - \hat{v}_1 \hat{v}_1^\top)\hat{v}_2 = \hat{v}_1^\top\hat{v}_2 - (\hat{v}_1^\top\hat{v}_1)\hat{v}_1^\top\hat{v}_2 = \hat{v}_1^\top\hat{v}_2 - \hat{v}_1^\top\hat{v}_2 = 0 $$

Using this idea, we construct an orthonormal basis:


$$ \hat{q}_1 = \frac{\vec{v}_1}{\|\vec{v}_1\|} $$
$$ \vec{q}_2 = (I - \hat{q}_1 \hat{q}_1^\top)\vec{v}_2, \qquad \hat{q}_2 = \frac{\vec{q}_2}{\|\vec{q}_2\|} $$
$$ \vec{q}_3 = (I - \hat{q}_1 \hat{q}_1^\top - \hat{q}_2 \hat{q}_2^\top)\vec{v}_3, \qquad \hat{q}_3 = \frac{\vec{q}_3}{\|\vec{q}_3\|} $$

In general:


$$ \vec{q}_k = \left(I - \sum_{i=1}^{k-1} \hat{q}_i \hat{q}_i^\top \right)\vec{v}_k, \qquad \hat{q}_k = \frac{\vec{q}_k}{\|\vec{q}_k\|} $$

Now define


$$ R = Q^\top A $$

With entries


$$ r_{ij} = \hat{q}_i^\top \vec{v}_j $$

Because $\vec{v}_j$ is orthogonal to $\hat{q}_{j+1}, \ldots \hat{q}_j$, we have:


$$ r_{ij} = 0 \quad \text{if } i > j $$

Thus, $R$ is upper triangular.


Since $Q^{-1} = Q^\top$, this gives the QR decomposition:


$$ R = Q^\top A \quad \Rightarrow \quad A = QR $$

Consider solving $A\vec{x} = \vec{b}$. Then,


$$ QR\vec{x} = \vec{b} \quad \Rightarrow \quad R\vec{x} = Q^\top \vec{b} $$

Since $R$ is upper triangular, we can solve this system using backward substitution.

Comments

Popular posts from this blog

Linear Algebra: III Square and Inverse Matrices

Linear Algebra: VII Orthonormal Matrices

Linear Algebra: VI Triangular Matrices and LU Decomposition