1y ago

25 Views

1 Downloads

522.20 KB

71 Pages

Transcription

The Matrix Cookbook [ http://matrixcookbook.com ] Kaare Brandt Petersen Michael Syskind Pedersen Version: November 14, 2008 What is this? These pages are a collection of facts (identities, approximations, inequalities, relations, .) about matrices and matters relating to them. It is collected in this form for the convenience of anyone who wants a quick desktop reference . Disclaimer: The identities, approximations and relations presented here were obviously not invented but collected, borrowed and copied from a large amount of sources. These sources include similar but shorter notes found on the internet and appendices in books - see the references for a full list. Errors: Very likely there are errors, typos, and mistakes for which we apologize and would be grateful to receive corrections at cookbook@2302.dk. Its ongoing: The project of keeping a large repository of relations involving matrices is naturally ongoing and the version will be apparent from the date in the header. Suggestions: Your suggestion for additional content or elaboration of some topics is most welcome at cookbook@2302.dk. Keywords: Matrix algebra, matrix relations, matrix identities, derivative of determinant, derivative of inverse matrix, differentiate a matrix. Acknowledgements: We would like to thank the following for contributions and suggestions: Bill Baxter, Brian Templeton, Christian Rishøj, Christian Schröppel Douglas L. Theobald, Esben Hoegh-Rasmussen, Glynne Casteel, Jan Larsen, Jun Bin Gao, Jürgen Struckmeier, Kamil Dedecius, Korbinian Strimmer, Lars Christiansen, Lars Kai Hansen, Leland Wilkinson, Liguo He, Loic Thibaut, Miguel Barão, Ole Winther, Pavel Sakov, Stephan Hattinger, Vasile Sima, Vincent Rabaud, Zhaoshui He. We would also like thank The Oticon Foundation for funding our PhD studies. 1

CONTENTS CONTENTS Contents 1 Basics 1.1 Trace and Determinants . . . . . . . . . . . . . . . . . . . . . . . 1.2 The Special Case 2x2 . . . . . . . . . . . . . . . . . . . . . . . . . 2 Derivatives 2.1 Derivatives 2.2 Derivatives 2.3 Derivatives 2.4 Derivatives 2.5 Derivatives 2.6 Derivatives 2.7 Derivatives 2.8 Derivatives of of of of of of of of a Determinant . . . . . . . . . . . . an Inverse . . . . . . . . . . . . . . . Eigenvalues . . . . . . . . . . . . . . Matrices, Vectors and Scalar Forms Traces . . . . . . . . . . . . . . . . . vector norms . . . . . . . . . . . . . matrix norms . . . . . . . . . . . . . Structured Matrices . . . . . . . . . 3 Inverses 3.1 Basic . . . . . . . . . . . 3.2 Exact Relations . . . . . 3.3 Implication on Inverses . 3.4 Approximations . . . . . 3.5 Generalized Inverse . . . 3.6 Pseudo Inverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 8 9 9 11 13 13 14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 16 17 19 19 20 20 4 Complex Matrices 23 4.1 Complex Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.2 Higher order and non-linear derivatives . . . . . . . . . . . . . . . 26 4.3 Inverse of complex sum . . . . . . . . . . . . . . . . . . . . . . . 26 5 Solutions and Decompositions 5.1 Solutions to linear equations . 5.2 Eigenvalues and Eigenvectors 5.3 Singular Value Decomposition 5.4 Triangular Decomposition . . 5.5 LU decomposition . . . . . . 5.6 LDM decomposition . . . . . 5.7 LDL decompositions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 27 29 30 32 32 32 32 6 Statistics and Probability 33 6.1 Definition of Moments . . . . . . . . . . . . . . . . . . . . . . . . 33 6.2 Expectation of Linear Combinations . . . . . . . . . . . . . . . . 34 6.3 Weighted Scalar Variable . . . . . . . . . . . . . . . . . . . . . . 35 Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 2

CONTENTS CONTENTS 7 Multivariate Distributions 7.1 Cauchy . . . . . . . . . . 7.2 Dirichlet . . . . . . . . . . 7.3 Normal . . . . . . . . . . 7.4 Normal-Inverse Gamma . 7.5 Gaussian . . . . . . . . . . 7.6 Multinomial . . . . . . . . 7.7 Student’s t . . . . . . . . 7.8 Wishart . . . . . . . . . . 7.9 Wishart, Inverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 36 36 36 36 36 36 36 37 38 8 Gaussians 8.1 Basics . . . . . . . . 8.2 Moments . . . . . . 8.3 Miscellaneous . . . . 8.4 Mixture of Gaussians . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 39 41 43 44 9 Special Matrices 9.1 Block matrices . . . . . . . . . . . . . . . . 9.2 Discrete Fourier Transform Matrix, The . . 9.3 Hermitian Matrices and skew-Hermitian . . 9.4 Idempotent Matrices . . . . . . . . . . . . . 9.5 Orthogonal matrices . . . . . . . . . . . . . 9.6 Positive Definite and Semi-definite Matrices 9.7 Singleentry Matrix, The . . . . . . . . . . . 9.8 Symmetric, Skew-symmetric/Antisymmetric 9.9 Toeplitz Matrices . . . . . . . . . . . . . . . 9.10 Transition matrices . . . . . . . . . . . . . . 9.11 Units, Permutation and Shift . . . . . . . . 9.12 Vandermonde Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 45 46 47 48 48 50 51 53 54 55 56 57 10 Functions and Operators 10.1 Functions and Series . . . . . 10.2 Kronecker and Vec Operator 10.3 Vector Norms . . . . . . . . . 10.4 Matrix Norms . . . . . . . . . 10.5 Rank . . . . . . . . . . . . . . 10.6 Integral Involving Dirac Delta 10.7 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 58 59 61 61 62 62 63 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Functions . . . . . . . . . . . . . . . . . . . . A One-dimensional Results 64 A.1 Gaussian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 A.2 One Dimensional Mixture of Gaussians . . . . . . . . . . . . . . . 65 B Proofs and Details 67 B.1 Misc Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 3

CONTENTS CONTENTS Notation and Nomenclature A Aij Ai Aij An A 1 A A1/2 (A)ij Aij [A]ij a ai ai a z z Z z z Z Matrix Matrix indexed for some purpose Matrix indexed for some purpose Matrix indexed for some purpose Matrix indexed for some purpose or The n.th power of a square matrix The inverse matrix of the matrix A The pseudo inverse matrix of the matrix A (see Sec. 3.6) The square root of a matrix (if unique), not elementwise The (i, j).th entry of the matrix A The (i, j).th entry of the matrix A The ij-submatrix, i.e. A with i.th row and j.th column deleted Vector Vector indexed for some purpose The i.th element of the vector a Scalar Real part of a scalar Real part of a vector Real part of a matrix Imaginary part of a scalar Imaginary part of a vector Imaginary part of a matrix det(A) Tr(A) diag(A) eig(A) vec(A) sup A AT A T A AH Determinant of A Trace of the matrix A Diagonal matrix of the matrix A, i.e. (diag(A))ij δij Aij Eigenvalues of the matrix A The vector-version of the matrix A (see Sec. 10.2.2) Supremum of a set Matrix norm (subscript if any denotes what norm) Transposed matrix The inverse of the transposed and vice versa, A T (A 1 )T (AT ) 1 . Complex conjugated matrix Transposed and complex conjugated matrix (Hermitian) A B A B Hadamard (elementwise) product Kronecker product 0 I Jij Σ Λ The null matrix. Zero in all entries. The identity matrix The single-entry matrix, 1 at (i, j) and zero elsewhere A positive definite matrix A diagonal matrix Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 4

1 1 Basics (AB) 1 (ABC.) 1 (AT ) 1 (A B)T (AB)T (ABC.)T (AH ) 1 (A B)H (AB)H (ABC.)H 1.1 B 1 A 1 .C 1 B 1 A 1 (A 1 )T A T BT BT A T .CT BT AT (A 1 )H A H BH BH A H .CH BH AH (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) P Aii Pi λi eig(A) i λi , Tr(AT ) Tr(BA) Tr(A) Tr(B) Tr(BCA) Tr(CAB) Q λi eig(A) i λi n c det(A), if A Rn n det(A) det(A) det(B) 1/ det(A) det(A)n 1 uT v 1 εTr(A), ε small (11) (12) (13) (14) (15) (16) (17) (18) (19) (20) (21) (22) (23) (24) Trace and Determinants Tr(A) Tr(A) Tr(A) Tr(AB) Tr(A B) Tr(ABC) det(A) det(cA) det(AT ) det(AB) det(A 1 ) det(An ) det(I uvT ) det(I εA) 1.2 BASICS The Special Case 2x2 Consider the matrix A A A11 A21 A12 A22 Determinant and trace det(A) A11 A22 A12 A21 (25) Tr(A) A11 A22 (26) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 5

1.2 The Special Case 2x2 1 BASICS Eigenvalues λ2 λ · Tr(A) det(A) 0 λ1 Tr(A) p Tr(A)2 4 det(A) 2 λ1 λ2 Tr(A) p Tr(A)2 4 det(A) λ2 2 λ1 λ2 det(A) Tr(A) Eigenvectors v1 A12 λ1 A11 Inverse A 1 1 det(A) v2 A22 A21 A12 λ2 A11 A12 A11 (27) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 6

2 2 DERIVATIVES Derivatives This section is covering differentiation of a number of expressions with respect to a matrix X. Note that it is always assumed that X has no special structure, i.e. that the elements of X are independent (e.g. not symmetric, Toeplitz, positive definite). See section 2.8 for differentiation of structured matrices. The basic assumptions can be written in a formula as Xkl δik δlj Xij that is for e.g. vector forms, xi x y i y x y i x yi (28) x y ij xi yj The following rules are general and very useful when deriving the differential of an expression ([19]): A (αX) (X Y) (Tr(X)) (XY) (X Y) (X Y) (X 1 ) (det(X)) (ln(det(X))) XT XH 2.1 2.1.1 0 (A is a constant) α X X Y Tr( X) ( X)Y X( Y) ( X) Y X ( Y) ( X) Y X ( Y) X 1 ( X)X 1 det(X)Tr(X 1 X) Tr(X 1 X) ( X)T ( X)H (29) (30) (31) (32) (33) (34) (35) (36) (37) (38) (39) (40) Derivatives of a Determinant General form det(Y) x det(Y) x x 1 Y det(Y)Tr Y x " " # Y 1 x det(Y) Tr Y x Y Y Tr Y 1 Tr Y 1 x x # 1 Y 1 Y Tr Y Y x x (41) (42) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 7

2.2 Derivatives of an Inverse 2.1.2 2 DERIVATIVES Linear forms det(X) X X det(X) Xjk Xik det(X)(X 1 )T δij det(X) (43) (44) k det(AXB) X 2.1.3 det(AXB)(X 1 )T det(AXB)(XT ) 1 (45) Square forms If X is square and invertible, then det(XT AX) 2 det(XT AX)X T X (46) If X is not square but A is symmetric, then det(XT AX) 2 det(XT AX)AX(XT AX) 1 X (47) If X is not square and A is not symmetric, then det(XT AX) det(XT AX)(AX(XT AX) 1 AT X(XT AT X) 1 ) X 2.1.4 (48) Other nonlinear forms Some special cases are (See [9, 7]) ln det(XT X) X ln det(XT X) X ln det(X) X det(Xk ) X 2.2 2(X )T 2XT (X 1 )T (XT ) 1 k det(Xk )X T (49) (50) (51) (52) Derivatives of an Inverse From [27] we have the basic identity Y 1 Y 1 Y 1 Y x x (53) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 8

2.3 Derivatives of Eigenvalues 2 DERIVATIVES from which it follows (X 1 )kl Xij aT X 1 b X det(X 1 ) X Tr(AX 1 B) X Tr((X A) 1 ) X (X 1 )ki (X 1 )jl (54) X T abT X T (55) det(X 1 )(X 1 )T (56) (X 1 BAX 1 )T (57) ((X A) 1 (X A) 1 )T (58) From [32] we have the following result: Let A be an n n invertible square matrix, W be the inverse of A, and J(A) is an n n -variate and differentiable function with respect to A, then the partial differentials of J with respect to A and W satisfy J J T A T A A W 2.3 Derivatives of Eigenvalues X eig(X) X Y eig(X) X 2.4 2.4.1 Tr(X) I X det(X) det(X)X T X (59) (60) Derivatives of Matrices, Vectors and Scalar Forms First Order xT a x aT Xb X aT XT b X aT Xa X X Xij (XA)ij Xmn (XT A)ij Xmn aT x x a (61) abT (62) baT (63) aT XT a X aaT Jij (64) (65) δim (A)nj (Jmn A)ij (66) δin (A)mj (Jnm A)ij (67) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 9

2.4 Derivatives of Matrices, Vectors and Scalar Forms 2.4.2 2 DERIVATIVES Second Order X Xkl Xmn Xij 2 X klmn bT XT Xc X (Bx b)T C(Dx d) x (XT BX)kl Xij (XT BX) Xij Xkl (68) kl X(bcT cbT ) (69) BT C(Dx d) DT CT (Bx b) (70) δlj (XT B)ki δkj (BX)il (71) XT BJij Jji BX (Jij )kl δik δjl (72) See Sec 9.7 for useful properties of the Single-entry matrix Jij xT Bx x bT XT DXc X (Xb c)T D(Xb c) X (B BT )x DT XbcT DXcbT (D DT )(Xb c)bT (73) (74) (75) Assume W is symmetric, then (x As)T W(x As) 2AT W(x As) s (x s)T W(x s) 2W(x s) x (x s)T W(x s) 2W(x s) s (x As)T W(x As) 2W(x As) x (x As)T W(x As) 2W(x As)sT A (76) (77) (78) (79) (80) As a case with complex values the following holds (a xH b)2 x 2b(a xH b) (81) This formula is also known from the LMS algorithm [14] 2.4.3 Higher order and non-linear n 1 X (Xn )kl (Xr Jij Xn 1 r )kl Xij r 0 (82) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 10

2.5 Derivatives of Traces 2 DERIVATIVES For proof of the above, see B.1.1. n 1 X T n a X b (Xr )T abT (Xn 1 r )T X r 0 n 1 Xh T n T n a (X ) X b X (83) Xn 1 r abT (Xn )T Xr r 0 (Xr )T Xn abT (Xn 1 r )T i (84) See B.1.1 for a proof. Assume s and r are functions of x, i.e. s s(x), r r(x), and that A is a constant, then T s Ar x (Ax)T (Ax) x (Bx)T (Bx) 2.4.4 s x T Ar r x T AT s xT AT Ax x xT BT Bx xT AT AxBT Bx AT Ax 2 2 T x BBx (xT BT Bx)2 (85) (86) (87) Gradient and Hessian Using the above we have for the gradient and the Hessian f f x f x 2f x xT 2.5 xT Ax bT x (A AT )x b A AT (88) (89) (90) Derivatives of Traces Assume F (X) to be a differentiable function of each of the elements of X. It then holds that Tr(F (X)) f (X)T X where f (·) is the scalar derivative of F (·). Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 11

2.5 Derivatives of Traces 2.5.1 2 DERIVATIVES First Order Tr(X) I X Tr(XA) AT X Tr(AXB) AT BT X Tr(AXT B) BA X Tr(XT A) A X Tr(AXT ) A X Tr(A X) Tr(A)I X 2.5.2 (91) (92) (93) (94) (95) (96) (97) Second Order Tr(X2 ) X Tr(X2 B) X Tr(XT BX) X Tr(XBXT ) X Tr(AXBX) X Tr(XT X) X Tr(BXXT ) X Tr(BT XT CXB) X Tr XT BXC X Tr(AXBXT C) X h i Tr (AXB C)(AXC C)T X Tr(X X) X 2XT (98) (XB BX)T (99) BX BT X (100) XBT XB (101) A T X T BT BT X T A T (102) 2X (103) (B BT )X (104) CT XBBT CXBBT (105) BXC BT XCT (106) AT CT XBT CAXB (107) 2AT (AXB C)BT (108) Tr(X)Tr(X) 2Tr(X)I(109) X See [7]. Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 12

2.6 Derivatives of vector norms 2.5.3 2 DERIVATIVES Higher Order Tr(Xk ) X k(Xk 1 )T k 1 X Tr(AXk ) (Xr AXk r 1 )T X r 0 T T T CXXT CXBBT X Tr B X CXX CXB CT XBBT XT CT X CXBBT XT CX CT XXT CT XBBT (110) (111) (112) 2.5.4 Other Tr(AX 1 B) (X 1 BAX 1 )T X T AT BT X T (113) X Assume B and C to be symmetric, then h i Tr (XT CX) 1 A (CX(XT CX) 1 )(A AT )(XT CX) 1 (114) X h i Tr (XT CX) 1 (XT BX) 2CX(XT CX) 1 XT BX(XT CX) 1 X 2BX(XT CX) 1 (115) h i Tr (A XT CX) 1 (XT BX) 2CX(A XT CX) 1 XT BX(A XT CX) 1 X 2BX(A XT CX) 1 (116) See [7]. Tr(sin(X)) X 2.6 2.6.1 2.7 cos(X)T (117) Derivatives of vector norms Two-norm x a x a 2 x x a 2 (118) x a I (x a)(x a)T x kx ak2 kx ak2 kx ak32 (119) x 22 xT x 2 2x x x (120) Derivatives of matrix norms For more on matrix norms, see Sec. 10.4. Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 13

2.8 Derivatives of Structured Matrices 2 DERIVATIVES 2.7.1 Frobenius norm X 2F Tr(XXH ) 2X (121) X X See (227). Note that this is also a special case of the result in equation 108. 2.8 Derivatives of Structured Matrices Assume that the matrix A has some structure, i.e. symmetric, toeplitz, etc. In that case the derivatives of the previous section does not apply in general. Instead, consider the following general rule for differentiating a scalar function f (A) " # T X f Akl f A df (122) Tr dAij Akl Aij A Aij kl The matrix differentiated with respect to itself is in this document referred to as the structure matrix of A and is defined simply by A Sij Aij (123) If A has no special structure we have simply Sij Jij , that is, the structure matrix is simply the singleentry matrix. Many structures have a representation in singleentry matrices, see Sec. 9.7.6 for more examples of structure matrices. 2.8.1 The Chain Rule Sometimes the objective is to find the derivative of a matrix which is a function of another matrix. Let U f (X), the goal is to find the derivative of the function g(U) with respect to X: g(f (X)) g(U) X X (124) Then the Chain Rule can then be written the following way: M N g(U) g(U) X X g(U) ukl X xij ukl xij (125) k 1 l 1 Using matrix notation, this can be written as: h g(U) g(U) U i Tr ( )T . Xij U Xij (126) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 14

2.8 Derivatives of Structured Matrices 2.8.2 2 DERIVATIVES Symmetric If A is symmetric, then Sij Jij Jji Jij Jij and therefore T df f f f diag dA A A A (127) That is, e.g., ([5]): Tr(AX) X det(X) X ln det(X) X 2.8.3 A AT (A I), see (131) (128) det(X)(2X 1 (X 1 I)) (129) 2X 1 (X 1 I) (130) Diagonal If X is diagonal, then ([19]): Tr(AX) X 2.8.4 A I (131) Toeplitz Like symmetric matrices and diagonal matrices also Toeplitz matrices has a special structure which should be taken into account when the derivative with respect to a matrix with Toeplitz structure. Tr(AT) T Tr(TA) T (132) Tr(A) Tr([AT ]n1 ) Tr([AT ]1n )) Tr(A) Tr([[AT ]1n ]n 1,2 ) . . Tr([[AT ]1n ]2,n 1 ) . . . A1n . . . . . . . ··· . . ··· . . . . . . Tr([[AT ]1n ]2,n 1 ) . . . . An1 . . . . . Tr([[AT ]1n ]n 1,2 ) . Tr([AT ]n1 ) Tr(A) Tr([AT ]1n )) α(A) As it can be seen, the derivative α(A) also has a Toeplitz structure. Each value in the diagonal is the sum of all the diagonal valued in A, the values in the diagonals next to the main diagonal equal the sum of the diagonal next to the main diagonal in AT . This result is only valid for the unconstrained Toeplitz matrix. If the Toeplitz matrix also is symmetric, the same derivative yields Tr(AT) Tr(TA) α(A) α(A)T α(A) I T T (133) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 15

