# Trace (linear algebra)

In linear algebra, the trace of a square matrix A, denoted ${\displaystyle \operatorname {tr} (\mathbf {A} )}$,[1][2] is defined to be the sum of elements on the main diagonal (from the upper left to the lower right) of A.

The trace of a matrix is the sum of its (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. The trace is only defined for a square matrix (n × n).

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[2][3][4]:34

${\displaystyle \operatorname {tr} (\mathbf {A} )=\sum _{i=1}^{n}a_{ii}=a_{11}+a_{22}+\dots +a_{nn}}$

where aii denotes the entry on the ith row and ith column of A.

## Example

Let A be a matrix, with

${\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}}}$

Then

${\displaystyle \operatorname {tr} (\mathbf {A} )=\sum _{i=1}^{3}a_{ii}=a_{11}+a_{22}+a_{33}=-1+5+(-5)=-1}$

## Properties

### Basic properties

The trace is a linear mapping. That is,[2][3]

{\displaystyle {\begin{aligned}\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{aligned}}}

for all square matrices A and B, and all scalars c.[4]:34

A matrix and its transpose have the same trace:[2][3][4]:34

${\displaystyle \operatorname {tr} (\mathbf {A} )=\operatorname {tr} \left(\mathbf {A} ^{\mathsf {T}}\right).}$

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 matrices can be rewritten as the sum of entry-wise products of their elements. More precisely, if A and B are two m × n matrices, then:

${\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,j}a_{ij}b_{ij}.}$

This means that the trace of a product of equal-sized matrices functions in a similar way to a dot product of vectors (imagine A and B as long vectors with columns stacked on each other). 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 A and B, the trace of a product can also be written in the following forms:

 ${\displaystyle \operatorname {tr} \left(\mathbf {A} ^{\mathsf {T}}\mathbf {B} \right)=\sum _{i,j}(\mathbf {A} \circ \mathbf {B} )_{ij}}$ (using the Hadamard product, also known as the entrywise product). ${\displaystyle \operatorname {tr} \left(\mathbf {A} ^{\mathsf {T}}\mathbf {B} \right)=\operatorname {vec} (\mathbf {B} )^{\mathsf {T}}\operatorname {vec} (\mathbf {A} )=\operatorname {vec} (\mathbf {A} )^{\mathsf {T}}\operatorname {vec} (\mathbf {B} )}$ (using the vectorization operator).

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[2][3][4]:34[note 1]

${\displaystyle \operatorname {tr} (\mathbf {A} \mathbf {B} )=\operatorname {tr} (\mathbf {B} \mathbf {A} )}$

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

${\displaystyle \operatorname {tr} \left(\mathbf {b} \mathbf {a} ^{\textsf {T}}\right)=\mathbf {a} ^{\textsf {T}}\mathbf {b} }$

### Cyclic property

More generally, the trace is invariant under cyclic permutations, that is,

${\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} ).}$

This is known as the cyclic property.

Arbitrary permutations are not allowed: in general,

${\displaystyle \operatorname {tr} (\mathbf {A} \mathbf {B} \mathbf {C} )\neq \operatorname {tr} (\mathbf {A} \mathbf {C} \mathbf {B} ).}$

However, if products of three symmetric matrices are considered, any permutation is allowed, since:

${\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} ),}$

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 matrix product

Unlike the determinant, the trace of the product is not the product of traces, that is there exist matrices A and B such that

${\displaystyle \operatorname {tr} (\mathbf {A} \mathbf {B} )\neq \operatorname {tr} (\mathbf {A} )\operatorname {tr} (\mathbf {B} )}$

For example, if

${\displaystyle \mathbf {A} ={\begin{pmatrix}0&1\\0&0\end{pmatrix}},\ \ \mathbf {B} ={\begin{pmatrix}0&0\\1&0\end{pmatrix}},}$

then the product is

${\displaystyle \mathbf {AB} ={\begin{pmatrix}1&0\\0&0\end{pmatrix}},}$

and the traces are ${\displaystyle \operatorname {tr} (\mathbf {A} \mathbf {B} )=1\neq 0\cdot 0=\operatorname {tr} (\mathbf {A} )\operatorname {tr} (\mathbf {B} ).}$

