Numerical Methods - Numerical Linear Algebra

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

Chapter 7 Iterative Techniques in Matrix Algebra

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

Numerical Methods in Matrix Computations

Algebra C Numerical Linear Algebra Sample Exam Problems

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

Solving Linear Systems of Equations

Direct Methods for Solving Linear Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le

Eigenvalue Problems. Eigenvalue problems occur in many areas of science and engineering, such as structural analysis

G1110 & 852G1 Numerical Linear Algebra

Scientific Computing: An Introductory Survey

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Computational Methods. Systems of Linear Equations

Iterative techniques in matrix algebra

Linear Algebra in Actuarial Science: Slides to the lecture

DEN: Linear algebra numerical view (GEM: Gauss elimination method for reducing a full rank matrix to upper-triangular

Computational Linear Algebra

The Solution of Linear Systems AX = B

Numerical Linear Algebra

Review of matrices. Let m, n IN. A rectangle of numbers written like A =

Applied Linear Algebra

Lecture 3: QR-Factorization

Lecture Note 7: Iterative methods for solving linear systems. Xiaoqun Zhang Shanghai Jiao Tong University

1 Number Systems and Errors 1

Numerical Linear Algebra And Its Applications

EECS 275 Matrix Computation

Introduction to Mathematical Programming

Next topics: Solving systems of linear equations

Direct Methods for Solving Linear Systems. Matrix Factorization

HOMEWORK PROBLEMS FROM STRANG S LINEAR ALGEBRA AND ITS APPLICATIONS (4TH EDITION)

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

lecture 2 and 3: algorithms for linear algebra

Numerical Methods I Eigenvalue Problems

Practical Linear Algebra: A Geometry Toolbox

Solution of Linear Equations

Matrices, Moments and Quadrature, cont d

Chapter 2. Solving Systems of Equations. 2.1 Gaussian elimination

Math Introduction to Numerical Analysis - Class Notes. Fernando Guevara Vasquez. Version Date: January 17, 2012.

Eigenvalues and eigenvectors

Math 471 (Numerical methods) Chapter 3 (second half). System of equations

Iterative methods for Linear System

Lecture 4 Eigenvalue problems

Matrix decompositions

Lecture 18 Classical Iterative Methods

lecture 3 and 4: algorithms for linear algebra

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Scientific Computing

Department of Mathematics California State University, Los Angeles Master s Degree Comprehensive Examination in. NUMERICAL ANALYSIS Spring 2015

Introduction to Applied Linear Algebra with MATLAB

Matrix Factorization and Analysis

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Jordan Journal of Mathematics and Statistics (JJMS) 5(3), 2012, pp A NEW ITERATIVE METHOD FOR SOLVING LINEAR SYSTEMS OF EQUATIONS

Cheat Sheet for MATH461

Linear Algebra Primer

AMS526: Numerical Analysis I (Numerical Linear Algebra)

EIGENVALUE PROBLEMS. Background on eigenvalues/ eigenvectors / decompositions. Perturbation analysis, condition numbers..

Eigenvalues and Eigenvectors

Math/Phys/Engr 428, Math 529/Phys 528 Numerical Methods - Summer Homework 3 Due: Tuesday, July 3, 2018

Linear Algebra: Matrix Eigenvalue Problems

5.6. PSEUDOINVERSES 101. A H w.

CAAM 454/554: Stationary Iterative Methods

Eigenvalue and Eigenvector Problems

Applied Linear Algebra

LU Factorization. LU factorization is the most common way of solving linear systems! Ax = b LUx = b

6.4 Krylov Subspaces and Conjugate Gradients

Parallel Numerics, WT 2016/ Iterative Methods for Sparse Linear Systems of Equations. page 1 of 1

Index. for generalized eigenvalue problem, butterfly form, 211

Foundations of Matrix Analysis

MAA507, Power method, QR-method and sparse matrix representation.

Math 405: Numerical Methods for Differential Equations 2016 W1 Topics 10: Matrix Eigenvalues and the Symmetric QR Algorithm

MAT 610: Numerical Linear Algebra. James V. Lambers

Gaussian Elimination without/with Pivoting and Cholesky Decomposition

LINEAR SYSTEMS (11) Intensive Computation

Last Time. Social Network Graphs Betweenness. Graph Laplacian. Girvan-Newman Algorithm. Spectral Bisection

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

Today s class. Linear Algebraic Equations LU Decomposition. Numerical Methods, Fall 2011 Lecture 8. Prof. Jinbo Bi CSE, UConn

Here is an example of a block diagonal matrix with Jordan Blocks on the diagonal: J

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

Math 411 Preliminaries

EIGENVALUE PROBLEMS. EIGENVALUE PROBLEMS p. 1/4

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Numerical Methods I Solving Square Linear Systems: GEM and LU factorization

Numerical Linear Algebra

Program Lecture 2. Numerical Linear Algebra. Gaussian elimination (2) Gaussian elimination. Decompositions, numerical aspects

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

LINEAR ALGEBRA BOOT CAMP WEEK 4: THE SPECTRAL THEOREM

Linear Algebra. Brigitte Bidégaray-Fesquet. MSIAM, September Univ. Grenoble Alpes, Laboratoire Jean Kuntzmann, Grenoble.

LINEAR ALGEBRA SUMMARY SHEET.

5 Selected Topics in Numerical Linear Algebra

SOLVING SPARSE LINEAR SYSTEMS OF EQUATIONS. Chao Yang Computational Research Division Lawrence Berkeley National Laboratory Berkeley, CA, USA

Stabilization and Acceleration of Algebraic Multigrid Method

Introduction to PDEs and Numerical Methods Lecture 7. Solving linear systems

CPE 310: Numerical Analysis for Engineers

Applied Mathematics 205. Unit V: Eigenvalue Problems. Lecturer: Dr. David Knezevic

4.6 Iterative Solvers for Linear Systems

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 13

MATHEMATICS FOR COMPUTER VISION WEEK 2 LINEAR SYSTEMS. Dr Fabio Cuzzolin MSc in Computer Vision Oxford Brookes University Year

Solving Linear Systems of Equations

Process Model Formulation and Solution, 3E4

arxiv: v1 [math.na] 5 May 2011

Transcription:

Numerical Methods - Numerical Linear Algebra Y. K. Goh Universiti Tunku Abdul Rahman 2013 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 1 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 2 / 62

Problem setting Two major problems: 1 Solving linear system Ax = b Direct methods (preferred method) Gaussian Elimination, matrix factorisation Iterative methods (normally for sparse matrix) - Jacobi, Gauss-Seidel Jacobi, Gauss-Seidel 2 Eigenvalue problem Av = λv Deflation methods Similarity transform methods Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 3 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 4 / 62

Engineering Example: Kirchhoff s Law Example The currents at different parts of an electrical network with many resistances and a battery can be studied with Kirchhoff s Law. Usually, the results of Kirchhoff s Law are several linear equations. Let denotes x 1, x 2, x 3 and x 4 are currents at different loops, then the equations are 15x 1 2x 2 6x 3 = 300 2x 1 + 12x 2 4x 3 x 4 = 0 6x 1 4x 2 + 19x 3 + 9x 4 = 0 x 2 9x 3 + 21x 4 = 0 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 5 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 6 / 62

Naive Gaussian Elimination Normally the linear system is written as augmented matrix [A b]. Naive Gaussian Elimination is a two step process: systematically applying row operations to get echelon form a 11 a 12 a 13 b 1 b b a 21 a 22 a 23 b 2 0 b 0 b a 31 a 32 a 33 0 b 0 0 b b 3 backward substitution to obtain x. x 3 = b 3 /a 33 x 2 = (b 2 a 23 x 3 )/a 22 x 1 = (b 1 a 13 x 3 a 12 x 2 )/a 11 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 7 / 62

Naive Gaussian Elimination Algorithm Example In the previous circuit example, we get the matrix equation: 15 02 06 0 300 2 12 4 1 0 6 4 19 9 0 0 1 9 21 0 Answer: [MATLAB code: nm03_naive_gaussian.m] systematically applying row operations to get echelon form 15 2 6 0 300 15 2 6 0 300 2 12 4 1 0 6 4 19 9 0 0 11.73 4 1 40 0 0 14.64 9 136.36 0 1 9 21 0 0 0 0 26.43 91.07 backward substitution x 4 = 3.44, x 3 = 7.29, x 2 = 6.69 and x 1 = 23.91. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 8 / 62

Caveat In the followings, we assume that all systems that we are dealing are having solutions. We exclude the cases where the systems are inconsistent or having infinite solutions. Consider the following two systems Example x 1 + x 2 + x 3 = 4 x 1 + x 2 + x 3 = 4 2x 1 + 2x 2 + x 3 = 4 2x 1 + 2x 2 + x 3 = 6 x 1 + x 2 + 2x 3 = 6 x 1 + x 2 + 2x 3 = 6 inconsistent infinite solutions when their row-reduced matrices 1 1 1 4 7 2 2 1 4 6 1 1 1 4 7 0 0 1 4 2 1 1 2 6 6 0 0 1 2 2 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 9 / 62

Naive Gaussian Elimination can fail in certain cases Example (Zero pivot element) 0x 1 + x 2 = 1 x 1 + x 2 = 2 Remedy: pivoting / swapping rows. Example (Ill-conditioned) when ɛ is small, solutions ɛx 1 + x 2 = 1 x 1 + x 2 = 2 x 2 = 2 ɛ 1 1 ɛ 1 1, x 1 = ɛ 1 (1 x 2 ) 0 becomes unreliable. Remedy: Pivoting. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 10 / 62

Partial Pivoting Partial Pivoting - exchange pivot row with the row with maximum leading element. Apply the partial pivoting when the pivoting element is zero or smaller than the leading element in the candidate row. Example Swap the equations in the previous slide: x 1 + x 2 = 2 ɛx 1 + x 2 = 1 Answer: [ 1 1 2 ] 0 1 ɛ 1 2ɛ = x 2 = 1 2ɛ 1 ɛ 1, x 1 = 1 + ɛ 1 ɛ 1. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 11 / 62

Scaled Partial Pivoting It is used when the leading element in the pivoting row is much smaller than other element in the same row. 1 Define a scale factor s i = max 1 j n a ij. 2 Exchange pivoting row with row p where a p1 s p a k1 = max. 1 k n s k Example (4-digit floating-point arithmetic) 30.00x 1 + 591400x 2 = 591700 5.291x 1 + 6.130x 2 = 46.78 will gives the wrong answer x 2 = 1.001 and x 1 = 10.00 in a 4-digit floating-point operations. However, with scaled partial pivoting, a 11 /s 1 = 0.5073 10 4 and a 21 /s 2 = 0.8631, we should swap the two row. The answer after the pivoting gives more accurate x 2 = 1.001 and x 1 = 10.00. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 12 / 62

Operations count for Gaussian Elimination The number of arithmetic operations involve in Gaussian Elimination depends on the size n n of the matrix considered. +/ operations always take less time to perform compared to /. Consider the( elimination ) step for row-i, that requires to perform a ij a ij aik a kk a kj for (n i) rows. 0 0 0 0 0 0 0 0...... 0 0 0 For each of the (n i) rows, need (n i) operations for a ik /a kk = m ik. need (n i)(n i + 1) / operations for a ij m ik a kj. need (n i)(n i + 1) +/ operations for a ij m ik a kj. thus, total +/ ops = (n i)(n0i + 1), total / ops = (n i)(n i + 2). Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 13 / 62

Operations count for Gaussian Elimination (Cont.) Repeating for all rows, then in the elimination stage: n 1 Total +/ ops is: (n i)(n i + 1) = n3 n O(n 3 ). 3 i=1 n 1 Total / ops is: (n i)(n i + 2) = 1 6 (2n3 + 3n 2 5n) O(n 3 ). i=1 As for the backward substitution stage: n 1 Total +/ ops is: 1 + (n i + 1) = n2 n 2 i=1 n 1 Total / ops is: i=1 (n i 1 + 1) = n2 + n 2 Total operations count for Gaussian Elimination: n 3 Total +/ ops is: 3 + n2 2 5n 6. Total / ops is: n 3 3 + n2 n 3. O(n 2 ). O(n 2 ). Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 14 / 62

Operations count for Gaussian Elimination (Cont.) n +/ / 3 17 11 10 375 430 50 42,875 44,150 100 338,250 343,300 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 15 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 16 / 62

Matrix Factorisation (motivation) From the previous slide, we know that in Gaussian Elimination: operations count for elimination stage O(n 3 ). operations count for substitution stage O(n 2 ). Suppose the matrix A can be factorised into two triangular form A = LU hen we could solve the Ax = b by just substitution. The idea: 1 Write A = LU, thus Ax = LUx = b. 2 Define y = Ux, now Ax = b are into two equations Ly = b and Ux = y. 3 Since both L and U are triangular, both equation could be solved by substitution operations. Since substitution has the op count O(n 2 ), it is expected to speed up the process of solving Ax = b. n n 3 /3 2n 2 % reduction 10 3. 3 10 2 2 10 2 40 100 3. 3 10 5 2 10 4 94 1000 3. 3 10 8 2 10 6 99.4 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 17 / 62

Matrix Factorisation (motivation) However, matrix factorisation method will not have much advantage over naive Gaussian Elimination for one value of b. This is because of the process required for factorising A into LU requires O(n 3 /3) op count. However, the factorisation method will be preferred if we are solving Ax = b i for different values of b i, as one only need to factorise A once and the same L and U could be applied to the different values of b i repeatedly. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 18 / 62

LU-Factorisation Let A be a 3 3 matrix and we would like to factorise into LU. Let M 1 and M 2 be the transformation matrices that perform the elimination operations: a 11 a 12 a 13 a 11 a 12 a 13 a 11 a 12 a 13 a 21 a 22 a 23 0 a 22 a 23 0 a 22 a 23 a 31 a 32 a 33 0 a 32 a 33 0 0 a 33 A M 1 A M 2 M 1 A 1 0 0 1 0 0 Note that, M 1 = m 21 1 0 and M 2 = 0 1 0 where m 31 0 1 0 m 32 1 m ij = aij a jj. Now, M 2 M 1 A = U, then A = M 1 1 M 1 2 U. 1 0 0 i.e. L = M 1 1 M 1 2 = L = m 21 1 0. m 31 m 32 1 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 19 / 62

LU Factorisation (example) Example Factorise A into LU and solve for Ax = b, where b = [1, 1, 3, 4] T. 1 1 0 3 A = 2 1 1 1 3 1 1 2 1 2 3 1 ANSWER: 1 0 0 0 1 1 0 3 1 0.30769 A = 2 1 0 0 0 1 1 5 3 4 1 0 0 0 3 13, y = 1 2, x = 1.76923 0 1 3 0 1 0 0 0 13 2 0.15385 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 20 / 62

P T LU-Factorisation LU-factorisation only work if A can be reduced by Gaussian Elimination without pivoting. If partial pivoting is required for controlling the round-off error, then we need to have extra permutation matrix P to carry out the row exchange. Thus, for Ax = b requires pivoting, we multiply P on both side: PAx = Pb. Then, factorise PA, ie. PA = P 1 LU. Since P is symmetric, P 1 = P T, thus A = P T LU. Example Find the permutation matrix P for exchanging row 1 and row 2, then factorise the matrix A. ANSWER: 0 1 0 0 2 3 = 1 1 1 = 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 0 2 3 0 1 1 0 1 0 0 0.5 1 0 2 3 0 0 2.5 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 21 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 22 / 62

Special Matrices Definition (Diagonally Dominant Matrix) A n n matrix A is said to be diagonally dominant when holds for each of i = 1, 2,..., n. a ii i=1 j i a ij Definition (Strictly Diagonally Dominant Matrix) A matrix A is strictly diagonally dominant matrix if for all i = 1, 2,..., n. a ii > i=1 j i a ij Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 23 / 62

Special Matrices (Cont.) Theorem A strictly diagonally dominant matrix A is nonsingular. Moreover, Gaussian Elimination can be performed on a strictly diagonally dominant matrix without row interchange. Example 15 2 6 0 2 12 4 1 6 4 19 9 is diagonally dominant, but not strictly diagonally 0 1 9 21 dominant. 15 2 6 0 2 12 4 1 6 4 19 7 is strictly diagonally dominant, and determinant is 0 1 9 21 non-zero. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 24 / 62

Positive Definite Matrix Definition (Positive Definite Matrix) A matrix A is (strictly) positive definite if it is symmetric and if x T Ax > 0 for every non-zero n-dimensional vector x. Definition (Leading Principal Submatrix) A leading principal submatrix of a n n matrix A is a matrix of form a 11 a 12... a 1k a 21 a 22... a 2k...... a k1 a k2... a kk for some 1 k n. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 25 / 62

Positive Definite Matrix (Cont.) Theorem A symmetric matrix A is positive definite if and only if each of its leading principal submatrices have positive determinants. Example A = 2 1 0 1 2 1 is positive definite since 0 1 2 A 1 = [2] and det(a 1 ) = 2 > 0 [ ] 2 1 A 2 = and det(a 1 2 2 ) = 3 > 0 A 3 = A and det(a 3 ) = 4 > 0 since the determinant for all leading principal submatrices is positive, thus A is positive definite. Check, x T Ax = x 2 1 + (x 1 + x 2 ) 2 + (x 2 x 3 ) 2 + x 2 3 0. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 26 / 62

LDL T and LL T Factorisations Theorem A matrix A is positive definite if and only if Gaussian Elimination without row interchange can be performed on the corresponding linear system Ax = b with all pivot elements positive. Corollary If A is symmetric and strictly diagonally dominant, then A can be factorised into the form of LDL T. Corollary (Cholesky Factorisation) If A is positive definite if and only if A can be factorised into the form LL T. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 27 / 62

LDL T and LL T Factorisations Example (LDL T Factorisation) 4 3 2 1 0 0 d 1 0 0 1 l 21 l 31 A = 3 3 2 = l 21 1 0 0 d 2 0 0 1 l 32 = 2 2 2 l 31 l 32 1 0 0 d 3 0 0 1 d 1 d 1 l 21 d 1 l 31 d 1 l 21 d 2 + d 1 l21 2 d 2 l 32 + d 1 l 21 l 31 d 1 l 31 d 1 l 21 l 31 + d 2 l 32 d 1 l31 2 + d 2 l32 2 + d 3 Example ( LL T Factorisation) 4 3 2 l 11 0 0 l 11 l 21 l 31 A = 3 3 2 = l 21 l 22 0 0 l 22 l 32 = 2 2 2 l 31 l 32 l 33 0 0 l 33 l11 2 l 11 l 21 l 11 l 31 l 11 l 21 l21 2 + l22 2 l 21 l 31 + l 22 l 32 l 11 l 31 l 21 l 31 + l 22 l 32 l31 2 + l32 2 + l33 2 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 28 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 29 / 62

Iterative Methods Stationary Methods Jacobi method Gauss-Seidel method Successive over-relaxation (SOR) method Krylov subspace methods The idea Conjugate gradient Generalized minimal residual Like fixed-point iteration, setup the recurrence relation Qx (k+1) = (Q A)x (k) + b, initial value x (0) and generates {x (k) } k=1 such that x (k) converges to the solution x for Ax = b. The can be different choices for Q depending on the ease to solve or iteration ensure convergence and rate of convergence Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 30 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 31 / 62

Jacobi Method Choose Q as the diagonal of A. Let A = D L U = Dx (k+1) = (L + U)x (k) + b The iterative scheme: x (k+1) = D 1 (L + U)x (k) + D 1 b or x (k+1) i = n (aij/a ii)x (k) j + (b i /a ii ), 1 i n The iterations will converge if A is strictly diagonally dominant. Example A = 2 1 0 1 3 1 and b = 1 8 0 1 2 5 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 32 / 62

Gauss-Seidel Method Choose Q as the lower triangular of A. Let A = D + L U = (D + L)x (k+1) = Ux (k) + b The iterative scheme: x (k+1) = (D + L) 1 Ux (k) + (D + L) 1 b or x (k+1) i = n (aij/a ii)x (k+1) j n (aij/a ii)x (k) j + (b i /a ii ), 1 i n Example 2 1 0 1 A = 1 3 1 and b = 8 0 1 2 5 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 33 / 62

Successive Over-relaxation (SOR) Method Choose Q = 1 ω (D ωl) where A = D L U and ω is a parameter. The iterative scheme: x (k+1) = Q 1 (Q A)x (k) + Q 1 b The parameter ω needs to choose in between 0 < ω < 2 to ensure convergence. Example 2 1 0 1 A = 1 3 1, b = 8 and ω = 1.1. 0 1 2 5 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 34 / 62

Convergence Theorem Definition (Spectral Radius) The spectral radius ρ(k) of a matrix K is the magnitude of the maximum eigenvalues ρ(k) = max 1 i n λ i. Theorem (Spectral Radius Theorem) In order that the sequence generated by x (k+1) = Kx (k) + c to converge, regardless of initial point x (0), the necessary and sufficient condition is that all eigenvalues of K lie in the open unit disc z < 1 or the spectral radius ρ(k) < 1. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 35 / 62

Convergence Theorem (Cont.) Theorem (Convergence theorem for Jacobi and Gauss-Seidel methods) If A is diagonally dominant, the Jacobi and Gauss-Seidel methods converge for any x (0). Theorem (Convergence theorem for SOR method) Suppose that A has positive diagonal elements and that 0 < ω < 2, the SOR method converges for any x (0) if and only if A is positive definite. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 36 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 37 / 62

A-Conjugacy Definition If u and v are mutually orthogonal, if u, v = 0. Definition A-inner product of u and v is defined as u, v A = Au, v = u T A T v. Definition u and v are A-conjugate if u, v A = 0. Definition A matrix A is positive definite if x, x A 0. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 38 / 62

Conjugate Gradient Method This is a popular iterative method for solving sparse system. Consider a quadratic form f(x) = 1 2 x, x A b, x + c and its gradient f(x) = 1 2 (AT x + Ax) b. If A is symmetric, then f(x) = Ax b. Therefore the linear system Ax = b is a critical point for f(x). Thus, if A is a positive definite and symmetric, then we can solve Ax = b by minimising f(x). Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 39 / 62

Conjugate Gradient Method (Cont.) Suppose x = t 1 v (1) + t 2 v (2) + + t n v (n) is the true solution for Ax = b, where: {v (1), v (2),..., v (n) } forms a mutually A-conjugate basis of R n. the coefficient is given by t k = v(k), b v (k), v (k) A Instead of compute directly the exact solution, We will construct v (k) iteratively to approximate x. Given a reference point, x (k), we would like to know a residual vector r (k) = b Ax (k) associated with x (k). a search direction v (k+1) that move away from x (k) and minimises f. a update rule x (k+1) = r (k) + t k v (k). A natural search direction will be in the direction of steepest descent, ie. in the direction of f(x (k) ) = r (k), however the convergence will be slow for linear system. Instead we use the A-conjugate set {v (1), v (2),..., v (n) } of direction vectors, and require that vectors {r (k) } are mutually orthogonal. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 40 / 62

Conjugate Gradient Method (Cont.) Theorem The residual vectors r (k), k = 1, 2,... n, for a conjugate gradient method, satisfy the conditions r (k), v (j) = 0, for each j = 1, 2,..., k. The algorithm 1 Given an initial point, x (0), compute residual vector, r (0) = b Ax (0) first search direction v (1) is the steepest descent direction, v (1) = r (0) 2 Compute the new approximate x (k) = x (k 1) + t k v (k), where t k = v(k), r (k 1) v (k), Av (k) = r(k 1), r (k 1) v (k), v (k) A 3 Prepare for the next iteration: new residual vector r (k) = r (k 1) t k Av (k) new search direction, v (k+1) = v (k) + s k v (k), where s k = r(k), r (k) r (k 1), r (k 1) 4 Repeat Step 2 and 3 until desirable accuracy. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 41 / 62

Conjugate Gradient Method (Example) Example 4 3 0 24 A = 3 4 1, b = 30, and x (0) = [0, 0, 0] T. 0 1 4 24 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 42 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 43 / 62

Review on Eigenvalue Problem Eigenvalue Problem Ax = λx The eigenvalues are zeros of characteristic polynomial, p(λ) = det(a λx). The algebraic multiplicity of an eigenvalue is the multiplicity of the corresponding root of the characteristic polynomial. The geometric multiplicity of an eigenvalue is the dimension of the associated eigenspace. If λ is eigenvalue of A, then p(λ) is an eigenvalue of p(a) for any polynomial p. then p(1/λ) is an eigenvalue for p(a 1 ), where A is nonsingular. λ k is an eigenvalue of A k. 1/λ is an eigenvalue of A 1 If A is real and symmetric, then its eigenvalues are real, and eigenvectors are mutually orthogonal. If A is complex and Hermitian, then its eigenvalues are real, and eigenvectors are mutually orthogonal (inner product with conjugate transpose). If A is Hermitian and positive definite, then itst eigenvalues are positive. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 44 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 45 / 62

Schur s decomposition Definition (Similar Matrices) Two matrices A and B are similar to each other, if there exist a nonsingular matrix P such that A = P 1 BP. Theorem Similar matrices have the same characteristic polynomial and eigenvalues. Theorem (Schur s Theorem) Every square matrix is unitarily similar to a triangular matrix. U AU = T. Theorem Every Hermitian (symmetric) matrix is unitarily (orthogonally) similar to a diagonal matrix. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 46 / 62

Schur s Decomposition (Cont.) Example 2 1 1 Given a matrix A = 1 2 1 Write the matrix into its Schur decomposition 1 1 2 form, T = U AU. ANSWER: [MATLAB code: nm03_schur.m] [V, D] = eig(a) The eigenvector columns {v 1, v 2, v 3 } in V are not mutually orthogonal. Use Gram-Schmidt orthogonalisation to find a new set of orthonormal basis, which gives the required unitary matrix U = [e 1, e 2, e 3 ], ie. 0.246474 0.962242 0.115507 0.147691 0.080498 0.985752 0.957830 0.260021 0.122274 The triangular matrix is given by 8.4853 3.1950 0.46072 T = U AU = 0 4.6318 0.76123 0 0 1.8828 Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 47 / 62

Geršgorin s Theorem Theorem (Geršgorin Circle) Let A be an n n matrix and R i denote the circle in the complex plane with centre a ii and radius n j=1,j i a ij ; that is, R i = z C n z a ii a ij, j=1,j i where C denotes the complex plane. The eigenvalues of A are contained within the union of these circles, R = n i=1 R i. Moreover, the union of any k of the circles that do not intersect the remaining (n k) contains precisely k (counting multiplicity) of the eigenvalues. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 48 / 62

Geršgorin s Theorem (Cont.) Example 4 1 1 Let A = 0 2 1. Determine the Geršgorin s circles for A and find bounds 2 0 9 of the spectral radius of A. ANSWER Eigenvalues: 8.4853, 4.6318, 1.8828. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 49 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 50 / 62

Power Method Let A be n n matrix and its eigenvalues λ i > λ 2 λ 3... λ n and associated eigenvectors u (i), where Au (i) = λ i u (i), i = 1, 2,..., n. Power method will computes the largest eigenvalue and its associated eigenvector. Choose an arbitrary starting vector x (0) C n and x (0) = c 1 u (1) + c 2 u (2) + + c n u (n) = n i=1 c iu (i). Then, generate the sequence {x (k) } from the recurrence relation Note that, x (k) = A k x (0) = A k n i=1 Thus, when k, lim k c i u (i) = ( λi λ 1 x (k+1) = Ax (k). n λ k i c i u (i) = λ k 1 i=1 k i=1 ( λi λ 1 ) k c i u (i). ) k = 0, and lim k Ak x (0) = lim k λk 1c 1 u (1). However, the last term will diverges if λ 1 > 1 and converges to 0 if λ 1 < 1, thus we need to scale A k x appropriately to ensure the limit is finite. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 51 / 62

Power Method Let denote ɛ (k) = k i=2 ( λi x (k) = λ k 1[c 1 u (1) + ɛ (k) ]. λ 1 ) k c i u (i), where lim k ɛ (k) = 0. Then, Let φ be any [ linear functional on C n such that φ(u (1) ) 0 and then, φ(x (k) ) = λ k 1 c1 φ(u (1) ) + φ(ɛ (k) ) ]. Then generate the sequence of ratios {r k }: r k = φ(x(k+1) ) φ(x (k) ) where when k, r k λ 1. The algorithm (Ax = λx) : [ c1 φ(u (1) ) + φ(ɛ (k+1) ] ) = λ 1, c 1 φ(u (1) ) + φ(ɛ (k) ) 1 choose a starting point x (0), for example [1, 1, 1] T 2 Repeat for N times: 1 y Ax 2 r φ(y)/φ(x) (a common choise is φ(x) = x 1.) 3 x y/ y Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 52 / 62

Power Method (Cont.) Example 4 1 1 Find the largest eigenvalue for A = 0 2 1. 2 0 9 ANSWER: [MATLAB code: nm03_power.m] Choose a starting point, x (0) = [1, 1, 1] T and φ(x) = x 1. After 22 iteration r converges to the largest eigenvalue 8.4853. Note that the power method could be accelerated by applying the Aitken s 2 method. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 53 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 54 / 62

Inverse Power Method Several modification could be done on the power method in order to compute the other eigenvalues. Case I : Smallest Eigenvalue Ax = λx 1 λ x = A 1 x. Since the smallest eigenvalue of A is the largest eigenvalue of A 1, thus we could apply the power method x (k+1) = Ax (k). To avoid calculating A 1, we could solve Ax (k+1) = x (k) by LU-decomposition instead. Example 4 1 1 Find the smallest eigenvalue for A = 0 2 1. 2 0 9 ANSWER: [MATLAB code: nm03_ipower_1.m] Choose a starting point, x (0) = [1, 1, 1] T and φ(x) = x 1. Use MATLAB command A\x to compute A 1 x. After 14 iterations 1/r converges to the smallest eigenvalue 1.8828. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 55 / 62

(Shifted) Inverse Power Method Case II : Shifted Inverse Power Method Ax = λx (A µi)x = (λ µ)x 1 x = (A λ µ µi) 1 x. Thus, we could apply inverse power method to find the smallest eigenvalue of (A µi). With appropriate choice of µ, then we could find the eigenvalue of A that is closest to µ. Example 4 1 1 Find an eigenvalue for A = 0 2 1 that is close to 4. 2 0 9 ANSWER: [MATLAB code: nm03_ipower_2.m] Choose a starting point, x (0) = [1, 1, 1] T and φ(x) = x 1. Let B = A µi and use MATLAB command B\x to compute B 1 x. After 14 iterations 1/r + µ converges to the smallest eigenvalue 1.8828. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 56 / 62

Power Method with Rayleigh Quotient Definition Let A be a real symmetric matrix, then the Rayleigh quotient of a vector x R n is defined as r(x) = xt Ax x T x. If u is an eigenvector of A, then r(u) = λ is the corresponding eigenvalue. If x is not an eigenvector, then r(x) = α minimises f(α) = Ax αx 2. Thus, r(x) is a natural eigenvalue estimate if x is close, but not equal, to an eigenvector. In fact, r(x) is quadratically accurate as eigenvalue estimate when x u. We could modify the power method to incorporate Rayleigh quotient to speed up the convergence. 1 Repeat for N times: 1 y Ax 2 x y/ y 3 r x T Ax. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 57 / 62

Outline 1 Motivation 2 Solving Linear Systems Issues on Gaussian Elimination Matrix Factorisation Special Matrices Iterative Methods Stationary Methods Conjugate Gradient Method 3 Eigenvalue Problem Schur s Decomposition Power Method Inverse Power Method QR Method and Householder Transformation Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 58 / 62

Householder Transformation A useful technique to find eigenvalues that are not suffer from too much round-off errors is QR method. However, the QR method requires tridiagonal matrix as input. Definition (Householder Transformation) Let w R n with w T w = 1. The n n matrix is called a Householder transformation. Theorem P = I 2ww T A Householder transformation, P = I 2ww T, is symmetric and orthogonal, ie P 1 = P. The aim of the Householder transform is to reduce an arbitrary symmetric matrix to a tridiagonal matrix. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 59 / 62

Householder Method Given a n n matrix A, the Householder algorithm: 1 For k = 1 : n 2, do 1/2 n 1 α = sgn(a (k) (a k jk) 2, k 1,k ) j=k+1 ( 1 2 r = 2 α2 1 2 2 k+1,k) αa(k), 3 w (k) 1 = w (2) 2 = = w (k) 3 = 0, 4 w (k) k+1 = a (k) k+1,k α, 2r 5 w (k) j = a (k) jk 2r, for each j = k + 2,..., n, 6 P (k) = I 2w (k) (w (k) ) T, 7 A (k+1) = P (k) A (k) P (k). Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 60 / 62

QR-Algorithm Let A denote a symmetric tridiagonal matrix. The aim of QR-algorithm is to decrease the off-diagnoal elements iteratively via similarity transforms. 1 Set A (0) = A. 2 Repeat for k = 1, 2,... 1 Q (k) R (k) = A (k 1), where Q is orthogonal and R is upper triangular. 2 A (k) = R (k) Q (k) To construct the factoring matrices Q and R uses a product of n 1 rotation matrices. R (k) = P n P n 1... P k+1 A (k). Each of these rotation matrices reset the lower off-diagonal elements to zero one-by-one. The performance of the QR-algorithm can be improved by introducing a shift on each step, ie work on the shifted matrix A µi instead of A. Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 61 / 62

THE END Y. K. Goh (UTAR) Numerical Methods - Numerical Linear Algebra I 2013 62 / 62