Lecture 3: QR-Factorization

Similar documents
Matrix decompositions

Lecture 11. Linear systems: Cholesky method. Eigensystems: Terminology. Jacobi transformations QR transformation

Linear Analysis Lecture 16

Math 102, Winter Final Exam Review. Chapter 1. Matrices and Gaussian Elimination

Math 407: Linear Optimization

Computational Linear Algebra

orthogonal relations between vectors and subspaces Then we study some applications in vector spaces and linear systems, including Orthonormal Basis,

Worksheet for Lecture 25 Section 6.4 Gram-Schmidt Process

Numerical Methods - Numerical Linear Algebra

Diagonalizing Matrices

This can be accomplished by left matrix multiplication as follows: I

Linear Algebra: Matrix Eigenvalue Problems

5. Orthogonal matrices

AM 205: lecture 8. Last time: Cholesky factorization, QR factorization Today: how to compute the QR factorization, the Singular Value Decomposition

j=1 u 1jv 1j. 1/ 2 Lemma 1. An orthogonal set of vectors must be linearly independent.

ENGG5781 Matrix Analysis and Computations Lecture 8: QR Decomposition

Numerical Linear Algebra

Fall TMA4145 Linear Methods. Exercise set Given the matrix 1 2

MATH 423 Linear Algebra II Lecture 33: Diagonalization of normal operators.

EECS 275 Matrix Computation

The Singular Value Decomposition

Matrix Theory, Math6304 Lecture Notes from September 27, 2012 taken by Tasadduk Chowdhury

Preliminary/Qualifying Exam in Numerical Analysis (Math 502a) Spring 2012

Matrix Factorization and Analysis

October 25, 2013 INNER PRODUCT SPACES

Applied Mathematics 205. Unit II: Numerical Linear Algebra. Lecturer: Dr. David Knezevic

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Section 6.4. The Gram Schmidt Process

Linear Algebra, part 3 QR and SVD

Schur s Triangularization Theorem. Math 422

Review problems for MA 54, Fall 2004.

Lecture 4 Orthonormal vectors and QR factorization

EXAM. Exam 1. Math 5316, Fall December 2, 2012

QR-decomposition. The QR-decomposition of an n k matrix A, k n, is an n n unitary matrix Q and an n k upper triangular matrix R for which A = QR

Non-square diagonal matrices

Math 108b: Notes on the Spectral Theorem

Orthonormal Transformations and Least Squares

Midterm for Introduction to Numerical Analysis I, AMSC/CMSC 466, on 10/29/2015

Lecture 9: Elementary Matrices

A Brief Outline of Math 355

Math 520 Exam 2 Topic Outline Sections 1 3 (Xiao/Dumas/Liaw) Spring 2008

1 Vectors. Notes for Bindel, Spring 2017 Numerical Analysis (CS 4220)

5.6. PSEUDOINVERSES 101. A H w.

9. Numerical linear algebra background

Linear Least squares

Numerical Methods. Elena loli Piccolomini. Civil Engeneering. piccolom. Metodi Numerici M p. 1/??

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Inverses. Stephen Boyd. EE103 Stanford University. October 28, 2017

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 9

13-2 Text: 28-30; AB: 1.3.3, 3.2.3, 3.4.2, 3.5, 3.6.2; GvL Eigen2

1 Last time: least-squares problems

33AH, WINTER 2018: STUDY GUIDE FOR FINAL EXAM

Orthonormal Transformations

12. Cholesky factorization

Householder reflectors are matrices of the form. P = I 2ww T, where w is a unit vector (a vector of 2-norm unity)

Numerical Linear Algebra Chap. 2: Least Squares Problems

4.2. ORTHOGONALITY 161

Lecture 6, Sci. Comp. for DPhil Students

Class notes: Approximation

Least-Squares Systems and The QR factorization

Q T A = R ))) ) = A n 1 R

G1110 & 852G1 Numerical Linear Algebra

Elementary linear algebra

We will discuss matrix diagonalization algorithms in Numerical Recipes in the context of the eigenvalue problem in quantum mechanics, m A n = λ m

Notes on Eigenvalues, Singular Values and QR

