Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Trace of a Matrix






The Simplest Matrix Invariant

The trace of a square matrix is the sum of its diagonal entries — an operation so simple it barely seems worth naming. Yet this single number equals the sum of the eigenvalues, remains unchanged under similarity transformations, and turns up in inner products, commutator identities, and optimization gradients. Its simplicity is precisely what makes it powerful.



Definition

For an n×nn \times n matrix AA, the trace is the sum of the entries on the main diagonal:

Trace Definition
tr(A)=i=1naii=a11+a22++ann\text{tr}(A) = \sum_{i=1}^{n} a_{ii} = a_{11} + a_{22} + \cdots + a_{nn}

The trace is defined only for square matrices — a rectangular matrix has no trace.

For example, if A=(314159265)A = \begin{pmatrix} 3 & 1 & 4 \\ 1 & 5 & 9 \\ 2 & 6 & 5 \end{pmatrix}, then tr(A)=3+5+5=13\text{tr}(A) = 3 + 5 + 5 = 13. The off-diagonal entries play no role.

The trace of the n×nn \times n identity matrix is tr(In)=n\text{tr}(I_n) = n, since there are nn ones on the diagonal. The trace of the zero matrix is 00.
A4×4a1,1a1,2a1,3a1,4a2,1a2,2a2,3a2,4a3,1a3,2a3,3a3,4a4,1a4,2a4,3a4,4
Sweeping the main diagonal

Only the entries on the main diagonal are picked up; everything off it is passed over untouched. That is the entire definition, and it is why the trace is defined for square matrices alone — a non-square matrix has no full diagonal to sweep. Run the sweep on your own matrix on the trace visualizer.

Everything that follows — linearity, the cyclic property, the link to eigenvalues — is a consequence of the trace being this simple a sum.

Trace Notation

Notation

Trace Notation

A three-letter operator that looks like a function and behaves like one, wrapped around a matrix and returning a scalar. The marks worth fixing are its competing spellings, the repeated subscript that picks out the diagonal, and the rearrangement rule that permits exactly one kind of reordering. All of them are catalogued among the linear algebra symbols.
The bracket-and-subscript anatomy [aij][a_{ij}] and the transpose ATA^{T} come from matrix operation notation; det\det and its bars from determinant notation; λ\lambda from eigenvalue notation; Σ\Sigma and its running index from sequence notation.
tr(A)\operatorname{tr}(A)
the trace of A
An operator name, set upright like det\det and rank\operatorname{rank} — the roman type is what marks it as a name rather than a product of three variables trt\cdot r. It consumes a matrix and returns a scalar, and it is defined only for square matrices, as Definition above states: a rectangular matrix has no diagonal to sum.
Also writtenCapitalised Tr(A)\operatorname{Tr}(A) throughout physics — in quantum mechanics the partial trace TrB\operatorname{Tr}_B carries a subscript naming the subsystem traced out. German and older Russian texts write sp(A)\operatorname{sp}(A) or Sp(A)\operatorname{Sp}(A), from Spur, the same word English borrowed as "trace". Brackets trA\operatorname{tr} A without parentheses are common once the argument is a single letter.
Do not confuseThe determinant. Both wrap a square matrix and return one number, and both appear in the characteristic polynomial — but tr\operatorname{tr} is additive and not multiplicative while det\det is multiplicative and not additive, the contrast Linearity below draws out. Neither has a bar notation in common with the other: A|A| always means the determinant.
tr(A)=i=1naii\operatorname{tr}(A) = \sum_{i=1}^{n} a_{ii}
sum of a-sub-i-i — the entries whose two indices agree
The repeated subscript is the whole definition: in [aij][a_{ij}] the first index is the row and the second the column, so forcing i=ji = j selects exactly the main diagonal. One running letter appears twice in a single symbol, which is a different job from the usual row-and-column pair of matrix notation.
CasesThe same doubled-index device names diagonal entries wherever they matter — aiia_{ii} for the diagonal of a product, δij\delta_{ij} for the identity's entries — and physics compresses the summation sign away entirely under the Einstein convention, where a twice-repeated index is summed by default and aiia_{ii} alone means the trace.
Do not confuseaia_{i} or ai1a_{i1}. A single subscript indexes a vector's component, not a matrix entry; the diagonal needs both slots filled with the same letter, and dropping one silently changes which object is being summed.
tr(AB)=tr(BA)\operatorname{tr}(AB) = \operatorname{tr}(BA)
the trace is unchanged when the factors are rotated, not merely swapped
The permission this notation grants is narrower than it looks. Factors may be rotatedtr(ABC)=tr(BCA)=tr(CAB)\operatorname{tr}(ABC) = \operatorname{tr}(BCA) = \operatorname{tr}(CAB) — because each rotation moves the front factor to the back. The Cyclic Property below works through why.
CasesThe rule is what makes the trace blind to similarity: tr(P1AP)=tr(APP1)=tr(A)\operatorname{tr}(P^{-1}AP) = \operatorname{tr}(APP^{-1}) = \operatorname{tr}(A), one rotation and the change of basis cancels — which is why the trace can equal the sum of the eigenvalues at all, a basis-independent quantity read off a basis-dependent array.
Do not confuseFull commutativity. tr(ABC)=tr(BAC)\operatorname{tr}(ABC) = \operatorname{tr}(BAC) is false in general — that is a swap of two adjacent factors, not a rotation. The two look almost identical on the page, and the cyclic rule is routinely over-applied into the wrong one.
A,BF=tr(ATB)\langle A, B\rangle_F = \operatorname{tr}(A^{T}B)
the Frobenius inner product of A and B
The trace borrows the inner-product brackets and the subscript FF names which one: tr(ATB)\operatorname{tr}(A^{T}B) multiplies the two matrices entry by entry and adds, exactly as if each were flattened into a vector of n2n^2 components — Frobenius Inner Product below.
CasesIts norm follows the same pattern one bar-count up, AF=tr(ATA)\|A\|_F = \sqrt{\operatorname{tr}(A^{T}A)} — the double-bar norm with a subscript, since a matrix here is being measured as a long vector rather than as a transformation.
Do not confuseThe matrix product itself. tr(ATB)\operatorname{tr}(A^{T}B) is a single number; ATBA^{T}B is a matrix — the trace is what collapses it, and dropping the operator turns a scalar quantity into an array without any visible error.

