Matrix Trace
The Matrix Trace: Identities and Proofs
A compact, self-contained reference covering every major trace identity — from basic linearity to the eigenvalue connection — with complete proofs.
Contents
- Definition
- Basic Linear Properties
- Cyclic Property
- Trace of A A T AA^T AAT
- Trace and Eigenvalues
- Summary & Caution
Definition
Let A = ( a i j ) ∈ F n × n A = (a_{ij}) \in F^{n \times n} A=(aij)∈Fn×n, where F F F is a field. The trace of A A A is the sum of its diagonal entries:
tr ( A ) = ∑ i = 1 n a i i . \operatorname{tr}(A) = \sum_{i=1}^{n} a_{ii}. tr(A)=i=1∑naii.
Simple as it looks, this single number encodes surprising depth — it is invariant under similarity, additive, and equals the sum of all eigenvalues.
Basic Linear Properties
Trace satisfies three elementary properties that together make it a linear map F n × n → F F^{n\times n} \to F Fn×n→F.
Transpose Invariance
tr ( A T ) = tr ( A ) . \operatorname{tr}(A^T) = \operatorname{tr}(A). tr(AT)=tr(A).
Proof. Since ( A T ) i i = a i i (A^T)_{ii} = a_{ii} (AT)ii=aii for every i i i, summing gives
tr ( A T ) = ∑ i = 1 n a i i = tr ( A ) . □ \operatorname{tr}(A^T) = \sum_{i=1}^n a_{ii} = \operatorname{tr}(A). \qquad \square tr(AT)=i=1∑naii=tr(A).□
Additivity
tr ( A + B ) = tr ( A ) + tr ( B ) . \operatorname{tr}(A + B) = \operatorname{tr}(A) + \operatorname{tr}(B). tr(A+B)=tr(A)+tr(B).
Proof.
tr ( A + B ) = ∑ i = 1 n ( a i i + b i i ) = ∑ i = 1 n a i i + ∑ i = 1 n b i i = tr ( A ) + tr ( B ) . □ \operatorname{tr}(A+B) = \sum_{i=1}^n (a_{ii}+b_{ii}) = \sum_{i=1}^n a_{ii} + \sum_{i=1}^n b_{ii} = \operatorname{tr}(A)+\operatorname{tr}(B). \qquad \square tr(A+B)=i=1∑n(aii+bii)=i=1∑naii+i=1∑nbii=tr(A)+tr(B).□
Homogeneity
tr ( λ A ) = λ tr ( A ) , λ ∈ F . \operatorname{tr}(\lambda A) = \lambda\,\operatorname{tr}(A), \qquad \lambda \in F. tr(λA)=λtr(A),λ∈F.
Proof.
tr ( λ A ) = ∑ i = 1 n λ a i i = λ ∑ i = 1 n a i i = λ tr ( A ) . □ \operatorname{tr}(\lambda A) = \sum_{i=1}^n \lambda a_{ii} = \lambda\sum_{i=1}^n a_{ii} = \lambda\operatorname{tr}(A). \qquad \square tr(λA)=i=1∑nλaii=λi=1∑naii=λtr(A).□
Combining additivity and homogeneity: for any α , β ∈ F \alpha, \beta \in F α,β∈F,
tr ( α A + β B ) = α tr ( A ) + β tr ( B ) . \operatorname{tr}(\alpha A + \beta B) = \alpha\operatorname{tr}(A) + \beta\operatorname{tr}(B). tr(αA+βB)=αtr(A)+βtr(B).
Cyclic Property
Two-Factor Identity
tr ( A B ) = tr ( B A ) . \operatorname{tr}(AB) = \operatorname{tr}(BA). tr(AB)=tr(BA).
Proof. The i i i-th diagonal entry of A B AB AB is ( A B ) i i = ∑ j a i j b j i (AB)_{ii} = \sum_{j} a_{ij}b_{ji} (AB)ii=∑jaijbji, so
tr ( A B ) = ∑ i ∑ j a i j b j i . \operatorname{tr}(AB) = \sum_i\sum_j a_{ij}b_{ji}. tr(AB)=i∑j∑aijbji.
Swapping the order of summation and recognising ( B A ) j j = ∑ i b j i a i j (BA)_{jj} = \sum_i b_{ji}a_{ij} (BA)jj=∑ibjiaij yields
tr ( A B ) = ∑ j ∑ i b j i a i j = ∑ j ( B A ) j j = tr ( B A ) . □ \operatorname{tr}(AB) = \sum_j\sum_i b_{ji}a_{ij} = \sum_j (BA)_{jj} = \operatorname{tr}(BA). \qquad \square tr(AB)=j∑i∑bjiaij=j∑(BA)jj=tr(BA).□
Transpose Variants
Because ( A B ) T = B T A T (AB)^T = B^T A^T (AB)T=BTAT and trace is transpose-invariant, one obtains the chain
tr ( A B ) = tr ( B A ) = tr ( B T A T ) = tr ( A T B T ) . \operatorname{tr}(AB) = \operatorname{tr}(BA) = \operatorname{tr}(B^TA^T) = \operatorname{tr}(A^TB^T). tr(AB)=tr(BA)=tr(BTAT)=tr(ATBT).
Similarity Invariance
If P P P is invertible, then
tr ( P − 1 A P ) = tr ( A ) . \operatorname{tr}(P^{-1}AP) = \operatorname{tr}(A). tr(P−1AP)=tr(A).
Proof. Apply the two-factor identity twice:
tr ( P − 1 A P ) = tr ( A P P − 1 ) = tr ( A ) . □ \operatorname{tr}(P^{-1}AP) = \operatorname{tr}(APP^{-1}) = \operatorname{tr}(A). \qquad \square tr(P−1AP)=tr(APP−1)=tr(A).□
More generally, trace is fully cyclic over any number of factors:
tr ( A 1 A 2 ⋯ A k ) = tr ( A 2 ⋯ A k A 1 ) . \operatorname{tr}(A_1 A_2 \cdots A_k) = \operatorname{tr}(A_2 \cdots A_k A_1). tr(A1A2⋯Ak)=tr(A2⋯AkA1).
Trace of A A T AA^T AAT
For real matrices A = ( a i j ) ∈ R n × n A = (a_{ij}) \in \mathbb{R}^{n\times n} A=(aij)∈Rn×n,
tr ( A A T ) = ∑ i = 1 n ∑ j = 1 n a i j 2 . \operatorname{tr}(AA^T) = \sum_{i=1}^n\sum_{j=1}^n a_{ij}^2. tr(AAT)=i=1∑nj=1∑naij2.
Proof. The i i i-th diagonal entry of A A T AA^T AAT is
( A A T ) i i = ∑ j a i j ( A T ) j i = ∑ j a i j 2 . (AA^T)_{ii} = \sum_j a_{ij}(A^T)_{ji} = \sum_j a_{ij}^2. (AAT)ii=j∑aij(AT)ji=j∑aij2.
Summing over all i i i gives
tr ( A A T ) = ∑ i ∑ j a i j 2 . □ \operatorname{tr}(AA^T) = \sum_i\sum_j a_{ij}^2. \qquad \square tr(AAT)=i∑j∑aij2.□
In other words, tr ( A A T ) \operatorname{tr}(AA^T) tr(AAT) is exactly the sum of squares of all entries of A A A — it is the squared Frobenius norm ∥ A ∥ F 2 \|A\|_F^2 ∥A∥F2. For complex matrices the analogue replaces squaring with the modulus:
tr ( A A ∗ ) = ∑ i , j ∣ a i j ∣ 2 . \operatorname{tr}(AA^*) = \sum_{i,j}|a_{ij}|^2. tr(AA∗)=i,j∑∣aij∣2.
Trace and Eigenvalues
If λ 1 , … , λ n \lambda_1, \dots, \lambda_n λ1,…,λn are the eigenvalues of A A A counted with algebraic multiplicity, then
tr ( A ) = ∑ i = 1 n λ i . \operatorname{tr}(A) = \sum_{i=1}^n \lambda_i. tr(A)=i=1∑nλi.
Proof. Over an algebraic closure, write A = P J P − 1 A = PJP^{-1} A=PJP−1 where J J J is the Jordan normal form of A A A. By similarity invariance, tr ( A ) = tr ( J ) \operatorname{tr}(A) = \operatorname{tr}(J) tr(A)=tr(J). The diagonal entries of J J J are precisely the eigenvalues of A A A, so
tr ( J ) = ∑ i = 1 n λ i . □ \operatorname{tr}(J) = \sum_{i=1}^n \lambda_i. \qquad \square tr(J)=i=1∑nλi.□
This identity shows that the trace is a basis-free invariant of the linear operator — not just a convenient coordinate-dependent sum.
Summary & Caution
For A , B ∈ F n × n A, B \in F^{n\times n} A,B∈Fn×n and λ ∈ F \lambda \in F λ∈F, the complete set of identities:
| Identity | Formula |
|---|---|
| Definition | tr ( A ) = ∑ i a i i \operatorname{tr}(A)=\sum_i a_{ii} tr(A)=∑iaii |
| Transpose | tr ( A T ) = tr ( A ) \operatorname{tr}(A^T)=\operatorname{tr}(A) tr(AT)=tr(A) |
| Additivity | tr ( A + B ) = tr ( A ) + tr ( B ) \operatorname{tr}(A+B)=\operatorname{tr}(A)+\operatorname{tr}(B) tr(A+B)=tr(A)+tr(B) |
| Homogeneity | tr ( λ A ) = λ tr ( A ) \operatorname{tr}(\lambda A)=\lambda\operatorname{tr}(A) tr(λA)=λtr(A) |
| Cyclic | tr ( A B ) = tr ( B A ) \operatorname{tr}(AB)=\operatorname{tr}(BA) tr(AB)=tr(BA) |
| Similarity | tr ( P − 1 A P ) = tr ( A ) \operatorname{tr}(P^{-1}AP)=\operatorname{tr}(A) tr(P−1AP)=tr(A) |
| Frobenius norm | tr ( A A T ) = ∑ i , j a i j 2 \operatorname{tr}(AA^T)=\sum_{i,j}a_{ij}^2 tr(AAT)=∑i,jaij2 |
| Eigenvalues | tr ( A ) = ∑ i λ i \operatorname{tr}(A)=\sum_i\lambda_i tr(A)=∑iλi |
Caution — cyclic ≠ commutative. Trace is cyclic, not fully commutative. While
tr ( A B C ) = tr ( B C A ) = tr ( C A B ) , \operatorname{tr}(ABC) = \operatorname{tr}(BCA) = \operatorname{tr}(CAB), tr(ABC)=tr(BCA)=tr(CAB),
in general tr ( A B C ) ≠ tr ( A C B ) \operatorname{tr}(ABC) \neq \operatorname{tr}(ACB) tr(ABC)=tr(ACB). Cycling preserves the trace; arbitrary reordering does not.
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐

所有评论(0)