5.7. THE QR FACTORIZATION 137

so it is symmetric. Now to show it is orthogonal,(I − 2vvT

) (I − 2vvT

)= I − 2vvT − 2vvT + 4vvTvvT

= I − 4vvT + 4vvT = I

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

Consider the following problem.

Problem 5.7.3 Given two vectors x,y such that |x| = |y| ≠ 0 but x ̸= y and you want anorthogonal matrix Q such that Qx = y and Qy = x. The thing which works is the House-holder matrix

Q ≡ I − 2x− y

|x− y|2(x− y)

T

Here is why this works.

Q (x− y) = (x− y)− 2x− y

|x− y|2(x− y)

T(x− y)

= (x− y)− 2x− y

|x− y|2|x− y|2 = y − x

Q (x+ y) = (x+ y)− 2x− y

|x− y|2(x− y)

T(x+ y)

= (x+ y)− 2x− y

|x− y|2((x− y) · (x+ y))

= (x+ y)− 2x− y

|x− y|2(|x|2 − |y|2

)= x+ y

Hence

Qx+Qy = x+ y

Qx−Qy = y − x

Adding these equations, 2Qx = 2y and subtracting them yields 2Qy = 2x.

A picture of the geometric significance follows.

x

y

The orthogonal matrix Q reflects across the dotted line taking x to y and y to x.

Definition 5.7.4 Let A be an m×n matrix. Then a QR factorization of A consists of twomatrices, Q orthogonal and R upper triangular (right triangular) having all the entries onthe main diagonal nonnegative such that A = QR.