ENGG5781 Matrix Analysis and Computations Lecture 8: QR Decomposition

Similar documents
Orthogonal Transformations

EECS 275 Matrix Computation

ENGG5781 Matrix Analysis and Computations Lecture 9: Kronecker Product

AMS526: Numerical Analysis I (Numerical Linear Algebra)

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

Orthonormal Transformations

Lecture 4 Orthonormal vectors and QR factorization

Orthonormal Transformations and Least Squares

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

Linear Analysis Lecture 16

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 9

Lecture # 5 The Linear Least Squares Problem. r LS = b Xy LS. Our approach, compute the Q R decomposition, that is, n R X = Q, m n 0

Lecture 3: QR-Factorization

Applied Numerical Linear Algebra. Lecture 8

Problem 1. CS205 Homework #2 Solutions. Solution

The QR Factorization

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

Orthogonalization and least squares methods

AMS526: Numerical Analysis I (Numerical Linear Algebra)

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

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

Math 407: Linear Optimization

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

Matrix decompositions

Lecture 6. Numerical methods. Approximation of functions

. The following is a 3 3 orthogonal matrix: 2/3 1/3 2/3 2/3 2/3 1/3 1/3 2/3 2/3

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

Section 6.4. The Gram Schmidt Process

Linear Algebra, part 3 QR and SVD

Worksheet for Lecture 25 Section 6.4 Gram-Schmidt Process

Matrix Factorization and Analysis

AM205: Assignment 2. i=1

Linear Models Review

Least-Squares Systems and The QR factorization

1 Cricket chirps: an example

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Lecture notes: Applied linear algebra Part 1. Version 2

Orthonormal Bases; Gram-Schmidt Process; QR-Decomposition

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

be a Householder matrix. Then prove the followings H = I 2 uut Hu = (I 2 uu u T u )u = u 2 uut u

LECTURE 7. Least Squares and Variants. Optimization Models EE 127 / EE 227AT. Outline. Least Squares. Notes. Notes. Notes. Notes.

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

Linear Least squares

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

MATH 22A: LINEAR ALGEBRA Chapter 4

a 11 a 12 a 11 a 12 a 13 a 21 a 22 a 23 . a 31 a 32 a 33 a 12 a 21 a 23 a 31 a = = = = 12

MATH 167: APPLIED LINEAR ALGEBRA Least-Squares

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

1 Last time: least-squares problems

Lecture 2 INF-MAT : , LU, symmetric LU, Positve (semi)definite, Cholesky, Semi-Cholesky

22m:033 Notes: 7.1 Diagonalization of Symmetric Matrices

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 13

Applied Linear Algebra in Geoscience Using MATLAB

Pseudoinverse & Moore-Penrose Conditions

14.2 QR Factorization with Column Pivoting

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

B553 Lecture 5: Matrix Algebra Review

5.6. PSEUDOINVERSES 101. A H w.

Computational Linear Algebra

Linear Algebra in Actuarial Science: Slides to the lecture

MATH 532: Linear Algebra

. =. a i1 x 1 + a i2 x 2 + a in x n = b i. a 11 a 12 a 1n a 21 a 22 a 1n. i1 a i2 a in

Least squares: the big idea

ELE/MCE 503 Linear Algebra Facts Fall 2018

Linear Algebra Primer

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

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

Lecture 6, Sci. Comp. for DPhil Students

Assignment #9: Orthogonal Projections, Gram-Schmidt, and Least Squares. Name:

Numerical Linear Algebra Chap. 2: Least Squares Problems

Basic Concepts in Linear Algebra

Dot product and linear least squares problems

Lecture 4: Applications of Orthogonality: QR Decompositions

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Linear Least Squares Problems

Linear Algebra Review. Vectors

Review of Basic Concepts in Linear Algebra

Fundamentals of Engineering Analysis (650163)

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

(a) If A is a 3 by 4 matrix, what does this tell us about its nullspace? Solution: dim N(A) 1, since rank(a) 3. Ax =

Solution of Linear Equations

Linear Algebra and Matrices

MAT 2037 LINEAR ALGEBRA I web:

Math113: Linear Algebra. Beifang Chen

Numerical Linear Algebra Primer. Ryan Tibshirani Convex Optimization /36-725

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Chapter 4 - MATRIX ALGEBRA. ... a 2j... a 2n. a i1 a i2... a ij... a in

