Course Compendium, Applied Matrix Analysis
Total Page:16
File Type:pdf, Size:1020Kb
Course compendium, Applied matrix analysis Christopher Engstr¨om Karl Lundeng˚ard Sergei Silvestrov November 14, 2018 Contents 1 Review of basic linear algebra6 1.1 Notation and elementary matrix operations . .6 1.2 Linear equation systems . .8 1.2.1 Determinants . 10 1.3 Eigenvalues and eigenvectors . 13 1.4 Exercises . 14 2 Matrix factorization and canonical forms 16 2.1 Important types of matrices and some useful properties . 17 2.1.1 Triangular and Hessenberg matrices . 17 2.1.2 Hermitian matrices . 18 2.1.3 Unitary matrices . 18 2.1.4 Positive definite matrices . 19 2.2 Factorization . 19 2.2.1 Spectral factorization . 20 2.2.2 Rank factorization . 20 2.2.3 LU and Cholesky factorization . 21 2.2.4 QR factorization . 22 2.2.5 Canonical forms . 22 2.2.6 Reduced row echelon form . 23 2.2.7 Jordan normal form . 23 2.2.8 Singular value decomposition (SVD) . 24 2.3 Applications . 25 2.3.1 Portfolio evaluation using Monte Carlo simulation . 25 3 Non-negative matrices and graphs 27 3.1 Introduction to graphs . 27 3.2 Connectivity and irreducible matrices . 30 3.3 The Laplacian matrix . 33 3.4 Exercises . 35 3.5 Applications . 35 3.5.1 Shortest path . 35 3.5.2 Resistance distance . 36 4 Perron-Frobenius theory 39 4.1 Perron-Frobenius for non negative matrices . 39 4.2 Exercises . 42 4.3 Applications . 43 4.3.1 Leontief input-output model . 43 5 Stochastic matrices and Perron-Frobenius 45 5.1 Stochastic matrices and Markov chains . 45 1 5.2 Irreducible, primitive stochastic matrices . 48 5.3 Irreducible, imprimitive stochastic matrices . 49 5.4 Reducible, stochastic matrices . 50 5.5 Hitting times and hitting probabilities . 52 5.6 A short look at continuous time Markov chains . 54 5.7 Exercises . 56 5.8 Applications . 57 5.8.1 Return to the Leontief model . 57 6 Linear spaces and projections 59 6.1 Linear spaces . 59 6.2 Inner product spaces . 65 6.3 Projections . 69 6.4 Applications . 73 6.4.1 Fourier approximation . 73 6.4.2 Finding a QR decomposition using the Gram-Schmidt process . 74 7 Principal component analysis (PCA) and dimension reduction 77 7.1 Mean, variance and covariance . 77 7.2 Principal component analysis . 81 7.3 Choosing the number of dimensions . 83 8 Linear transformations 86 8.1 Linear transformations in geometry . 89 8.2 surjection,injection and combined transformations . 91 8.3 Application: Transformations in computer graphics and homogeneous co- ordinates . 92 8.4 Kernel and image . 95 8.5 Isomorphisms . 98 9 Regression and the Least Square Method 100 9.1 Multiple linear regression . 102 9.1.1 Single linear regression . 102 9.1.2 Fitting several variables . 103 9.2 Finding the coefficients . 105 9.3 Weighted Least Squares Method (WLS) . 106 9.4 Non-linear regression . 107 9.5 Pseudoinverses . 108 10 Matrix functions 110 10.1 Matrix power function . 110 10.1.1 Calculating An ............................. 111 10.2 Matrix root function . 113 10.2.1 Root of a diagonal matrix . 113 2 10.2.2 Finding the square root of a matrix using the Jordan canonical form114 10.3 Matrix polynomials . 115 10.3.1 The Cayley-Hamilton theorem . 116 10.3.2 Calculating matrix polynomials . 119 10.3.3 Companion matrices . 120 10.4 Exponential matrix . 122 10.4.1 Solving matrix differential equations . 124 10.5 General matrix functions . 125 11 Matrix equations 126 11.1 Tensor products . 126 11.2 Solving matrix equations . 128 12 Numerical methods for computing eigenvalues and eigenvectors 131 12.1 The Power method . 131 12.1.1 Inverse Power method . 134 12.2 The QR-method . 136 12.3 Applications . 139 12.3.1 PageRank . 139 Index 143 3 4 Notation v vector (usually represented by a row or column matrix) jvj length (Euclidean norm) of a vector kvk norm of a vector M matrix M> transpose M−1 inverse M∗ pseudoinverse M complex conjugate MH Hermitian transpose Mk the k:th power of matrix M, see section 10.1 mi;j The element on the i:th row and j:th column of M (k) k mi;j The element on the i:th row and j:th column of M Mi: i:th row of M M:j j:th column of M ⊗ Kroenecker (tensor) product a scalar jaj absolute value of a scalar h·; ·i inner product (scalar product) Z set of integers + Z set of positive integers R set of real numbers C set of complex numbers Mm×n(K) set of matrices with dimension m × n and elements from the set K 5 1 Review of basic linear algebra The reader should already be familiar with the concepts and content in this chapter, instead it serves more as a reminder and overview of what we already know. We will start by giving some notation used throughout the book as well as reminding ourselves of the most basic matrix operations. We will then take a look at linear systems, eigenvalues and eigenvectors and related concepts as seen in elementary courses in linear algebra. While the methods presented here works, they are often very slow or unstable when used on a computer. Much of our later work will relate to how to find better ways to find these or similar quantities or give other examples of where and why they are useful. 1.1 Notation and elementary matrix operations We will here go through the most elementary matrix operations as well as give the no- tation which will be used throughout the book. We remind ourselves that a matrix is a rectangular array of numbers, symbols or expressions. Some example of matrices can be seen below: 1 0 A = B = 0 1 − i 0 4 2 1 −23 1 0 0 C = −2 3 D = 4 5 0 3 0 3 1 We note that matrices need not be square as in C and D, we also note that although matrices can be complex valued, in most of our examples or practical applications we need only to work with real valued matrices. • We denote every element of A as ai;j, where i is it's row number and j is it's column number. For example looking at C we have c3;2 = 1. • The size of a matrix is the number of rows and columns (or the index of the bottom right element): We say that C above is a 3 × 2 matrix. • A matrix with only one row or column is called a row vector or column vector respectively. We usually denote vectors with an arrow v and we assume all vectors are column vectors unless stated otherwise. • The diagonal of a matrix is the elements diagonally from the top left corner towards the bottom left (a1;1; a2;2; : : : an;n). A matrix where all elements except those on the diagonal is zero is called a diagonal matrix. For example A is a diagonal matrix, but so is D although we will usually only consider square diagonal matrices. • The trace of a matrix is the sum of the elements on the diagonal. 6 Matrix addition Add every element in the first matrix with corresponding element in the second matrix. Both matrices need to be of the same size for addition to be defined. 1 0 1 −2 1 + 1 0 − 2 2 −2 + = = 0 2 2 −1 0 + 2 2 − 1 2 1 Although addition between a scalar and a matrix is undefined, sometimes authors write it as such in which case they usually means to add the scalar to every element of the matrix as if the scalar was a matrix of the same size with every element equal to the constant. The general definition of matrix addition is: Let A = B + C where all three matrices have the same number of rows and columns. Then ai;j = bi;j + ci;j for every element in A. Matrix multiplication Given the two matrices A and B we get the product AB as the matrix whose elements ei;j are found by multiplying the elements in row i of A with the elements of column j of B and adding the results. 23 2 0 13 23201 3 211 10 7 143 61234 7 61234 7 6 5 9 16 247 6 7 6 7 = 6 7 40 1 2 15 40121 5 4 1 4 8 9 5 0 0 1 3 0013 0 1 5 10 For the colored element we have:1 · 3 + 2 · 1 + 3 · 0 + 4 · 0 = 5 We note that we need the number of columns in A to be the same as the number of rows in B but A can have any number of rows and B can have any number of columns. Also we have: • Generally AB 6= BA, why? • The size of AB is the number of rows of A times the number of columns of B. • The Identity matrix I is the matrix with ones on the diagonal and zero elsewhere. For the Identity matrix we have: AI = IA = A. Multiplying a scalar with a matrix is done by multiplying the scalar with every element of the matrix. 1 0 3 · 1 3 · 0 3 0 3 = = 0 2 3 · 0 3 · 2 0 6 The general definition of matrix multiplication is: Let A = BC then j X ai;j = bi;kck;j k=1 for each element in A. 7 Matrix transpose The transpose of a matrix is obtained by flipping the rows and columns such that the elements of the first row is now the elements of the first column.