The matrix will only be consistent if the last entry of row three is 0, meaning 2b 3 + b 2 b 1 = 0.

We wish to solve a system of N simultaneous linear algebraic equations for the N unknowns x 1, x 2,...,x N, that are expressed in the general form

Solutions to Review Problems for Chapter 6 ( ), 7.1

forms Christopher Engström November 14, 2014 MAA704: Matrix factorization and canonical forms Matrix properties Matrix factorization Canonical forms

Part IB - Easter Term 2003 Numerical Analysis I

Lecture notes on Quantum Computing. Chapter 1 Mathematical Background

Eigenvalues and Eigenvectors

Linear Algebra, part 3. Going back to least squares. Mathematical Models, Analysis and Simulation = 0. a T 1 e. a T n e. Anna-Karin Tornberg

Orthogonal iteration revisited

LINEAR ALGEBRA SUMMARY SHEET.

1. What is the determinant of the following matrix? a 1 a 2 4a 3 2a 2 b 1 b 2 4b 3 2b c 1. = 4, then det

AMS526: Numerical Analysis I (Numerical Linear Algebra)

6.4 Krylov Subspaces and Conjugate Gradients

APPLICATIONS The eigenvalues are λ = 5, 5. An orthonormal basis of eigenvectors consists of

Orthonormal Bases; Gram-Schmidt Process; QR-Decomposition

Cayley-Hamilton Theorem

Linear Algebra Massoud Malek

EECS 275 Matrix Computation

Numerical Linear Algebra

Matrices and Vectors

Math 489AB Exercises for Chapter 2 Fall Section 2.3

Orthogonal Transformations

1 Inner Product and Orthogonality

Computation of eigenvalues and singular values Recall that your solutions to these questions will not be collected or evaluated.

The QR Factorization

Review of Linear Algebra Definitions, Change of Basis, Trace, Spectral Theorem

Math 291-2: Lecture Notes Northwestern University, Winter 2016

Pivoting. Reading: GV96 Section 3.4, Stew98 Chapter 3: 1.3

MATH 22A: LINEAR ALGEBRA Chapter 4

Chapter 6 Inner product spaces

Eigenvectors and Hermitian Operators

1 Linear Algebra Problems

9. Numerical linear algebra background

Conceptual Questions for Review

AMS526: Numerical Analysis I (Numerical Linear Algebra for Computational and Data Sciences)

Transcription:

Lecture 3: QR-Factorization This lecture introduces the Gram Schmidt orthonormalization process and the associated QR-factorization of matrices It also outlines some applications of this factorization This corresponds to section 26 of the textbook In addition, supplementary information on other algorithms used to produce QR-factorizations is given 1 Gram Schmidt orthonormalization process Consider n linearly independent vectors u 1,, u n in C m Observe that we necessarily have m n We wish to orthonormalize them, ie, to create vectors v 1,, v n such that (v 1,, v k ) is an orthonormal basis for V k := span[u 1,, u k ] for all 1k [1 : n] It is always possible to find such vectors, and in fact they are uniquely determined if the additional condition v k, u k > 0 is imposed The step-by-step construction is based on the following scheme Suppose that v 1,, v k 1 have been obtained; search in V k for a vector k 1 ṽ k = u k + c k,i v i such that ṽ k V k 1 ; i=1 the conditions 0 = ṽ k, v i = u k, v i + c k,i, i [1 : k 1], impose the choice c k,i = u k, v i ; now that ṽ k is completely determined, normalize it to obtain the vector v k = 1 ṽ k ṽk For instance, let us write down explicitly all the steps in the orthonormalization process for the vectors u 1 = [6, 3, 2], u 2 = [6, 6, 1], u 3 = [1, 1, 1] ṽ 1 = u 1, ṽ 1 = 36 + 3 + 4 =, v 1 = 1/ [6, 3, 2] ; ṽ 2 = u 2 + αv 1, 0 = ṽ 2, v 1 α = u 2, v 1 = (16 + 18 + 2)/, α = 8, ṽ 2 = 1/ [ 6 8 6, 6 8 3, 1 8 2] = 1/ [ 6, 18, 9] = 3/ [ 2, 6, 3], ṽ 2 = 3/ 4 + 36 + 9 = 3, v 2 = 1/ [ 2, 6, 3] ; ṽ 3 = u 3 + βv 2 + γv 1, 0 = ṽ 3, v 2, 0 = ṽ 3, v 1, β = u 3, v 2 = ( 2 + 6 3)/, γ = u 3, v 1 = (6 + 3 + 2)/, β = 1/, γ = 11/, ṽ 3 = 1/49 [49 + 2 66, 49 6 33, 49 + 3 22] = 1/49 [ 15, 10, 30] = 5/49 [ 3, 2, 6], ṽ 3 = 5/49 9 + 4 + 36 = 5/, v 3 = 1/ [ 3, 2, 6] 1