Linearity

The trace is a linear function from the space of n×nn \times n matrices to the real numbers. It satisfies additivity:

tr(A+B)=tr(A)+tr(B)\text{tr}(A + B) = \text{tr}(A) + \text{tr}(B)


and scalar homogeneity:

tr(cA)=ctr(A)\text{tr}(cA) = c \cdot \text{tr}(A)


Combined, these give the linearity identity:

Trace Linearity
tr(cA+dB)=ctr(A)+dtr(B)\text{tr}(cA + dB) = c \cdot \text{tr}(A) + d \cdot \text{tr}(B)

for any scalars c,dc, d and any n×nn \times n matrices A,BA, B. Both component properties follow immediately from the definition — the sum of the diagonals of A+BA + B is the sum of the individual diagonal sums, and scaling every entry by cc scales each diagonal entry by cc.

The transpose does not affect the trace, since transposition does not move the diagonal entries:

Trace of Transpose
tr(AT)=tr(A)\text{tr}(A^T) = \text{tr}(A)

It is worth contrasting the trace with the determinant. The determinant is multiplicative (det(AB)=det(A)det(B)\det(AB) = \det(A)\det(B)) but not additive (det(A+B)det(A)+det(B)\det(A + B) \neq \det(A) + \det(B) in general). The trace is additive but not multiplicative — tr(AB)\text{tr}(AB) generally has no relation to tr(A)tr(B)\text{tr}(A) \cdot \text{tr}(B). Each captures different structural information about the matrix.
Property Trace Determinant
Additivity tr(A + B) = tr(A) + tr(B) det(A + B) ≠ det(A) + det(B) in general
Multiplicativity tr(AB) has no simple relation to tr(A)·tr(B) det(AB) = det(A) · det(B)
Transpose tr(Aᵀ) = tr(A) det(Aᵀ) = det(A)
Eigenvalue link sum: λ₁ + λ₂ + ⋯ + λₙ product: λ₁ · λ₂ · ⋯ · λₙ
Similarity invariance tr(P⁻¹AP) = tr(A) det(P⁻¹AP) = det(A)

