← Back to Math 010

6.3 Gram-Schmidt Process: Class Notes

Definition

A set of two or more vectors in a real inner product space is said to be orthogonal if all pairs of distinct vectors in the set are orthogonal. An orthogonal set in which each vector has norm 1 is said to be orthonormal.

Just as with the Euclidean inner product, we can normalize a nonzero vector 𝐯 to obtain a unit vector:

𝐮=1‖𝐯‖𝐯

Theorem 6.3.1

If S={𝐯1,𝐯2,…,𝐯n} is an orthogonal set of nonzero vectors in an inner product space, then S is linearly independent.

Proof

Suppose k1𝐯1+k2𝐯2+⋯+kn𝐯n=𝟎 and consider, for 1≤i≤n,

⟨k1𝐯1+k2𝐯2+⋯+kn𝐯n,𝐯i⟩=⟨𝟎,𝐯i⟩=0

But by the additivity and homogeneity axioms,

⟨k1𝐯1+k2𝐯2+⋯+kn𝐯n,𝐯i⟩=⟨k1𝐯1,𝐯i⟩+⟨k2𝐯2,𝐯i⟩+⋯+⟨ki𝐯i,𝐯i⟩+⋯+⟨kn𝐯n,𝐯i⟩=⟨ki𝐯i,𝐯i⟩=ki⟨𝐯i,𝐯i⟩

since ⟨𝐯k,𝐯i⟩=0 for k≠i because S is orthogonal. So ki⟨𝐯i,𝐯i⟩=0.

Since 𝐯i≠𝟎, ⟨𝐯i,𝐯i⟩≠0 by the positivity axiom, so ki=0 for every i. Thus S is linearly independent.

Definition

In an inner product space, a basis comprising orthogonal vectors is an orthogonal basis, and a basis comprising orthonormal vectors is an orthonormal basis.

Example: With the Euclidean inner product, {(3,4,0), (−4,3,0), (0,0,1)} is an orthogonal basis for R3. Normalizing each vector gives an orthonormal basis:

{(35,45,0), (−45,35,0), (0,0,1)}

#6

Show that the column vectors of A form an orthogonal basis for the column space of A with respect to the Euclidean inner product, and then find an orthonormal basis for that column space.

A=[1/5−1/21/31/51/21/31/50−2/3]

Solution

Call the columns c→1, c→2, and c→3. Check each pair:

c→1·c→2=(15,15,15)·(−12,12,0)=−110+110+0=0c→1·c→3=(15,15,15)·(13,13,−23)=115+115−215=0c→2·c→3=(−12,12,0)·(13,13,−23)=−16+16+0=0

The columns are nonzero and orthogonal, so by Theorem 6.3.1 they are linearly independent. They span the column space, so they form an orthogonal basis for it.

To normalize, first scale the columns to clear the fractions (scaling by a positive number doesn’t change the unit vector):

5c→1=(1,1,1),‖5c→1‖=32c→2=(−1,1,0),‖2c→2‖=23c→3=(1,1,−2),‖3c→3‖=6

Divide each scaled column by its norm. The orthonormal basis is

Answer: {(13,13,13), (−12,12,0), (16,16,−26)}

Theorem 6.3.2

a) If S={𝐯1,𝐯2,…,𝐯n} is an orthogonal basis for an inner product space V, and if 𝐮 is any vector in V, then

𝐮=⟨𝐮,𝐯1⟩‖𝐯1‖2𝐯1+⟨𝐮,𝐯2⟩‖𝐯2‖2𝐯2+⋯+⟨𝐮,𝐯n⟩‖𝐯n‖2𝐯n

b) If S={𝐯1,𝐯2,…,𝐯n} is an orthonormal basis for an inner product space V, and if 𝐮 is any vector in V, then 𝐮=⟨𝐮,𝐯1⟩𝐯1+⟨𝐮,𝐯2⟩𝐯2 +⋯+⟨𝐮,𝐯n⟩𝐯n.

So with an orthogonal basis, the coordinates of 𝐮 come straight from inner products, with no system to solve: the boxed coefficients in (a) are the entries of the coordinate vector.

𝐮=⟨𝐮,𝐯1⟩‖𝐯1‖2𝐯1+⟨𝐮,𝐯2⟩‖𝐯2‖2𝐯2+⋯+⟨𝐮,𝐯n⟩‖𝐯n‖2𝐯n

(𝐮)S=(⟨𝐮,𝐯1⟩‖𝐯1‖2,⟨𝐮,𝐯2⟩‖𝐯2‖2,…,⟨𝐮,𝐯n⟩‖𝐯n‖2)

Proof

Let 𝐮 be in V. Since S is a basis for V, there are scalars ci with 𝐮=c1𝐯1+c2𝐯2+⋯+cn𝐯n. For 1≤i≤n,