3 3 3.1 3.1.1 INVERSES Inverses Basic Definition The inverse A 1 of a matrix A Cn n is defined such that AA 1 A 1 A I, (134) where I is the n n identity matrix. If A 1 exists, A is said to be nonsingular. Otherwise, A is said to be singular (see e.g. [12]). 3.1.2 Cofactors and Adjoint The submatrix of a matrix A, denoted by [A]ij is a (n 1) (n 1) matrix obtained by deleting the ith row and the jth column of A. The (i, j) cofactor of a matrix is defined as cof(A, i, j) ( 1)i j det([A]ij ), The matrix of cofactors can be created from the cofactors cof(A, 1, 1) ··· cof(A, 1, n) . . . . cof(A) cof(A, i, j) . cof(A, n, 1) ··· cof(A, n, n) (135) (136) The adjoint matrix is the transpose of the cofactor matrix adj(A) (cof(A))T , 3.1.3 (137) Determinant The determinant of a matrix A Cn n is defined as (see [12]) det(A) n X j 1 n X ( 1)j 1 A1j det ([A]1j ) (138) A1j cof(A, 1, j). (139) j 1 3.1.4 Construction The inverse matrix can be constructed, using the adjoint matrix, by A 1 1 · adj(A) det(A) (140) For the case of 2 2 matrices, see section 1.2. Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 16

