Matrix Trace Calculator

Use this free matrix trace calculator to find the sum of the main diagonal entries of a square matrix. Enter your matrix, calculate its trace, and review the diagonal values used in the calculation.

Calculate the trace of a matrix

Enter one row per line. Separate numbers with spaces or commas. You can also use semicolons to separate rows.

Reset

What is the trace of a matrix?

The trace of a square matrix is the sum of the elements on its main diagonal, running from the top-left corner to the bottom-right corner. The matrix must have the same number of rows and columns.

Formula

tr(A) = a₁₁ + a₂₂ + a₃₃ + ... + aₙₙ

Example calculation

Consider this matrix:

1  2  3
4  5  6
7  8  9

The main diagonal contains 1, 5, and 9.

Trace = 1 + 5 + 9 = 15

The other entries do not contribute to the trace. Only the main diagonal entries are added.

Frequently asked questions

Can a rectangular matrix have a trace?

The standard matrix trace is defined for square matrices only. A rectangular matrix has different numbers of rows and columns, so this calculator will ask you to enter a square matrix.

Can the trace be negative?

Yes. If the sum of the main diagonal entries is negative, the trace is negative.

What is the trace of an identity matrix?

For an n × n identity matrix, every diagonal entry is 1. Its trace is therefore n.

Does the trace depend on the off-diagonal entries?

No. The trace is calculated using only the entries on the main diagonal.

Is this calculator free?

Yes. The calculator runs directly in your browser through Matrices.org, without requiring an account or installation.

Related matrix calculators

Check that each related link matches the actual filename on your website.