ALGEBRALinear AlgebraMathematics Calculator
tr

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).

Concept Fundamentals
tr(A) = Σ aᵢᵢ
Definition
tr = Σλᵢ
Eigenvalues
tr(BA)
tr(AB)
tr(P⁻¹AP)=tr(A)
Similarity
Compute TraceSum of diagonal elements

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

tr(A): 0
Diagonal: 0, 0, 0
Matrix: 3×3
Screenshot card — share your result

Diagonal Elements

Sign

Steps

[SETUP]Definition: tr(A) = Σ aᵢᵢ (sum of diagonal elements)
[DIAG]Diagonal elements: 0, 0, 0
[COMPUTE]Sum: 0 + 0 + 0 = 0
[RESULT]Trace: 0
[NOTE]Eigenvalue relation: tr(A) = sum of eigenvalues (for diagonalizable A)

⚠️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?

⚛️In quantum mechanics, tr(ρA) gives expectation value of observable A.Source: Quantum
📊PCA: maximize tr(WᵀCW) to find principal components.Source: ML
📐Frobenius norm: ||A||²_F = tr(AᵀA).Source: Norms
🔢Nilpotent matrices always have trace 0.Source: Algebra
📜Trace is invariant under similarity: tr(P⁻¹AP) = tr(A).Source: Similarity
🔬Projection P: tr(P) = rank(P).Source: Projections

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

FeatureThis CalculatorNumPy
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

tr(Iₙ)
n
Complexity
O(n)
tr(AB)
tr(BA)
tr(A+B)
tr(A)+tr(B)

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
Disclaimer: This calculator is for educational purposes. Trace is computed in JavaScript. For production, use NumPy/MATLAB.
👈 START HERE
⬅️Jump in and explore the concept!
AI