Lecture 4: Applications of Orthogonality: QR Decompositions

Similar documents
Lecture 6: Lies, Inner Product Spaces, and Symmetric Matrices

22A-2 SUMMER 2014 LECTURE 5

Lecture 19: The Determinant

Math 416, Spring 2010 Gram-Schmidt, the QR-factorization, Orthogonal Matrices March 4, 2010 GRAM-SCHMIDT, THE QR-FACTORIZATION, ORTHOGONAL MATRICES

Section 6.4. The Gram Schmidt Process

Worksheet for Lecture 25 Section 6.4 Gram-Schmidt Process

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

Recitation 8: Graphs and Adjacency Matrices

Linear Analysis Lecture 16

Math 3191 Applied Linear Algebra

The 'linear algebra way' of talking about "angle" and "similarity" between two vectors is called "inner product". We'll define this next.

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4

18.06 Quiz 2 April 7, 2010 Professor Strang

Lecture 2: Change of Basis

MATH 1120 (LINEAR ALGEBRA 1), FINAL EXAM FALL 2011 SOLUTIONS TO PRACTICE VERSION

The Gram Schmidt Process

The Gram Schmidt Process

L2-7 Some very stylish matrix decompositions for solving Ax = b 10 Oct 2015

[Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty.]

Math 18, Linear Algebra, Lecture C00, Spring 2017 Review and Practice Problems for Final Exam

Math Linear Algebra II. 1. Inner Products and Norms

MATH 22A: LINEAR ALGEBRA Chapter 4

GAUSSIAN ELIMINATION AND LU DECOMPOSITION (SUPPLEMENT FOR MA511)

Lecture 14: The Rank-Nullity Theorem

LINEAR ALGEBRA 1, 2012-I PARTIAL EXAM 3 SOLUTIONS TO PRACTICE PROBLEMS

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

Final Review Sheet. B = (1, 1 + 3x, 1 + x 2 ) then 2 + 3x + 6x 2

Recitation 5: Elementary Matrices

Recitation 9: Probability Matrices and Real Symmetric Matrices. 3 Probability Matrices: Definitions and Examples

Math 4A Notes. Written by Victoria Kala Last updated June 11, 2017

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

Roberto s Notes on Linear Algebra Chapter 9: Orthogonality Section 2. Orthogonal matrices

MAT2342 : Introduction to Applied Linear Algebra Mike Newman, fall Projections. introduction

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

3 QR factorization revisited

MATH 20F: LINEAR ALGEBRA LECTURE B00 (T. KEMP)

Dylan Zwick. Fall Ax=b. EAx=Eb. UxrrrEb

2. Every linear system with the same number of equations as unknowns has a unique solution.

Orthonormal Bases; Gram-Schmidt Process; QR-Decomposition

Linear Algebra Final Exam Study Guide Solutions Fall 2012

ft-uiowa-math2550 Assignment NOTRequiredJustHWformatOfQuizReviewForExam3part2 due 12/31/2014 at 07:10pm CST

REVIEW FOR EXAM III SIMILARITY AND DIAGONALIZATION

Dot Products, Transposes, and Orthogonal Projections

18.06 Professor Johnson Quiz 1 October 3, 2007

Math 1180, Notes, 14 1 C. v 1 v n v 2. C A ; w n. A and w = v i w i : v w = i=1

Linear Algebra, Summer 2011, pt. 3

Practice problems for Exam 3 A =

MATH 167: APPLIED LINEAR ALGEBRA Least-Squares

Lecture 4 Orthonormal vectors and QR factorization

Math 261 Lecture Notes: Sections 6.1, 6.2, 6.3 and 6.4 Orthogonal Sets and Projections

The value of a problem is not so much coming up with the answer as in the ideas and attempted ideas it forces on the would be solver I.N.

Cheat Sheet for MATH461

SUMMARY OF MATH 1600

1 0 1, then use that decomposition to solve the least squares problem. 1 Ax = 2. q 1 = a 1 a 1 = 1. to find the intermediate result:

