7.7 Gram–Schmidt Orthogonalization Process
INTRODUCTION
In Section 7.6 we saw that a vector space V can have many different bases. Recall, the defining characteristics of any basis B = {x1, x2, … , xn} of a vector space V is that
- the set B is linearly independent, and
- the set B spans the space.
In this context the word span means that every vector in the space can be expressed as a linear combination of the vectors x1, x2, … , xn. For example, every vector u in Rn can be written as a linear combination of the vectors in the standard basis B = {e1, e2, … , en}, where
e1 = 〈1, 0, 0, … , 0〉, e2 = 〈0, 1, 0, … , 0〉, …, en = 〈0, 0, 0, … , 1〉.
This standard basis B = {e1, e2, … , en} is also an example of an orthonormal basis; that is, the ei, i = 1, 2, … , n are mutually orthogonal and are unit vectors; that is,
ei · ej = 0, i ≠ j and ei = 1, i = 1, 2, … , n.
In this section we focus on orthonormal bases for Rn and examine a procedure whereby we can transform or convert any basis B of Rn into an orthonormal basis.
EXAMPLE 1 Orthonormal Basis for R3
The set of three vectors
(1)
is linearly independent and spans the space R3. Hence B = {w1, w2, w3} is a basis for R3. Using the standard inner product or dot product defined on R3, observe
w1 · w2 = 0, w1 · w3 = 0, w2 · w3 = 0, and w1 = 1, w2 = 1, w3 = 1.
Hence B is an orthonormal basis. ≡
A basis B for Rn need not be orthogonal nor do the basis vectors need to be unit vectors. In fact, any linearly independent set of n vectors can serve as a basis for the n-dimensional vector space Rn. For example, it is a straightforward task to show that the vectors
u1 = 〈1, 0, 0〉, u2 = 〈1, 1, 0〉, u3 = 〈1, 1, 1〉
in R3 are linearly independent, and hence B = {u1, u2, u3} is a basis for R3. Note that B is not an orthogonal basis.
Generally, an orthonormal basis for a vector space V turns out to be the most convenient basis for V. One of the advantages that an orthonormal basis has over any other basis for Rn is the comparative ease with which we can obtain the coordinates of a vector u relative to that basis.
THEOREM 7.7.1 Coordinates Relative to an Orthonormal Basis
Suppose B = {w1, w2, … , wn} is an orthonormal basis for Rn. If u is any vector in Rn, then
PROOF:
The vector u is in Rn and so it is an element of the set Span(B). In other words, there exist real scalars ki, i = 1, 2, … , n such that u can be expressed as the linear combination
u = k1w1 + k2w2 + … + knwn.
The scalars ki are the coordinates of u relative to the basis B. These coordinates can be found by taking the dot product of u with each of the basis vectors:
u · wi = (k1w1 + k2w2 + … + knwn) · wi = k1(w1 · wi) + k2(w2 · wi) + … + kn(wn · wi). (2)
Since B is orthonormal, wi is orthogonal to all vectors in B with the exception of wi itself. That is, wi · wj = 0, i ≠ j and wi · wi = wi2 = 1. Hence from (2), we obtain ki = (u · wi) for i = 1, 2, … , n. ≡
EXAMPLE 2 Coordinates of a Vector in R3
Find the coordinates of the vector u = 〈3, −2, 9〉 relative to the orthonormal basis B for R3 given in (1) of Example 1. Write u in terms of the basis B.
SOLUTION
From Theorem 7.7.1, the coordinates of u relative to the basis B in (1) of Example 1 are simply
Hence we can write
≡
Gram–Schmidt Orthogonalization Process
The procedure known as the Gram–Schmidt orthogonalization process is a straightforward algorithm for generating an orthogonal basis B′ = {v1, v2, … , vn} from any given basis B = {u1, u2, … , un} for Rn. We then produce an orthonormal basis B″ = {w1, w2, … , wn} by normalizing the vectors in the orthogonal basis B′. The key idea in the orthogonalization process is vector projection, and so we suggest that you review that concept in Section 7.3. Also, for the sake of gaining some geometric insight into the process, we shall begin in R2 and R3.
Constructing an Orthogonal Basis for R2
The Gram–Schmidt orthogonalization process for Rn is a sequence of steps; at each step we construct a vector vi that is orthogonal to the vector in the preceding step. The transformation of a basis B = {u1, u2} for R2 into an orthogonal basis B′ = {v1, v2} consists of two steps. See FIGURE 7.7.1(a). The first step is simple, we merely choose one of the vectors in B, say, u1, and rename it v1. Next, as shown in Figure 7.7.1(b), we project the remaining vector u2 in B onto the vector v1 and define a second vector to be v2 = u2 − u2. Recall from (12) of Section 7.3 that u2 = . As seen in Figure 7.7.1(c), the vectors
(3)
are orthogonal. If you are not convinced of this, we suggest you verify the orthogonality of v1 and v2 by demonstrating that v1 · v2 = 0.
EXAMPLE 3 Gram–Schmidt Process in R2
The set B = {u1, u2}, where u1 = 〈3, 1〉, u2= 〈1, 1〉, is a basis for R2. Transform B into an orthonormal basis B″ = {w1, w2}.
SOLUTION
We choose v1 as u1: v1 = 〈3, 1〉. Then from the second equation in (3), with u2 · v1 = 4 and v1 · v1 = 10, we obtain
The set B′ = {v1, v2} = {〈3, 1〉, 〈−, 〉} is an orthogonal basis for R2. We finish by normalizing the vectors v1 and v2:
.
The basis B is shown in FIGURE 7.7.2(a), and the new orthonormal basis B″ = {w1, w2} is shown in blue in Figure 7.7.2(b). ≡
In Example 3 we are free to choose either vector in B = {u1, u2} as the vector v1. However, by choosing v1 = u2 = 〈1, 1〉, we obtain a different orthonormal basis, namely, B″ = {w1, w2}, where w1 = 〈1/, 1/〉 and w2 = 〈1/, −1/〉. See Problems 5–8 in Exercises 7.7.
Constructing an Orthogonal Basis for R3
Now suppose B = {u1, u2, u3} is a basis for R3. Then the set B′ = {v1, v2, v3}, where
(4)
is an orthogonal basis for R3. Again, if you do not see this, then compute v1· v2, v1 · v3, and v2 · v3.
Since the vectors v1 and v2 in the list (4) are by construction orthogonal, the set {v1, v2} must be linearly independent. See Problem 36 in Exercises 7.6. Thus, W2 = Span(v1, v2) is necessarily a two-dimensional subspace of R3. Now the vector is a vector in W2 because it is a linear combination of v1 and v2. The vector x is called the orthogonal projection of u3 onto the subspace W2 and is usually denoted by In FIGURE 7.7.3, x is the red vector. Notice, too, that x is the sum of two projections. Using (12) of Section 7.3, we can write
.(5)
The difference v3 = u3 − x is orthogonal to x. Indeed, v3 is orthogonal to v1 and v2 and to every vector in W2. This is precisely the same idea in (3). In that context, v2 = u2 − x, where x was the projection of u2 onto the one-dimensional subspace W1 = Span(v1) of R2. Analogous to (5), we have
(6)
EXAMPLE 4 Gram–Schmidt Process in R3
The set B = {u1, u2, u3}, where
u1 = 〈1, 1, 1〉, u2 = 〈1, 2, 2〉, u3 = 〈1, 1, 0〉
is a basis for R3. Transform B into an orthonormal basis B″.
SOLUTION
We choose v1 as u1: v1 = 〈1, 1, 1〉. Then from the second equation in (4), with u2 · v1 = 5 and v1 · v1 = 3, we obtain
Now with u3 · v1 = 2, v1 · v1 = 3, u3 · v2 = −, and v2 · v2 = , the third equation in (4) yields
The set B′ = {v1, v2, v3} = {〈1, 1, 1〉, 〈−, , 〉, 〈0, , −〉} is an orthogonal basis for R3. As in Example 3, we finish the job by normalizing each vector in B′. Using = , = , = , and wi = vi, i = 1, 2, 3, we find that an orthonormal basis for R3 is B″ = {w1, w2, w3}, where
The set B″ is recognized as the orthonormal basis for R3 examined in Example 1. ≡
We conclude this section with a theorem that summarizes the most general case of the Gram–Schmidt process for Rn. The orthogonalization process can be used on any linearly independent set S, and so we can use it to find orthonormal bases for subspaces of Rn.
THEOREM 7.7.2 Gram–Schmidt Orthogonalization Process
Let B = {u1, u2, … , um}, m ≤ n, be a basis for a subspace Wm of Rn. Then B′ = {v1, v2, … , vm}, where
(7)
is an orthogonal basis for Wm. An orthonormal basis for Wm is
REMARKS
Although we have focused on Rn in the foregoing discussion, the orthogonalization process summarized in (7) of Theorem 7.7.2 holds in all vector spaces V on which an inner product (u, v) is defined. In this case, we replace the symbol Rn in (7) with the words “an inner product space V” and each dot product symbol u · v with (u, v). See Problems 17 and 18 in Exercises 7.7.
7.7 Exercises Answers to selected odd-numbered problems begin on page ANS-17.
In Problems 1 and 2, verify that the basis B for the given vector space is orthonormal. Use Theorem 7.7.1 to find the coordinates of the vector u relative to the basis B. Then write u as a linear combination of the basis vectors.
In Problems 3 and 4, verify that the basis B for the given vector space is orthogonal. Use Theorem 7.7.1 as an aid in finding the coordinates of the vector u relative to the basis B. Then write u as a linear combination of the basis vectors.
In Problems 5−8, use the Gram–Schmidt orthogonalization process (3) to transform the given basis B = {u1, u2} for R2 into an orthogonal basis B′ = {v1, v2}. Then form an orthonormal basis B″ = {w1, w2}.
- First construct B″ using v1, u1.
- Then construct B″ using v1, u2.
- Sketch B and each basis B″.
- B = {〈−3, 2〉, 〈−1, −1〉}
- B = {〈−3, 4〉, 〈−1, 0〉}
- B = {〈1, 1〉, 〈1, 0〉}
- B = {〈5, 7〉, 〈1, −2〉}
In Problems 9–12, use the Gram–Schmidt orthogonalization process (4) to transform the given basis B = {u1, u2, u3} for R3 into an orthogonal basis B′ = {v1, v2, v3}. Then form an orthonormal basis B″ = {w1, w2, w3}.
- B = {〈1, 1, 0〉, 〈1, 2, 2〉, 〈2, 2, 1〉}
- B = {〈−3, 1, 1〉, 〈1, 1, 0〉, 〈−1, 4, 1〉}
- B = {〈, , 1〉, 〈−1, 1, −〉, 〈−1, , 1〉}
- B = {〈1, 1, 1〉, 〈9, −1, 1〉, 〈−1, 4, −2〉}
In Problems 13 and 14, the given vectors span a subspace W of R3. Use the Gram–Schmidt orthogonalization process to construct an orthonormal basis for the subspace.
- u1 = 〈1, 5, 2〉, u2 = 〈−2, 1, 1〉
- u1 = 〈1, 2, 3〉, u2 = 〈3, 4, 1〉
In Problems 15 and 16, the given vectors span a subspace W of R4. Use the Gram–Schmidt orthogonalization process to construct an orthonormal basis for the subspace.
- u1 = 〈1, −1, 1, −1〉, u2 = 〈1, 3, 0, 1〉
- u1 = 〈4, 0, 2, −1〉, u2 = 〈2, 1, −1, 1〉, u3 = 〈1, 1, −1, 0〉
In Problems 17 and 18, an inner product defined on the vector space P2 of all polynomials of degree less than or equal to 2, is given by
Use the Gram–Schmidt orthogonalization process to transform the given basis B for P2 into an orthogonal basis B′.
- B = {1, x, x2}
- B = {x2 − x, x2 + 1, 1 − x2}
For the inner product (p, q) defined on P2 in Problems 17 and 18, the norm of a polynomial p is defined by
Use this norm in Problems 19 and 20.
- Construct an orthonormal basis B″ from B′ obtained in Problem 17.
- Construct an orthonormal basis B″ from B′ obtained in Problem 18.
In Problems 21 and 22, let p(x) = 9x2 − 6x + 5 be a vector in P2. Use Theorem 7.7.1 and the indicated orthonormal basis B″ to find the coordinates p(x) relative to B″. Then write p(x) as a linear combination of the basis vectors.
- B″ in Problem 19
- B″ in Problem 20
Discussion Problem
- The set of vectors {u1, u2, u3}, where
u1 = 〈1, 1, 3〉, u2 = 〈1, 4, 1〉, and u3 = 〈1, 10, −3〉,
is linearly dependent in R3 since u3 = −2u1 + 3u2. Discuss what you would expect when the Gram–Schmidt process in (4) is applied to these vectors. Then carry out the orthogonalization process.