Moreover:

${\displaystyle \operatorname {tr} (\mathbf {A} \mathbf {B} )=\operatorname {tr} (\mathbf {B} \mathbf {A} )}$

### Trace of a Kronecker product

The trace of the Kronecker product of two matrices is the product of their traces:

${\displaystyle \operatorname {tr} (\mathbf {A} \otimes \mathbf {B} )=\operatorname {tr} (\mathbf {A} )\operatorname {tr} (\mathbf {B} ).}$

### Full characterization of the trace

The following three properties:

{\displaystyle {\begin{aligned}\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{aligned}}}

characterize the trace completely in the sense that follows. Let f be a linear functional on the space of square matrices satisfying f (xy) = f (yx). Then f and tr are proportional.[note 2]

### Similarity invariance

The trace is similarity-invariant, which means that for any square matrix A and any invertible matrix P of the same dimensions, the matrices A and P−1AP have the same trace. This is because

${\displaystyle \operatorname {tr} \left(\mathbf {P} ^{-1}\mathbf {A} \mathbf {P} \right)=\operatorname {tr} \left(\mathbf {P} ^{-1}(\mathbf {A} \mathbf {P} )\right)=\operatorname {tr} \left((\mathbf {A} \mathbf {P} )\mathbf {P} ^{-1}\right)=\operatorname {tr} \left(\mathbf {A} \left(\mathbf {P} \mathbf {P} ^{-1}\right)\right)=\operatorname {tr} (\mathbf {A} ).}$

### Trace of product of symmetric and skew-symmetric matrix

If A is symmetric and B is skew-symmetric, then

${\displaystyle \operatorname {tr} (\mathbf {A} \mathbf {B} )=0}$ .

### Relation to eigenvalues

#### Trace of the identity matrix

The trace of the n × n identity matrix is the dimension of the space, namely n.[1]

${\displaystyle \operatorname {tr} \left(\mathbf {I} _{n}\right)=n}$

This leads to generalizations of dimension using trace.

#### Trace of an idempotent matrix

The trace of an idempotent matrix A (a matrix for which A2 = A) is the rank of A.

#### Trace of a nilpotent matrix

The trace of a nilpotent matrix is zero.

When the characteristic of the base field is zero, the converse also holds: if tr(Ak) = 0 for all k, then A is nilpotent.

When the characteristic n > 0 is positive, the identity in n dimensions is a counterexample, as ${\displaystyle \operatorname {tr} \left(\mathbf {I} _{n}^{k}\right)=\operatorname {tr} \left(\mathbf {I} _{n}\right)=n\equiv 0}$ , but the identity is not nilpotent.

#### Trace equals sum of eigenvalues

More generally, if

${\displaystyle f(x)=\prod _{i=1}^{k}\left(x-\lambda _{i}\right)^{d_{i}}}$

is the characteristic polynomial of a matrix A, then

${\displaystyle \operatorname {tr} (\mathbf {A} )=\sum _{i=1}^{k}d_{i}\lambda _{i}}$

that is, the trace of a square matrix equals the sum of the eigenvalues counted with multiplicities.

### 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 glnk 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 combinations of the commutators of pairs of matrices.[note 3] Moreover, any square matrix with zero trace is unitarily equivalent to a square matrix with diagonal consisting of all zeros.

### Trace of Hermitian matrix

The trace of a Hermitian matrix is real, because the elements on the diagonal are real.

### Trace of permutation matrix

The trace of a permutation matrix is the number of fixed points, because the diagonal term aii is 1 if the ith point is fixed and 0 otherwise.

### Trace of projection matrix

The trace of a projection matrix is the dimension of the target space.

{\displaystyle {\begin{aligned}\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{aligned}}}

The matrix PX is idempotent, and more generally, the trace of any idempotent matrix equals its own rank.

## Exponential 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:

${\displaystyle \operatorname {tre} (A):=\operatorname {tr} (\exp(A)).}$

tre is sometimes referred to as the exponential trace function; it is used in the Golden–Thompson inequality.