MATH 31 - ADDITIONAL PRACTICE PROBLEMS FOR FINAL

Maths for Signals and Systems Linear Algebra in Engineering

MATH 310, REVIEW SHEET

Vector Spaces, Orthogonality, and Linear Least Squares

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

4 ORTHOGONALITY ORTHOGONALITY OF THE FOUR SUBSPACES 4.1

Conceptual Questions for Review

Math 407: Linear Optimization

1 GSW Sets of Systems

Least squares problems Linear Algebra with Computer Science Application

Warm-up. True or false? Baby proof. 2. The system of normal equations for A x = y has solutions iff A x = y has solutions

MATH 240 Spring, Chapter 1: Linear Equations and Matrices

Miderm II Solutions To find the inverse we row-reduce the augumented matrix [I A]. In our case, we row reduce

Lecture 6: Finite Fields

MATH 320, WEEK 7: Matrices, Matrix Operations

Math Lecture 26 : The Properties of Determinants

Numerical Methods Lecture 2 Simultaneous Equations

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

IMPORTANT DEFINITIONS AND THEOREMS REFERENCE SHEET

Dot product and linear least squares problems

Linear Least-Squares Data Fitting

Lecture 2: Eigenvalues and their Uses

Mon Feb Matrix algebra and matrix inverses. Announcements: Warm-up Exercise:

Linear Algebra in Derive 6. David Jeffrey, New FACTOR commands in Derive 6

Designing Information Devices and Systems I Fall 2018 Lecture Notes Note 6

Review problems for MA 54, Fall 2004.

MTH 2032 SemesterII

Chapter 4. Solving Systems of Equations. Chapter 4

Glossary of Linear Algebra Terms. Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Math 290-2: Linear Algebra & Multivariable Calculus Northwestern University, Lecture Notes

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 9

c 1 v 1 + c 2 v 2 = 0 c 1 λ 1 v 1 + c 2 λ 1 v 2 = 0

1 Introduction. 2 Determining what the J i blocks look like. December 6, 2006

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

33AH, WINTER 2018: STUDY GUIDE FOR FINAL EXAM

Linear Algebra Highlights

IMPORTANT DEFINITIONS AND THEOREMS REFERENCE SHEET

LINEAR ALGEBRA KNOWLEDGE SURVEY

Math 2B Spring 13 Final Exam Name Write all responses on separate paper. Show your work for credit.

Applied Linear Algebra in Geoscience Using MATLAB

Linear Algebra Primer

Linear least squares problem: Example

Linear Algebra Massoud Malek