⟨𝐮,𝐯i⟩=⟨c1𝐯1+c2𝐯2+⋯+cn𝐯n,𝐯i⟩=ci⟨𝐯i,𝐯i⟩=ci‖𝐯i‖2

because S is orthogonal (every other term is 0, as in the proof of Theorem 6.3.1). Hence

ci=⟨𝐮,𝐯i⟩‖𝐯i‖2

If S is an orthonormal basis, then ‖𝐯i‖2=1, so ci=⟨𝐮,𝐯i⟩. This is part (b).

#8

Use Theorem 6.3.2(b) to express the vector 𝐮=(3,−7,4) as a linear combination of the vectors 𝐯1=(−35,45,0), 𝐯2=(45,35,0), 𝐯3=(0,0,1).

Solution

First note that this is an orthonormal basis with respect to the Euclidean inner product (the dot product): 𝐯1·𝐯2=−1225+1225=0, 𝐯1·𝐯3=𝐯2·𝐯3=0, and each vector has norm 1. So

𝐮=⟨𝐮,𝐯1⟩𝐯1+⟨𝐮,𝐯2⟩𝐯2+⟨𝐮,𝐯3⟩𝐯3=(−95−285)𝐯1+(125−215)𝐯2+4𝐯3

Answer: 𝐮=−375𝐯1−95𝐯2+4𝐯3

#12

Find the coordinate vector (𝐮)S for the vector 𝐮 and the basis S that were given in Exercise 8.

Solution

The coordinates are the coefficients found in #8.

Answer: (𝐮)S=(−375,−95,4)

Note that since S is an orthonormal basis, no augmented matrix is required.

Theorem 6.3.3 Projection Theorem (generalization of Theorem 3.3.2)

If W is a finite-dimensional subspace of an inner product space V, then every vector 𝐮 in V can be expressed in exactly one way as 𝐮=𝐰1+𝐰2 where 𝐰1 is in W and 𝐰2 is in W⟂.

Definition

If W is a finite-dimensional subspace of an inner product space V and a vector 𝐮 in V is expressed as 𝐮=𝐰1+𝐰2, where 𝐰1 is in W and 𝐰2 is in W⟂, then 𝐰1 is called the orthogonal projection of 𝐮 on 𝐖 and is denoted by 𝐰1=projW𝐮 and 𝐰2 is called the orthogonal projection of 𝐮 on 𝐖⟂ and is denoted by 𝐰2=projW⟂𝐮. The vector 𝐰2 is also called the component of 𝐮 orthogonal to 𝐖.

Theorem 6.3.4

Let W be a finite-dimensional subspace of an inner product space V.

a) If {𝐯1,𝐯2,…,𝐯r} is an orthogonal basis for W and 𝐮 is any vector in V, then

projW𝐮=⟨𝐮,𝐯1⟩‖𝐯1‖2𝐯1+⟨𝐮,𝐯2⟩‖𝐯2‖2𝐯2+⋯+⟨𝐮,𝐯r⟩‖𝐯r‖2𝐯r

b) If {𝐯1,𝐯2,…,𝐯r} is an orthonormal basis for W and 𝐮 is any vector in V, then

projW𝐮=⟨𝐮,𝐯1⟩𝐯1+⟨𝐮,𝐯2⟩𝐯2+⋯+⟨𝐮,𝐯r⟩𝐯r

Here V is n-dimensional and W is r-dimensional. The basis vectors 𝐯1,…,𝐯r lie in W (a basis for V would continue on to 𝐯n), and 𝐮 is any vector in V, not necessarily in W.

Proof

From Theorem 6.3.3, 𝐮=𝐰1+𝐰2 with 𝐰1 in W and 𝐰2 in W⟂. Since 𝐰1 is in W, Theorem 6.3.2(a) applied to W gives

projW𝐮=𝐰1=⟨𝐰1,𝐯1⟩‖𝐯1‖2𝐯1+⟨𝐰1,𝐯2⟩‖𝐯2‖2𝐯2+⋯+⟨𝐰1,𝐯r⟩‖𝐯r‖2𝐯r

Since 𝐰2 is in W⟂, ⟨𝐰2,𝐯i⟩=0, so

⟨𝐰1,𝐯i⟩=⟨𝐰1,𝐯i⟩+⟨𝐰2,𝐯i⟩=⟨𝐰1+𝐰2,𝐯i⟩=⟨𝐮,𝐯i⟩

Therefore

projW𝐮=⟨𝐮,𝐯1⟩‖𝐯1‖2𝐯1+⋯+⟨𝐮,𝐯r⟩‖𝐯r‖2𝐯r=∑i=1r⟨𝐮,𝐯i⟩‖𝐯i‖2𝐯i