## Trace of a linear operator

In general, given some linear map f : VV (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 VV*, 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 vf 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 matrix with real or complex entries and if λ1, …, λn are the eigenvalues of A (listed according to their algebraic multiplicities), then

${\displaystyle \operatorname {tr} (\mathbf {A} )=\sum _{i}\lambda _{i}}$

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,

${\displaystyle \det(\mathbf {A} )=\prod _{i}\lambda _{i}.}$

More generally,

${\displaystyle \operatorname {tr} \left(\mathbf {A} ^{k}\right)=\sum _{i}\lambda _{i}^{k}.}$

### 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: tr = det′I. From this (or from the connection between the trace and the eigenvalues), one can derive a connection between the trace function, the exponential map between a Lie algebra and its Lie group (or concretely, the matrix exponential function), and the determinant:

${\displaystyle \det(\exp(\mathbf {A} ))=\exp(\operatorname {tr} (\mathbf {A} )).}$

For example, consider the one-parameter family of linear transformations given by rotation through angle θ,

${\displaystyle \mathbf {R} _{\theta }={\begin{pmatrix}\cos \theta &-\sin \theta \\\sin \theta &\cos \theta \end{pmatrix}}.}$

These transformations all have determinant 1, so they preserve area. The derivative of this family at θ = 0, the identity rotation, is the antisymmetric matrix

${\displaystyle A={\begin{pmatrix}0&-1\\1&0\end{pmatrix}}}$

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 Rn 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 Rn, 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:

${\displaystyle \operatorname {d} \operatorname {tr} (\mathbf {X} )=\operatorname {tr} (\operatorname {d} \mathbf {X} ).}$

## Applications

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 : GGL(V) of a group G are equivalent (up to change of basis on V) if tr(A(g)) = tr(B(g)) for all gG.

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

## Lie algebra

The trace is a map of Lie algebras ${\displaystyle \operatorname {tr} :{\mathfrak {gl}}_{n}\to K}$  from the Lie algebra ${\displaystyle {\mathfrak {gl}}_{n}}$  of linear operators on an n-dimensional space (n × n matrices with entries in ${\displaystyle K}$ ) 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:

${\displaystyle \operatorname {tr} ([\mathbf {A} ,\mathbf {B} ])=0{\text{ for each }}\mathbf {A} ,\mathbf {B} \in {\mathfrak {gl}}_{n}.}$

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 ${\displaystyle {\mathfrak {sl}}_{n}}$ , 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 ${\displaystyle {\mathfrak {gl}}_{n}={\mathfrak {sl}}_{n}\oplus K}$  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:

${\displaystyle \mathbf {A} \mapsto {\frac {1}{n}}\operatorname {tr} (\mathbf {A} )\mathbf {I} .}$

Formally, one can compose the trace (the counit map) with the unit map ${\displaystyle K\to {\mathfrak {gl}}_{n}}$  of "inclusion of scalars" to obtain a map ${\displaystyle {\mathfrak {gl}}_{n}\to {\mathfrak {gl}}_{n}}$  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

${\displaystyle 0\to {\mathfrak {sl}}_{n}\to {\mathfrak {gl}}_{n}{\overset {\operatorname {tr} }{\to }}K\to 0}$

which is analogous to

${\displaystyle 1\to \operatorname {SL} _{n}\to \operatorname {GL} _{n}{\overset {\det }{\to }}K^{*}\to 1}$

(where ${\displaystyle K^{*}=K\setminus \{0\}}$ ) for Lie groups. However, the trace splits naturally (via ${\displaystyle 1/n}$  times scalars) so ${\displaystyle {\mathfrak {gl}}_{n}={\mathfrak {sl}}_{n}\oplus K}$ , 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:

${\displaystyle \operatorname {GL} _{n}\neq \operatorname {SL} _{n}\times K^{*}.}$

### Bilinear forms

The bilinear form (where X, Y are square matrices)

${\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} }$

is called the Killing form, which is used for the classification of Lie algebras.

The trace defines a bilinear form:

