In mathematics, a trace is a property of a matrix and of a linear operator on a vector space. The trace plays an important role in the representation theory of groups (the collection of traces is the character of the representation) and in statistical thermodynamics (the trace of a thermodynamic observable times the density operator is the thermodynamic average of the observable).
Definition and properties of matrix traces
Let A be an n × n matrix; its trace is defined by
![{\displaystyle \mathrm {Tr} (\mathbf {A} )\;{\stackrel {\mathrm {def} }{=}}\;\sum _{i=1}^{n}A_{ii}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/18e550da1234e3bae9226231d748e67cf350bea7)
where Aii is the ith diagonal element of A.
Example
![{\displaystyle \mathbf {A} ={\begin{pmatrix}2.1&1.3&0.0\\5.0&-0.1&8.3\\7.0&-4.7&3.0\\\end{pmatrix}}\Longrightarrow \mathrm {Tr} (\mathbf {A} )=2.1-0.1+3.0=5.0}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a4ed6f520eb7769b7ac7e77ac97a103691798720)
Theorem
Let A and B be n×n matrices, then Tr(A B) = Tr (B A).
Proof
![{\displaystyle \mathrm {Tr} (\mathbf {AB} )=\sum _{i=1}^{n}(\mathbf {AB} )_{ii}=\sum _{i=1}^{n}\sum _{j=1}^{n}\;A_{ij}B_{ji}=\sum _{j=1}^{n}\sum _{i=1}^{n}\;B_{ji}A_{ij}=\sum _{j=1}^{n}(\mathbf {BA} )_{jj}=\mathrm {Tr} (\mathbf {BA} )}](https://wikimedia.org/api/rest_v1/media/math/render/svg/059bf3aaea5fec90526b7e37c475dea669de91df)
Theorem
The trace of a matrix is invariant under a similarity transformation Tr(B−1A B) = Tr(A).
Proof
![{\displaystyle \mathrm {Tr} {\big (}\mathbf {B} ^{-1}(\mathbf {AB} ){\big )}=\mathrm {Tr} {\big (}(\mathbf {AB} )\mathbf {B} ^{-1}{\big )}=\mathrm {Tr} (\mathbf {AE} )=\mathrm {Tr} (\mathbf {A} ),}](https://wikimedia.org/api/rest_v1/media/math/render/svg/94a206b09430856c5af897abf7cdcffcb3bca717)
where we used B B−1 = E (the identity matrix).
Other properties of traces are (all matrices are n × n matrices):
![{\displaystyle {\begin{aligned}\mathrm {Tr} (\mathbf {A} +\mathbf {B} )&=\mathrm {Tr} (\mathbf {A} )+\mathrm {Tr} (\mathbf {B} )\\\mathrm {Tr} (\mathbf {E} )&=n\qquad {\hbox{(trace of identity matrix)}}\\\mathrm {Tr} (\mathbf {O} )&=0\qquad {\hbox{(trace of zero matrix)}}\\\mathrm {Tr} (\mathbf {ABC} )&=\mathrm {Tr} (\mathbf {CAB} )=\mathrm {Tr} (\mathbf {BCA} )\\\mathrm {Tr} (c\mathbf {A} )&=c\mathrm {Tr} (\mathbf {A} )\quad c\in \mathbb {C} \\\mathrm {Tr} (\mathbf {A} ^{\mathrm {T} })&=\mathrm {Tr} (\mathbf {A} )\\\end{aligned}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a1d8e6ba2b636ae99dcbb062af7636281cccf96c)
Theorem
Let S be a symmetric matrix, ST = S, and A be an antisymmetric matrix, AT = −A. Then
![{\displaystyle \mathrm {Tr} (\mathbf {S} \mathbf {A} )=\mathrm {Tr} (\mathbf {A} \mathbf {S} )=0.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/75a561f857bfe704e5222ede3b4d44920efb7eec)
Proof
![{\displaystyle \mathrm {Tr} (\mathbf {SA} )=\mathrm {Tr} {\big (}(\mathbf {SA} )^{\mathrm {T} }{\big )}=\mathrm {Tr} (\mathbf {A} ^{\mathrm {T} }\mathbf {S} ^{\mathrm {T} })=-\mathrm {Tr} (\mathbf {AS} )=-\mathrm {Tr} (\mathbf {SA} )}](https://wikimedia.org/api/rest_v1/media/math/render/svg/d733ea4b6eebcf1879cf94550d9cf798d78cdd0d)
A number equal to minus itself can only be zero.
Relation to eigenvalues
We will show that the trace of an n×n matrix is equal to the sum of its n eigenvalues (the n roots of its secular equation).
The secular determinant of an n × n matrix A is the determinant of A −λ E, where λ is a number (an element of a field F). If we put the secular determinant equal to zero we obtain the secular equation of A (also known as the characteristic equation),
![{\displaystyle \Delta (\lambda )\equiv {\begin{vmatrix}A_{11}-\lambda &A_{12}&\cdots &\cdots &A_{1n}\\A_{21}&A_{22}-\lambda &\cdots &\cdots &A_{2n}\\\cdots &\cdots &\ddots \\A_{n1}&A_{n2}&&\cdots &A_{nn}-\lambda \\\end{vmatrix}}=0}](https://wikimedia.org/api/rest_v1/media/math/render/svg/51232d501093283483f393ed5940959fe52c484e)
The secular determinant is a polynomial in λ:
![{\displaystyle \Delta (\lambda )=(-\lambda )^{n}+P_{1}(-\lambda )^{n-1}+P_{2}(-\lambda )^{n-2}+\cdots +P_{n-1}(-\lambda )+P_{n}=0.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/37904ac610650a73f5767a1a65f454c1e9db7d00)
The coefficient P1 of λn−1 is equal to the trace of A (and incidentally Pn is the determinant of A). If the field F is algebraically closed (such as the field of complex numbers) then the fundamental theorem of algebra states that the secular equation has exactly n roots (zeros) λi, i =1, ..., n, the eigenvalues of A and the following factorization holds
![{\displaystyle \Delta (\lambda )=(\lambda _{1}-\lambda )(\lambda _{2}-\lambda )\cdots (\lambda _{n}-\lambda ).}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c1efb15b52a10c1753af9f500a31a88c580abd97)
Expansion shows that the coefficient P1 of (−λ)n−1 is equal to
![{\displaystyle \sum _{i=1}^{n}\lambda _{i}=P_{1}=\mathrm {Tr} (\mathbf {A} ).}](https://wikimedia.org/api/rest_v1/media/math/render/svg/bf6dca5f44e594f931fc1868a10774cb518febca)
Note: It is not necessary that A has n linearly independent eigenvectors, although any A has n eigenvalues in an algebraically closed field.
Definition for a linear operator on a finite-dimensional vector space
Let Vn be an n-dimensional vector space (also known as linear space).
Let
be a linear operator (also known as linear map) on this space,
.
Let
![{\displaystyle \{v_{1},v_{2},\ldots ,v_{n}\}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/fcac395b5c561134d68acb76a660b5bec2c45633)
be a basis for Vn, then the matrix of
with respect to this basis is given by
![{\displaystyle {\hat {A}}v_{i}=\sum _{j=1}^{n}\;v_{j}A_{ji}\quad {\hbox{for}}\quad i=1,\ldots ,n,\quad {\hbox{and}}\quad \mathbf {A} \equiv (A_{ij}).}](https://wikimedia.org/api/rest_v1/media/math/render/svg/d53f0a844f52326a980d64405e1a87585efc7116)
Definition: The trace of the linear operator
is the trace of the matrix of the operator in any basis. This definition is possible since the trace is independent of the choice of basis.
We prove that a trace of an operator does not depend on choice of basis. Consider two bases connected by the non-singular matrix B (a basis transformation matrix),
![{\displaystyle w_{i}=\sum _{j=1}^{n}\;v_{j}B_{ji},\quad i=1,\ldots ,n.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/bec99a0e528643346ea8506682410bcae9c132a3)
Above we introduced the matrix A of
in the basis vi. Write A' for its matrix in the basis wi
![{\displaystyle {\hat {A}}w_{i}=\sum _{j=1}^{n}\;w_{j}A'_{ji}\quad {\hbox{with}}\quad \mathbf {A} '=(A'_{ij}).}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f343e2d61fba98ea2e22e4cfed16d0817ba3d669)
It is not difficult to prove that
![{\displaystyle \mathbf {A} '=\mathbf {B} ^{-1}\;\mathbf {A} \;\mathbf {B} \quad \Longrightarrow \quad \mathrm {Tr} (\mathbf {A} ')=\mathrm {Tr} (\mathbf {A} ),}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b6095cf129c43f40276f3bcc290a17d459133fa7)
from which follows that the trace of
in both bases is equal.
Theorem
Let a linear operator
on Vn have n linearly independent eigenvectors,
![{\displaystyle {\hat {A}}\;v_{i}=\alpha _{i}v_{i}\quad {\hbox{with}}\quad \alpha _{i}\in \mathbb {C} \quad {\hbox{and}}\quad i=1,\ldots ,n.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/568e937e0890d700ba286a63e4f719cebfb57138)
Then its trace is the sum of the eigenvalues
![{\displaystyle \mathrm {Tr} ({\hat {A}})=\sum _{i=1}^{n}\alpha _{i}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/d90ee42a3c79c2076212d14c190ab3ae814d0e77)
Proof
The matrix of
in basis of its eigenvectors is
![{\displaystyle {\hat {A}}\;v_{i}=\sum _{j=1}^{n}\;v_{j}(\alpha _{j}\delta _{ji})\quad \Longrightarrow \quad \mathbf {A} ={\begin{pmatrix}\alpha _{1}&0&\cdots &0\\0&\alpha _{2}&\cdots \\\cdots &&\ddots \\0&&&\alpha _{n}\\\end{pmatrix}},}](https://wikimedia.org/api/rest_v1/media/math/render/svg/fdba7e4851fd5aac6663d5626532d87f43d15319)
where δji is the Kronecker delta.
Note. To avoid misunderstanding: not all linear operators on Vn possess n linearly independent eigenvectors.
Finite-dimensional inner product space
When the n-dimensional linear space Vn is equipped with a positive definite inner product, an expression for the matrix of a linear operator and its trace can be given. These expressions can be generalized to inner product spaces of infinite dimension and are of great importance in quantum mechanics.
Let
![{\displaystyle \{v_{1},v_{2},\ldots ,v_{n}\}\quad {\hbox{with}}\quad \langle v_{i}|v_{j}\rangle =\delta _{ij},\quad i,j=1,\ldots ,n,}](https://wikimedia.org/api/rest_v1/media/math/render/svg/710e1d0b5432c79053bf3c9bd175c56669f959a2)
be an orthonormal basis for Vn. The symbol δij stands for the Kronecker delta. The matrix of
with respect to this basis is given by
![{\displaystyle {\hat {A}}v_{i}=\sum _{j=1}^{n}\;v_{j}A_{ji}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a980d81f9d5c3e88f5d6d0299f5fa10191d6c162)
Project with vk:
![{\displaystyle \langle v_{k}|{\hat {A}}|v_{i}\rangle =\sum _{j=1}^{n}\;\langle v_{k}|v_{j}\rangle \;A_{ji}=\sum _{j=1}^{n}\;\delta _{kj}\;A_{ji}=A_{ki}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e889ca9bfae0a015c41daf3b6378144f118425d3)
Hence
![{\displaystyle A_{ij}=\langle v_{i}|{\hat {A}}|v_{j}\rangle \quad \Longrightarrow \quad \mathrm {Tr} ({\hat {A}})=\sum _{i=1}^{n}\langle v_{i}|{\hat {A}}|v_{i}\rangle .}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e847839ad8ed9cf4bb17e92b9db61d4f6fb9c1e9)
Infinite-dimensional space
The trace of a linear operator on an infinite-dimensional linear space is not always defined. For instance, we saw above that the trace of the identity operator on a finite-dimensional space is equal to the dimension of the space, so that a simple extension of the definition leads to a trace of the identity operator that is infinite, i.e., the trace is undefined. In fact, the property of having a finite trace is a severe restriction on a linear operator.
We consider an infinite-dimensional space with an inner product (a Hilbert space). Let
be a linear operator on this space with the property
![{\displaystyle ({\hat {T}}^{\dagger }{\hat {T}})\;v_{i}=\alpha _{i}^{2}\;v_{i},\quad i=1,2,\ldots ,\infty \quad {\hbox{and}}\quad \alpha _{i}^{2}\in \mathbb {R} ,}](https://wikimedia.org/api/rest_v1/media/math/render/svg/905c7845595fc0104e59755e4a3e7762c4f5d33d)
where {vi} is an orthonormal basis of the space.
Note that the operator
is self-adjoint and positive definite, i.e.,
![{\displaystyle \langle (T^{\dagger }T)w|w\rangle =\langle w|(T^{\dagger }T)w\rangle =\langle Tw|Tw\rangle \geq 0\quad {\hbox{for any}}\quad w.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5d63c72f36c251a73ea2722b63e6452951bddc10)
From this follows that the eigenvalues of
are positive—so that they may be written as squares—and its eigenvectors vi are orthonormal.
If the following sum of square roots of eigenvalues converges,
![{\displaystyle \sum _{i=1}^{\infty }\alpha _{i}<\infty ,}](https://wikimedia.org/api/rest_v1/media/math/render/svg/507177ca4b4b94ed5e0cd2c7bf724c51ee96be43)
then the trace of
can be defined by
![{\displaystyle \mathrm {Tr} ({\hat {T}})\equiv \sum _{i=1}^{\infty }\langle v_{i}|T|v_{i}\rangle ,}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a1fe2224aee59f69c46f3b3db9afb9c60127dba1)
i.e., it can be proved that this summation converges as well. Operators that have a well-defined trace are called "trace class operators" or sometimes "nuclear operators".
As in the finite-dimensional case the trace is independent of the choice of (orthonormal) basis,
![{\displaystyle \mathrm {Tr} ({\hat {T}})=\sum _{i=1}^{\infty }\langle w_{i}|T|w_{i}\rangle <\infty ,}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6d4a2a630f0c8e44e9dc3cfb7957477f95a05472)
for any orthonormal basis {wi}.
An important example of a trace class operator is the exponential of the self-adjoint operator H,
![{\displaystyle e^{-\beta {\hat {H}}},\quad \beta \in \mathbb {R} ,\quad 0<\beta <\infty .}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9b8a0378a6f338a8fbc40a5fb58f08d24f517cb1)
The operator H, being self-adjoint, has only real eigenvalues εi. When H is bounded from below (its lowest eigenvalue is finite) then the sum
![{\displaystyle \mathrm {Tr} e^{-\beta H}=\sum _{i=1}^{\infty }e^{-\beta \epsilon _{i}}<\infty }](https://wikimedia.org/api/rest_v1/media/math/render/svg/cff36e1a495139c038dc310510625218b47272b3)
converges. This trace is the canonical partition function of statistical physics.
Reference
- F. R. Gantmacher, Matrizentheorie, Translated from the Russian by H. Boseck, D. Soyka, and K. Stengert, Springer Verlag, Berlin (1986). ISBN 3540165827
- N. I Achieser and I. M. Glasmann, Theorie der linearen Operatoren im Hilbert Raum, Translated from the Russian by H. Baumgärtel, Verlag Harri Deutsch, Thun (1977). ISBN 3871443263