Calculate the trace (sum of diagonal elements) of a square matrix
Enter the elements of a square matrix to calculate its trace. The trace is the sum of all diagonal elements and is a fundamental property in linear algebra.
Matrix trace is only defined for square matrices
Try these sample matrices to see how matrix trace calculation works
Basic 2×2 matrix with integer elements
Size: 2×2
Matrix: [4, 2, 1, 3]
Identity matrix with trace equal to matrix size
Size: 3×3
Matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
Matrix with decimal elements showing precise calculation
Size: 3×3
Matrix: [2.5, 1.2, 0.7, 3.1, -1.8, 2.3, 0.5, 4.2, 1.1]
Diagonal matrix where trace equals sum of non-zero elements
Size: 4×4
Matrix: [5, 0, 0, 0, 0, 3, 0, 0, 0, 0, -2, 0, 0, 0, 0, 7]