Matrix Trace Calculator

Quick answer

The matrix trace calculator adds the diagonal entries of a 2 × 2, 3 × 3 or 4 × 4 matrix.

Trace
12
Sum of the diagonal
tr(A) = 4 + 3 + 5 = 12

The trace is the sum of the eigenvalues, is unchanged by similarity transformations and appears in the characteristic polynomial, in physics (the trace of the stress tensor) and in machine learning (Frobenius inner products).

How to use the Matrix Trace Calculator

  1. Choose the matrix size – the matching grid of fields appears.
  2. Enter the entries row by row (a₁ b₁ c₁ is the first row, a₂ b₂ c₂ the second, and so on).
  3. Read the result; integer matrices give exact fractions.

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

Only the entries on the main diagonal are added.

Formula

tr(A) = a₁₁ + a₂₂ + … + aₙₙ

Worked example

Inputs — Matrix size: 3 × 3; a₁: 4; b₁: 1; c₁: 2; a₂: 1; b₂: 3; c₂: 0; a₃: 2; b₃: 0; c₃: 5.
Results — Trace = 12; Sum of the diagonal = tr(A) = 4 + 3 + 5 = 12.

Key terms

Trace
The sum of the diagonal entries.

Frequently asked questions

What is the trace of the identity matrix?

n, its size.

Is tr(AB) = tr(BA)?

Yes, even though AB ≠ BA in general.

How is the trace related to eigenvalues?

It equals their sum.

Can non-square matrices have a trace?

No.

Sources

  1. Wolfram MathWorld – Matrix trace
  2. MIT OpenCourseWare – 18.06 Linear Algebra (Gilbert Strang)
  3. Jim Hefferon – Linear Algebra (free textbook)

Cite this calculator

Speedy Calculator. (2026). Matrix Trace Calculator. Speedy Calculator. https://speedycalculator.com/calculators/math/matrix-trace/