3.2 Exact Relations 3.1.5 3 INVERSES Condition number The condition number of a matrix c(A) is the ratio between the largest and the smallest singular value of a matrix (see Section 5.3 on singular values), c(A) d d (141) The condition number can be used to measure how singular a matrix is. If the condition number is large, it indicates that the matrix is nearly singular. The condition number can also be estimated from the matrix norms. Here c(A) kAk · kA 1 k, (142) where k · k is a norm such as e.g the 1-norm, the 2-norm, the -norm or the Frobenius norm (see Sec 10.4p for more on matrix norms). The 2-norm of A equals (max(eig(AH A))) [12, p.57]. For a symmetric matrix, this reduces to A 2 max( eig(A) ) [12, p.394]. If the matrix ia symmetric and positive definite, A 2 max(eig(A)). The condition number based on the 2-norm thus reduces to kAk2 kA 1 k2 max(eig(A)) max(eig(A 1 )) 3.2 3.2.1 max(eig(A)) . min(eig(A)) Exact Relations Basic (AB) 1 B 1 A 1 3.2.2 (143) (144) The Woodbury identity The Woodbury identity comes in many variants. The latter of the two can be found in [12] (A CBCT ) 1 (A UBV) 1 A 1 A 1 C(B 1 CT A 1 C) 1 CT A 1 (145) A 1 A 1 U(B 1 VA 1 U) 1 VA 1 (146) If P, R are positive definite, then (see [30]) (P 1 BT R 1 B) 1 BT R 1 PBT (BPBT R) 1 3.2.3 (147) The Kailath Variant (A BC) 1 A 1 A 1 B(I CA 1 B) 1 CA 1 (148) See [4, page 153]. Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 17