${\displaystyle (\mathbf {X} ,\mathbf {Y} )\mapsto \operatorname {tr} (\mathbf {X} \mathbf {Y} ).}$

The form is symmetric, non-degenerate[note 4] and associative in the sense that:

${\displaystyle \operatorname {tr} (\mathbf {X} [\mathbf {Y} ,\mathbf {Z} ])=\operatorname {tr} ([\mathbf {X} ,\mathbf {Y} ]\mathbf {Z} ).}$

For a complex simple Lie algebra (such as ${\displaystyle {\mathfrak {sl}}}$ n), every such bilinear form is proportional to each other; in particular, to the Killing form.

Two matrices X and Y are said to be trace orthogonal if

${\displaystyle \operatorname {tr} (\mathbf {X} \mathbf {Y} )=0}$ .

## Inner product

For an m × n matrix A with complex (or real) entries and H being the conjugate transpose, we have

${\displaystyle \operatorname {tr} \left(\mathbf {A} ^{\mathsf {H}}\mathbf {A} \right)\geq 0}$

with equality if and only if A = 0.[5]:7

The assignment

${\displaystyle \langle \mathbf {A} ,\mathbf {B} \rangle =\operatorname {tr} \left(\mathbf {A} ^{\mathsf {H}}\mathbf {B} \right)}$

yields an inner product on the space of all complex (or real) m × 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 mn.

It follows that if A and B are real positive semi-definite matrices of the same size then

${\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}.}$ [note 5]

## 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 trace-class, then for any orthonormal basis ${\displaystyle (\varphi _{n})_{n}}$ , the trace is given by

${\displaystyle \operatorname {tr} (K)=\sum _{n}\left\langle \varphi _{n},K\varphi _{n}\right\rangle ,}$

and is finite and independent of the orthonormal basis.[6]

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 AB is equal to the partial traces over A and B:

${\displaystyle \operatorname {tr} (Z)=\operatorname {tr} _{A}\left(\operatorname {tr} _{B}(Z)\right)=\operatorname {tr} _{B}\left(\operatorname {tr} _{A}(Z)\right).}$

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 : Ak which vanishes on commutators: tr([a,b]) for all a, bA. 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

The trace can also be approached in a coordinate-free manner, i.e., without referring to a choice of basis, as follows: the space of linear operators on a finite-dimensional vector space V (defined over the field F) is isomorphic to the space VV via the linear map

${\displaystyle V\otimes V^{*}\to \mathrm {Hom} (V,V),v\otimes h\mapsto (w\mapsto h(w)v).}$

There is also a canonical bilinear function t : V × VF that consists of applying an element w of V to an element v of V to get an element of F:

${\displaystyle t\left(v,w^{*}\right):=w^{*}(v)\in F.}$

This induces a linear function on the tensor product (by its universal property) t : VV → F, which, as it turns out, when that tensor product is viewed as the space of operators, is equal to the trace.

In particular, given a rank one operator A (equivalently, a simple tensor ${\displaystyle v\otimes w^{*}}$ ), the square is ${\displaystyle A^{2}=\lambda A,}$  because on its one-dimensional image, A is just scalar multiplication. In terms of the tensor expression, ${\displaystyle \lambda =w^{*}(v),}$  and it is the trace (and only non-zero eigenvalue) of A; this gives a coordinate-free interpretation of the diagonal entry. Every operator on an n-dimensional space can be expressed as a sum of n rank one operators; this gives a coordinate-free version of the sum of diagonal entries.

This also clarifies why tr(AB) = tr(BA) and why tr(AB) ≠ tr(A)tr(B), as composition of operators (multiplication of matrices) and trace can be interpreted as the same pairing. Viewing

${\displaystyle \operatorname {End} (V)\cong V\otimes V^{*},}$

one may interpret the composition map

${\displaystyle \operatorname {End} (V)\times \operatorname {End} (V)\to \operatorname {End} (V)}$

as

${\displaystyle (V\otimes V^{*})\times (V\otimes V^{*})\to (V\otimes V^{*})}$