c i r i i=1 r 1 = [1, 2] r 2 = [0, 1] r 3 = [3, 4].

YORK UNIVERSITY. Faculty of Science Department of Mathematics and Statistics MATH M Test #2 Solutions

Problems of Eigenvalues/Eigenvectors

COMP 558 lecture 18 Nov. 15, 2010

Basic Elements of Linear Algebra

σ 11 σ 22 σ pp 0 with p = min(n, m) The σ ii s are the singular values. Notation change σ ii A 1 σ 2

Linear Algebra- Final Exam Review

From Matrix to Tensor. Charles F. Van Loan

A = , A 32 = n ( 1) i +j a i j det(a i j). (1) j=1

MAT Linear Algebra Collection of sample exams

Problems of Eigenvalues/Eigenvectors

1 Inner Product and Orthogonality

MIDTERM. b) [2 points] Compute the LU Decomposition A = LU or explain why one does not exist.

Transcription:

ENGG5781 Matrix Analysis and Computations Lecture 8: QR Decomposition Wing-Kin (Ken) Ma 2017 2018 Term 2 Department of Electronic Engineering The Chinese University of Hong Kong

Lecture 8: QR Decomposition QR decomposition Gram-Schmidt orthonormalization Householder transformations Givens rotations W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 1

Main Result QR decomposition: any A R m n can be decomposed as A = QR, where Q R m m is orthogonal, R R m n takes an upper triangular form. efficient to compute, poor man s SVD can be used to compute LS solutions; a basis for R(A) ; other decompositions such as SVD. W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 2

QR Decomposition QR decomposition: any A R m n can be decomposed as A = QR, where Q R m m is orthogonal; R R m n takes an upper triangular form. Questions: how do we know that QR decomposition exists? answer: by the algorithm, as we will see how to compute the factors Q and R algorithmically? answer: more than one way: Gram-Schmidt, Householder, and Givens. W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 3

Application: LS Consider the LS problem for a full column-rank A R m n : Let min x R n Ax y 2 2. A = QR = [ ] [ ] R Q 1 Q 1 2 0 = Q 1 R 1, where Q 1 R m n, Q 2 R m (m n), R 1 R n n (upper triangular). Since Ax y 2 2 = Q T (Ax y) 2 2 = = R 1 x Q T 1 y 2 2 + Q T 2 y 2 2, [ ] Q T 1 (Ax y) 2 Q T 2 (Ax y) the LS problem is equivalent to solving the upper triangular system R 1 x = Q T 1 y. 2 W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 4

QR for Full Column-Rank Matrices Theorem 8.1. Let A R m n, and suppose that A has full column rank. Then, A admits a decomposition A = Q 1 R 1, ( ) where Q 1 R m n is semi-orthogonal; R 1 R n n is upper triangular and nonsingular. we call ( ) a thin QR of A, and (Q 1, R 1 ) a thin QR pair of A it follows directly that Property 8.1. For the thin QR in Theorem 8.1, we have R(A) = R(Q 1 ). W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 5

QR for Full Column-Rank Matrices Proof of Theorem 8.1: 1. A T A is PD 2. let R 1 be the (upper triangular and nonsingular) Cholesky factor of A T A; i.e., Also, let Q 1 = AR 1 1. A T A = R T 1 R 1. 3. it can be verified that Q T 1 Q 1 = I, Q 1 R 1 = A. alternatively, Theorem 8.1 can be proven by using the Gram-Schmidt procedure W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 6

Classical Gram-Schmidt for Thin QR Recall the Gram-Schmidt procedure in Lecture 1: Algorithm: Gram-Schmidt input: a collection of linearly independent vectors a 1,..., a n q 1 = a 1, q 1 = q 1 / q 1 2 for i = 2,..., n why q i = a i i 1 j=1 (qt j a i)q j why q i = q i / q i 2 end output: q 1,..., q n let r ii = q i 2, r ij = q T j a i for j = 1,..., i 1 from the above procedure we see that a i = i j=1 r ijq i ; thus A = Q 1 R 1 where Q 1 = [ q 1,..., q m ]; R 1 is upper triangular with [R 1 ] ij = r ij for j i W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 7

Classical Gram-Schmidt for Thin QR the Gram-Schmidt procedure gives an alternative proof of the existence of thin QR decomposition for full-column rank A it also tells us how to compute the thin QR factors there are many variants with the Gram-Schmidt procedure e.g., one may want to improve the numerical stability of the procedure W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 8