2 QR-factorization Theorem 1 For a nonsingular A M n, there exists a unique pair of unitary matrix Q M n and upper triangular matrix R M n with positive diagonal entries such that A = QR The QR-factorization can be used for the following tasks: solving linear systems according to [Ax = b] [Qy = b, y = Rx], since the system y = Rx is easy to solve [backward substitution], and the system Qy = b is even easier to solve [take y = Q b]; calculate the (modulus of the) determinant and find the inverse [ det A = n i=1 r i,i, A 1 = R 1 Q ]; find the Cholesky factorization of a positive definite matrix B = A A M n, A M n being nonsingular (we will later see why every positive definite matrix can be factored in this way), ie, find a factorization B = LL, where L M n is lower triangular with positive diagonal entries [L = R ]; find a Schur s factorization of a matrix A M n via the QR-algorithm defined by A 0 := A, A 0 =: Q 0 R 0, A 1 := R 0 Q 0, A 1 =: Q 1 R 1, A k := R k 1 Q k 1, A 1 =: Q k R k, Note that A k is always unitarily equivalent to A If all the eigenvalues of A have distinct moduli, then A k tends to an upper triangular matrix T (which is therefore unitarily equivalent to A, see Exercise 3) The eigenvalues of A are read on the diagonal of T In the general case of nonsingular or nonsquare matrices, the QR-factorization reads: Theorem 2 For A M m n, m n, there exists a matrix Q M m n with orthonormal columns and an upper triangular matrix R M n such that A = QR Beware that the QR-factorization of a rectangular matrix A is not always understood with Q rectangular and R square, but sometimes with Q square and R rectangular, as with the MATLAB command qr 2

