Trace (linear algebra)
This articleneeds additional citations forverification.(November 2023) |
Inlinear algebra,thetraceof asquare matrixA,denotedtr(A),[1]is defined to be the sum of elements on themain diagonal(from the upper left to the lower right) ofA.The trace is only defined for a square matrix (n×n).
In mathematical physics texts, iftr(A)= 0 then the matrix is said to betraceless.This is a misnomer, but widely used, such as in thePauli Matrices.
It can be proven that the trace of a matrix is the sum of itseigenvalues(counted with multiplicities). It can also be proven thattr(AB) = tr(BA)for any two matricesAandBof appropriate sizes. This implies thatsimilar matriceshave the same trace. As a consequence one can define the trace of alinear operatormapping a finite-dimensionalvector spaceinto itself, since all matrices describing such an operator with respect to a basis are similar.
The trace is related to the derivative of thedeterminant(seeJacobi's formula).
Definition
[edit]Thetraceof ann×nsquare matrixAis defined as[1][2][3]: 34 whereaiidenotes the entry on thei throw andi thcolumn ofA.The entries ofAcan bereal numbers,complex numbers,or more generally elements of afieldF.The trace is not defined for non-square matrices.
Example
[edit]LetAbe a matrix, with
Then
Properties
[edit]Basic properties
[edit]The trace is alinear mapping.That is,[1][2] for all square matricesAandB,and allscalarsc.[3]: 34
A matrix and itstransposehave the same trace:[1][2][3]: 34
This follows immediately from the fact that transposing a square matrix does not affect elements along the main diagonal.
Trace of a product
[edit]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, i.e. as the sum of all elements of theirHadamard product.Phrased directly, ifAandBare twom×nmatrices, then:
If one views any realm×nmatrix as a vector of lengthmn(an operation calledvectorization) then the above operation onAandBcoincides with the standarddot product.According to the above expression,tr(A⊤A)is a sum of squares and hence is nonnegative, equal to zero if and only ifAis 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 aninner product;it is common to calltr(A⊤B)theFrobenius inner productofAandB.This is a natural inner product on thevector spaceof all real matrices of fixed dimensions. Thenormderived from this inner product is called theFrobenius norm,and it satisfies a submultiplicative property, as can be proven with theCauchy–Schwarz inequality: ifAandBare realpositive semi-definite matricesof the same size. The Frobenius inner product and norm arise frequently inmatrix calculusandstatistics.
The Frobenius inner product may be extended to ahermitian inner producton thecomplex vector spaceof all complex matrices of a fixed size, by replacingBby itscomplex 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. IfAandBarem×nandn×mreal or complex matrices, respectively, then[1][2][3]: 34 [note 1]
This is notable both for the fact thatABdoes not usually equalBA,and also since the trace of either does not usually equaltr(A)tr(B).[note 2]Thesimilarity-invarianceof the trace, meaning thattr(A) = tr(P−1AP)for any square matrixAand any invertible matrixPof the same dimensions, is a fundamental consequence. This is proved by Similarity invariance is the crucial property of the trace in order to discuss traces oflinear transformationsas below.
Additionally, for real column vectorsand,the trace of the outer product is equivalent to the inner product:
Cyclic property
[edit]More generally, the trace isinvariant undercircular shifts,that is,
This is known as thecyclic property.
Arbitrary permutations are not allowed: in general,
However, if products ofthreesymmetricmatrices are considered, any permutation is allowed, since: 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
[edit]The trace of theKronecker productof two matrices is the product of their traces:
Characterization of the trace
[edit]The following three properties: characterize the traceup toa scalar multiple in the following sense: Ifis alinear functionalon the space of square matrices that satisfiesthenandare proportional.[note 3]
Formatrices, imposing the normalizationmakesequal to the trace.
Trace as the sum of eigenvalues
[edit]Given anyn×nmatrixA,there is
whereλ1,..., λnare theeigenvaluesofAcounted with multiplicity. This holds true even ifAis a real matrix and some (or all) of the eigenvalues are complex numbers. This may be regarded as a consequence of the existence of theJordan canonical form,together with the similarity-invariance of the trace discussed above.
Trace of commutator
[edit]When bothAandBaren×nmatrices, the trace of the (ring-theoretic)commutatorofAandBvanishes:tr([A,B]) = 0,becausetr(AB) = tr(BA)andtris linear. One can state this as "the trace is a map ofLie algebrasgln→kfrom operators to scalars ", as the commutator of scalars is trivial (it is anAbelian 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 isunitarily equivalentto a square matrix with diagonal consisting of all zeros.
Traces of special kinds of matrices
[edit]- The trace of then×nidentity matrixis the dimension of the space, namelyn.
- The trace of aHermitian matrixis real, because the elements on the diagonal are real.
- The trace of apermutation matrixis the number offixed pointsof the corresponding permutation, because the diagonal termaiiis 1 if theith point is fixed and 0 otherwise.
- The trace of aprojection matrixis the dimension of the target space. The matrixPXis idempotent.
- More generally, the trace of anyidempotent matrix,i.e. one withA2=A,equals its ownrank.
- The trace of anilpotent matrixis zero.
When the characteristic of the base field is zero, the converse also holds: iftr(Ak) = 0for allk,thenAis nilpotent.
When the characteristicn> 0is positive, the identity inndimensions is a counterexample, as,but the identity is not nilpotent.
Relationship to the characteristic polynomial
[edit]The trace of anmatrixis the coefficient ofin thecharacteristic polynomial,possibly changed of sign, according to the convention in the definition of the characteristic polynomial.
Relationship to eigenvalues
[edit]IfAis a linear operator represented by a square matrix withrealorcomplexentries and ifλ1,...,λnare theeigenvaluesofA(listed according to theiralgebraic multiplicities), then
This follows from the fact thatAis alwayssimilarto itsJordan form,an uppertriangular matrixhavingλ1,...,λnon the main diagonal. In contrast, thedeterminantofAis theproductof its eigenvalues; that is,
Everything in the present section applies as well to any square matrix with coefficients in analgebraically closed field.
Derivative relationships
[edit]IfΔAis a square matrix with small entries andIdenotes theidentity matrix,then we have approximately
Precisely this means that the trace is thederivativeof thedeterminantfunction at the identity matrix.Jacobi's formula
is more general and describes thedifferentialof the determinant at an arbitrary square matrix, in terms of the trace and theadjugateof the matrix.
From this (or from the connection between the trace and the eigenvalues), one can derive a relation between the trace function, thematrix exponentialfunction, and the determinant:
A related characterization of the trace applies to linearvector fields.Given a matrixA,define a vector fieldFonRnbyF(x) =Ax.The components of this vector field are linear functions (given by the rows ofA). ItsdivergencedivFis a constant function, whose value is equal totr(A).
By thedivergence theorem,one can interpret this in terms of flows: ifF(x)represents the velocity of a fluid at locationxandUis a region inRn,thenet flowof the fluid out ofUis given bytr(A) · vol(U),wherevol(U)is thevolumeofU.
The trace is a linear operator, hence it commutes with the derivative:
Trace of a linear operator
[edit]In general, given some linear mapf:V→V(whereVis a finite-dimensionalvector space), we can define the trace of this map by considering the trace of amatrix representationoff,that is, choosing abasisforVand describingfas 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 tosimilar matrices,allowing for the possibility of a basis-independent definition for the trace of a linear map.
Such a definition can be given using thecanonical isomorphismbetween the spaceEnd(V)of linear maps onVandV⊗V*,whereV*is thedual spaceofV.Letvbe inVand letgbe inV*.Then the trace of the indecomposable elementv⊗gis defined to beg(v);the trace of a general element is defined by linearity. The trace of a linear mapf:V→Vcan then be defined as the trace, in the above sense, of the element ofV⊗V*corresponding tofunder the above mentioned canonical isomorphism. Using an explicit basis forVand the corresponding dual basis forV*,one can show that this gives the same definition of the trace as given above.
Numerical algorithms
[edit]Stochastic estimator
[edit]The trace can be estimated unbiasedly by "Hutchinson's trick":[5]
Given any matrix,and any randomwith,we have.(Proof: expand the expectation directly.)
Usually, the random vector is sampled from(normal distribution) or(Rademacher distribution).
More sophisticated stochastic estimators of trace have been developed.[6]
Applications
[edit]If a 2 x 2 real matrix has zero trace, its square is adiagonal matrix.
The trace of a 2 × 2complex matrixis used to classifyMöbius transformations.First, the matrix is normalized to make itsdeterminantequal to one. Then, if the square of the trace is 4, the corresponding transformation isparabolic.If the square is in the interval[0,4),it iselliptic.Finally, if the square is greater than 4, the transformation isloxodromic.Seeclassification of Möbius transformations.
The trace is used to definecharactersofgroup representations.Two representationsA,B:G→GL(V)of a groupGare equivalent (up to change of basis onV) iftr(A(g)) = tr(B(g))for allg∈G.
The trace also plays a central role in the distribution ofquadratic forms.
Lie algebra
[edit]The trace is a map of Lie algebrasfrom the Lie algebraof linear operators on ann-dimensional space (n×nmatrices with entries in) to the Lie algebraKof scalars; asKis 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:
The kernel of this map, a matrix whose trace iszero,is often said to betracelessortrace free,and these matrices form thesimple Lie algebra,which is theLie algebraof thespecial linear groupof matrices with determinant 1. The special linear group consists of the matrices which do not change volume, while thespecial linear Lie algebrais the matrices which do not alter volume ofinfinitesimalsets.
In fact, there is an internaldirect sumdecompositionof 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:
Formally, one can compose the trace (thecounitmap) with the unit mapof "inclusion ofscalars"to obtain a mapmapping onto scalars, and multiplying byn.Dividing bynmakes this a projection, yielding the formula above.
In terms ofshort exact sequences,one has which is analogous to (where) forLie groups.However, the trace splits naturally (viatimes scalars) so,but the splitting of the determinant would be as thenth 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:
Bilinear forms
[edit]Thebilinear form(whereX,Yare square matrices) is called theKilling form,which is used for the classification of Lie algebras.
The trace defines a bilinear form:
The form is symmetric, non-degenerate[note 5]and associative in the sense that:
For a complex simple Lie algebra (such asn), every such bilinear form is proportional to each other; in particular, to the Killing form[citation needed].
Two matricesXandYare said to betrace orthogonalif
There is a generalization to a general representationof a Lie algebra,such thatis a homomorphism of Lie algebrasThe trace formonis defined as above. The bilinear form is symmetric and invariant due to cyclicity.
Generalizations
[edit]The concept of trace of a matrix is generalized to thetrace classofcompact operatorsonHilbert spaces,and the analog of theFrobenius normis called theHilbert–Schmidtnorm.
IfKis a trace-class operator, then for anyorthonormal basis,the trace is given by and is finite and independent of the orthonormal basis.[7]
Thepartial traceis another generalization of the trace that is operator-valued. The trace of a linear operatorZwhich lives on a product spaceA⊗Bis equal to the partial traces overAandB:
For more properties and a generalization of the partial trace, seetraced monoidal categories.
IfAis a generalassociative algebraover a fieldk,then a trace onAis often defined to be any maptr:A↦kwhich vanishes on commutators;tr([a,b]) = 0for alla,b∈A.Such a trace is not uniquely defined; it can always at least be modified by multiplication by a nonzero scalar.
Asupertraceis the generalization of a trace to the setting ofsuperalgebras.
The operation oftensor contractiongeneralizes the trace to arbitrary tensors.
Traces in the language of tensor products
[edit]Given a vector spaceV,there is a natural bilinear mapV×V∗→Fgiven by sending(v,φ)to the scalarφ(v).Theuniversal propertyof thetensor productV⊗V∗automatically implies that this bilinear map is induced by a linear functional onV⊗V∗.[8]
Similarly, there is a natural bilinear mapV×V∗→ Hom(V,V)given by sending(v,φ)to the linear mapw↦ φ(w)v.The universal property of the tensor product, just as used previously, says that this bilinear map is induced by a linear mapV⊗V∗→ Hom(V,V).IfVis finite-dimensional, then this linear map is alinear isomorphism.[8]This fundamental fact is a straightforward consequence of the existence of a (finite) basis ofV,and can also be phrased as saying that any linear mapV→Vcan 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 onHom(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 formulatr(AB) = tr(BA)is straightforward to prove, and was given above. In the present perspective, one is considering linear mapsSandT,and viewing them as sums of rank-one maps, so that there are linear functionalsφiandψjand nonzero vectorsviandwjsuch thatS(u) = Σφi(u)viandT(u) = Σψj(u)wjfor anyuinV.Then
for anyuinV.The rank-one linear mapu↦ψj(u)φi(wj)vihas traceψj(vi)φi(wj)and so
Following the same procedure withSandTreversed, one finds exactly the same formula, proving thattr(S∘T)equalstr(T∘S).
The above proof can be regarded as being based upon tensor products, given that the fundamental identity ofEnd(V)withV⊗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 mapV×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 mapEnd(V) × End(V) → End(V)given by sending(f,g)to the compositionf∘g,which is then induced by a linear mapEnd(V) ⊗ End(V) → End(V).It can be seen that this coincides with the linear mapV⊗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 spaceV,there is a natural linear mapF→V⊗V';in the language of linear maps, it assigns to a scalarcthe linear mapc⋅idV.Sometimes this is calledcoevaluation map,and the traceV⊗V'→Fis calledevaluation map.[8]These structures can be axiomatized to definecategorical tracesin the abstract setting ofcategory theory.
See also
[edit]- 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
[edit]- ^This is immediate from the definition of thematrix product:
- ^For example, if then the product is and the traces aretr(AB) = 1 ≠ 0 ⋅ 0 = tr(A)tr(B).
- ^Proof: Letthe standard basis and note thatif and only ifand More abstractly, this corresponds to the decomposition as(equivalently,) defines the trace onwhich 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:is asemisimple Lie algebraand thus every element in it is a linear combination of commutators of some pairs of elements, otherwise thederived algebrawould be a proper ideal.
- ^This follows from the fact thattr(A*A) = 0if and only ifA=0.
References
[edit]- ^abcde"Rank, trace, determinant, transpose, and inverse of matrices".fourier.eng.hmc.edu.Retrieved2020-09-09.
- ^abcdWeisstein, Eric W.(2003) [1999]."Trace (matrix)".In Weisstein, Eric W. (ed.).CRC Concise Encyclopedia of Mathematics(2nd ed.). Boca Raton, FL:Chapman & Hall.doi:10.1201/9781420035223.ISBN1-58488-347-2.MR1944431.Zbl1079.00009.Retrieved2020-09-09.
- ^abcdLipschutz, Seymour; Lipson, Marc (September 2005).Theory and Problems of Linear Algebra.Schaum's Outline. McGraw-Hill.ISBN9780070605022.
- ^Horn, Roger A.; Johnson, Charles R. (2013).Matrix Analysis(2nd ed.). Cambridge University Press.ISBN9780521839402.
- ^Hutchinson, M.F. (January 1989)."A Stochastic Estimator of the Trace of the Influence Matrix for Laplacian Smoothing Splines".Communications in Statistics - Simulation and Computation.18(3): 1059–1076.doi:10.1080/03610918908812806.ISSN0361-0918.
- ^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.ISSN0004-5411.S2CID5827717.
- ^Teschl, G. (30 October 2014).Mathematical Methods in Quantum Mechanics.Graduate Studies in Mathematics. Vol. 157 (2nd ed.). American Mathematical Society.ISBN978-1470417048.
- ^abcdKassel, Christian (1995).Quantum groups.Graduate Texts in Mathematics.Vol. 155. New York:Springer-Verlag.doi:10.1007/978-1-4612-0783-2.ISBN0-387-94370-6.MR1321145.Zbl0808.17003.
- Gantmacher, F.R.(1959).The Theory of Matrices.Translated byHirsch, K.A.New York, NY:Chelsea Publishing Company.MR0107649.
- Horn, R.A.;Johnson, C.R.(2013) [1985].Matrix Analysis(2nd ed.). Cambridge, UK:Cambridge University Press.ISBN978-0-521-54823-6.MR2978290.
- Strang, G.(2004) [1976].Linear Algebra and its Applications(4th ed.).Cengage Learning.ISBN978-003010567-8.