3.2 Exact Relations 3.2.4 3 INVERSES The Searle Set of Identities The following set of identities, can be found in [25, page 151], (I A 1 ) 1 A(A I) 1 (A BBT ) 1 B A 1 B(I BT A 1 B) 1 (A 1 B 1 ) 1 A(A B) 1 B B(A B) 1 A A A(A B) 1 A B B(A B) 1 B A 1 B 1 A 1 (A B)B 1 (I AB) 1 I A(I BA) 1 B (I AB) 1 A A(I BA) 1 3.2.5 (149) (150) (151) (152) (153) (154) (155) Rank-1 update of Moore-Penrose Inverse The following is a rank-1 update for the Moore-Penrose pseudo-inverse of real valued matrices and proof can be found in [18]. The matrix G is defined below: (A cdT ) A G (156) 1 dT A c A c (A )T d (I AA )c (I A A)T d (157) (158) (159) (160) (161) Using the the notation β v n w m the solution is given as six different cases, depending on the entities w , m , and β. Please note, that for any (column) vector v it holds that v vT vT (vT v) 1 v 2 . The solution is: Case 1 of 6: If w 6 0 and m 6 0. Then G vw (m )T nT β(m )T w 1 1 β vwT mnT mwT w 2 m 2 m 2 w 2 (162) (163) Case 2 of 6: If w 0 and m 6 0 and β 0. Then G vv A (m )T nT 1 1 vvT A mnT 2 v m 2 (164) (165) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 18