3 Proof of Theorems 1 and 2 Uniqueness: Suppose that A = Q 1 R 1 = Q 2 R 2 where Q 1, Q 2 are unitary and R 1, R 2 are upper triangular with positive diagonal entries Then M := R 1 R 1 2 = Q 1Q 2 Since M is a unitary (hence normal) matrix which is also upper triangular, it must be diagonal (see Lemma 4 of Lecture 2) Note also that the diagonal entries of M are positive (because the upper triangular matrices R 1 and R2 1 have positive diagonal entries) and of modulus one (because M is a diagonal unitary matrix) We deduce that M = I, and consequently that R 1 = R 2, Q 1 = Q 2 Existence: Let us consider a matrix A M m n with m n, and let u 1,, u n C m denote its columns We may assume that u 1,, u n are linearly independent (otherwise limiting arguments can be used, see Exercise 4) Then the result is just a matrix interpretation of the Gram Schmidt orthonormalization process of m linearly independent vectors in C n Indeed, the Gram Schmidt algorithm produces orthonormal vectors v 1,, v n C m such that, for each j [1 : n], (1) u j = j r k,j v k = k=1 n r k,j v k, with r k,j = 0 for k > j, in other words, R := [r i,j ] n i,j=1 is an n n upper triangular matrix The n equations (1) reduce, in matrix form, to A = QR, where Q is the m n matrix whose columns are the orthonormal vectors v 1,, v n [To explain the other QR-factorization, let us complete v 1,, v n with v m+1,, v n to form an orthonormal basis (v 1,, v m ) of C m The analogs of the equations (1), ie, u j = m k=1 r k,j v k with r k,j = 0 for k > j, read A = QR, where Q is the m m orthogonal matrix with columns v 1,, v m and R is an m n upper triangular matrix] To illustrate the matrix interpretation, observe that the orthonormalization carried out in Section 1 translates into the factorization [identify all the entries] 3 6 1 = 1 6 2 3 8 11/ 3 6 2 0 3 1/ 2 1 1 2 3 6 0 0 5/ }{{}}{{} unitary upper triangular k=1 3

An aside: other QR-factorization algorithms The Gram Schmidt algorithm has the disadvantage that small imprecisions in the calculation of inner products accumulate quickly and lead to effective loss of orthogonality Alternative ways to obtain a QR-factorization are presented below on some examples They are based on the following idea and exploits the fact that the computed product of unitary matrices gives a unitary matrix with acceptable error Multiply the (real) matrix A on the left by some orthogonal matrices Q i which eliminate some entries below the main diagonal, until the result is an upper triangular matrix R, thus Q k Q 2 Q 1 A = R yields A = QR, with Q = Q 1Q 2 Q k We mainly know two types of unitary transformations, namely rotations and reflexions Therefore, the two methods we describe are associated with Givens rotations [preferred when A is sparse] and Householder reflections [preferred when A is dense] Givens rotations The matrix i j 1 0 0 i cos θ sin θ Ω [i,j] := 0 0 j sin θ cos θ 0 0 1 corresponds to a rotation along the two-dimensional space span[e i, e j ] The rows of the matrix Ω [i,j] A are the same as the rows of A, except for the i-th and j-th rows, which are linear combinations of the i-th and j-th rows of A By choosing θ appropriately, we may introduce a zero at a prescribed position on one of these rows Consider for example the matrix A = 3 6 1 2 1 1 of the end of Section 1 We pick Ω [1,2] so that Ω [1,2] A = 0 Then we pick Ω [1,3] so that Ω [1,3] Ω [1,2] A = 0 Finally, thanks to the leading zeros in the second and third rows, 0 4

we can pick Ω [2,3] so that Ω [2,3] Ω [1,3] Ω [1,2] A = 0 The matrix [ Ω [2,3] Ω [1,3] Ω [1,2]] is the 0 0 unitary matrix required in the factorization of A Householder reflections The reflection in the direction of a vector v transforms v into v while leaving the space v unchanged It can therefore be expressed through the Hermitian unitary matrix H v := I 2 v 2 vv Consider the matrix A = 3 6 1 once again We may transform u 1 = [6, 3, 2] into e 1 = 2 1 1 [, 0, 0] by way of the reflection in the direction v 1 = u 1 e 1 = [ 1, 3, 2] The latter is represented by the matrix H v1 = I 2 v 1 2 v 1v1 = I 1 1 3 2 3 9 6 = 1 6 3 2 3 2 6 2 6 4 2 6 3 Then the matrix H v1 A has the form 0, where the precise expression for the second 0 column is H v1 u 2 = u 2 v 8 1, u 2 v 1 = u 2 2v 1 = 0 3 To cut the argument short, we may observe at this point that the multiplication of H v1 A 1 0 0 on the left by the permutation matrix P = 0 0 1 [which can be interpreted as H e2 e 3 ] 0 1 0 exchanges the second and third rows, thus gives an upper triangular matrix In conclusion, the orthogonal matrix Q has been obtained as (P H v1 ) = Hv 1 P = H v1 P = 1 6 2 3 3 6 2 2 3 6 5

4 Exercises Ex1: Prove that a matrix A M m n, m n, can be factored as A = LP where L M m is lower triangular and P M m n has orthonormal rows Ex2: Prove the uniqueness of the Cholesky factorization of a positive definite matrix Ex3: Exercise 5 p 11 Ex4: Fill in the details of the following argument: for A M m n with m n, there exists a sequence of matrices A k M m n with linearly independent columns such that A k A as k ; each A k can be written as A k = Q k R k where Q k M m n has orthonormal columns and R k M n is upper triangular; there exists a subsequence (Q kj ) converging to a matrix Q M m n with orthonormal columns, and the sequence (R kj ) converges to an upper triangular matrix R M n ; taking the limit when j yields A = QR Ex5: Fill in the numerical details in the section on Givens rotations 6