
















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















































What is this? These pages are a collection of facts (identities, approxima- tions, 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 apolo- gize and would be grateful to receive corrections at [email protected].
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 [email protected].
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 contribu- tions and suggestions: Christian Rishøj, Douglas L. Theobald, Esben Hoegh- Rasmussen, Lars Christiansen, and Vasile Sima. We would also like thank The Oticon Foundation for funding our PhD studies.
A Matrix Aij Matrix indexed for some purpose Ai 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) A^1 /^2 The square root of a matrix (if unique), not elementwise (A)ij The (i, j).th entry of the matrix A Aij The (i, j).th entry of the matrix A [A]ij The ij-submatrix, i.e. A with i.th row and j.th column deleted a Vector ai Vector indexed for some purpose ai The i.th element of the vector a a Scalar
<z Real part of a scalar <z Real part of a vector <Z Real part of a matrix =z Imaginary part of a scalar =z Imaginary part of a vector =Z Imaginary part of a matrix
det(A) Determinant of A Tr(A) Trace of the matrix A diag(A) Diagonal matrix of the matrix A, i.e. (diag(A))ij = δij Aij vec(A) The vector-version of the matrix A (see Sec. 9.2.2) ||A|| Matrix norm (subscript if any denotes what norm) AT^ Transposed matrix A∗^ Complex conjugated matrix AH^ Transposed and complex conjugated matrix (Hermitian)
A ◦ B Hadamard (elementwise) product A ⊗ B Kronecker product
0 The null matrix. Zero in all entries. I The identity matrix Jij^ The single-entry matrix, 1 at (i, j) and zero elsewhere Σ A positive definite matrix Λ A diagonal matrix
Tr(A) =
iAii Tr(A) =
iλi,^ λi^ = eig(A) Tr(A) = Tr(AT^ ) Tr(AB) = Tr(BA) Tr(A + B) = Tr(A) + Tr(B) Tr(ABC) = Tr(BCA) = Tr(CAB) det(A) =
iλi^ λi^ = eig(A) det(AB) = det(A) det(B) det(A−^1 ) = 1 / det(A) det(I + uvT^ ) = 1 + uT^ v
Consider the matrix A
A =
Determinant and trace
det(A) = A 11 A 22 − A 12 A 21
Tr(A) = A 11 + A 22
Eigenvalues λ^2 − λ · Tr(A) + det(A) = 0
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.5 for differentiation of structured matrices. The basic assumptions can be written in a formula as
∂Xkl ∂Xij
= δikδlj
that is for e.g. vector forms, [ ∂x ∂y
i
∂xi ∂y
∂x ∂y
i
∂x ∂yi
∂x ∂y
ij
∂xi ∂yj
The following rules are general and very useful when deriving the differential of an expression ([13]):
∂A = 0 (A is a constant) (1) ∂(αX) = α∂X (2) ∂(X + Y) = ∂X + ∂Y (3) ∂(Tr(X)) = Tr(∂X) (4) ∂(XY) = (∂X)Y + X(∂Y) (5) ∂(X ◦ Y) = (∂X) ◦ Y + X ◦ (∂Y) (6) ∂(X ⊗ Y) = (∂X) ⊗ Y + X ⊗ (∂Y) (7) ∂(X−^1 ) = −X−^1 (∂X)X−^1 (8) ∂(det(X)) = det(X)Tr(X−^1 ∂X) (9) ∂(ln(det(X))) = Tr(X−^1 ∂X) (10) ∂XT^ = (∂X)T^ (11) ∂XH^ = (∂X)H^ (12)
2.1.1 General form
∂ det(Y) ∂x = det(Y)Tr
∂x
2.1.2 Linear forms
∂ det(X) ∂X = det(X)(X−^1 )T
∂ det(AXB) ∂X = det(AXB)(X−^1 )T^ = det(AXB)(XT^ )−^1
2.2 Derivatives of an Inverse 2 DERIVATIVES
2.1.3 Square forms
If X is square and invertible, then
∂ det(XT^ AX) ∂X
= 2 det(XT^ AX)X−T
If X is not square but A is symmetric, then
∂ det(XT^ AX) ∂X
= 2 det(XT^ AX)AX(XT^ AX)−^1
If X is not square and A is not symmetric, then
∂ det(XT^ AX) ∂X
= det(XT^ AX)(AX(XT^ AX)−^1 + AT^ X(XT^ AT^ X)−^1 ) (13)
2.1.4 Other nonlinear forms
Some special cases are (See [8, 7])
∂ ln det(XT^ X)| ∂X
∂ ln det(XT^ X) ∂X+^
∂ ln | det(X)| ∂X
∂ det(Xk) ∂X
= k det(Xk)X−T
From [19] we have the basic identity
∂Y−^1 ∂x
∂x
from which it follows
∂(X−^1 )kl ∂Xij
= −(X−^1 )ki(X−^1 )jl
∂aT^ X−^1 b ∂X = −X−T^ abT^ X−T ∂ det(X−^1 ) ∂X
= − det(X−^1 )(X−^1 )T
∂Tr(AX−^1 B) ∂X
2.3 Derivatives of Matrices, Vectors and Scalar Forms 2 DERIVATIVES
Assume W is symmetric, then
∂ ∂s
(x − As)T^ W(x − As) = − 2 AT^ W(x − As) ∂ ∂s
(x − s)T^ W(x − s) = − 2 W(x − s) ∂ ∂x
(x − As)T^ W(x − As) = 2 W(x − As) ∂ ∂A
(x − As)T^ W(x − As) = − 2 W(x − As)sT
2.3.3 Higher order and non-linear
aT^ Xnb =
n∑− 1
r=
(Xr^ )T^ abT^ (Xn−^1 −r^ )T^ (14)
aT^ (Xn)T^ Xnb =
n∑− 1
r=
Xn−^1 −r^ abT^ (Xn)T^ Xr
+(Xr^ )T^ XnabT^ (Xn−^1 −r^ )T^
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
∂ ∂x
sT^ Ar =
∂s ∂x
Ar + sT^ A
∂r ∂x
2.3.4 Gradient and Hessian
Using the above we have for the gradient and the hessian
f = xT^ Ax + bT^ x
∇xf =
∂f ∂x = (A + AT^ )x + b
∂^2 f ∂x∂xT^
2.4 Derivatives of Traces 2 DERIVATIVES
2.4.1 First Order
Tr(X) = I ∂ ∂X
Tr(XA) = AT^ (16) ∂ ∂X
Tr(AXB) = AT^ BT ∂ ∂X
Tr(AXT^ B) = BA ∂ ∂X
Tr(XT^ A) = A ∂ ∂X
Tr(AXT^ ) = A
2.4.2 Second Order
Tr(X^2 ) = 2 XT ∂ ∂X
Tr(X^2 B) = (XB + BX)T ∂ ∂X
Tr(XT^ BX) = BX + BT^ X ∂ ∂X
Tr(XBXT^ ) = XBT^ + XB ∂ ∂X
Tr(AXBX) = AT^ XT^ BT^ + BT^ XT^ AT ∂ ∂X
Tr(XT^ X) = 2 X ∂ ∂X
Tr(BXXT^ ) = (B + BT^ )X ∂ ∂X
Tr(BT^ XT^ CXB) = CT^ XBBT^ + CXBBT ∂ ∂X
Tr
Tr(AXBXT^ C) = AT^ CT^ XBT^ + CAXB ∂ ∂X
Tr
(AXb + c)(AXb + c)T^
= 2 AT^ (AXb + c)bT
See [7].
2.5 Derivatives of Structured Matrices 2 DERIVATIVES
2.5.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(U) ∂X
∂g(f (X)) ∂X
Then the Chain Rule can then be written the following way:
∂g(U) ∂X
∂g(U) ∂xij
k=
l=
∂g(U) ∂ukl
∂ukl ∂xij
Using matrix notation, this can be written as:
∂g(U) ∂Xij
= Tr
∂g(U) ∂U
∂Xij
2.5.2 Symmetric
If A is symmetric, then Sij^ = Jij^ + Jji^ − Jij^ Jij^ and therefore
df dA
∂f ∂A
∂f ∂A
− diag
∂f ∂A
That is, e.g., ([5], [20]):
∂Tr(AX) ∂X
= A + AT^ − (A ◦ I), see (23) (20) ∂ det(X) ∂X
= det(X)(2X−^1 − (X−^1 ◦ I)) (21) ∂ ln det(X) ∂X
2.5.3 Diagonal
If X is diagonal, then ([13]):
∂Tr(AX) ∂X
2.5.4 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.
2.5 Derivatives of Structured Matrices 2 DERIVATIVES
∂Tr(AT) ∂T
∂Tr(TA) ∂T
Tr(A) Tr([AT^ ]n 1 ) Tr([[AT^ ] 1 n]n− 1 , 2 ) · · · An 1 Tr([AT^ ] 1 n)) Tr(A)
.. . .. .
.. . Tr([[AT^ ] 1 n] 2 ,n− 1 )
.. . .. . .. . (^) Tr([[AT^ ] 1 n]n− 1 , 2 ) .. . .. . .. . .. . (^) Tr([AT^ ]n 1 ) A 1 n · · · Tr([[AT^ ] 1 n] 2 ,n− 1 ) Tr([AT^ ] 1 n)) Tr(A)
≡ α(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) ∂T
∂Tr(TA) ∂T = α(A) + α(A)T^ − α(A) ◦ I (25)
3.2 Exact Relations 3 INVERSES
3.1.5 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.2 on singular values),
c(A) = d+ d−
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) = ‖A‖ · ‖A−^1 ‖, (32)
where ‖ · ‖ is a norm such as e.g the 1-norm, the 2-norm, the ∞-norm or the Frobenius norm (see Sec 9.4 for more on matrix norms).
3.2.1 The Woodbury identity
If P, R are positive definite, then (see [22])
(P−^1 + BT^ R−^1 B)−^1 BT^ R−^1 = PBT^ (BPBT^ + R)−^1
3.2.2 The Kailath Variant
See [4] page 153.
3.2.3 The Searle Set of Identities
The following set of identities, can be found in [17], 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.3 Implication on Inverses 3 INVERSES
See [17].
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
See [22].
A − A(I + A)−^1 A ∼= I − A−^1 if A large and symmetric
If σ^2 is small then
(Q + σ^2 M)−^1 ∼= Q−^1 − σ^2 Q−^1 MQ−^1
3.5.1 Definition
A generalized inverse matrix of the matrix A is any matrix A−^ such that (see [18]) AA−A = A
The matrix A−^ is not unique.
3.6.1 Definition
The pseudo inverse (or Moore-Penrose inverse) of a matrix A is the matrix A+ that fulfils
I AA+A = A II A+AA+^ = A+ III AA+^ symmetric IV A+A symmetric
The matrix A+^ is unique and does always exist.
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) dz
∂<(f (z)) ∂<z
and df (z) dz
= −i
∂<(f (z)) ∂=z
∂=(f (z)) ∂=z
or in a more compact form:
∂f (z) ∂=z
= i
∂f (z) ∂<z
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 ([16], [6]):
df (z) dz
( (^) ∂f (z) ∂<z
− i ∂f (z) ∂=z
df (z) dz∗^
( (^) ∂f (z) ∂<z
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 [14] when deriving a complex gradient. Notice: df (z) dz
∂f (z) ∂<z
∇f (z) = 2
df (z) dz∗^
∂f (z) ∂<z
∂f (z) ∂=z
4.1 Complex Derivatives 4 COMPLEX MATRICES
∇f (Z) = 2
df (Z) dZ∗^
∂f (Z) ∂<Z
∂f (Z) ∂=Z
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
∂u ∂x
∂g ∂u∗
∂u∗ ∂x
∂g ∂u
∂u ∂x
( (^) ∂g∗ ∂u
)∗ (^) ∂u∗ ∂x
Notice, if the function is analytic, the second term reduces to zero, and the func- tion is reduced to the normal well-known chain rule. For the matrix derivative of a scalar function g(U), the chain rule can be written the following way:
∂g(U) ∂X
Tr(( ∂g ∂(UU ))T^ ∂U) ∂X
Tr(( ∂g ∂U(U∗ ))T^ ∂U∗) ∂X
4.1.2 Complex Derivatives of Traces
If the derivatives involve complex numbers, the conjugate transpose is often in- volved. The most useful way to show complex derivative is to show the derivative with respect to the real and the imaginary part separately. An easy example is:
∂Tr(X∗) ∂<X
∂Tr(XH^ ) ∂<X
i
∂Tr(X∗) ∂=X
= i
∂Tr(XH^ ) ∂=X
Since the two results have the same sign, the conjugate complex derivative (37) should be used.
∂Tr(X) ∂<X
∂Tr(XT^ ) ∂<X
i
∂Tr(X) ∂=X
= i
∂Tr(XT^ ) ∂=X
Here, the two results have different signs, the generalized complex derivative (36) should be used. Hereby, it can be seen that (16) holds even if X is a