Trace of Special Matrices

For a diagonal matrix D=diag(d1,,dn)D = \text{diag}(d_1, \dots, d_n), the trace is simply d1+d2++dnd_1 + d_2 + \cdots + d_n — the entire matrix reduces to its diagonal, and the trace reads off everything. A scalar matrix cIcI has trace cncn.

A skew-symmetric matrix has all diagonal entries equal to zero (since aii=aiia_{ii} = -a_{ii} forces aii=0a_{ii} = 0), so tr(A)=0\text{tr}(A) = 0 for every real skew-symmetric matrix.

An idempotent matrix — one satisfying A2=AA^2 = A — has a striking property: tr(A)=rank(A)\text{tr}(A) = \text{rank}(A). The eigenvalues of an idempotent matrix are restricted to 00 and 11, the trace counts the number of eigenvalues equal to 11, and this count equals the dimension of the column space.

A nilpotent matrix has all eigenvalues equal to zero, so tr(A)=0\text{tr}(A) = 0. More generally, tr(Ak)=0\text{tr}(A^k) = 0 for every positive integer kk, since the eigenvalues of AkA^k are the kk-th powers of the eigenvalues of AA, and 0k=00^k = 0.
Matrix type Defining condition Trace
Diagonal D = diag(d₁,…,dₙ) nonzero entries only on the diagonal d₁ + d₂ + ⋯ + dₙ
Scalar cI every diagonal entry equals c cn
Identity Iₙ diagonal with every diagonal entry equal to 1 n
Skew-symmetric Aᵀ = −A (forces zero diagonal) 0
Idempotent A² = A rank(A)
Nilpotent Aᵏ = O for some k ≥ 1 0

The Cyclic Property

The most distinctive algebraic property of the trace is its invariance under cyclic permutations of a product. For any two matrices AA and BB where both products ABAB and BABA are defined:

Trace Cyclic Property
tr(AB)=tr(BA)\text{tr}(AB) = \text{tr}(BA)

Note that ABAB and BABA need not even have the same dimensions — if AA is m×nm \times n and BB is n×mn \times m, then ABAB is m×mm \times m and BABA is n×nn \times n. The traces of these differently-sized matrices are nevertheless equal.

The proof is a direct computation. The (i,i)(i,i) entry of ABAB is kaikbki\sum_k a_{ik} b_{ki}, so tr(AB)=ikaikbki\text{tr}(AB) = \sum_i \sum_k a_{ik} b_{ki}. The (k,k)(k,k) entry of BABA is ibkiaik\sum_i b_{ki} a_{ik}, so tr(BA)=kibkiaik\text{tr}(BA) = \sum_k \sum_i b_{ki} a_{ik}. Both double sums range over the same index pairs and contain the same terms.

For three matrices, the cyclic property extends to

tr(ABC)=tr(BCA)=tr(CAB)\text{tr}(ABC) = \text{tr}(BCA) = \text{tr}(CAB)


Only cyclic reorderings are permitted. The rearrangement tr(ABC)=tr(ACB)\text{tr}(ABC) = \text{tr}(ACB) is false in general — swapping two adjacent factors is not a cyclic permutation.

Trace and Eigenvalues

The trace of a matrix equals the sum of its eigenvalues, counted with algebraic multiplicity:

Trace Sum of Eigenvalues
tr(A)=λ1+λ2++λn\text{tr}(A) = \lambda_1 + \lambda_2 + \cdots + \lambda_n

This identity connects a trivially computable quantity (add the diagonal entries) to eigenvalue information that ordinarily requires solving a degree-nn polynomial.

The proof comes from the characteristic polynomial p(λ)=det(AλI)p(\lambda) = \det(A - \lambda I). Expanding this determinant produces a polynomial of degree nn whose leading term is (λ)n(-\lambda)^n and whose λn1\lambda^{n-1} coefficient is (1)n1tr(A)(-1)^{n-1} \text{tr}(A). By Vieta's formulas, the sum of the roots of pp equals tr(A)\text{tr}(A).

