Calculate the trace of a square matrix by summing the values on its main diagonal.
Last updated: June 2026 | By Patchworkr Team
The trace of a square matrix is the sum of the entries on its main diagonal. It is an important invariant in linear algebra and appears in many applications across mathematics and science.
For [[3, 8, 1], [4, 6, 2], [7, 5, 9]], the trace is 18.
Is the trace defined for non-square matrices?
No. The trace is only defined for square matrices.
Can the trace be negative?
Yes. The trace is the sum of diagonal values, so it can be positive, negative, or zero.
Does the trace change if I transpose the matrix?
No. A matrix and its transpose have the same trace.
What if a cell is blank?
Blank cells are rejected instead of being silently converted to zero.
Related Tools
Calculate adjoint matrix.
Find angle between vectors.
Find characteristic polynomial.
Cholesky factorization.
Expand determinant by cofactors.
Calculate cofactor matrix.