Matrix Trace
The trace tr(A) = Σ aᵢᵢ is the sum of diagonal elements. tr(A) = sum of eigenvalues. Invariant under similarity: tr(P⁻¹AP) = tr(A).
Why This Mathematical Concept Matters
Why: Trace appears in characteristic polynomial, Frobenius norm (||A||_F² = tr(AᵀA)), and quantum mechanics.
How: Sum the diagonal: tr(A) = a₁₁ + a₂₂ + … + aₙₙ. For 2×2: tr = a + d in [[a,b],[c,d]].
- ●tr(A) = sum of eigenvalues.
- ●tr(AB) = tr(BA) (cyclic).
- ●tr(Aᵀ) = tr(A).
Examples
Diagonal Elements
Sign
Steps
⚠️For educational and informational purposes only. Verify with a qualified professional.
🧮 Fascinating Math Facts
tr(A) = λ₁ + λ₂ + … + λₙ
tr(Iₙ) = n
Key Takeaways
- • Trace = sum of diagonal elements: tr(A) = a₁₁ + a₂₂ + … + aₙₙ.
- • Defined only for square matrices.
- • tr(A) = sum of eigenvalues (for diagonalizable A).
- • tr(AB) = tr(BA) — cyclic invariance.
- • tr(Iₙ) = n. tr(cA) = c·tr(A).
Did You Know?
How It Works
1. Identify diagonal
Main diagonal: (1,1), (2,2), …, (n,n).
2. Sum elements
tr(A) = a₁₁ + a₂₂ + … + aₙₙ.
3. Eigenvalue relation
For diagonalizable A, tr(A) = Σ λᵢ.
4. O(n) complexity
Only n elements to sum — very efficient.
Expert Tips
Diagonal matrices
tr(D) = sum of diagonal entries.
Trace zero
Nilpotent, skew-symmetric, or balanced diagonals.
Similarity
tr(P⁻¹AP) = tr(A) — trace is a similarity invariant.
Product order
tr(ABC) = tr(BCA) = tr(CAB) — cyclic only.
Comparison Table
| Feature | This Calculator | NumPy |
|---|---|---|
| Diagonal elements | ✅ | ❌ |
| Eigenvalue sum note | ✅ | ❌ |
| Bar & Doughnut charts | ✅ | ❌ |
| Square only | ✅ | ✅ |
FAQ
What is the trace?
Sum of diagonal elements. Defined only for square matrices.
Relation to eigenvalues?
tr(A) = sum of eigenvalues (for diagonalizable A).
Why is tr(AB) = tr(BA)?
Cyclic invariance: trace of product is unchanged by cyclic permutation.
Trace of identity?
tr(Iₙ) = n.
When is trace zero?
Nilpotent matrices, skew-symmetric, or when diagonals cancel.
Trace of projection?
tr(P) = rank(P) when P² = P.
Can rectangular matrices have trace?
No. Trace requires square matrix.
Trace in machine learning?
Used in PCA, regularization (trace norm), kernel methods.
Stats
Sources
- • Gilbert Strang, Linear Algebra and Its Applications
- • Khan Academy — Linear Algebra
- • MIT OpenCourseWare 18.06
- • Wolfram MathWorld — Matrix Trace
- • 3Blue1Brown — Essence of Linear Algebra
- • Golub & Van Loan, Matrix Computations