A companion identity links the determinant to the product of eigenvalues: det(A)=λ1λ2λn\det(A) = \lambda_1 \lambda_2 \cdots \lambda_n. Together, the trace and the determinant capture the two simplest symmetric functions of the eigenvalue spectrum — their sum and their product.

For a 3×33 \times 3 matrix with eigenvalues 2,1,42, -1, 4, the trace is 55 and the determinant is 8-8. Neither the trace nor the determinant individually determines the eigenvalues, but together they constrain them heavily. For a 2×22 \times 2 matrix, the trace and determinant determine the eigenvalues completely via the quadratic formula.

Trace and Similarity

Two matrices AA and BB are similar if B=P1APB = P^{-1}AP for some invertible matrix PP. Similar matrices represent the same linear transformation in different coordinate systems — PP encodes the change of basis.

The trace is invariant under similarity:

Trace Similarity Invariance
tr(P1AP)=tr(A)\text{tr}(P^{-1}AP) = \text{tr}(A)

This follows in one step from the cyclic property: tr(P1AP)=tr(APP1)=tr(A)\text{tr}(P^{-1}AP) = \text{tr}(APP^{-1}) = \text{tr}(A).

Invariance under similarity means the trace is a property of the transformation itself, not of any particular matrix representation. No matter which basis is chosen, the trace comes out the same. The eigenvalues share this invariance (similar matrices have the same eigenvalues), and indeed tr(A)=λi\text{tr}(A) = \sum \lambda_i is an eigenvalue identity, so trace invariance and eigenvalue invariance are two sides of the same coin.

The determinant is also a similarity invariant: det(P1AP)=det(A)\det(P^{-1}AP) = \det(A). Together with the trace, it forms the beginning of a sequence of similarity invariants — the coefficients of the characteristic polynomial — that collectively determine the eigenvalue structure of the transformation.

The Frobenius Inner Product

The trace provides a natural inner product on the space of n×nn \times n matrices. For two matrices AA and BB, the Frobenius inner product is

Frobenius Inner Product
A,BF=tr(ATB)=i=1nj=1naijbij\langle A, B \rangle_F = \text{tr}(A^T B) = \sum_{i=1}^{n} \sum_{j=1}^{n} a_{ij} b_{ij}

This is the dot product of AA and BB viewed as vectors of n2n^2 entries. It is symmetric (A,BF=B,AF\langle A, B \rangle_F = \langle B, A \rangle_F), linear in each argument, and positive definite (A,AF>0\langle A, A \rangle_F > 0 whenever AOA \neq O).

The associated norm is the Frobenius norm:

Frobenius Norm
AF=tr(ATA)=i,jaij2\|A\|_F = \sqrt{\text{tr}(A^T A)} = \sqrt{\sum_{i,j} a_{ij}^2}

This measures the "total size" of a matrix as the square root of the sum of squares of all entries — the matrix analogue of the Euclidean length of a vector.

The Frobenius inner product turns the space of n×nn \times n matrices into an inner product space, bringing geometric concepts — angles, orthogonality, projections, distances — to bear on matrices themselves, not just on the vectors they act upon.

Trace of Commutators

The commutator of two n×nn \times n matrices is the matrix

[A,B]=ABBA[A, B] = AB - BA


The commutator measures how far AA and BB are from commuting — it is zero if and only if AB=BAAB = BA.

Regardless of what AA and BB are, the commutator always has trace zero:

Trace of Commutator
tr(ABBA)=0\text{tr}(AB - BA) = 0

The cancellation follows from the cyclic property: tr(ABBA)=tr(AB)tr(BA)=0\text{tr}(AB - BA) = \text{tr}(AB) - \text{tr}(BA) = 0. This means the identity matrix II can never be a commutator, since tr(I)=n0\text{tr}(I) = n \neq 0. In particular, there exist no n×nn \times n matrices A,BA, B satisfying ABBA=IAB - BA = I when working over the real or complex numbers with finite-dimensional matrices.

The converse does not hold in general: a traceless matrix is not necessarily a commutator, though in the space of n×nn \times n matrices over a field, every traceless matrix can in fact be written as a commutator — a result that requires proof beyond the trace identity itself.

