Linear Algebra, part 3 QR and SVD

Similar documents
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

UNIT 6: The singular value decomposition.

Singular Value Decomposition

Notes on Eigenvalues, Singular Values and QR

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

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

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Review problems for MA 54, Fall 2004.

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

Applied Linear Algebra in Geoscience Using MATLAB

Linear Algebra, part 2 Eigenvalues, eigenvectors and least squares solutions

Matrix decompositions

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

I. Multiple Choice Questions (Answer any eight)

Linear Algebra in Actuarial Science: Slides to the lecture

Linear Algebra Primer

A Review of Linear Algebra

The Singular Value Decomposition

(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 =

Vector and Matrix Norms. Vector and Matrix Norms

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

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

COMP 558 lecture 18 Nov. 15, 2010

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

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

Conceptual Questions for Review

7. Symmetric Matrices and Quadratic Forms

The Singular Value Decomposition and Least Squares Problems

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 9

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

Numerical Methods I Singular Value Decomposition

Singular Value Decomposition (SVD)

18.06 Problem Set 10 - Solutions Due Thursday, 29 November 2007 at 4 pm in

The Singular Value Decomposition (SVD) and Principal Component Analysis (PCA)

Maths for Signals and Systems Linear Algebra in Engineering

Lecture notes: Applied linear algebra Part 1. Version 2

Singular Value Decomposition

Example Linear Algebra Competency Test

Singular Value Decomposition

Practical Linear Algebra: A Geometry Toolbox

Notes on Solving Linear Least-Squares Problems

Math 224, Fall 2007 Exam 3 Thursday, December 6, 2007

Linear Least Squares. Using SVD Decomposition.

Singular value decomposition

5.6. PSEUDOINVERSES 101. A H w.

Stability of the Gram-Schmidt process

The Singular Value Decomposition

Stat 159/259: Linear Algebra Notes

Linear Analysis Lecture 16

Linear Algebra Review. Fei-Fei Li

Lecture 6, Sci. Comp. for DPhil Students

Computational Methods. Eigenvalues and Singular Values

Computational Linear Algebra

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

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

Dimensionality Reduction: PCA. Nicholas Ruozzi University of Texas at Dallas

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

linearly indepedent eigenvectors as the multiplicity of the root, but in general there may be no more than one. For further discussion, assume matrice

The SVD-Fundamental Theorem of Linear Algebra

22m:033 Notes: 7.1 Diagonalization of Symmetric Matrices

Linear Algebra Review. Fei-Fei Li

MAT Linear Algebra Collection of sample exams

Linear Algebra Review. Vectors

MATH 304 Linear Algebra Lecture 34: Review for Test 2.

1 Cricket chirps: an example

The QR Factorization

Lecture 3: QR-Factorization

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

Math 407: Linear Optimization

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

Singular Value Decomposition

Index. book 2009/5/27 page 121. (Page numbers set in bold type indicate the definition of an entry.)

MATH 1553, Intro to Linear Algebra FINAL EXAM STUDY GUIDE

Final Exam, Linear Algebra, Fall, 2003, W. Stephen Wilson

Problem Set (T) If A is an m n matrix, B is an n p matrix and D is a p s matrix, then show

Singular Value Decompsition

Matrix decompositions

Pseudoinverse & Moore-Penrose Conditions

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

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

Lecture 6. Numerical methods. Approximation of functions

1 Linearity and Linear Systems

Least Squares. Tom Lyche. October 26, Centre of Mathematics for Applications, Department of Informatics, University of Oslo

Linear Algebra Review

Notes on singular value decomposition for Math 54. Recall that if A is a symmetric n n matrix, then A has real eigenvalues A = P DP 1 A = P DP T.

MATH 612 Computational methods for equation solving and function minimization Week # 2

Linear Algebra- Final Exam Review

1 Inner Product and Orthogonality

Algebra C Numerical Linear Algebra Sample Exam Problems

Chapter 7: Symmetric Matrices and Quadratic Forms

ANSWERS. E k E 2 E 1 A = B

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

lecture 2 and 3: algorithms for linear algebra

1 Last time: least-squares problems

The QR Decomposition

1. Select the unique answer (choice) for each problem. Write only the answer.

Designing Information Devices and Systems II

There are six more problems on the next two pages

LINEAR ALGEBRA SUMMARY SHEET.

Solutions to Review Problems for Chapter 6 ( ), 7.1

Transcription:

Linear Algebra, part 3 QR and SVD Anna-Karin Tornberg Mathematical Models, Analysis and Simulation Fall semester, 2012 Going back to least squares (Section 1.4 from Strang, now also see section 5.2). We know from before: The vector x that minimizes Ax b 2 is the solution to the normal equations A T Ax = A T b. This vector x =(A T A) 1 A T b is the least squares solution to Ax = b. The error e = b Ax = b p. The projection p is the closest point to b in the column space of A. The error is orthogonal to the column space of A, i.e. orthogonal to each column of A. a T 1 Let A = a 1 a n, then A T e e =. = 0. a T n e (eacha i and e is m 1).

Least squares solutions - how to compute them? Form the matrix K = A T A. Solve Kx = b using e.g. LU decomposition. Another idea: Obtain an orthogonal basis for A by e.g. the Gram-Schmidt orthogonalization. First: What if the columnvectors of A were orthogonal, what good would it do? [WORKSHEET] Gram-Schmidt orthogonalization Assume all n columns of A are linearly independent (A is m n). An orthogonal basis for A can be found by e.g. Gram-Schmidt orthogonalization. Here is the algorithm: r 11 = a 1, q 1 = a 1 /r 11 for k=2,3,...,n for j=2,3,...,k-1 r jk = a T k q j =< a T k, q j > end k 1 q k = a k r jk q j r kk = q k j=1 inner product q k = q k r kk end q 1, q 2,...,q n are now orthogonal. How does this algorithm work? [NOTES] (1)

QR factorization Given an m n matrix A, m n. - Assume that all columns a i i =1,...,n are linearly independent. (Matrix is of rank n). - Then the orthogonalization procedure produces a factorization A = QR, with Q = q 1 q n, and R upper triangular and r jk and r kk as given by the Gram-Schmidt algorithm. - Q is m n, columns of Q are orthogonal. - R is n n, R is non-singular. (Upperdiagonal and diagonal entries norm of non-zero vectors). QUESTION: What do the normal equations become? FULL QR factorization Given an m n matrix A, m > n. - Matlab s QR command produces a FULL QR factorization. - It appends an additional m n orthogonal columns to Q such that it becomes an m m unitary matrix. - Rows of zeros are appended to R so that it becomes a m n matrix, still upper triangular. - The command QR(A,0) yields what they call the economy size decomposition, without this extension.

The Householder algorithm - The Householder algorithm is an alternative to Gram-Schmidt for computing the QR decomposition. - Process of orthogonal triangularization, making a matrix triangular by a sequence of unitary matrix operations. - Read in Strang, section 5.2. Singular Value Decomposition - Eigenvalue decomposition (A is n n): A = SΛS 1. Not all square matrices are diagonalizable. Need a full set of linearly independent eigenvectors. Singular Value Decomposition: A m n = U m n Σ n n V T n n. where U and V are matrices with orthonormal columns and Σ is a diagonal matrix with the singular values (σ i ) of A on the diagonal. - ALL matrices have a singular value decomposition.

Singular Values and Singular Vectors Definition: A non-negative real number σ is a singular value for A (m n) if and only if there exist unit length vectors u R m and v R n such that Av = σu and A T u = σv. The vectors u and v are called the left singular and right singular vectors for A, respectively. We can find n such u vectors, and n such v vectors, such that - {u 1,...,u n } forms a basis for the column space of A. - {v 1,...,v n } forms a basis for the row space of A. These vectors are the columns of the matrices U and V, respectivelyin A m n = U m n Σ n n V T n n. Singular Values and Singular Vectors, contd. - The singular values of A: square root of eigenvalues of A T A. - The column vectors of V are the orthonormal eigenvectors of A T A. A T A is symmetric and hence diagonalizable, has a full set of eigenvectors, and V is an n n orthogonal matrix. - Assume that the columns of A are linearly independent, then all singular values are positive. (A T A is SPD, all eigenvalues strictly positive). QUESTION: How to solve the least squares problem, ones we know the SVD?

SVD, columns of A linearly dependent - A and A T A have the same null space, the same row space and the same rank. - Now let, A be m n, m n. Assumethatrank(A) =r < n. Then it follows: - A T A no longer positive definite, but at least definite: x T A T Ax 0 x. - All eigenvalues of A T A are non negative, λ i 0. - A T A symmetric, i.e. diagonalizable. Rank of A T A and hence of A, number of strictly positive eigenvalues. - σ i = λ i.therankr of A is the number of strictly positive singular values of A. Reduced and full SVD - Number the u i, v i and σ i such that σ 1 σ 2... σ r > 0. - The orthonormal eigenvectors of A T A are in V. - AV = UΣ. Defineu i = Av i /σ i, i =1,...,r. - Reduced SVD: A = U m r Σ r r V T r n. - To complete the v s add any orthonormal basis v r+1,...,v n for the nullspace of A. - To complete the u s add any orthonormal basis u r+1,...,u m for the nullspace of A T. - Full SVD: A = U m m Σ m n V T n n. Pseudoinverse: A + = VΣ + U T,whereΣ + has 1/σ 1,...,1/σ r on its diagonal, and zeros elsewhere. Solution to least squares problem: x = A + b = VΣ + U T b.

QR for rank deficient matrices - The QR algorithm can also be adapted to the case when columns of A are linearly dependent. - Gram-Schmidt algorithm combined with column reordering to choose the largest remaining column at each step. - Permutation matrix P. AP = QR. - R: Lastn r rows zero, where r is rank of A. (Or for full QR: m r last rows zero). Condition number - Condition number of matrix measures the sensitivity of the linear system Ax = b. - Perturb rhs by b. What change x does it give? What relative change x/x? - Condition number of A defined as c(a) =AA 1. - Computer algorithms for solving the linear system looses about log c decimals to round off error. If large condition number, render inaccurate solution. - A T A might have a very large condition number. Working with LU factorization (or Cholesky) on the normal equations is then not a good algorithm. - The QR-algorithm is better conditioned. Standard method for least squares problems. - If matrix close to rank-deficient, the algorithm based on the SVD is however more stable.

Operation count - So far, have focused on how algorithms computes the desired solution. - Speed is important! (Think huge systems with thousands to millions of unknowns). - Operation count: Counting how many elementary operations must be done given parameters of matrix size. - Asymptotic cost for: i) Matrix vector multiply: 2nm. ii) LU decomposition: 2/3n 3. iii) Backsolve: 2n 2 iii) Total solution of linear n n system: 2/3n 3 +2n 2. - Asymptotic cost for least squares solution for m n matrix A: i) Normal equations (Cholesky): mn 2 + n 3 /3 ii) QR algorithm with Gram-Schmidt: 2mn 2. iii) SVD algorithm: 2mn 2 +11n 3. Depends on details: Changing Gram-Schmidt to Householder, different SVD algorithm etc. Useful property of the SVD - We can write (assuming σ r+1 =...= σ n = 0): A = σ 1 u 1 v T 1 + σ 1u 2 v T 2 + + σ r u r v T r. - Can remove the terms with small singular values and still have a good approximation of A. Low rank approximation. - If a low rank approximation of a matrix is found: takes less space to store the matrix, less time to compute a matrix vector multiply etc. - Randomized ways to find low rank approximations of matrices without actually computing the SVD, active research area (cheaper than doing the SVD). - Used also for image compression. See HW1.