If the basis is orthonormal, then ‖𝐯i‖2=1, which gives part (b).

#24

The vectors 𝐯1=(0,1,−4,−1) and 𝐯2=(3,5,1,1) are orthogonal with respect to the Euclidean inner product on R4. Find the orthogonal projection 𝐰1 of 𝐛=(1,2,0,−2) on the subspace W spanned by these vectors. [Extension of the exercise] Then find 𝐰2 in W⟂ such that 𝐛=𝐰1+𝐰2.

Solution

By Theorem 6.3.4(a), with 𝐛·𝐯1=0+2+0+2=4, ‖𝐯1‖2=0+1+16+1=18, 𝐛·𝐯2=3+10+0−2=11, and ‖𝐯2‖2=9+25+1+1=36:

𝐰1=projW𝐛=𝐛·𝐯1‖𝐯1‖2𝐯1+𝐛·𝐯2‖𝐯2‖2𝐯2=418(0,1,−4,−1)+1136(3,5,1,1)=836(0,1,−4,−1)+1136(3,5,1,1)=136(33,63,−21,3)

Answer: 𝐰1=(1112,74,−712,112)

𝐰2=𝐛−𝐰1=(1,2,0,−2)−(1112,74,−712,112)

Answer: 𝐰2=(112,14,712,−2512)

Check that 𝐰2 is in W⟂:

𝐰2·𝐯1=0+312−2812+2512=0𝐰2·𝐯2=312+1512+712−2512=0

#25

The vectors 𝐯1, 𝐯2, and 𝐯3 are orthonormal with respect to the Euclidean inner product on R4. Find the orthogonal projection of 𝐛=(1,2,0,−1) onto the subspace W spanned by these vectors.

𝐯1=(0,118,−418,−118), 𝐯2=(12,56,16,16), 𝐯3=(118,0,118,−418)

Solution

The basis is orthonormal, so by Theorem 6.3.4(b),

projW𝐛=⟨𝐛,𝐯1⟩𝐯1+⟨𝐛,𝐯2⟩𝐯2+⟨𝐛,𝐯3⟩𝐯3

⟨𝐛,𝐯1⟩=0+2+0+118=318⟨𝐛,𝐯2⟩=12+106+0−16=126=2⟨𝐛,𝐯3⟩=1+0+0+418=518

Multiply out (for example, 318𝐯1=318(0,1,−4,−1)):

projW𝐛=(0,16,−23,−16)+(1,53,13,13)+(518,0,518,−109)

Answer: projW𝐛=(2318,116,−118,−1718)

Theorem 6.3.5 (proof outlines the Gram-Schmidt process)

Every nonzero finite-dimensional inner product space has an orthonormal basis.

Proof

This is a constructive proof. Let W be any nonzero finite-dimensional subspace of an inner product space and suppose {𝐮1,𝐮2,…,𝐮r} is any basis for W. We will produce an orthogonal basis {𝐯1,𝐯2,…,𝐯r} for W that can be normalized to form an orthonormal basis.

Let 𝐯1=𝐮1 and let W1 be the space spanned by 𝐯1.

u2 split into its projection along the line W1 and a perpendicular part v2

The line W1 contains 𝐯1=𝐮1. The vector 𝐮2 points up and to the right. Its projection projW1𝐮2 lies along W1, and 𝐯2=𝐮2−projW1𝐮2 starts at the origin and is perpendicular to W1.

Let

𝐯2=𝐮2−projW1𝐮2=𝐮2−⟨𝐮2,𝐯1⟩‖𝐯1‖2𝐯1

We know 𝐯2≠𝟎, because if it were, 𝐮2 would be a scalar multiple of 𝐯1=𝐮1, contradicting that {𝐮1,…,𝐮r} is linearly independent. By construction, 𝐯1⟂𝐯2.

Now let W2 be the space spanned by 𝐯1 and 𝐯2.

u3 split into its projection onto the plane W2 and a part v3 perpendicular to the plane

A shaded plane W2 contains 𝐯1 and 𝐯2. The vector 𝐮3 points up out of the plane. Its projection projW2𝐮3 lies in the plane, directly below the tip of 𝐮3, and 𝐯3=𝐮3−projW2𝐮3 starts at the origin and is perpendicular to the plane.

𝐯3=𝐮3−projW2𝐮3=𝐮3−⟨𝐮3,𝐯1⟩‖𝐯1‖2𝐯1−⟨𝐮3,𝐯2⟩‖𝐯2‖2𝐯2

is orthogonal to W2, and so is orthogonal to 𝐯1 and 𝐯2. We can likewise find a vector 𝐯4 that is orthogonal to 𝐯1, 𝐯2, and 𝐯3:

