Lecture 15 Math 221 

QR Factorization and Solutions to Equations of the form Ax=b 

 

We will study another method to solve the system Ax = b.  The QR factorization is also, important in finding the eigenvalues of the matrix A but that is will have to wait until we know what an eigenvalue is and why we want to find them.   

 

The QR factorization is obtained by using the Gram-Schmidt process on the columns of A to form an orthogonal matrix.  An orthogonal matrix has the property that Typesetting:-mrow(Typesetting:-mi( and Typesetting:-mrow(Typesetting:-mi(.  Thus , the matrix must be square to be orthogonal.  We will also use the letter Q for a non square matrix with the property that Typesetting:-mrow(Typesetting:-mi(  but we will not call it an orthogonal matrix.  We have all the tools necessary to find the matrices Q.   

We will illustrate how to find an orthogonal matrix Q starting with a 3x3 non-singular matrix. 

We know from previous work that if A is non-singular then the columns of A are linearly independent.   

 

> A:=<<1,-1,0>|<-1,1,-1>|<0,1,-1>>;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> with(LinearAlgebra):
 

> v1:=Column(A,1);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> v2:=Column(A,2);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> v3:=Column(A,3);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> p1:=v1;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> p2:=v2-(p1^%T.v2)/(p1^%T.p1)*p1;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> p3:=v3-(p1^%T.v3)/(p1^%T.p1)*p1-(p2^%T.v3)/(p2^%T.p2)*p2;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> p3a:=2*p3;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> q1:=p1*1/Norm(p1,2);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> q2:=p2*1/Norm(p2,2);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> q3:=p3*1/Norm(p3,2);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> Q:=<q1|q2|q3>;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> R:=Q^%T.A;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> Q.R;
 

Matrix(%id = 1384164)
 

> b:=<1,-2,0>;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

If we have the equation Ax = b  The by multiplying by the transpose of Q we have 

Typesetting:-mrow(Typesetting:-mi(
 

For our example then we will only have to multiply b  by the transpose of Q and use back substitution. 

 

 

> QTb:=Q^%T.b;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> x:=BackwardSubstitute(<R|QTb>);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

We will next look at the case when we do not have a square matrix.  We can find a matrix that we will designate by the letter Q but it will not be an orthogonal matrix since it is not square. 

 

 

QR for Non-Square Matrices. 

Consider the following system 

Typesetting:-mrow(Typesetting:-mi(
 

We will find a matrix Q so that Typesetting:-mrow(Typesetting:-mi( where R is an upper triangular matrix and the columns of Q are orthonormal. 

 

 

> C:=<<1,0,1,1>|<1,1,0,0>|<0,1,2,1>>;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> e:=<3,3,3,2>;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> v1:=Column(C,1);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> v2:=Column(C,2);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> v3:=Column(C,3);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> p1:=v1;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> p2:=v2 - (p1^%T.v2)/(p1^%T.p1)*p1;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> p3:=v3-(p1^%T.v3)/(p1^%T.p1)*p1 - (p2^%T.v3)/(p2^%T.p2)*p2;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> p1^%T.p2;
 

0
 

> p1^%T.p3;
 

0
 

> p2^%T.p3;
 

0
 

> q1:=p1*1/Norm(p1,2);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> q2:=p2*1/Norm(p2,2);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> q3:=p3*1/Norm(p3,2);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> Q:=<q1|q2|q3>;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> R:=Q^%T.C;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> Qe:=Q^%T.e;
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> Y:=BackwardSubstitute(<R|Qe>);
 

Typesetting:-mrow(Typesetting:-mverbatim(
 

> C.Y;
 

Vector[column](%id = 1481284)
 

>
 

We will talk about the meaning of such equation when there is no solution.  The above process will 

give a solution but it is not a solution as we now know it.   

 

Exercises 2.5 

Exercise 2.5.2, Exercise 2.5.3 (c), (e) , Exercise 2.5.7 (d),(f) .   Exercises are due on October 27, 2008.