3.3 Implication on Inverses 3 INVERSES Case 3 of 6: If w 0 and β 6 0. Then T v 2 1 β m 2 T T G mv A m v (A ) v n β v 2 m 2 β 2 β β (166) Case 4 of 6: If w 6 0 and m 0 and β 0. Then G A nn vw 1 1 A nnT vwT n 2 w 2 (167) (168) Case 5 of 6: If m 0 and β 6 0. Then T 1 w 2 β n 2 G A nwT (169) A w n n v β n 2 w 2 β 2 β β Case 6 of 6: If w 0 and m 0 and β 0. Then G 3.3 vv A A nn v A nvn 1 1 v T A n vvT A A nnT vnT 2 2 v n v 2 n 2 (170) (171) Implication on Inverses (A B) 1 A 1 B 1 If then AB 1 A BA 1 B (172) See [25]. 3.3.1 A PosDef identity Assume P, R to be positive definite and invertible, then (P 1 BT R 1 B) 1 BT R 1 PBT (BPBT R) 1 (173) See [30]. 3.4 Approximations The following is a Taylor expansion if An 0 when n , (I A) 1 I A A2 A3 . Note the following variant can be useful 1 1 1 1 2 1 3 1 (I A) I A 2 A 3 A . c c c c c (174) (175) The following approximation is from [22] and holds when A large and symmetric A A(I A) 1 A I A 1 (176) If σ 2 is small compared to Q and M then (Q σ 2 M) 1 Q 1 σ 2 Q 1 MQ 1 (177) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 19

