In linear algebra, the trace of an n-by-n square matrix A is defined to be the sum of the elements on the main diagonal (the diagonal from the upper left to the lower right) of A, i.e.,
Contents
- Example
- Basic properties
- Trace of a product
- Other properties
- Exponential trace
- Trace of a linear operator
- Eigenvalue relationships
- Derivatives
- Applications
- Lie algebra
- Bilinear forms
- Inner product
- Generalizations
- Coordinate free definition
- Dual
- References
where aii denotes the entry on the ith row and ith column of A. The trace of a matrix is the sum of the (complex) eigenvalues, and it is invariant with respect to a change of basis. This characterization can be used to define the trace of a linear operator in general. Note that the trace is only defined for a square matrix (i.e., n × n).
The trace (often abbreviated to "tr") is related to the derivative of the determinant (see Jacobi's formula).
Example
Let A be a matrix, with
Then
Basic properties
The trace is a linear mapping. That is,
for all square matrices A and B, and all scalars c.
A matrix and its transpose have the same trace:
This follows immediately from the fact that transposing a square matrix does not affect elements along the main diagonal.
Trace of a product
The trace of a product can be rewritten as the sum of entry-wise products of elements:
This means that the trace of a product of matrices functions similarly to a dot product of vectors. For this reason, generalizations of vector operations to matrices (e.g. in matrix calculus and statistics) often involve a trace of matrix products.
For real matrices, the trace of a product can also be written in the following forms:
The matrices in a trace of a product can be switched without changing the result: If A is an m × n matrix and B is an n × m matrix, then
More generally, the trace is invariant under cyclic permutations, i.e.,
This is known as the cyclic property.
Note that arbitrary permutations are not allowed: in general,
However, if products of three symmetric matrices are considered, any permutation is allowed. (Proof: tr(ABC) = tr(AT BT CT) = tr(AT(CB)T) = tr((CB)TAT) = tr((ACB)T) = tr(ACB), where the last equality is because the traces of a matrix and its transpose are equal.) For more than three factors this is not true.
Unlike the determinant, the trace of the product is not the product of traces, that is:
What is true is that the trace of the Kronecker product of two matrices is the product of their traces:
Other properties
The following three properties:
characterize the trace completely in the sense that follows. Let f be a linear functional on the space of square matrices satisfying f(x y) = f(y x). Then f and tr are proportional.
The trace is similarity-invariant, which means that A and P−1AP have the same trace. This is because
If A is symmetric and B is antisymmetric, then
The trace of the identity matrix is the dimension of the space; this leads to generalizations of dimension using trace. The trace of an idempotent matrix A (for which A2 = A) is the rank of A. The trace of a nilpotent matrix is zero.
More generally, if f(x) = (x − λ1)d1···(x − λk)dk is the characteristic polynomial of a matrix A, then
When both A and B are n-by-n, the trace of the (ring-theoretic) commutator of A and B vanishes: tr([A, B]) = 0; one can state this as "the trace is a map of Lie algebras
Conversely, any square matrix with zero trace is a linear combinations of the commutators of pairs of matrices. Moreover, any square matrix with zero trace is unitarily equivalent to a square matrix with diagonal consisting of all zeros.
The trace of any power of a nilpotent matrix is zero. When the characteristic of the base field is zero, the converse also holds: if
The trace of a Hermitian matrix is real, because the elements on the diagonal are real.
The trace of a projection matrix is the dimension of the target space. If
thenExponential trace
Expressions like tr(exp(A)), where A is a square matrix, occur so often in some fields (e.g. multivariate statistical theory), that a shorthand notation has become common:
This is sometimes referred to as the exponential trace function; it is used in the Golden–Thompson inequality.
Trace of a linear operator
Given some linear map f : V → V (where V is a finite-dimensional vector space) generally, we can define the trace of this map by considering the trace of matrix representation of f, that is, choosing a basis for V and describing f as a matrix relative to this basis, and taking the trace of this square matrix. The result will not depend on the basis chosen, since different bases will give rise to similar matrices, allowing for the possibility of a basis-independent definition for the trace of a linear map.
Such a definition can be given using the canonical isomorphism between the space End(V) of linear maps on V and V ⊗ V∗, where V∗ is the dual space of V. Let v be in V and let f be in V∗. Then the trace of the indecomposable element v ⊗ f is defined to be f(v); the trace of a general element is defined by linearity. Using an explicit basis for V and the corresponding dual basis for V∗, one can show that this gives the same definition of the trace as given above.
Eigenvalue relationships
If A is a linear operator represented by a square n-by-n matrix with real or complex entries and if λ1, ..., λn are the eigenvalues of A (listed according to their algebraic multiplicities), then
This follows from the fact that A is always similar to its Jordan form, an upper triangular matrix having λ1, ..., λn on the main diagonal. In contrast, the determinant of A is the product of its eigenvalues; i.e.,
More generally,
Derivatives
The trace corresponds to the derivative of the determinant: it is the Lie algebra analog of the (Lie group) map of the determinant. This is made precise in Jacobi's formula for the derivative of the determinant.
As a particular case, at the identity, the derivative of the determinant actually amounts to the trace:
For example, consider the one-parameter family of linear transformations given by rotation through angle θ,
These transformations all have determinant 1, so they preserve area. The derivative of this family at θ = 0, the identity rotation, is the antisymmetric matrix
which clearly has trace zero, indicating that this matrix represents an infinitesimal transformation which preserves area.
A related characterization of the trace applies to linear vector fields. Given a matrix A, define a vector field F on ℝn by F(x) = Ax. The components of this vector field are linear functions (given by the rows of A). Its divergence div F is a constant function, whose value is equal to tr(A). By the divergence theorem, one can interpret this in terms of flows: if F(x) represents the velocity of a fluid at location x and U is a region in ℝn, the net flow of the fluid out of U is given by tr(A) ⋅ vol(U), where vol(U) is the volume of U.
The trace is a linear operator, hence it commutes with the derivative:
Applications
The trace of a 2-by-2 complex matrix is used to classify Möbius transformations. First the matrix is normalized to make its determinant equal to one. Then, if the square of the trace is 4, the corresponding transformation is parabolic. If the square is in the interval [0,4), it is elliptic. Finally, if the square is greater than 4, the transformation is loxodromic. See classification of Möbius transformations.
The trace is used to define characters of group representations. Two representations
The trace also plays a central role in the distribution of quadratic forms.
Lie algebra
The trace is a map of Lie algebras
The kernel of this map, a matrix whose trace is zero, is often said to be traceless or tracefree, and these matrices form the simple Lie algebra sln, which is the Lie algebra of the special linear group of matrices with determinant 1. The special linear group consists of the matrices which do not change volume, while the special linear Lie algebra is the matrices which infinitesimally do not change volume.
In fact, there is an internal direct sum decomposition
Formally, one can compose the trace (the counit map) with the unit map
In terms of short exact sequences, one has
which is analogous to
for Lie groups. However, the trace splits naturally (via
Bilinear forms
The bilinear form
is called the Killing form, which is used for the classification of Lie algebras.
The trace defines a bilinear form:
(x, y square matrices).
The form is symmetric, non-degenerate and associative in the sense that:
For a complex simple Lie algebra (e.g.,
Two matrices x and y are said to be trace orthogonal if
Inner product
For an m-by-n matrix A with complex (or real) entries and * being the conjugate transpose, we have
with equality if and only if A = 0. The assignment
yields an inner product on the space of all complex (or real) m-by-n matrices.
The norm derived from the above inner product is called the Frobenius norm, which satisfies submultiplicative property as matrix norm. Indeed, it is simply the Euclidean norm if the matrix is considered as a vector of length m n.
It follows that if A and B are real positive semi-definite matrices of the same size then
Generalizations
The concept of trace of a matrix is generalized to the trace class of compact operators on Hilbert spaces, and the analog of the Frobenius norm is called the Hilbert–Schmidt norm.
If
and is finite and independent of the orthonormal basis.
The partial trace is another generalization of the trace that is operator-valued. The trace of a linear operator
If A is a general associative algebra over a field k, then a trace on A is often defined to be any map tr: A → k which vanishes on commutators: tr([a, b]) = 0 for all a, b in A. Such a trace is not uniquely defined; it can always at least be modified by multiplication by a nonzero scalar.
A supertrace is the generalization of a trace to the setting of superalgebras.
The operation of tensor contraction generalizes the trace to arbitrary tensors.
Coordinate-free definition
We can identify the space of linear operators on a vector space V, defined over the field F, with the space
This also clarifies why
coming from the pairing
In coordinates, this corresponds to indexes: multiplication is given by
For
Dual
Further, one may dualize this map, obtaining a map
One can then compose these,