𝐯4=𝐮4−⟨𝐮4,𝐯1⟩‖𝐯1‖2𝐯1−⟨𝐮4,𝐯2⟩‖𝐯2‖2𝐯2−⟨𝐮4,𝐯3⟩‖𝐯3‖2𝐯3

and so on until we have r vectors. Normalizing the 𝐯i results in an orthonormal basis.

Example

Let R4 have the Euclidean inner product. Use the Gram-Schmidt process to transform the basis {𝐮1,𝐮2,𝐮3,𝐮4} into an orthonormal basis.

𝐮1=(1,1,0,0), 𝐮2=(1,0,1,0), 𝐮3=(0,1,1,1), 𝐮4=(−1,1,1,1)

Solution

We want an orthogonal set {𝐯1,𝐯2,𝐯3,𝐯4} first, then we normalize. Start with

𝐯1=𝐮1=(1,1,0,0)

𝐯2=𝐮2−𝐮2·𝐯1‖𝐯1‖2𝐯1=(1,0,1,0)−12(1,1,0,0)=(12,−12,1,0)

Scaling doesn’t affect orthogonality, so use 𝐯2′=2𝐯2=(1,−1,2,0) to avoid fractions.

Tip: Check for orthogonality as you go: 𝐯1·𝐯2′=1−1+0+0=0.

𝐯3=𝐮3−𝐮3·𝐯1‖𝐯1‖2𝐯1−𝐮3·𝐯2′‖𝐯2′‖2𝐯2′=(0,1,1,1)−12(1,1,0,0)−16(1,−1,2,0)=(−23,23,23,1)

Use 𝐯3′=3𝐯3=(−2,2,2,3).

Tip: Check: 𝐯1·𝐯3′=−2+2=0 and 𝐯2′·𝐯3′=−2−2+4=0.

Here 𝐮4·𝐯1=0 and 𝐮4·𝐯2′=−1−1+2=0, so those terms drop out, and 𝐮4·𝐯3′=2+2+2+3=9 with ‖𝐯3′‖2=21:

𝐯4=𝐮4−𝐮4·𝐯1‖𝐯1‖2𝐯1−𝐮4·𝐯2′‖𝐯2′‖2𝐯2′−𝐮4·𝐯3′‖𝐯3′‖2𝐯3′=(−1,1,1,1)−0−0−37(−2,2,2,3)=(−17,17,17,−27)

Use 𝐯4′=7𝐯4=(−1,1,1,−2).

Tip: Check: 𝐯4′·𝐯1=0, 𝐯4′·𝐯2′=0, 𝐯4′·𝐯3′=0.

Orthogonal basis:

{(1,1,0,0), (1,−1,2,0), (−2,2,2,3), (−1,1,1,−2)}

The norms are 2, 6, 21, and 7. Dividing each vector by its norm gives the orthonormal basis

Answer: (12,12,0,0), (16,−16,26,0),(−221,221,221,321), (−17,17,17,−27)

Theorem 6.3.6 (inner product space analog of Theorem 4.6.5 (b))

If W is a finite-dimensional inner product space, then:

a) Every orthogonal set of nonzero vectors in W can be enlarged to an orthogonal basis for W.

b) Every orthonormal set of nonzero vectors in W can be enlarged to an orthonormal basis for W.

Example 6.3.9 Legendre Polynomials

Let the vector space P2 have the inner product ⟨𝐩,𝐪⟩=∫−11p(x)q(x)dx. Apply the Gram-Schmidt process to transform the standard basis {1,x,x2} for P2 into an orthogonal basis {ϕ1(x),ϕ2(x),ϕ3(x)}.

Solution

Start with 𝐮1=1, 𝐮2=x, 𝐮3=x2.

ϕ1(x)=1

ϕ2(x)=x−⟨x,1⟩‖1‖2·1,where⟨x,1⟩=∫−11xdx=0

ϕ2(x)=x

ϕ3(x)=x2−⟨x2,1⟩‖1‖2·1−⟨x2,x⟩‖x‖2x

Compute the pieces:

⟨x2,x⟩=∫−11x3dx=0⟨x2,1⟩=∫−11x2dx=13x3|−11=23‖1‖2=∫−111dx=2

ϕ3(x)=x2−2/32=x2−13

Answer: {ϕ1,ϕ2,ϕ3}={1, x, x2−13}

Suppose we want a scalar a such that aϕ3(1)=1. Then

a(1−13)=1 ⇒ 23a=1 ⇒ a=32,aϕ3=32(x2−13)=12(3x2−1)

We then have {1, x, 12(3x2−1)}.

Definition

The first three Legendre polynomials are 1, x, and 12(3x2−1). They result from transforming the standard basis for P2 with the inner product ⟨𝐩,𝐪⟩=∫−11p(x)q(x)dx into an orthogonal basis for P2 via the Gram-Schmidt process, scaled so they have a value of 1 at x=1.