gram-schmidt orthogonalization and qr decompositon

3
Gram-Schmidt Orthogonalization and QR Decomposition Mohammad Umar Rehman PhD Student, Control Group, EE Department, IIT Delhi [email protected] Abstract A very quick and easy to understand introduction to Gram-Schmidt Orthogonalization (Orthonormalization) and how to obtain QR decomposition of a matrix using it. A basic back- ground in linear algebra is assumed. Aim Given a basis B of a vector subspace V spanned by vectors {v 1 , v 2 ,..., v n } it is required to find an orthonormal basis {q 1 , q 2 ,..., q n } (A basis that is orthogonal with unit length of con- stituent vectors). Thus, q T i q j = 1, i = j 0, i 6 = j Proof. Note that span{v 1 , v 2 ,..., v n } = span{q 1 , q 2 ,..., q n } (successive spanning) Lets start with one vector v 1 , normalize this to obtain vector q 1 as q 1 = v 1 kv 1 k (1) Now, lets include another vector, v 2 to the picture (See Fig. 1) 1 . We have already obtained q 1 , now we need q 2 , which can be obtained by normalizing a vector that is orthogonal to v 1 (q 1 ). Suppose, this vector is ˜ v 2 . By triangle law of vectors, it can be seen that ˜ v 2 = v 2 - v 1 But, to be more formal in lines with the algorithm we write ˜ v 2 as ˜ v 2 = v 2 - proj v 1 (v 2 )= v 2 -hv 2 , q 1 i q 1 (2) and, q 2 = ˜ v 2 k ˜ v 2 k where, h a, bi = a T b is the inner product. 1 This is an improved version of the document with the figures included, it would have been better if a successive series of figures were included showing the process step by step. An animation of the GS process can be found on Wikipedia here: https://en.wikipedia.org/wiki/Gram-Schmidt_process Please contact for any clarifications, or found errors. Thanks! 1

Upload: mohammad-umar-rehman

Post on 14-Apr-2017

319 views

Category:

Engineering


4 download

TRANSCRIPT

Page 1: Gram-Schmidt Orthogonalization and QR Decompositon

Gram-Schmidt Orthogonalizationand QR Decomposition

Mohammad Umar RehmanPhD Student, Control Group,

EE Department, IIT [email protected]

Abstract A very quick and easy to understand introduction to Gram-Schmidt Orthogonalization(Orthonormalization) and how to obtain QR decomposition of a matrix using it. A basic back-ground in linear algebra is assumed.

Aim Given a basis B of a vector subspace V spanned by vectors {v1, v2, . . . , vn} it is requiredto find an orthonormal basis {q1, q2, . . . , qn} (A basis that is orthogonal with unit length of con-stituent vectors). Thus,

qTi qj =

{1, i = j0, i 6= j

Proof. Note that span{v1, v2, . . . , vn} = span{q1, q2, . . . , qn} (successive spanning)Lets start with one vector v1, normalize this to obtain vector q1 as

q1 =v1

‖v1‖(1)

Now, lets include another vector, v2 to the picture (See Fig. 1) 1. We have already obtained q1, nowwe need q2, which can be obtained by normalizing a vector that is orthogonal to v1(q1). Suppose,this vector is v2. By triangle law of vectors, it can be seen that

v2 = v2 − v1

But, to be more formal in lines with the algorithm we write v2 as

v2 = v2 − projv1(v2) = v2 − 〈v2, q1〉 q1 (2)

and,

q2 =v2

‖v2‖where, 〈a, b〉 = aTb is the inner product.

1This is an improved version of the document with the figures included, it would have been better if a successiveseries of figures were included showing the process step by step. An animation of the GS process can be found onWikipedia here: https://en.wikipedia.org/wiki/Gram-Schmidt_processPlease contact for any clarifications, or found errors. Thanks!

1

Page 2: Gram-Schmidt Orthogonalization and QR Decompositon

Figure 1: Obtaining an orthonormal basis–2D case

Going one step further we include v3 and proceed on similar lines to obtain v3 as

v3 = v3 − projq1(v3)− projq2

(v3)

= v3 − 〈v3, q1〉 q1 − 〈v3, q2〉 q2

q3 = v3/ ‖v3‖(3)

Figure 2: Obtaining an orthonormal basis–3D case

Similarly,v4 = v4 − 〈v4, q1〉 q1 − 〈v4, q2〉 q2 − 〈v4, q3〉 q3, q4 = v4/ ‖v4‖ (4)

So, this process continues and we are in a position to write the expression for vn

vn = vn − 〈vn, q1〉 q1 − 〈vn, q2〉 q2 − · · · − 〈vn, qn−1〉 qn−1, qn = vn/ ‖vn‖ (5)

2

Page 3: Gram-Schmidt Orthogonalization and QR Decompositon

In compact form,

vn = vn −n−1

∑i=0〈vn, qi〉 qi

Hence, we have obtained an orthonormal basis from a regular basis for the vector subspace V.

Obtaining QR decompositionNow, let us rearrange the equations (1) to (5) in terms of v’s only

v1 = ‖v1‖ q1 (6)v2 = 〈v2, q1〉 q1 + v2 = 〈v2, q1〉 q1 + ‖v2‖ q2 (7)v3 = 〈v3, q1〉 q1 + 〈v3, q2〉 q2 + v3 = 〈v3, q1〉 q1 + 〈v3, q2〉 q2 + ‖v3‖ q3 (8)v4 = 〈v4, q1〉 q1 + 〈v4, q2〉 q2 + 〈v4, q3〉 q3 + ‖v4‖ q4 (9)

...

vn = 〈vn, q1〉 q1 + 〈vn, q2〉 q2 + · · ·+ 〈vn−1, qn−1〉 qn−1 + ‖vn‖ qn (10)

And rewrite these equations in the matrix form, we get

[v1 v2 . . . vn

]=[q1 q2 . . . qn

]

‖v1‖ 〈v2, q1〉 〈v3, q1〉 . . . 〈vn, q1〉0 ‖v2‖ 〈v3, q2〉 . . . 〈vn, q2〉0 0 ‖v3‖ . . . 〈vn, q3〉0 0 0 . . . ...0 0 0 ‖vn−1‖ 〈vn−1, qn−1〉0 0 0 0 ‖vn‖

or, V = QR

(11)

Thus, we have obtained the QR decomposition of the matrix A starting from the Gram-Schmidtprocess, where Q is an orthonormal matrix and R is an upper triangular matrix.

3