3.5 Generalized Inverse 3.5 3.5.1 3 INVERSES Generalized Inverse Definition A generalized inverse matrix of the matrix A is any matrix A such that (see [26]) AA A A (178) The matrix A is not unique. 3.6 3.6.1 Pseudo Inverse Definition The pseudo inverse (or Moore-Penrose inverse) of a matrix A is the matrix A that fulfils I II III IV AA A A A AA A AA symmetric A A symmetric The matrix A is unique and does always exist. Note that in case of complex matrices, the symmetric condition is substituted by a condition of being Hermitian. Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 20

3.6 Pseudo Inverse 3.6.2 3 INVERSES Properties Assume A to be the pseudo-inverse of A, then (See [3] for some of them) (A ) (AT ) (AH ) (A ) (A A)AH (A A)AT (cA) A A (AT A) (AAT ) A A (AH A) (AAH ) (AB) f (AH A) f (0)I f (AAH ) f (0)I 6 A (A )T (A )H (A ) AH AT (1/c)A (AT A) AT AT (AAT ) A (AT ) (AT ) A (AH A) AH AH (AAH ) A (AH ) (AH ) A (A AB) (ABB ) A [f (AAH ) f (0)I]A A[f (AH A) f (0)I]A (179) (180) (181) (182) (183) (184) (185) (186) (187) (188) (189) (190) (191) (192) (193) (194) (195) (196) where A Cn m . Assume A to have full rank, then (AA )(AA ) (A A)(A A) Tr(AA ) Tr(A A) AA A A rank(AA ) rank(A A) (See [26]) (See [26]) (197) (198) (199) (200) For two matrices it hold that (AB) (A B) 3.6.3 (A AB) (ABB ) A B (201) (202) Construction Assume that A has full rank, then A n n A n m A n m Square Broad Tall rank(A) n rank(A) n rank(A) m A A 1 A AT (AAT ) 1 A (AT A) 1 AT Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 21

