10.7. THE QR FACTORIZATION 213

10.7 The QR FactorizationAs pointed out above, the LU factorization is not a mathematically respectable thing be-cause it does not always exist. There is another factorization which does always exist.Much more can be said about it than I will say here. At this time, I will only deal with realmatrices and so the inner product will be the usual real dot product. Letting A be an m×nreal matrix and letting (·, ·) denote the usual real inner product,

(Ax,y) = ∑i(Ax)i yi = ∑

i∑

jAi jx jyi = ∑

j∑

i

(AT )

ji yix j

= ∑j

(AT y

)j x j =

(x,AT y

)Thus, when you take the matrix across the comma, you replace with a transpose.

Definition 10.7.1 An n×n real matrix Q is called an orthogonal matrix if

QQT = QT Q = I.

Thus an orthogonal matrix is one whose inverse is equal to its transpose.

From the above observation,

|Qx|2 = (Qx,Qx) =(x,QT Qx

)= (x,Ix) = (x,x) = |x|2

This shows that orthogonal transformations preserve distances. Conversely you can alsoshow that if you have a matrix which does preserve distances, then it must be orthogonal.

Example 10.7.2 One of the most important examples of an orthogonal matrix is the socalled Householder matrix. You have v a unit vector and you form the matrix

I−2vvT

This is an orthogonal matrix which is also symmetric. To see this, you use the rules ofmatrix operations. (

I−2vvT )T= IT −

(2vvT )T

= I−2vvT

so it is symmetric. Now to show it is orthogonal,(I−2vvT )(I−2vvT ) = I−2vvT −2vvT +4vvT vvT

= I−4vvT +4vvT = I

because vT v = v ·v = |v|2 = 1. Therefore, this is an example of an orthogonal matrix.

Next consider the problem illustrated in the following picture.

x

y

Find an orthogonal matrix Q which switches the two vectors taking x to y and y to x.

10.7. THE QR FACTORIZATION 21310.7. The OR FactorizationAs pointed out above, the LU factorization is not a mathematically respectable thing be-cause it does not always exist. There is another factorization which does always exist.Much more can be said about it than I will say here. At this time, I will only deal with realmatrices and so the inner product will be the usual real dot product. Letting A be an m x nreal matrix and letting (-,-) denote the usual real inner product,(Ax,y) = AX) = LV Anri = VY 4) eii— L(A") 33 = (x,A‘y)Thus, when you take the matrix across the comma, you replace with a transpose.Definition 10.7.1 Ann x n real matrix Q is called an orthogonal matrix if90" = 9'Q=1.Thus an orthogonal matrix is one whose inverse is equal to its transpose.From the above observation,|Ox| = (Ox, Ox) = (x,0" Ox) = (xx) = (x,x) = |x|?This shows that orthogonal transformations preserve distances. Conversely you can alsoshow that if you have a matrix which does preserve distances, then it must be orthogonal.Example 10.7.2 One of the most important examples of an orthogonal matrix is the socalled Householder matrix. You have v a unit vector and you form the matrixI—2vv"This is an orthogonal matrix which is also symmetric. To see this, you use the rules ofmatrix operations.(I—2vv")* = [- (2vw")"= [—2vy"so it is symmetric. Now to show it is orthogonal,(I—2vv") (I—2vv’) = 1-2! —2vv! +4yv" vy"= [—4yy’ +4vv! =]Tbecause V' V=V-V= Iv| = |. Therefore, this is an example of an orthogonal matrix.Next consider the problem illustrated in the following picture.Find an orthogonal matrix Q which switches the two vectors taking x to y and y to x.