( 9x + 3y. y 3y = (λ 9)x 3x + y = λy 9x + 3y = 3λy 9x + (λ 9)x = λ(λ 9)x. (λ 2 10λ)x = 0

18.06SC Final Exam Solutions

1 Last time: least-squares problems

Transcription:

Math 08B Professor: Padraic Bartlett Lecture 4: Applications of Orthogonality: QR Decompositions Week 4 UCSB 204 In our last class, we described the following method for creating orthonormal bases, known as the Gram-Schmidt method: Theorem Suppose that V is a k-dimensional space with a basis B = { b, b k } The following process (called the Gram-Schmidt process) creates an orthonormal basis for V : First, create the following vectors { v, v k }: u = b u 2 = b 2 proj( b 2 onto u ) u 3 = b 3 proj( b 3 onto u ) proj( b 3 onto u 2 ) u 4 = b 4 proj( b 4 onto u ) proj( b 4 onto u 2 ) proj( b 4 onto u 3 ) u k = b k proj( b k onto u ) proj( b k onto u k ) 2 Now, take each of the vectors u i, and rescale them so that they are unit length: ie redefine each u i as the rescaled vector u i u i In this class, I want to talk about a useful application of the Gram-Schmidt method: the QR decomposition! We define this here: The QR decomposition Definition We say that an n n matrix Q is orthogonal if its columns form an orthonormal basis for R n As a side note: we ve studied these matrices before! In class on Friday, we proved that for any such matrix, the relation Q T Q = I held; to see this, we just looked at the (i, j)-th entry of the product Q T Q, which by definition was the i-th row of Q T dotted with the j-th column of A The fact that Q s columns formed an orthonormal basis was enough to tell us that this product must be the identity matrix, as claimed

Definition A QR-decomposition of an n n matrix A is an orthogonal matrix Q and an upper-triangular matrix R, such that A = QR Theorem Every invertible matrix has a QR-decomposition, where R is invertible Proof We prove this using the Gram-Schmidt process! Specifically, consider the following process: take the columns a c, a cn of A Because A is invertible, its columns are linearly independent, and thus form a basis for R n Therefore, running the Gram-Schmidt process on them will create an orthonormal basis for R n! Do this here: ie set u = a c u 2 = a c2 proj( a c2 onto u ) u 3 = a c3 proj( a c3 u 4 = a proj( a u n = a cn proj( a cn onto u ) proj( a c3 onto u 2 ) onto u ) proj( a onto u 2 ) proj( a onto u 3 ) onto u ) proj( a cn onto u n ) Skip the rescaling step for a second columns of A, we get a ci If we take these equations and solve them for the c = u c2 = u 2 + proj( a c2 onto u ) c3 = u 3 + proj( a c3 = u 4 + proj( a cn = u n + proj( a cn onto u ) + proj( a c3 onto u 2 ) onto u ) + proj( a onto u 2 ) + proj( a onto u 3 ) onto u ) + + proj( a cn onto u n ) Now, notice that all of the proj( a ci onto u j )-terms are actually, by defintion, just multiples of the vector u j To make this more obvious, we could replace each of these terms with what a ci u j they are precisely defined to be, ie u u 2 j However, that takes up a lot of space! Instead, for shorthand s sake, denote the constant ac i u j u as p 2 ci,j Then, we have the following: c = u A matrix is called upper-triangular if all of its entries below the main diagonal are 0 For example, 2 3 0 3 2 is upper-triangular 0 0 2

c2 = u 2 + p c2, u c3 = u 3 + p c3, u + p c3,2 u 2 = u 4 + p, u + p,2 u 2 + p,3 u 3 cn = u n + p c2, u + + p c2,n u n If we do this, then it is not too hard to see that we actually have the following identity: p c2, p c3, p cn, 0 p c3,2 p cn,2 u u 2 u 3 u n 0 0 p cn,3 0 0 0 ( = u ( u 2 + p c2, u ) ( u 3 + p c3,2 u 2 + p c3, u ) u n + ) n i= p c n,i u i = A In other words, we have a QR-decomposition! Well, almost The left-hand matrix s rows form an orthogonal basis for R n, but they are not yet all length To fix this, simply scale the left matrix s columns so that they re all length, and then increase the scaling on the right-hand matrix s rows so that it cancels out: ie u p c2, u p c3, u p cn, u u u 2 u 3 u u u 2 u 3 n 0 u 2 p c3,2 u 2 p cn,2 u 2 u n 0 0 u 3 p cn,3 u 3 0 0 0 u n ( = u ( u 2 + p c2, u ) ( u 3 + p c3,2 u 2 + p c3, u ) u n + ) n i= p c n,i u i = A A QR-decomposition! 3

As a side note, it bears mentioning that this result holds even if the matrix is not invertible: Theorem Every matrix has a QR-decomposition, though R may not always be invertible The proof is pretty much exactly the same as above, except you have to be careful when dealing with the u i s, as you might be dividing by zero in the situations where A s columns were linearly dependent On your own, try to think about what you d need to change in the above proof to make it work for a general matrix! Instead, I want to focus on why this decomposition is nice: solving systems of linear equations! 2 Applications of QR decompositions: Solving Systems of Linear Equations Suppose you have an invertible matrix A and vector b Consider the task of a vector v such that A v = b; in other words, solving the system of n linear equations a ri v = b i, i = n This is typically a doable if slightly tedious task, via Gaussian elimination (ie pivoting on entries in A) However it takes time, and (from the perspective of implementing on a computer) can be fairly sensitive to small changes or errors: ie if you re pivoting on an entry in A that is nearly zero, it is easy for small rounding errors in a computer program to suddenly cause very big changes in what the entries in your matrix should be! However, suppose that we have a QR decomposition for A: ie we can write A = QR, for some upper-triangular R and orthogonal Q Then, solving is the same task as solving QR v = b Q T QR v = R v = Q T b; and this is suddenly much easier! In particular, because R is upper-triangular, R v is just r, v + r,2 v 2 + r,3 v 3 + + r,n v n r 2,2 v 2 + r 2,3 v 3 + + r 2,n v n r n,n v n + r n,n v n r n,n v n And finding values of this to set equal to some fixed vector Q T b is really easy! In particular, the last coordinate of R v just has one variable v n, so it s easy to solve for that variable From here, the second coordinate of R v has just two variables, v n, v n, one of which we 4

know now! So it s equally easy to solve for v n Working our way up, we have the same situation for each variable: we never have to do any work to solve for the variables v i! To illustrate this, we work an example: Example Consider the matrix 2 3 3 A = 2 2 3 3 2 First, find its QR decomposition Then, use that QR decomposition to find a vector A such that A v = 2 0 Answer We start by performing Gram-Schmidt on the columns of A: u = a c = (2, 2, 2, 2) u 2 = a c2 proj( a c2 onto u ) = (,,, ) = (,,, ) 0 = (,,, ) u 3 = a c3 proj( a c3 = (3,, 3, ) (,,, ) (2, 2, 2, 2) (2, 2, 2, 2) (2, 2, 2, 2) (2, 2, 2, 2) onto u ) proj( a c3 onto u 2 ) = (3,, 3, ) 8 (2, 2, 2, 2) 0 6 = (2, 2, 2, 2) u 4 = a proj( a (3,, 3, ) (2, 2, 2, 2) (3,, 3, ) (,,, ) (2, 2, 2, 2) (,,, ) (2, 2, 2, 2) (2, 2, 2, 2) (,,, ) (,,, ) onto u ) proj( a onto u 2 ) proj( a onto u 3 ) (3,, 3, ) (2, 2, 2, 2) (3,, 3, ) (,,, ) = (3,, 3, ) (2, 2, 2, 2) (,,, ) (2, 2, 2, 2) (2, 2, 2, 2) (,,, ) (,,, ) (3,, 3, ) (2, 2, 2, 2) (2, 2, 2, 2) (2, 2, 2, 2) (2, 2, 2, 2) = (3,, 3, ) 0 8 (,,, ) 0 4 = (,,, ) Using these four vectors, we construct a QR-decomposition as described earlier Notice that we ve already calculated the ac i u j u u 2 j = p ci,j s above, and so we don t need to repeat our 5

work here: u p c2, u p c3, u p, u u u 2 u 3 u 4 u u u u 4 0 u 2 p c3,2 u 2 p,2 u 2 0 0 u 3 p,3 u 3 0 0 0 u 4 4 0 2 0 = 2 0 2 0 4 0 0 4 0 0 0 0 2 From here, to solve the equation A v = (, 2, 0, ), we can use our QR-decomposition to write QR v = (, 2, 0, ), or equivalently R v = Q T (, 2, 0, ) We find the right-hand-side here: 2 T 2 0 = 2 2 0 = So: we have the simple problem of finding v = (v, v 2, v 3, v 4 ) such that 4 0 2 0 v 0 2 0 4 0 0 4 0 v 2 v 3 = 0 0 0 2 v 4 Ordering from bottom to top, this problem is just the task of solving the four linear equations 2v 4 = 0 4v 3 = 2v 2 + 4v 4 = 4v + 2v 3 = 2 2 0 2 0 If we solve from the top down, this is trivial: we get v 4 = 0, v 3 = /4, v 2 = /2, and v = 5 8 Thus, we ve found a solution to our system of linear equations, and we re done! 6