Trace Identities

Several identities involving the trace appear frequently enough to be worth collecting.

If SS is symmetric and KK is skew-symmetric, then their product has trace zero:

Trace Symmetric Skew Zero
S=ST, K=KT    tr(SK)=0S = S^T,\ K = -K^T \implies \text{tr}(SK) = 0

The proof: tr(SK)=tr((SK)T)=tr(KTST)=tr(KS)=tr(KS)=tr(SK)\text{tr}(SK) = \text{tr}((SK)^T) = \text{tr}(K^T S^T) = \text{tr}(-KS) = -\text{tr}(KS) = -\text{tr}(SK), where the last step uses the cyclic property. The only number equal to its own negative is zero.

The trace can be written as a sum of quadratic forms against the standard basis: tr(A)=i=1neiTAei\text{tr}(A) = \sum_{i=1}^{n} \mathbf{e}_i^T A \mathbf{e}_i. Each term eiTAei=aii\mathbf{e}_i^T A \mathbf{e}_i = a_{ii} extracts one diagonal entry. This formula generalizes to any orthonormal basis {q1,,qn}\{\mathbf{q}_1, \dots, \mathbf{q}_n\}:

Trace Orthonormal Basis
tr(A)=i=1nqiTAqi\text{tr}(A) = \sum_{i=1}^{n} \mathbf{q}_i^T A \mathbf{q}_i

The result is independent of which orthonormal basis is used — another manifestation of the trace's invariance under orthogonal change of coordinates.

Trace in Differentiation

Many objective functions in optimization and statistics are expressed as traces of matrix products, and computing their gradients requires differentiating with respect to a matrix variable.

The simplest case is the linear function f(X)=tr(AX)f(X) = \text{tr}(AX), where AA is a fixed matrix and XX is the variable. The derivative with respect to XX is

Xtr(AX)=AT\frac{\partial}{\partial X} \text{tr}(AX) = A^T


For the quadratic form f(X)=tr(XTAX)f(X) = \text{tr}(X^T A X), the derivative is

Xtr(XTAX)=(A+AT)X\frac{\partial}{\partial X} \text{tr}(X^T A X) = (A + A^T)X


When AA is symmetric, this simplifies to 2AX2AX.

These formulas are the matrix analogues of the scalar rules ddx(ax)=a\frac{d}{dx}(ax) = a and ddx(ax2)=2ax\frac{d}{dx}(ax^2) = 2ax. They appear in deriving the normal equations for least squares, in the gradient descent updates for matrix factorization problems, and in the analysis of covariance estimators. The trace's linearity and cyclic property make these derivatives clean and systematic — full matrix calculus extends these patterns to products of arbitrary length and composition.

Trace Properties at a Glance

The properties developed across the preceding sections can be collected for quick reference. Each row pairs the defining identity with the structural fact it carries — the trace owes its usefulness to this short list of algebraic guarantees.
Matrix · trace

Trace properties at a glance

Seven identities, each linked to the section that proves it. What holds them together is that the trace sees only the diagonal — every entry below either exploits that or is limited by it.

07properties
Unconditional3
i
Linearity§ 2tr(cA+dB)=ctr(A)+dtr(B)\operatorname{tr}(cA + dB) = c\operatorname{tr}(A) + d\operatorname{tr}(B)
The trace is a linear functional on the space of n × n matrices — it maps matrices to scalars…
Unconditional
Requires
A,BA, B both n×nn \times n

The trace is a linear functional on the space of n×nn \times n matrices — it maps matrices to scalars while respecting addition and scaling. That is a stronger statement than the formula alone: it means the trace lives in the dual space, which is what makes the Frobenius inner product possible.

ii
Transpose invariance§ 9tr(AT)=tr(A)\operatorname{tr}(A^{\mathsf{T}}) = \operatorname{tr}(A)
Transposition reflects entries across the main diagonal, and the diagonal entries are exactly…
Unconditional
Requires
AA square

Transposition reflects entries across the main diagonal, and the diagonal entries are exactly the ones fixed by that reflection. Since the trace reads only those, it cannot notice.