3.6 Pseudo Inverse 3 INVERSES Assume A does not have full rank, i.e. A is n m and rank(A) r min(n, m). The pseudo inverse A can be constructed from the singular value decomposition A UDVT , by T A Vr D 1 (203) r Ur where Ur , Dr , and Vr are the matrices with the degenerated rows and columns deleted. A different way is this: There do always exist two matrices C n r and D r m of rank r, such that A CD. Using these matrices it holds that A DT (DDT ) 1 (CT C) 1 CT (204) See [3]. Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 22

4 4 COMPLEX MATRICES Complex Matrices 4.1 Complex Derivatives In order to differentiate an expression f (z) with respect to a complex z, the Cauchy-Riemann equations have to be satisfied ([7]): df (z) (f (z)) (f (z)) i dz z z (205) and df (z) (f (z)) (f (z)) i dz z z or in a more compact form: f (z) f (z) i . z z (206) (207) A complex function that satisfies the Cauchy-Riemann equations for points in a region R is said yo be analytic in this region R. In general, expressions involving complex conjugate or conjugate transpose do not satisfy the Cauchy-Riemann equations. In order to avoid this problem, a more generalized definition of complex derivative is used ([24], [6]): Generalized Complex Derivative: df (z) 1 f (z) f (z) i . dz 2 z z (208) Conjugate Complex Derivative 1 f (z) f (z) df (z) i . dz 2 z z (209) The Generalized Complex Derivative equals the normal derivative, when f is an analytic function. For a non-analytic function such as f (z) z , the derivative equals zero. The Conjugate Complex Derivative equals zero, when f is an analytic function. The Conjugate Complex Derivative has e.g been used by [21] when deriving a complex gradient. Notice: f (z) f (z) df (z) 6 i . (210) dz z z Complex Gradient Vector: If f is a real function of a complex vector z, then the complex gradient vector is given by ([14, p. 798]) f (z) df (z) dz f (z) f (z) i . z z 2 (211) Petersen & Pedersen, The Matrix Cookbook, Version: November 14, 2008, Page 23

4.1 Complex Derivatives 4 COMPLEX MATRICES Complex Gradient Matrix: If f is a real function of a complex matrix Z, then the complex gradient matrix is given by ([2]) f (Z) df (Z) dZ f (Z) f (Z) i . Z Z 2 (212) These expressions can be used for gradient descent algorithms. 4.1.1 The Chain Rule for complex numbers The chain rule is a little more complicated when the function of a complex u f (x) is non-analytic. For a non-analytic function, the following chain rule can be applied ([7]) g(u) x g u g u u x u x g u g u u x u x (213) Notice, if the function is analytic, the second term reduces to zero, and the function is reduced to the normal well-known chain rule. For the matrix derivative of a scalar function g(U)

A Matrix A ij Matrix indexed for some purpose A i Matrix indexed for some purpose Aij Matrix indexed for some purpose An Matrix indexed for some purpose or The n.th power of a square matrix A 1 The inverse matrix of the matrix A A The pseudo inverse matrix of the matrix A (see Sec. 3.6) A1/2 The square root of a matrix (if unique), not .

Related Documents: