The motivation for the projection is as follows: Given the vectors \(\vv\) and \(\uu\text{,}\) we want to find vectors \(\ww\) and \(\zz\) with the following properties:
The vector \(\ww\) is parallel to the vector \(\uu\text{.}\)
The vectors \(\ww\) and \(\zz\) add to \(\vv\text{.}\)
The vectors \(\ww\) and \(\zz\) are orthogonal.
Motivation for the construction comes from Physics, where one needs to be able to decompose a force vector into parts that are parallel and orthogonal to a given direction.
To derive the formula, we note that the vector \(\ww\) must be a scalar multiple of \(\uu\text{,}\) since it is parallel to \(\uu\text{,}\) so \(\ww = c\uu\) for some scalar \(c\text{.}\) Next, since \(\ww\text{,}\)\(\zz\text{,}\) and \(\vv\) form a right triangle, 1
Assuming that the angle \(\theta\) is acute. If it is obtuse, the scalar \(c\) is negative, but so is the dot product, so the signs work out.
we know that \(\len{\ww}=c\len{\uu}=\len{\vv}\cos(\theta)\text{.}\) But \(\cos(\theta)=\frac{\vv\boldsymbol{\cdot}\uu}{\len{\vv}\len{\uu}}\text{.}\) Plugging this in, and solving for \(c\text{,}\) we get the formula in (3.2.1).
Exercise3.2.2.
On the left, pairs of vectors \(\uu,\vv\) are given, and on the right, pairs of vectors \(\ww,\zz\text{.}\) Match each pair on the left with the pair on the right such that \(\ww=\proj{\uu}{\vv}\text{,}\) and \(\zz=\vv-\ww\text{.}\)
You can solve this problem without actually computing any projections. Think about the relationships between the different vectors.
An important part of the projection construction is that the vector \(\zz=\vv-\proj{\uu}{\vv}\) is orthogonal to \(\uu\text{.}\) Our next result is a generalization of this observation.
Theorem3.2.3.Orthogonal Lemma.
Let \(\{\vv_1,\vv_2,\ldots, \vv_m\}\) be an orthogonal set of vectors in \(\R^n\text{,}\) and let \(\xx\) be any vector in \(\R^n\text{.}\) Define the vector \(\vv_{m+1}\) by
\(\vv_{m+1}\dotp \vv_i = 0\) for each \(i=1,\ldots, m\text{.}\)
If \(\xx\notin\spn\{\vv_1,\ldots, \vv_m\}\text{,}\) then \(\vv_{m+1}\neq \zer\text{,}\) and therefore, \(\{\vv_1,\ldots, \vv_m,\vv_{m+1}\}\) is an orthogonal set.
Strategy.
For the first part, try calculating the dot product, using the definition of \(\vv_{m+1}\text{.}\) Don’t forget that \(\vv_i\dotp\vv_j=0\) if \(i\neq j\text{,}\) since you are assuming you have an orthogonal set of vectors.
For the second part, what does the Fourier Expansion Theorem say?
since \(\vv_i\dotp\vv_j = 0\) for \(i\neq j\text{.}\)
It follows from the Fourier expansion theorem that \(\vv_{m+1}=\zer\) if and only if \(\xx\in\spn\{\vv_1,\ldots, \vv_m\}\text{,}\) and the fact that \(\{\vv_1,\ldots, \vv_m,\vv_{m+1}\}\) is an orthogonal set then follows from the first part.
It follows from the Orthogonal Lemma that for any subspace \(U\subseteq \R^n\text{,}\) any set of orthogonal vectors in \(U\) can be extended to an orthogonal basis of \(U\text{.}\) Since any set containing a single nonzero vector is orthogonal, it follows that every subspace has an orthogonal basis. (If \(U=\{\zer\}\text{,}\) we consider the empty basis to be orthogonal.)
The procedure for creating an orthogonal basis is clear. Start with a single nonzero vector \(\xx_1\in U\text{,}\) which we’ll also call \(\vv_1\text{.}\) If \(U\neq \spn\{\vv_1\}\text{,}\) choose a vector \(\xx_2\in U\) with \(\xx_2\notin\spn\{\vv_1\}\text{.}\) The Orthogonal Lemma then provides us with a vector
such that \(\{\vv_1,\vv_2\}\) is orthogonal. If \(U=\spn\{\vv_1,\vv_2\}\text{,}\) we’re done. Otherwise, we repeat the process, choosing \(\xx_3\notin\spn\{\vv_1,\vv_2\}\text{,}\) and then using the Orthogonal Lemma to obtain \(\vv_3\text{,}\) and so on, until an orthogonal basis is obtained.
With one minor modification, the above procedure provides us with a major result. Suppose \(U\) is a subspace of \(\R^n\text{,}\) and start with any basis \(\{\xx_1,\ldots, \xx_m\}\) of \(U\text{.}\) By choosing our \(\xx_i\) in the procedure above to be these basis vectors, we obtain the Gram-Schmidt algorithm for constructing an orthogonal basis.
Let \(U\) be a subspace of \(\R^n\text{,}\) and let \(\{\xx_1,\ldots, \xx_m\}\) be a basis of \(U\text{.}\) Define vectors \(\vv_1,\ldots, \vv_m\) in \(U\) as follows:
Of course, once we’ve used Gram-Schmidt to find an orthogonal basis, we can normalize each vector to get an orthonormal basis. The Gram-Schmidt algorithm is ideal when we know how to find a basis for a subspace, but we need to know an orthogonal basis. For example, suppose we want an orthonormal basis for the nullspace of the matrix
And now we probably get about five minutes into the fractions and say something that shouldn’t appear in print. This sounds like a job for the computer.
What if we want our vectors normalized? Turns out the GramSchmidt function has an optional argument of true or false. The default is false, which is to not normalize. Setting it to true gives an orthonormal basis:
OK, so that’s nice, and fairly intimidating looking. Did it work? We can specify the vectors in our list by giving their positions, which are 0, 1, and 2, respectively.
Let’s compute dot products:
Let’s also confirm that these are indeed in the nullspace.
Boom. Let’s try another example. This time we’ll keep the vectors a little smaller in case you want to try it by hand.
Example3.2.5.
Confirm that the set \(B=\{(1,-2,1), (3,0,-2), (-1,1,2)\}\) is a basis for \(\R^3\text{,}\) and use the Gram-Schmidt Orthonormalization Algorithm to find an orthonormal basis.
Solution.
First, note that we can actually jump right into the Gram-Schmidt procedure. If the set \(B\) is not a basis, then it won’t be independent, and when we attempt to construct the third vector in our orthonormal basis, its projection on the the subspace spanned by the first two will be the same as the original vector, and we’ll get zero when we subtract the two.
We let \(\xx_1=(1,-2,1), \xx_2=(3,0,-2), \xx_3=(-1,1,2)\text{,}\) and set \(\vv_1=\xx_1\text{.}\) Then we have
We got it done! But doing this sort of thing by hand makes it possible that we made a calculation error somewhere. To check our work, we can turn to the computer.
Success! Full disclosure: there was indeed a mistake in the manual computation. Whether it was a typo or a miscalculation, the \(-13/6\) entry was originally written as \(-3/6\text{.}\) This led, as you might expect, to some very wrong answers for \(\vv_3\text{.}\)