Modified Gram-Schmidt the following modified Gram-Schmidt procedure is known to be numerically more stable. let r i denote the ith row of R 1, and note A = Q 1 R 1 = n q i r T i i=1 suppose q 1,..., q k 1, r 1,..., r k 1 are known. Then, A k 1 i=1 we can obtain q k, r k via q i r T i = n i=k q i r T i = [ 0,..., 0, }{{} k 1 zeros r kk q k,... ], q k = q k / q k 2, r T i = q T k (A k 1 i=1 q ir T i ). q k = (A k 1 i=1 q ir T i )e k, W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 9

Householder Transformations Consider an alternative QR via the Householder transformations (to be introduced). Reflection matrix: a matrix of the form H = I 2P, where P R m m is an orthogonal projector, is called a reflection matrix. by letting x = Px + P x, P = I P, we see that where Px is reflected. a reflection matrix is orthogonal: Hx = Px + P x, H T H = I 2P 2 P T }{{} =P +4 PP }{{} =P = I. W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 10

Householder Transformations Problem: given x R m, find a reflection matrix H R m m such that Hx = βe 1, for some β R. Householder transformations: let v R m, v 0, and let H = I 2 v 2 vv T. 2 Suppose x x 1 e 1 (if x = x 1 e 1 we simply choose H = I). By choosing v = x + x 2 e 1, we get (verify this as a mini-exercise). Hx = x 2 e 1 ; W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 11

Householder QR Stage 1: let H 1 R m m be the Householder transformation w.r.t. a 1. Then,... A (1) = H 1 A = 0...... 0... Stage 2: let H 2 R (m 1) (m 1) be the Householder transformation w.r.t. the 1st column of A (1) 2:m,2:n. Then,... [ ] [ ] 1 0... 0... A (2) = H 0 1 A = H2 0 H2 A (1) =. 0... }{{} 2:m,2:n.... =H 2 0 0... The same idea applies to stage k, 1 k n 1. W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 12

Householder QR Householder QR: for k = 1,..., n 1, compute where A (k) = H k A (k 1), H k = [ ] Ik 1 0, 0 Hk in which I k is the k k identity matrix, and H k R (m k+1) (n k+1) is the Householder transformation w.r.t. A (k 1) k:m,k. The above procedure results in A (n 1) = H n 1... H 2 H 1 A, A (n 1) being upper triangular. A = QR is obtained by letting Q = H T 1 H T 2... H T n 1 (orthogonal), R = A (n 1). the above QR procedure already implies the existence of full QR; also, A can be any matrix (rather than being of full column rank as in Gram-Schmidt). W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 13

Consider yet another way for QR. Givens Rotations Example: given x R 2, consider [ y1 y 2 ] = [ ] c s s c }{{} =J [ ] x1 x 2 = [ ] cx1 + sx 2, sx 1 + cx 2 where c = cos(θ), s = sin(θ), for some θ. It can be verified that J is orthogonal y 2 = 0 if θ = tan 1 (x 2 /x 1 ), or if c = x 1 x 2 1 + x 2 2, s = x 2 x 2 1 + x 2 2. W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 14

Givens Rotations Givens rotations: I c s J(i, k, θ) = I s c I where c = cos(θ), s = sin(θ); c lies in the (k, k)th and (i, i) entries; s the (i, k)th entry; s the (k, i)th entry. J(i, k, θ) is orthogonal let y = J(i, k, θ)x. We have y j = cx i + sx k, sx i + cx k, x j, j = i j = k j i, k Also, y k can be forced to zero by choosing θ = tan 1 (x k /x i ). W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 15

Givens QR Example: A = 0 0 0 0 consider a 4 3 matrix. J 2,1 J 4,2 0 0 0 0 0 0 J 3,1 J 4,3 0 J 4,1 0 0 0 0 0 0 0 = R 0 0 0 J 3,2 where B J C means B = JC; J i,k = J(i, k, θ), with θ that is chosen to zero out the (i, k)th entry of the matrix transformed by J i,k. W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 16

Givens QR Givens QR: perform a sequence of Givens rotations to annihilate the lower triangular parts of A to obtain J n,n 1... (J n,2... J 32 )(J n1... J 21 ) A = R }{{} =Q T where R is upper triangular, and Q is orthogonal. W.-K. Ma, ENGG5781 Matrix Analysis and Computations, CUHK, 2017 2018 Term 2. 17