- Matrix calculus
-
In mathematics, matrix calculus is a specialized notation for doing multivariable calculus, especially over spaces of matrices, where it defines the matrix derivative. This notation was to describe systems of differential equations, and taking derivatives of matrix-valued functions with respect to matrix variables. This notation is commonly used in statistics and engineering, while the tensor index notation is preferred in physics.
Note this article uses an alternate definition for vector and matrix calculus than the form often encountered within the field of estimation theory and pattern recognition. The resulting equations therefore appear to be transposed when compared to the equations used in textbooks within these fields.
Contents
Notation
Let M(n,m) denote the space of real n×m matrices with n rows and m columns, such matrices will be denoted using bold capital letters: A, X, Y, etc. An element of M(n,1), that is, a column vector, is denoted with a boldface lowercase letter: a, x, y, etc. An element of M(1,1) is a scalar, denoted with lowercase italic typeface: a, t, x, etc. XT denotes matrix transpose, tr(X) is trace, and det(X) is the determinant. All functions are assumed to be of differentiability class C1 unless otherwise noted. Generally letters from first half of the alphabet (a, b, c, …) will be used to denote constants, and from the second half (t, x, y, …) to denote variables.
Vector calculus
Main article: Vector calculusBecause the space M(n,1) is identified with the Euclidean space Rn and M(1,1) is identified with R, the notations developed here can accommodate the usual operations of vector calculus.
- The tangent vector to a curve x : R → Rn is
- The gradient of a scalar function f : Rn → R
- The pushforward or differential of a function f : Rm → Rn is described by the Jacobian matrix
Matrix calculus
For the purposes of defining derivatives of simple functions, not much changes with matrix spaces; the space of n×m matrices is isomorphic to the vector space Rnm.[dubious ] The three derivatives familiar from vector calculus have close analogues here, though beware the complications that arise in the identities below.
- The tangent vector of a curve F : R → M(n,m)
- The gradient of a scalar function f : M(n,m) → R
- The differential or the matrix derivative of a function F : M(n,m) → M(p,q) is an element of M(p,q) ⊗ M(m,n), a fourth-rank tensor (the reversal of m and n here indicates the dual space of M(n,m)). In short it is an m×n matrix each of whose entries is a p×q matrix.[citation needed]
- as formal block matrices.
According to Jan R. Magnus and Heinz Neudecker, the following notations are both unsuitable, as the determinants of the resulting matrices would have "no interpretation" and "a useful chain rule does not exist" if these notations are being used:[1]
The Jacobian matrix, according to Magnus and Neudecker,[1] is
Identities
Note that matrix multiplication is not commutative, so in these identities, the order must not be changed.
- Chain rule: If Z is a function of Y which in turn is a function of X, and these are all column vectors, then [2]
- Product rule:In all cases where the derivatives do not involve tensor products (for example, Y has more than one row and X has more than one column),[citation needed]
Examples
Derivative of linear functions
This section lists some commonly used vector derivative formulas for linear equations evaluating to a vector.
Derivative of quadratic functions
This section lists some commonly used vector derivative formulas for quadratic matrix equations evaluating to a scalar.
Related to this is the derivative of the Euclidean norm:
Derivative of matrix traces
This section shows examples of matrix differentiation of common trace equations.
Derivative of matrix determinant
Relation to other derivatives
The matrix derivative is a convenient notation for keeping track of partial derivatives for doing calculations. The Fréchet derivative is the standard way in the setting of functional analysis to take derivatives with respect to vectors. In the case that a matrix function of a matrix is Fréchet differentiable, the two derivatives will agree up to translation of notations. As is the case in general for partial derivatives, some formulae may extend under weaker analytic conditions than the existence of the derivative as approximating linear mapping.
Usages
Matrix calculus is used for deriving optimal stochastic estimators, often involving the use of Lagrange multipliers. This includes the derivation of:
Alternatives
The tensor index notation with its Einstein summation convention is very similar to the matrix calculus, except one writes only a single component at a time. It has the advantage that one can easily manipulate arbitrarily high rank tensors, whereas tensors of rank higher than two are quite unwieldy with matrix notation. Note that a matrix can be considered simply a tensor of rank two.
See also
Notes
- ^ a b Magnus, Jan R.; Neudecker, Heinz (1999 (1988)). Matrix Differential Calculus. Wiley Series in Probability and Statistics (revised ed.). Wiley. pp. 171–173.
- ^ Introduction to Finite Element Methods http://www.colorado.edu/engineering/CAS/courses.d/IFEM.d/ p. D 5
- ^ Duchi, John C. "Properties of the Trace and Matrix Derivatives". University of California at Berkeley. http://www.cs.berkeley.edu/~jduchi/projects/matrix_prop.pdf. Retrieved 19 July 2011.
- ^ "Derivation of Derivative of Determinant". http://en.wikipedia.org/wiki/Determinant#Derivative.
External links
- Matrix Calculus appendix from Introduction to Finite Element Methods book on University of Colorado at Boulder. Uses the Hessian (transpose to Jacobian) definition of vector and matrix derivatives.
- Matrix calculus Matrix Reference Manual , Imperial College London.
- The Matrix Cookbook, with a derivatives chapter. Uses the Hessian definition.
- Linear Algebra and its applications, Chapter 9, by Peter Lax
- [1] Matrix Differentiation
- The tangent vector to a curve x : R → Rn is
Wikimedia Foundation. 2010.