# Matrix Trace Calculator

URL: https://speedycalculator.com/calculators/math/matrix-trace/
Last updated: 2026-10-30

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

## Inputs

- Matrix size
- a₁
- b₁
- c₁
- d₁
- a₂
- b₂
- c₂
- d₂
- a₃
- b₃
- c₃
- d₃
- a₄
- b₄
- c₄
- d₄

## Results

- Trace
- Sum of the diagonal

## Formula

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

## Explanation

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

- Choose the **matrix size** – the matching grid of fields appears.
- Enter the entries **row by row** (a₁ b₁ c₁ is the first row, a₂ b₂ c₂ the second, and so on).
- 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.

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

## FAQ

**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

- [Wolfram MathWorld – Matrix trace](https://mathworld.wolfram.com/MatrixTrace.html)
- [MIT OpenCourseWare – 18.06 Linear Algebra (Gilbert Strang)](https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010/)
- [Jim Hefferon – Linear Algebra (free textbook)](https://hefferon.net/linearalgebra/)
