Gram-Schmidt Orthogonalization
In Orthogonality and Projections we said that a set \(\{ \vec {f}_1, \vec {f}_2, \dots , \vec {f}_m\}\) of nonzero vectors in \(\RR ^n\) is called an orthogonal set if \(\vec {f}_i \dotp \vec {f}_j =0\) for all \(i \neq j\). In this section we will prove that every orthogonal set is linearly independent, and therefore it is a basis for its span. We have already seen that the expansion of a vector as a linear combination of orthogonal basis vectors is easy to obtain because formulas exist for the coefficients. Hence the orthogonal bases are the “nice” bases. Our next task is to show that every subspace of \(\RR ^n\) has an orthogonal basis. We will start with intuitive explorations in lower dimensions, then proceed to formalize our results for subspaces of \(\RR ^n\).
A Visual Guide to Creating an Orthogonal Basis
Given an arbitrary basis \(\{\vec {v}_1, \vec {v}_2\}\) of \(\RR ^2\), let’s start building our orthogonal basis, \(\{\vec {f}_1, \vec {f}_2\}\), by setting \(\vec {f}_1 = \vec {v}_1\). To find the next element of our orthogonal basis, consider the orthogonal projection of \(\vec {v}_2\) onto \(\vec {f}_1\). (See the figure below.)
Next, let \(\vec {f}_2=\vec {v}_2-\mbox {proj}_{\vec {f}_1}\vec {v}_2\). Observe that \(\vec {f}_2\) is orthogonal to \(\vec {f}_1\) (See Theorem ?? of Orthogonality and Projections). This gives us an orthogonal collection \(\mathcal {B}=\{\vec {f}_1,\vec {f}_2\}\). It is intuitively clear that \(\vec {f}_1\) and \(\vec {f}_2\) are linearly independent. Therefore \(\mathcal {B}\) is an orthogonal basis of \(\RR ^2\).
The following exploration illustrates this process dynamically.
We can apply this process to any two-dimensional subset of \(\RR ^n\). The following exploration will guide you through the process of constructing an orthogonal basis for a plane spanned by two arbitrary vectors in \(\RR ^3\).
In the next exploration, we take the process of constructing an orthogonal basis to the edge of the visual realm and construct an orthogonal basis for \(\RR ^3\).
Gram-Schmidt Orthogonalization Algorithm
In Orthogonality and Projections we have repeatedly assumed that our subspaces of \(\RR ^n\) have an orthogonal basis. We will now prove that this is indeed the case. Recall that to be a basis of a subspace, a set of vectors must be linearly independent and it must span the subspace. We will start by demonstrating that a set of orthogonal vectors must be linearly independent.
To show that this set is linearly independent, we need to demonstrate that the only solution to the following equation is the trivial solution.
Now since the set is orthogonal, \(\vec {w}_i \dotp \vec {w}_m = 0\) for all \(m \neq i\), so we have:
We know that \(\norm {\vec {w}_i}^2 \neq 0\), so it follows that \(a_i =0\). Since \(i\) was chosen arbitrarily, \(a_i =0\) for all \(i\) \((0\leq i\leq k)\). This proves that \(\{ \vec {w}_1, \vec {w}_2, \cdots , \vec {w}_k \}\) is linearly independent.
The following theorem shows how to start with an arbitrary basis of a subspace \(W\) of \(\RR ^n\) and find an orthogonal basis for \(W\). To better understand the notation and the process presented in this theorem, you may want to match the steps of the theorem to the steps of Exploration .
Then we can construct an orthogonal basis \(\{\vec {f}_{1},\vec {f}_{2},\ldots ,\vec {f}_{m}\}\) for \(W_k\) for each \(k = 2, 3, \dots , m\) by adding one vector at a time successively as follows:
Then, \(\{\vec {f}_{1},\vec {f}_{2},\ldots ,\vec {f}_{m}\}\) will be an orthogonal basis for \(W\).
Using the definition of projection onto a subspace, the iterative procedure above may be written:
Repeated application of Corollary ?? shows that the set \(\{\vec {f}_{1},\vec {f}_{2},\ldots ,\vec {f}_{m}\}\) is orthogonal. Linear independence follows from orthogonality by Theorem 1.
We conclude that \(\{\vec {f}_{1},\vec {f}_{2},\ldots ,\vec {f}_{m}\}\) is a linearly independent orthogonal set that spans \(W\).
Hence \(\{[1, 1, -1, -1], [2, 1, 1, 2], \frac {1}{10}[4, -3, 7, -6]\}\) is the orthogonal basis provided by the algorithm. In hand calculations it may be convenient to eliminate fractions (see the Remark below), so \(\{[1, 1, -1, -1], [2, 1, 1, 2], [4, -3, 7, -6]\}\) is also an orthogonal basis for \(\mbox {row}(A)\).
The Gram-Schmidt algorithm demonstrates in a constructive way that every subspace of \(\RR ^n\) has an orthogonal basis. We formalize this in one final theorem.
Suppose \(\{\vec {f}_{1}, \dots , \vec {f}_{m}\}\) is an orthogonal subset of \(W\). If \(\mbox {span}\left (\vec {f}_{1}, \dots , \vec {f}_{m}\right ) = W\), it is already a basis. Otherwise, there exists \(\vec {x}\) in \(W\) outside \(\mbox {span}\left (\vec {f}_{1}, \dots , \vec {f}_{m}\right )\). Using the Gram-Schmidt procedure we define \(\vec {f}_{m+1} = \vec {x} - \mbox {proj}_{W_{m}}(\vec {x})\), where \(W_m = \mbox {span}\{\vec {f}_{1},\vec {f}_{2},\ldots ,\vec {f}_{m}\}\). If \(\mbox {span}\left (\vec {f}_{1}, \dots , \vec {f}_{m}, \vec {f}_{m+1}\right ) = W\), we are done. Otherwise, the process continues to create larger and larger orthogonal subsets of \(W\). They are all linearly independent by Theorem 3, so we have a basis when we reach a subset containing \(\mbox {dim}(W)\) vectors.
The process described in the proof of this theorem is used in this final example.
Choose any vector \(\vec {v}_4 \in \RR ^4\) not in \(\mbox {span}\{\vec {f}_1, \vec {f}_2, \vec {f}_3\}\), and apply the Gram-Schmidt algorithm to produce a vector \(\vec {f}_4\) such that \(\{\vec {f}_1, \vec {f}_2, \vec {f}_3, \vec {f}_4\}\) is an orthogonal basis for \(\RR ^4\).
Since any multiple of \(\vec {f}\) will suffice, we are free to choose \(\vec {f}_{4} = 44\vec {f} = [9, -15, -9, 3]\) to get rid of the fraction. It is easy to check that \(\{\vec {f}_1, \vec {f}_2, \vec {f}_3, \vec {f}_4\}\) is an orthogonal set, and it follows from Theorem 1 that this set is a basis for \(\RR ^4\).
We could not add a multiple of \(\vec {f}\) to \(\{\vec {f}_1, \vec {f}_2, \vec {f}_3\}\) to get an orthogonal basis for \(\RR ^4\).
Practice Problems
In each case, use the Gram-Schmidt algorithm to convert the given basis \(\mathcal {B}\) of \(V\) to an orthogonal basis.
Text Source
This section was adapted from the first part of Section 8.1 of Keith Nicholson’s Linear Algebra with Applications. (CC-BY-NC-SA)
W. Keith Nicholson, Linear Algebra with Applications, Lyryx 2018, Open Edition, p. 415