Matrix Trace Calculator
Find the trace of any square matrix by summing the entries along its main diagonal.
Sum of the main diagonal entries
- 1
Diagonal entry A[1,1]
2 - 2
Diagonal entry A[2,2]
5 - 3
Diagonal entry A[3,3]
7 - 4
Trace tr(A)
2 + 5 + 7 = 14
How does this calculator work?
The trace of a square matrix is the sum of its main diagonal entries, written tr(A) = ΣA[i,i]. Enter the matrix as rows of numbers; the tool checks that it is square, then adds the top-left to bottom-right diagonal elements to return a single scalar trace value.
Formula
How this is calculated
Enter a square matrix A with one row per line, using spaces or commas to separate the numbers within a row. The calculator parses the text into an n×n array. Every row must contain the same number of entries, and the count of rows must equal the count of columns; otherwise the matrix is not square and the trace is undefined.
The trace is defined only for square matrices and equals the sum of the entries on the main diagonal, the positions A[i][i] running from the top-left to the bottom-right corner. The calculator collects these diagonal entries A[1,1], A[2,2], …, A[n,n] and adds them together to produce a single scalar value.
The trace is a linear operation: tr(A + B) = tr(A) + tr(B) and tr(cA) = c·tr(A). It also equals the sum of the eigenvalues of A and is invariant under similarity transformations, since tr(AB) = tr(BA). Off-diagonal entries never affect the result, so only the diagonal needs to be valid; non-numeric or ragged input is rejected.
Frequently asked questions
The trace, written tr(A), is the sum of the entries on the main diagonal of a square matrix — the elements running from the top-left to the bottom-right corner.
No. The trace is only defined for square matrices, where the number of rows equals the number of columns. This tool reports an error for non-square input.
Yes. The trace of a matrix equals the sum of its eigenvalues (counted with multiplicity), which makes it a useful quick invariant in linear algebra.
Also known as
TG we-Calculate Editorial Team. (2026). Matrix Trace Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/matrix-trace-calculator
TG we-Calculate Editorial Team. "Matrix Trace Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/matrix-trace-calculator.
TG we-Calculate Editorial Team, "Matrix Trace Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/matrix-trace-calculator
@misc{wecalculate_matrix_trace_calculator, title = {Matrix Trace Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/matrix-trace-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
