Professor Alexandru I. Suciu

MTH 1230 - Linear Algebra

Spring 1999

Gram Schmidt Process and QR-Decomposition



Gram Schmidt Process

For most purposes, the most convenient type of basis for a vector space is orthonormal, i.e., the vectors are unit length and are pairwise orthogonal. The Gram-Schmidt procedure takes an arbitrary basis and generates an orthonormal one. It does this by sequentially processing the list of vectors, generating a vector perpendicular to the previous vectors in the list. For the process to succeed in producing an orthonormal set, the given vectors must be linearly independent. The function GramSchmidt assumes that this is the case. If the given vectors are not linearly independent, indeterminate or zero vectors may be produced.

This applies the Gram-Schmidt procedure to the given list of three-dimensional vectors.

{w1, w2, w3} = GramSchmidt[{{1,2,1}, {2,8,3}, {3,-2,-1}}]
[Graphics:g-sgr2.gif][Graphics:g-sgr1.gif]

The result is an orthonormal basis, so the dot product of each pair of vectors is zero and each vector has unit length.

{w1.w2,w2.w3,w1.w3,w1.w1,w2.w2,w3.w3}
[Graphics:g-sgr2.gif][Graphics:g-sgr3.gif]

QR-Decomposition

QRDecomposition[m] yields the QR decomposition for a numerical matrix m. The result is a list [Graphics:g-sgr4.gif]q, r[Graphics:g-sgr5.gif], where q is an orthogonal matrix and r is an upper triangular matrix.

[Graphics:g-sgr2.gif][Graphics:g-sgr6.gif]

[Graphics:g-sgr2.gif][Graphics:g-sgr7.gif]
[Graphics:g-sgr2.gif][Graphics:g-sgr8.gif]


Problems from Section 4.2

Problem 4

{q, r} = QRDecomposition[Transpose[{{4,0,3},{25,0,-25},{0,-2,0}}]]; 

[Graphics:sect4.2gr2.gif][Graphics:sect4.2gr1.gif]
[Graphics:sect4.2gr2.gif][Graphics:sect4.2gr3.gif]

Problem 6

{q, r} = QRDecomposition[Transpose[{{2,0,0},{3,4,0},{5,6,7}}]]; 

[Graphics:sect4.2gr2.gif][Graphics:sect4.2gr4.gif]
[Graphics:sect4.2gr2.gif][Graphics:sect4.2gr5.gif]

Problem 7

{q, r} = QRDecomposition[Transpose[{{2,2,1},{-2,1,2},{18,0,0}}]]; 

[Graphics:sect4.2gr2.gif][Graphics:sect4.2gr6.gif]
[Graphics:sect4.2gr2.gif][Graphics:sect4.2gr7.gif]

Back to MTH 1230, Created: May 17, 1999.
or back to my Home page. http://www.math.neu.edu/~suciu/mth1230/gram-schmidt/g-s.html