# Trace (linear algebra)

__: Sum of elements on the main diagonal__

**Short description**In linear algebra, the **trace** of a square matrix **A**, denoted tr(**A**),^{[1]} is defined to be the sum of elements on the main diagonal (from the upper left to the lower right) of **A**. The trace is only defined for a square matrix (*n* × *n*).

It can be proven that the trace of a real matrix is the sum of its (complex) eigenvalues (counted with multiplicities). It can also be proven that tr(**AB**) = tr(**BA**) for any two matrices **A** and **B** of appropriate sizes. This implies that similar matrices have the same trace. As a consequence one can define the trace of a linear operator mapping a finite-dimensional vector space into itself, since all matrices describing such an operator with respect to a basis are similar.

The trace is related to the derivative of the determinant (see Jacobi's formula).

## Definition

The **trace** of an *n* × *n* square matrix **A** is defined as^{[1]}^{[2]}^{[3]}^{:34}
[math]\displaystyle{ \operatorname{tr}(\mathbf{A}) = \sum_{i=1}^n a_{ii} = a_{11} + a_{22} + \dots + a_{nn} }[/math]
where *a _{ii}* denotes the entry on the ith row and ith column of

**A**. The entries of

**A**can be real numbers, complex numbers, or more generally elements of a field

*F*. The trace is not defined for non-square matrices.

## Example

Let **A** be a matrix, with
[math]\displaystyle{ \mathbf{A} =
\begin{pmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{pmatrix} =
\begin{pmatrix}
1 & 0 & 3 \\
11 & 5 & 2 \\
6 & 12 & -5
\end{pmatrix}
}[/math]

Then [math]\displaystyle{ \operatorname{tr}(\mathbf{A}) = \sum_{i=1}^{3} a_{ii} = a_{11} + a_{22} + a_{33} = 1 + 5 + (-5) = 1 }[/math]

## Properties

### Basic properties

The trace is a linear mapping. That is,^{[1]}^{[2]}
[math]\displaystyle{ \begin{align}
\operatorname{tr}(\mathbf{A} + \mathbf{B}) &= \operatorname{tr}(\mathbf{A}) + \operatorname{tr}(\mathbf{B}) \\
\operatorname{tr}(c\mathbf{A}) &= c \operatorname{tr}(\mathbf{A})
\end{align} }[/math]
for all square matrices **A** and **B**, and all scalars c.^{[3]}^{:34}

A matrix and its transpose have the same trace:^{[1]}^{[2]}^{[3]}^{:34}
[math]\displaystyle{ \operatorname{tr}(\mathbf{A}) = \operatorname{tr}\left(\mathbf{A}^\mathsf{T}\right). }[/math]

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 square matrix which is the product of two real matrices can be rewritten as the sum of entry-wise products of their elements, i.e. as the sum of all elements of their Hadamard product. Phrased directly, if **A** and **B** are two *m* × *n* real matrices, then:
[math]\displaystyle{
\operatorname{tr}\left(\mathbf{A}^\mathsf{T}\mathbf{B}\right) =
\operatorname{tr}\left(\mathbf{A}\mathbf{B}^\mathsf{T}\right) =
\operatorname{tr}\left(\mathbf{B}^\mathsf{T}\mathbf{A}\right) =
\operatorname{tr}\left(\mathbf{B}\mathbf{A}^\mathsf{T}\right) =
\sum_{i=1}^m \sum_{j=1}^n a_{ij}b_{ij} \; .
}[/math]

If one views any *m* × *n* real matrix as a vector of length mn (an operation called vectorization) then the above operation on **A** and **B** coincides with the standard dot product. According to the above expression, tr(**A**^{⊤}**A**) is a sum of squares and hence is nonnegative, equal to zero if and only if **A** is zero.^{[4]}^{:7} Furthermore, as noted in the above formula, tr(**A**^{⊤}**B**) = tr(**B**^{⊤}**A**). These demonstrate the positive-definiteness and symmetry required of an inner product; it is common to call tr(**A**^{⊤}**B**) the Frobenius inner product of **A** and **B**. This is a natural inner product on the vector space of all real matrices of fixed dimensions. The norm derived from this inner product is called the Frobenius norm, and it satisfies a submultiplicative property, as can be proven with the Cauchy–Schwarz inequality:
[math]\displaystyle{ 0 \leq
\left[\operatorname{tr}(\mathbf{A} \mathbf{B})\right]^2 \leq
\operatorname{tr}\left(\mathbf{A}^2\right) \operatorname{tr}\left(\mathbf{B}^2\right) \leq
\left[\operatorname{tr}(\mathbf{A})\right]^2 \left[\operatorname{tr}(\mathbf{B})\right]^2 \ , }[/math]
if **A** and **B** are real positive semi-definite matrices of the same size. The Frobenius inner product and norm arise frequently in matrix calculus and statistics.

The Frobenius inner product may be extended to a hermitian inner product on the complex vector space of all complex matrices of a fixed size, by replacing **B** by its complex conjugate.

The symmetry of the Frobenius inner product may be phrased more directly as follows: the matrices in the trace of a product can be switched without changing the result. If **A** and **B** are *m* × *n* and *n* × *m* real or complex matrices, respectively, then^{[1]}^{[2]}^{[3]}^{:34}^{[note 1]}

[math]\displaystyle{ \operatorname{tr}(\mathbf{A}\mathbf{B}) = \operatorname{tr}(\mathbf{B}\mathbf{A}) }[/math]

This is notable both for the fact that **AB** does not usually equal **BA**, and also since the trace of either does not usually equal tr(**A**)tr(**B**).^{[note 2]} The similarity-invariance of the trace, meaning that tr(**A**) = tr(**P**^{−1}**AP**) for any square matrix **A** and any invertible matrix **P** of the same dimensions, is a fundamental consequence. This is proved by
[math]\displaystyle{
\operatorname{tr}\left(\mathbf{P}^{-1}(\mathbf{A}\mathbf{P})\right) =
\operatorname{tr}\left((\mathbf{A} \mathbf{P})\mathbf{P}^{-1}\right) =
\operatorname{tr}(\mathbf{A}).
}[/math]
Similarity invariance is the crucial property of the trace in order to discuss traces of linear transformations as below.

Additionally, for real column vectors [math]\displaystyle{ \mathbf{a}\in\mathbb{R}^n }[/math] and [math]\displaystyle{ \mathbf{b}\in\mathbb{R}^n }[/math], the trace of the outer product is equivalent to the inner product:

[math]\displaystyle{ \operatorname{tr}\left(\mathbf{b}\mathbf{a}^\textsf{T}\right) = \mathbf{a}^\textsf{T}\mathbf{b} }[/math]

### Cyclic property

More generally, the trace is *invariant under circular shifts*, that is,

[math]\displaystyle{ \operatorname{tr}(\mathbf{A}\mathbf{B}\mathbf{C}\mathbf{D}) = \operatorname{tr}(\mathbf{B}\mathbf{C}\mathbf{D}\mathbf{A}) = \operatorname{tr}(\mathbf{C}\mathbf{D}\mathbf{A}\mathbf{B}) = \operatorname{tr}(\mathbf{D}\mathbf{A}\mathbf{B}\mathbf{C}). }[/math]

This is known as the *cyclic property*.

Arbitrary permutations are not allowed: in general, [math]\displaystyle{ \operatorname{tr}(\mathbf{A}\mathbf{B}\mathbf{C}) \ne \operatorname{tr}(\mathbf{A}\mathbf{C}\mathbf{B}). }[/math]

However, if products of *three* symmetric matrices are considered, any permutation is allowed, since:
[math]\displaystyle{ \operatorname{tr}(\mathbf{A}\mathbf{B}\mathbf{C}) = \operatorname{tr}\left(\left(\mathbf{A}\mathbf{B}\mathbf{C}\right)^{\mathsf T}\right) = \operatorname{tr}(\mathbf{C}\mathbf{B}\mathbf{A}) = \operatorname{tr}(\mathbf{A}\mathbf{C}\mathbf{B}), }[/math]
where the first equality is because the traces of a matrix and its transpose are equal. Note that this is not true in general for more than three factors.

### Trace of a Kronecker product

The trace of the Kronecker product of two matrices is the product of their traces: [math]\displaystyle{ \operatorname{tr}(\mathbf{A} \otimes \mathbf{B}) = \operatorname{tr}(\mathbf{A})\operatorname{tr}(\mathbf{B}). }[/math]

### Characterization of the trace

The following three properties:
[math]\displaystyle{ \begin{align}
\operatorname{tr}(\mathbf{A} + \mathbf{B}) &= \operatorname{tr}(\mathbf{A}) + \operatorname{tr}(\mathbf{B}), \\
\operatorname{tr}(c\mathbf{A}) &= c \operatorname{tr}(\mathbf{A}), \\
\operatorname{tr}(\mathbf{A}\mathbf{B}) &= \operatorname{tr}(\mathbf{B}\mathbf{A}),
\end{align} }[/math]
characterize the trace up to a scalar multiple in the following sense: If [math]\displaystyle{ f }[/math] is a linear functional on the space of square matrices that satisfies [math]\displaystyle{ f(xy) = f(yx), }[/math] then [math]\displaystyle{ f }[/math] and [math]\displaystyle{ \operatorname{tr} }[/math] are proportional.^{[note 3]}

For [math]\displaystyle{ n\times n }[/math] matrices, imposing the normalization [math]\displaystyle{ f(\mathbf{I}) = n }[/math] makes [math]\displaystyle{ f }[/math] equal to the trace.

### Trace as the sum of eigenvalues

Given any *n* × *n* real or complex matrix **A**, there is

[math]\displaystyle{ \operatorname{tr}(\mathbf{A}) = \sum_{i=1}^n \lambda_i }[/math]

where λ_{1}, ..., λ_{n} are the eigenvalues of **A** counted with multiplicity. This holds true even if **A** is a real matrix and some (or all) of the eigenvalues are complex numbers. This may be regarded as a consequence of the existence of the Jordan canonical form, together with the similarity-invariance of the trace discussed above.

### Trace of commutator

When both **A** and **B** are *n* × *n* matrices, the trace of the (ring-theoretic) commutator of **A** and **B** vanishes: tr([**A**, **B**]) = 0, because tr(**AB**) = tr(**BA**) and tr is linear. One can state this as "the trace is a map of Lie algebras gl_{n} → *k* from operators to scalars", as the commutator of scalars is trivial (it is an Abelian Lie algebra). In particular, using similarity invariance, it follows that the identity matrix is never similar to the commutator of any pair of matrices.

Conversely, any square matrix with zero trace is a linear combination of the commutators of pairs of matrices.^{[note 4]} Moreover, any square matrix with zero trace is unitarily equivalent to a square matrix with diagonal consisting of all zeros.

### Traces of special kinds of matrices

- The trace of the
*n*×*n*identity matrix is the dimension of the space, namely n.

- [math]\displaystyle{ \operatorname{tr}\left(\mathbf{I}_n\right) = n }[/math]

- This leads to generalizations of dimension using trace.

- The trace of a Hermitian matrix is real, because the elements on the diagonal are real.
- The trace of a permutation matrix is the number of fixed points of the corresponding permutation, because the diagonal term
*a*_{ii}is 1 if the*i*th point is fixed and 0 otherwise. - The trace of a projection matrix is the dimension of the target space.

- [math]\displaystyle{ \begin{align} \mathbf{P}_\mathbf{X} &= \mathbf{X}\left(\mathbf{X}^\mathsf{T} \mathbf{X}\right)^{-1} \mathbf{X}^\mathsf{T} \\[3pt] \Longrightarrow \operatorname{tr}\left(\mathbf{P}_\mathbf{X}\right) &= \operatorname{rank}(\mathbf{X}). \end{align} }[/math]

- The matrix
**P**is idempotent._{X}

- More generally, the trace of any idempotent matrix, i.e. one with
**A**^{2}=**A**, equals its own rank. - The trace of a nilpotent matrix is zero.

- When the characteristic of the base field is zero, the converse also holds: if tr(
**A**^{k}) = 0 for all k, then**A**is nilpotent. - When the characteristic
*n*> 0 is positive, the identity in n dimensions is a counterexample, as [math]\displaystyle{ \operatorname{tr}\left(\mathbf{I}_n^k\right) = \operatorname{tr}\left(\mathbf{I}_n\right) = n \equiv 0 }[/math], but the identity is not nilpotent.

### Relationship to the characteristic polynomial

The trace of an [math]\displaystyle{ n \times n }[/math] matrix [math]\displaystyle{ A }[/math] is the coefficient of [math]\displaystyle{ t^{n-1} }[/math] in the characteristic polynomial, possibly changed of sign, according to the convention in the definition of the characteristic polynomial.

## Relationship to eigenvalues

If **A** is a linear operator represented by a square matrix with real or complex entries and if *λ*_{1}, ..., *λ _{n}* are the eigenvalues of

**A**(listed according to their algebraic multiplicities), then

[math]\displaystyle{ \operatorname{tr}(\mathbf{A}) = \sum_i \lambda_i }[/math]

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; that is, [math]\displaystyle{ \det(\mathbf{A}) = \prod_i \lambda_i. }[/math]

Everything in the present section applies as well to any square matrix with coefficients in an algebraically closed field.

### Derivative relationships

If **ΔA** is a square matrix with small entries and **I** denotes the identity matrix, then we have approximately

[math]\displaystyle{ \det(\mathbf{I}+\mathbf{\Delta A})\approx 1 + \operatorname{tr}(\mathbf{\Delta A}). }[/math]

Precisely this means that the trace is the derivative of the determinant function at the identity matrix. Jacobi's formula

[math]\displaystyle{ d\det(\mathbf{A}) = \operatorname{tr} \big(\operatorname{adj}(\mathbf{A})\cdot d\mathbf{A}\big) }[/math]

is more general and describes the differential of the determinant at an arbitrary square matrix, in terms of the trace and the adjugate of the matrix.

From this (or from the connection between the trace and the eigenvalues), one can derive a relation between the trace function, the matrix exponential function, and the determinant:[math]\displaystyle{ \det(\exp(\mathbf{A})) = \exp(\operatorname{tr}(\mathbf{A})). }[/math]

A related characterization of the trace applies to linear vector fields. Given a matrix **A**, define a vector field **F** on **R**^{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 **R**^{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: [math]\displaystyle{ d \operatorname{tr} (\mathbf{X}) = \operatorname{tr}(d\mathbf{X}) . }[/math]

## Trace of a linear operator

In general, given some linear map *f* : *V* → *V* (where V is a finite-dimensional vector space), we can define the trace of this map by considering the trace of a 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 g be in *V**. Then the trace of the indecomposable element *v* ⊗ *g* is defined to be *g*(*v*); the trace of a general element is defined by linearity. The trace of a linear map *f* : *V* → *V* can then be defined as the trace, in the above sense, of the element of *V* ⊗ *V** corresponding to *f* under the above mentioned canonical isomorphism. 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.

## Numerical algorithms

### Stochastic estimator

The trace can be estimated unbiasedly by "Hutchinson's trick":^{[5]}

Given any matrix [math]\displaystyle{ W\in \R^{n\times n} }[/math], and any random [math]\displaystyle{ u\in \R^n }[/math] with [math]\displaystyle{ E[uu^T] = I }[/math], we have [math]\displaystyle{ E[u^T W u] = tr(W) }[/math]. (Proof: expand the expectation directly.)

Usually, the random vector is sampled from [math]\displaystyle{ N(0, I) }[/math] (normal distribution) or [math]\displaystyle{ \{\pm n^{-1/2}\}^n }[/math] (Rademacher distribution).

More sophisticated stochastic estimators of trace have been developed.^{[6]}

## Applications

If a 2 x 2 real matrix has zero trace, its square is a diagonal matrix.

The trace of a 2 × 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 **A**, **B** : *G* → *GL*(*V*) of a group G are equivalent (up to change of basis on V) if tr(**A**(*g*)) = tr(**B**(*g*)) for all *g* ∈ *G*.

The trace also plays a central role in the distribution of quadratic forms.

## Lie algebra

The trace is a map of Lie algebras [math]\displaystyle{ \operatorname{tr}:\mathfrak{gl}_n\to K }[/math] from the Lie algebra [math]\displaystyle{ \mathfrak{gl}_n }[/math] of linear operators on an n-dimensional space (*n* × *n* matrices with entries in [math]\displaystyle{ K }[/math]) to the Lie algebra K of scalars; as K is Abelian (the Lie bracket vanishes), the fact that this is a map of Lie algebras is exactly the statement that the trace of a bracket vanishes:
[math]\displaystyle{ \operatorname{tr}([\mathbf{A}, \mathbf{B}]) = 0 \text{ for each }\mathbf A,\mathbf B\in\mathfrak{gl}_n. }[/math]

The kernel of this map, a matrix whose trace is zero, is often said to be **traceless** or **trace free**, and these matrices form the simple Lie algebra [math]\displaystyle{ \mathfrak{sl}_n }[/math], 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 do not alter volume of *infinitesimal* sets.

In fact, there is an internal direct sum decomposition [math]\displaystyle{ \mathfrak{gl}_n = \mathfrak{sl}_n \oplus K }[/math] of operators/matrices into traceless operators/matrices and scalars operators/matrices. The projection map onto scalar operators can be expressed in terms of the trace, concretely as: [math]\displaystyle{ \mathbf{A} \mapsto \frac{1}{n}\operatorname{tr}(\mathbf{A})\mathbf{I}. }[/math]

Formally, one can compose the trace (the counit map) with the unit map [math]\displaystyle{ K\to\mathfrak{gl}_n }[/math] of "inclusion of scalars" to obtain a map [math]\displaystyle{ \mathfrak{gl}_n\to\mathfrak{gl}_n }[/math] mapping onto scalars, and multiplying by n. Dividing by n makes this a projection, yielding the formula above.

In terms of short exact sequences, one has [math]\displaystyle{ 0 \to \mathfrak{sl}_n \to \mathfrak{gl}_n \overset{\operatorname{tr}}{\to} K \to 0 }[/math] which is analogous to [math]\displaystyle{ 1 \to \operatorname{SL}_n \to \operatorname{GL}_n \overset{\det}{\to} K^* \to 1 }[/math] (where [math]\displaystyle{ K^*=K\setminus\{0\} }[/math]) for Lie groups. However, the trace splits naturally (via [math]\displaystyle{ 1/n }[/math] times scalars) so [math]\displaystyle{ \mathfrak{gl}_n=\mathfrak{sl}_n\oplus K }[/math], but the splitting of the determinant would be as the nth root times scalars, and this does not in general define a function, so the determinant does not split and the general linear group does not decompose: [math]\displaystyle{ \operatorname{GL}_n \neq \operatorname{SL}_n \times K^*. }[/math]

### Bilinear forms

The bilinear form (where **X**, **Y** are square matrices)
[math]\displaystyle{ B(\mathbf{X}, \mathbf{Y}) = \operatorname{tr}(\operatorname{ad}(\mathbf{X})\operatorname{ad}(\mathbf{Y}))\quad \text{where } \operatorname{ad}(\mathbf{X})\mathbf{Y} = [\mathbf{X}, \mathbf{Y}] = \mathbf{X}\mathbf{Y} - \mathbf{Y}\mathbf{X} }[/math]
is called the Killing form, which is used for the classification of Lie algebras.

The trace defines a bilinear form: [math]\displaystyle{ (\mathbf{X}, \mathbf{Y}) \mapsto \operatorname{tr}(\mathbf{X}\mathbf{Y}). }[/math]

The form is symmetric, non-degenerate^{[note 5]} and associative in the sense that:
[math]\displaystyle{ \operatorname{tr}(\mathbf{X}[\mathbf{Y}, \mathbf{Z}]) = \operatorname{tr}([\mathbf{X}, \mathbf{Y}]\mathbf{Z}). }[/math]

For a complex simple Lie algebra (such as [math]\displaystyle{ \mathfrak{sl} }[/math]_{n}), every such bilinear form is proportional to each other; in particular, to the Killing form^{[citation needed]}.

Two matrices **X** and **Y** are said to be *trace orthogonal* if
[math]\displaystyle{ \operatorname{tr}(\mathbf{X}\mathbf{Y}) = 0. }[/math]

There is a generalization to a general representation [math]\displaystyle{ (\rho,\mathfrak{g},V) }[/math] of a Lie algebra [math]\displaystyle{ \mathfrak{g} }[/math], such that [math]\displaystyle{ \rho }[/math] is a homomorphism of Lie algebras [math]\displaystyle{ \rho: \mathfrak{g} \rightarrow \text{End}(V). }[/math] The trace form [math]\displaystyle{ \text{tr}_V }[/math] on [math]\displaystyle{ \text{End}(V) }[/math] is defined as above. The bilinear form [math]\displaystyle{ \phi(\mathbf{X},\mathbf{Y}) = \text{tr}_V(\rho(\mathbf{X})\rho(\mathbf{Y})) }[/math] is symmetric and invariant due to cyclicity.

## 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 K is a trace-class operator, then for any orthonormal basis [math]\displaystyle{ (e_n)_n }[/math], the trace is given by
[math]\displaystyle{ \operatorname{tr}(K) = \sum_n \left\langle e_n, Ke_n \right\rangle, }[/math]
and is finite and independent of the orthonormal basis.^{[7]}

The partial trace is another generalization of the trace that is operator-valued. The trace of a linear operator Z which lives on a product space *A* ⊗ *B* is equal to the partial traces over A and B:
[math]\displaystyle{ \operatorname{tr}(Z) = \operatorname{tr}_A \left(\operatorname{tr}_B(Z)\right) = \operatorname{tr}_B \left(\operatorname{tr}_A(Z)\right). }[/math]

For more properties and a generalization of the partial trace, see traced monoidal categories.

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* ∈ *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.

## Traces in the language of tensor products

Given a vector space V, there is a natural bilinear map *V* × *V*^{∗} → *F* given by sending (*v*, φ) to the scalar φ(*v*). The universal property of the tensor product *V* ⊗ *V*^{∗} automatically implies that this bilinear map is induced by a linear functional on *V* ⊗ *V*^{∗}.^{[8]}

Similarly, there is a natural bilinear map *V* × *V*^{∗} → Hom(*V*, *V*) given by sending (*v*, φ) to the linear map *w* ↦ φ(*w*)*v*. The universal property of the tensor product, just as used previously, says that this bilinear map is induced by a linear map *V* ⊗ *V*^{∗} → Hom(*V*, *V*). If V is finite-dimensional, then this linear map is a linear isomorphism.^{[8]} This fundamental fact is a straightforward consequence of the existence of a (finite) basis of V, and can also be phrased as saying that any linear map *V* → *V* can be written as the sum of (finitely many) rank-one linear maps. Composing the inverse of the isomorphism with the linear functional obtained above results in a linear functional on Hom(*V*, *V*). This linear functional is exactly the same as the trace.

Using the definition of trace as the sum of diagonal elements, the matrix formula tr(**AB**) = tr(**BA**) is straightforward to prove, and was given above. In the present perspective, one is considering linear maps S and T, and viewing them as sums of rank-one maps, so that there are linear functionals *φ*_{i} and *ψ*_{j} and nonzero vectors *v*_{i} and *w*_{j} such that *S*(u) = Σ*φ*_{i}(*u*)*v*_{i} and *T*(u) = Σ*ψ*_{j}(*u*)*w*_{j} for any u in V. Then

- [math]\displaystyle{ (S\circ T)(u)=\sum_i\varphi_i\left(\sum_j\psi_j(u)w_j\right)v_i=\sum_i\sum_j\psi_j(u)\varphi_i(w_j)v_i }[/math]

for any u in V. The rank-one linear map *u* ↦ *ψ*_{j}(*u*)*φ*_{i}(*w*_{j})*v*_{i} has trace *ψ*_{j}(*v*_{i})*φ*_{i}(*w*_{j}) and so

- [math]\displaystyle{ \operatorname{tr}(S\circ T)=\sum_i\sum_j\psi_j(v_i)\varphi_i(w_j)=\sum_j\sum_i\varphi_i(w_j)\psi_j(v_i). }[/math]

Following the same procedure with S and T reversed, one finds exactly the same formula, proving that tr(*S* ∘ *T*) equals tr(*T* ∘ *S*).

The above proof can be regarded as being based upon tensor products, given that the fundamental identity of End(*V*) with *V* ⊗ *V*^{∗} is equivalent to the expressibility of any linear map as the sum of rank-one linear maps. As such, the proof may be written in the notation of tensor products. Then one may consider the multilinear map *V* × *V*^{∗} × *V* × *V*^{∗} → *V* ⊗ *V*^{∗} given by sending (*v*, *φ*, *w*, *ψ*) to *φ*(*w*)*v* ⊗ *ψ*. Further composition with the trace map then results in *φ*(*w*)*ψ*(*v*), and this is unchanged if one were to have started with (*w*, *ψ*, *v*, *φ*) instead. One may also consider the bilinear map End(*V*) × End(*V*) → End(*V*) given by sending (*f*, *g*) to the composition *f* ∘ *g*, which is then induced by a linear map End(*V*) ⊗ End(*V*) → End(*V*). It can be seen that this coincides with the linear map *V* ⊗ *V*^{∗} ⊗ *V* ⊗ *V*^{∗} → *V* ⊗ *V*^{∗}. The established symmetry upon composition with the trace map then establishes the equality of the two traces.^{[8]}

For any finite dimensional vector space V, there is a natural linear map *F* → *V* ⊗ *V*'; in the language of linear maps, it assigns to a scalar c the linear map *c*⋅id_{V}. Sometimes this is called *coevaluation map*, and the trace *V* ⊗ *V*' → *F* is called *evaluation map*.^{[8]} These structures can be axiomatized to define categorical traces in the abstract setting of category theory.

## See also

- Trace of a tensor with respect to a metric tensor
- Characteristic function
- Field trace
- Golden–Thompson inequality
- Singular trace
- Specht's theorem
- Trace class
- Trace identity
- Trace inequalities
- von Neumann's trace inequality

## Notes

- ↑ This is immediate from the definition of the matrix product: [math]\displaystyle{ \operatorname{tr}(\mathbf{A}\mathbf{B}) = \sum_{i=1}^m \left(\mathbf{A}\mathbf{B}\right)_{ii} = \sum_{i=1}^m \sum_{j=1}^n a_{ij} b_{ji} = \sum_{j=1}^n \sum_{i=1}^m b_{ji} a_{ij} = \sum_{j=1}^n \left(\mathbf{B}\mathbf{A}\right)_{jj} = \operatorname{tr}(\mathbf{B}\mathbf{A}). }[/math]
- ↑ For example, if
[math]\displaystyle{
\mathbf{A} = \begin{pmatrix}
0 & 1 \\
0 & 0
\end{pmatrix},\quad
\mathbf{B} = \begin{pmatrix}
0 & 0 \\
1 & 0
\end{pmatrix},
}[/math]
then the product is
[math]\displaystyle{ \mathbf{AB} = \begin{pmatrix}
1 & 0 \\
0 & 0
\end{pmatrix}, }[/math]
and the traces are tr(
**AB**) = 1 ≠ 0 ⋅ 0 = tr(**A**)tr(**B**). - ↑ Proof: Let [math]\displaystyle{ e_{ij} }[/math] the standard basis and note that [math]\displaystyle{ f\left(e_{ij}\right) = 0 }[/math] if and only if [math]\displaystyle{ i \neq j }[/math] and [math]\displaystyle{ f\left(e_{jj}\right) = f\left(e_{11}\right) }[/math] [math]\displaystyle{ f(\mathbf{A}) = \sum_{i, j} [\mathbf{A}]_{ij} f\left(e_{ij}\right) = \sum_i [\mathbf{A}]_{ii} f\left(e_{11}\right) = f\left(e_{11}\right) \operatorname{tr}(\mathbf{A}). }[/math] More abstractly, this corresponds to the decomposition [math]\displaystyle{ \mathfrak{gl}_n = \mathfrak{sl}_n \oplus k, }[/math] as [math]\displaystyle{ \operatorname{tr}(AB) = \operatorname{tr}(BA) }[/math] (equivalently, [math]\displaystyle{ \operatorname{tr}([A, B]) = 0 }[/math]) defines the trace on [math]\displaystyle{ \mathfrak{sl}_n, }[/math] which has complement the scalar matrices, and leaves one degree of freedom: any such map is determined by its value on scalars, which is one scalar parameter and hence all are multiple of the trace, a nonzero such map.
- ↑ Proof: [math]\displaystyle{ \mathfrak{sl}_n }[/math] is a semisimple Lie algebra and thus every element in it is a linear combination of commutators of some pairs of elements, otherwise the derived algebra would be a proper ideal.
- ↑ This follows from the fact that tr(
**A*****A**) = 0 if and only if**A**=**0**.

## References

- ↑
^{1.0}^{1.1}^{1.2}^{1.3}^{1.4}"Rank, trace, determinant, transpose, and inverse of matrices". http://fourier.eng.hmc.edu/e161/lectures/algebra/node2.html. - ↑
^{2.0}^{2.1}^{2.2}^{2.3}Weisstein, Eric W. (2003). "Trace (matrix)".*CRC Concise Encyclopedia of Mathematics*(Second edition of 1999 original ed.). Boca Raton, FL: Chapman & Hall. doi:10.1201/9781420035223. ISBN 1-58488-347-2. https://mathworld.wolfram.com/MatrixTrace.html. Retrieved 2020-09-09. - ↑
^{3.0}^{3.1}^{3.2}^{3.3}Lipschutz, Seymour; Lipson, Marc (September 2005).*Schaum's Outline of Theory and Problems of Linear Algebra*. McGraw-Hill. ISBN 9780070605022. - ↑ Horn, Roger A.; Johnson, Charles R. (2013).
*Matrix Analysis*(2nd ed.). Cambridge University Press. ISBN 9780521839402. - ↑ Hutchinson, M.F. (January 1989). "A Stochastic Estimator of the Trace of the Influence Matrix for Laplacian Smoothing Splines" (in en).
*Communications in Statistics - Simulation and Computation***18**(3): 1059–1076. doi:10.1080/03610918908812806. ISSN 0361-0918. http://www.tandfonline.com/doi/abs/10.1080/03610918908812806. - ↑ Avron, Haim; Toledo, Sivan (2011-04-11). "Randomized algorithms for estimating the trace of an implicit symmetric positive semi-definite matrix".
*Journal of the ACM***58**(2): 8:1–8:34. doi:10.1145/1944345.1944349. ISSN 0004-5411. https://doi.org/10.1145/1944345.1944349. - ↑ Teschl, G. (30 October 2014).
*Mathematical Methods in Quantum Mechanics*. Graduate Studies in Mathematics.**157**(2nd ed.). American Mathematical Society. ISBN 978-1470417048. - ↑
^{8.0}^{8.1}^{8.2}^{8.3}Kassel, Christian (1995).*Quantum groups*. Graduate Texts in Mathematics.**155**. New York: Springer-Verlag. doi:10.1007/978-1-4612-0783-2. ISBN 0-387-94370-6.

- Gantmacher, F. R. (1959).
*The theory of matrices. Vols. 1, 2*. Translated by K. A. Hirsch. New York: Chelsea Publishing Company. - Horn, Roger A.; Johnson, Charles R. (2013).
*Matrix analysis*(Second edition of 1985 original ed.). Cambridge:*Cambridge University Press*. ISBN 978-0-521-54823-6. - Strang, Gilbert (2004).
*Linear algebra and its applications*(Fourth edition of 1976 original ed.). Cengage Learning. ISBN 978-0030105678.

## External links

- Hazewinkel, Michiel, ed. (2001), "Trace of a square matrix",
*Encyclopedia of Mathematics*, Springer Science+Business Media B.V. / Kluwer Academic Publishers, ISBN 978-1-55608-010-4, https://www.encyclopediaofmath.org/index.php?title=p/t093550

Original source: https://en.wikipedia.org/wiki/Trace (linear algebra).
Read more |