Linear Algebra
Intermediate

Matrix Trace

Sum of the diagonal entries of a square matrix.

Formula

tr(A)=∑iaii\text{tr}(A) = \sum_i a_{ii}

Variables

a_{ii}Diagonal entries

Example

tr of I₃ = 3

How it works

The trace of a square matrix is found by adding the entries running from the top-left to the bottom-right. It is useful because it captures a key part of a matrix’s action in a compact single number, and it stays the same under a change of basis, so it describes an intrinsic property of the linear transformation rather than just the chosen coordinate system. For an n×n matrix, only the diagonal entries are included because they are the terms that contribute directly to how each basis direction maps back onto itself.

When to use it

Use the trace when you need a quick summary of a square matrix, especially in linear algebra, differential equations, physics, and statistics. It often appears in eigenvalue problems, matrix identities, and calculations involving determinants, covariance matrices, and linear transformations.

Worked example, step by step

Let A = [[4, -1, 2], [0, 3, 5], [7, 8, -2]] Identify the diagonal entries: a11 = 4, a22 = 3, a33 = -2 Add the diagonal entries: tr(A) = 4 + 3 + (-2) Compute the sum: tr(A) = 5

Common mistakes to avoid

  • Adding every entry in the matrix instead of only the diagonal entries
  • Trying to take the trace of a non-square matrix
  • Mixing up the trace with the determinant, which is a product-like quantity rather than a sum

Did You Know?

The trace of a matrix equals the sum of its eigenvalues, a fact that survives any change of coordinates.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026