coming from the pairing V × VF on the middle terms. Taking the trace of the product then comes from pairing on the outer terms, while taking the product in the opposite order and then taking the trace just switches which pairing is applied first. On the other hand, taking the trace of A and the trace of B corresponds to applying the pairing on the left terms and on the right terms (rather than on inner and outer), and is thus different.

In coordinates, this corresponds to indexes: multiplication is given by

${\displaystyle (\mathbf {A} \mathbf {B} )_{ik}=\sum _{j}a_{ij}b_{jk},}$

so

${\displaystyle \operatorname {tr} (\mathbf {A} \mathbf {B} )=\sum _{ij}a_{ij}b_{ji}\quad {\text{and}}\quad \operatorname {tr} (\mathbf {B} \mathbf {A} )=\sum _{ij}b_{ij}a_{ji}}$

which is the same, while

${\displaystyle \operatorname {tr} (\mathbf {A} )\cdot \operatorname {tr} (\mathbf {B} )=\sum _{i}a_{ii}\cdot \sum _{j}b_{jj},}$

which is different.

For finite-dimensional V, with basis {ei} and dual basis {ei}, then eiej is the ij-entry of the matrix of the operator with respect to that basis. Any operator A is therefore a sum of the form

${\displaystyle \mathbf {A} =a_{ij}e_{i}\otimes e^{j}.}$

With t defined as above,

${\displaystyle \operatorname {tr} (\mathbf {A} )=a_{ij}\operatorname {tr} \left(e_{i}\otimes e^{j}\right).}$

The latter, however, is just the Kronecker delta, being 1 if i = j and 0 otherwise. This shows that tr(A) is simply the sum of the coefficients along the diagonal. This method, however, makes coordinate invariance an immediate consequence of the definition.

### Dual

Further, one may dualize this map, obtaining a map

${\displaystyle F^{*}=F\to V\otimes V^{*}\cong \operatorname {End} (V).}$

This map is precisely the inclusion of scalars, sending 1 ∈ F to the identity matrix: "trace is dual to scalars". In the language of bialgebras, scalars are the unit, while trace is the counit.

One can then compose these,

${\displaystyle F~{\overset {I}{\to }}~\operatorname {End} (V)~{\overset {\operatorname {tr} }{\to }}~F,}$

which yields multiplication by n, as the trace of the identity is the dimension of the vector space.

### Generalizations

Using the notion of dualizable objects and categorical traces, this approach to traces can be fruitfully axiomatized and applied to other mathematical areas.

## Notes

1. ^ This is immediate from the definition of the matrix product:
${\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} )}$ .
2. ^ Proof: f (eij) = 0 if and only if ij and f (ejj) = f (e11) (with the standard basis eij), and thus
${\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} ).}$
More abstractly, this corresponds to the decomposition
${\displaystyle {\mathit {gl}}_{n}={\mathit {sl}}_{n}\oplus k,}$
as tr(AB) = tr(BA) (equivalently, tr([A,B]) = 0) defines the trace on sln, 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.
3. ^ Proof: ${\displaystyle {\mathfrak {sl}}}$ n 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.
4. ^ This follows from the fact that tr(A*A) = 0 if and only if A = 0.
5. ^ This can be proven with the Cauchy–Schwarz inequality.

## References

1. ^ a b "Comprehensive List of Algebra Symbols". Math Vault. 2020-03-25. Retrieved 2020-09-09.
2. "Rank, trace, determinant, transpose, and inverse of matrices". fourier.eng.hmc.edu. Retrieved 2020-09-09.
3. ^ a b c d Weisstein, Eric W. "Matrix Trace". mathworld.wolfram.com. Retrieved 2020-09-09.
4. ^ a b c d Lipschutz, Seymour; Lipson, Marc. Schaum's Outline of Theory and Problems of Linear Algebra. McGraw-Hill. ISBN 9780070605022.
5. ^ Horn, Roger A.; Johnson, Charles R. (2013). Matrix Analysis (2nd ed.). Cambridge University Press. ISBN 9780521839402.
6. ^ Teschl, G. (30 October 2014). Mathematical Methods in Quantum Mechanics. Graduate Studies in Mathematics. 157 (2nd ed.). American Mathematical Society. ISBN 1470417049.