vi
Commutator trace§ 8tr(ABBA)=0\operatorname{tr}(AB - BA) = 0
Immediate from the cyclic property and linearity.
Unconditional
Requires
A,BA, B both n×nn \times n

Immediate from the cyclic property and linearity. The consequence is sharper than it looks: since tr(In)=n0\operatorname{tr}(I_n) = n \neq 0, the identity matrix is never a commutator. No pair of matrices satisfies ABBA=IAB - BA = I in finite dimensions — which is exactly why the canonical commutation relation of quantum mechanics needs infinite-dimensional operators.

Conditional4
iii
Cyclic property§ 4tr(AB)=tr(BA)\operatorname{tr}(AB) = \operatorname{tr}(BA)
Rotating the factors is allowed; permuting them arbitrarily is not.
Conditional
Holds when
both products defined — AA and BB need not be square
Common error
reading it as full commutativity: tr(ABC)=tr(BCA)\operatorname{tr}(ABC) = \operatorname{tr}(BCA) but not tr(BAC)\operatorname{tr}(BAC)

Rotating the factors is allowed; permuting them arbitrarily is not. For three matrices the cyclic rotations ABCBCACABABC \to BCA \to CAB all share a trace, while BACBAC generally does not. This is the identity everything below is derived from — it is the reason the trace survives a change of basis at all.

Where it breaksA = [[1, 0], [0, 0]], B = [[0, 1], [0, 0]], C = [[0, 0], [1, 0]]
tr(ABC) = 1 but tr(BAC) = 0
iv
Similarity invariance§ 6tr(P1AP)=tr(A)\operatorname{tr}(P^{-1}AP) = \operatorname{tr}(A)
A direct consequence of the cyclic property: rotate P^-1 to the back and it meets P.
Conditional
Holds when
PP invertible

A direct consequence of the cyclic property: rotate P1P^{-1} to the back and it meets PP. The consequence is what matters — the trace is a property of the underlying linear transformation, not of the basis chosen to write it down. Two matrices with different traces cannot represent the same map.

v
Eigenvalue sum§ 5tr(A)=λ1+λ2++λn\operatorname{tr}(A) = \lambda_1 + \lambda_2 + \cdots + \lambda_n
Spectral information read straight off the diagonal, with no characteristic polynomial to solve.
Conditional
Holds when
eigenvalues counted with algebraic multiplicity, over C\mathbb{C}

Spectral information read straight off the diagonal, with no characteristic polynomial to solve. Over R\mathbb{R} the statement can fail because some eigenvalues may not exist there — a rotation matrix has trace 2cosθ2\cos\theta and no real eigenvalues at all. The sum is still correct once the complex pair is counted.

vii
Frobenius inner product§ 7A,BF=tr(ATB)\langle A, B \rangle_F = \operatorname{tr}(A^{\mathsf{T}}B)
Gives the space of matrices a geometry — angles, lengths and projections, exactly as the dot…
Conditional
Holds when
real entries; use AA^* for the complex case

Gives the space of matrices a geometry — angles, lengths and projections, exactly as the dot product does for vectors. Positive definiteness holds because A,AF\langle A, A \rangle_F is the sum of every entry squared, so the induced norm is the Frobenius norm.

