Section 6.2

Gram-Schmidt Process

>

> with(linalg):

```Warning, the protected names norm and trace have been redefined and unprotected
```

>

Introduction

A basis of a linear space is its building block. Every element of the linear space can

be uniquely expressed in terms of the basis. In the Euclidean space , it is easy to express

a vector in terms of the standard basis. However, the process can be very tedious if the

basis is not the standard one. Another special and useful basis is the "orthonormal basis".

Every vector can be easily expressed in terms of this orthonormal basis.

Orthogonal and Orthonormal Bases

******************************************************************

Let { ,..., } in be an orthogonal set of non-zero vectors, i.e

innerprod( ) = 0 for all i, j ( i not equal to j) . Then

this set is independent and consequently is a basis for the subspace

span{ ,..., }.

*******************************************************************

*******************************************************************

Theorem 6.3

Let { ,..., } be an orthogonal basis for a subspace W of , and let

b be any vector in . The projection of b on W is

= + + . . . +

********************************************************************

Example 1: Let B = {u,v} be an orthogonal basis for

>

> u:=vector([-2,3]); v:=vector([3,2]);

> innerprod(u,v);

>

The two vectors u and v are orthogonal.

Let w be a vector in

> w:=vector([-1,1]);

>

If w = , then the inner product of w with u and with v respectively yields

>

> c1:=innerprod(w,u)/innerprod(u,u);

> c2:=innerprod(w,v)/innerprod(v,v);

> w := c1*evalm(u) + c2*evalm(v);

>

Example 2: Consider a subspace W of consisting of the vectors

>

> u1:=vector([-1,1,1]); u2:=vector([2,1,1]);

>

> W = `span`(evalm(u1),evalm(u2));

>

Do the vectors and form an orthogonal basis for W? Form the inner product:

>

> innerprod(u1,u2);

>

Since the set is orthogonal we can quickly compute .

For example if b is the vector

>

> b :=vector([-1,2,3]);

>

then we can find the following and

>

> c1:=innerprod(b,u1)/innerprod(u1,u1);

> c2:= innerprod(b,u2)/innerprod(u2,u2);

>

Thus the projection vector is equal to

> c1*evalm(u1)+ c2*evalm(u2);

>

It is sometimes desirable to normalize the vectors in an orthogonal basis. That is change the

length of each vector to be 1. Then all vectors in the orthogonal basis are unit vectors.

******************************************************************

An orthonormal basis { ,...., } of a subspace W of is a basis in which the

elements are mutually orthogonal unit vectors. If { ,..., } is an orthonormal basis

for W and if b is any vector in W, then

= +....+

where .

******************************************************************

Example 3 Consider the orthogonal set of vectors

>

> u1:=vector([1,1,-4]); u2:=vector([2,2,1]);

> W = `span`(evalm(u1),evalm(u2));

>

The length of each vector is

> Lu1:=sqrt(innerprod(u1,u1));

> Lu2:=sqrt(innerprod(u2,u2));

>

Dividing each vector by its length yields three mutually orthogonal unit vectors:

>

> w1:=evalm(u1/Lu1);

> w2:=evalm(u2/Lu2);

>

Does this set form a basis for ? This set is linearly independent.Hence, it is a basis for .

Recall, a basis consisting of mutually orthogonal unit vectors is called an orthonormal basis .

Consider the vector

>

> b :=vector([-5,56,72]);

>

Compute = .

>

> c1:=innerprod(b,w1);

> c2:=innerprod(b,w2);

>

Therefore is equal to

>

> c1*evalm(w1)+ c2*evalm(w2);

>

As we see having an orthonormal basis makes calculations a lot easier. We now

describe how to change a linearly independent set of vectors into an orthonormal

set of vectors.

Gram-Schmidt Process

Step 0 . Check whether the given set is linearly independent. If it is independent ,

proceed to construct an orthonormal basis; otherwise, extract an independent set and

then proceed. Now assume the set W = { ,...., }is independent;

Step 1 . Construct the first vector

= / || ||

Step 2 . Find the orthogonal projection of upon

= i

and construct the vector

=

Then the second member of the orthonormal basis is

= / || ||

Step 3 . Find the projection of onto the span( )

= +

and construct the vector

=

The third element in the orthonormal basis is

= / || ||

Step 4 Repeat the process until all the v's of the original set have been exhausted.

The set { ,.... } is an orthonormal basis.

Learning the Process

Here is an example

>

> a1:=vector([1,0,1]);

> a2:=vector([0,1,2]);

> a3:=vector([2,1,0]);

>

Step 0: Are the vectors linearly independent?

>

> A := augment(a1,a2,a3);

>

> rref(A);

>

>

Step 1: Construct the first vector.

>

> v1 := evalm(a1/sqrt(innerprod(a1,a1)));

>

Step 2: Find the orthogonal projection of upon

>

> p1 := evalm(innerprod(a2,v1)*v1);

>

and construct the vector (Note: this vector is orthogonal to .)

>

> w2 := evalm(a2-p1);

>

Then the second member of the orthonormal basis is

>

> v2 := evalm(w2/sqrt(innerprod(w2,w2)));

>

Step 3 . Find now the projection of onto the span( )

>

> p2 := evalm(innerprod(a3,v2)*v2 + innerprod(a3,v1)*v1);

>

and construct the vector (Note: this vector is orthogonal to and .)

>

> w3 := evalm(a3-p2);

>

The third element in the orthonormal basis is

>

> v3 := evalm(w3/sqrt(innerprod(w3,w3)));

>

> W = `span`(evalm(a1),evalm(a2),evalm(a3));

>

Orthonormal basis,

> `span`(evalm(v1),evalm(v2),evalm(v3));

>

Exercises

1-13(odd), 17, 19.