Unconditional
Conditional
Linearity§ 2Unconditional
tr(cA+dB)=ctr(A)+dtr(B)\operatorname{tr}(cA + dB) = c\operatorname{tr}(A) + d\operatorname{tr}(B)
Requires
A,BA, B both n×nn \times n
The trace is a linear functional on the space of n×nn \times n matrices — it maps matrices to scalars while respecting addition and scaling. That is a stronger statement than the formula alone: it means the trace lives in the dual space, which is what makes the Frobenius inner product possible.
Read the full section
tr(AT)=tr(A)\operatorname{tr}(A^{\mathsf{T}}) = \operatorname{tr}(A)
Requires
AA square
Transposition reflects entries across the main diagonal, and the diagonal entries are exactly the ones fixed by that reflection. Since the trace reads only those, it cannot notice.
Read the full section
tr(AB)=tr(BA)\operatorname{tr}(AB) = \operatorname{tr}(BA)
Holds when
both products defined — AA and BB need not be square
Common error
reading it as full commutativity: tr(ABC)=tr(BCA)\operatorname{tr}(ABC) = \operatorname{tr}(BCA) but not tr(BAC)\operatorname{tr}(BAC)
Rotating the factors is allowed; permuting them arbitrarily is not. For three matrices the cyclic rotations ABCBCACABABC \to BCA \to CAB all share a trace, while BACBAC generally does not. This is the identity everything below is derived from — it is the reason the trace survives a change of basis at all.
Where it breaksA = [[1, 0], [0, 0]], B = [[0, 1], [0, 0]], C = [[0, 0], [1, 0]]
tr(ABC) = 1 but tr(BAC) = 0
Read the full section
tr(P1AP)=tr(A)\operatorname{tr}(P^{-1}AP) = \operatorname{tr}(A)
Holds when
PP invertible
A direct consequence of the cyclic property: rotate P1P^{-1} to the back and it meets PP. The consequence is what matters — the trace is a property of the underlying linear transformation, not of the basis chosen to write it down. Two matrices with different traces cannot represent the same map.
Read the full section
tr(A)=λ1+λ2++λn\operatorname{tr}(A) = \lambda_1 + \lambda_2 + \cdots + \lambda_n
Holds when
eigenvalues counted with algebraic multiplicity, over C\mathbb{C}
Spectral information read straight off the diagonal, with no characteristic polynomial to solve. Over R\mathbb{R} the statement can fail because some eigenvalues may not exist there — a rotation matrix has trace 2cosθ2\cos\theta and no real eigenvalues at all. The sum is still correct once the complex pair is counted.
Read the full section
tr(ABBA)=0\operatorname{tr}(AB - BA) = 0
Requires
A,BA, B both n×nn \times n
Immediate from the cyclic property and linearity. The consequence is sharper than it looks: since tr(In)=n0\operatorname{tr}(I_n) = n \neq 0, the identity matrix is never a commutator. No pair of matrices satisfies ABBA=IAB - BA = I in finite dimensions — which is exactly why the canonical commutation relation of quantum mechanics needs infinite-dimensional operators.
Read the full section
A,BF=tr(ATB)\langle A, B \rangle_F = \operatorname{tr}(A^{\mathsf{T}}B)
Holds when
real entries; use AA^* for the complex case
Gives the space of matrices a geometry — angles, lengths and projections, exactly as the dot product does for vectors. Positive definiteness holds because A,AF\langle A, A \rangle_F is the sum of every entry squared, so the induced norm is the Frobenius norm.
Read the full section
Two of these are load-bearing for the rest. Linearity makes the trace a functional rather than merely a formula, and the cyclic property is what similarity invariance, the eigenvalue sum and the commutator identity are all derived from.
Trace properties at a glance·/linear-algebra/matrix/traceLearn Math Class

Matrix Trace FAQ

Is tr(ABC)\operatorname{tr}(ABC) the same as tr(BAC)\operatorname{tr}(BAC)?

+
No, and this is the most over-applied rule on the topic. The cyclic property permits rotation only, moving the front factor to the back: tr(ABC)=tr(BCA)=tr(CAB)\operatorname{tr}(ABC) = \operatorname{tr}(BCA) = \operatorname{tr}(CAB). Swapping two adjacent factors, as BACBAC does, is a different move and generally changes the value. The two forms look almost identical written down.Read more →

Is tr(ATB)\operatorname{tr}(A^{T}B) a number or a matrix?

+
A number. The product ATBA^{T}B is itself a matrix, and the trace is exactly what collapses it to a single scalar by summing the diagonal. Dropping the operator turns a scalar quantity into an array with nothing visibly wrong on the page, which makes it an easy error to carry through a derivation unnoticed.Read more →

Why is tr\operatorname{tr} set in upright type rather than italics?

+
The roman type marks it as an operator name rather than a product of two variables tt and rr, the same convention that sets det\det and rank\operatorname{rank} upright. Spellings vary by field: physics capitalises it as Tr\operatorname{Tr}, while German and older Russian texts write sp\operatorname{sp}, from the word Spur.Read more →