Math
Matrix Trace Calculator
Enter a square matrix to get its trace, the sum of the main-diagonal entries, exactly.
The calculator lists the diagonal, shows the running sum, checks the identity trace = sum of the eigenvalues, and reports the determinant and tr(A²) alongside the properties you use in proofs.
One row per line. Separate entries with spaces or commas. Integers, decimals, and fractions like 1/3 all work. Up to 8 x 8.
Try an example
Result
Trace
—
- Exact and decimal
- —
- Determinant
- —
- tr(A²)
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What the trace is
The trace of a square A rectangular grid of numbers arranged in rows and columns. is the sum of the entries on its main diagonal, from the top-left corner to the bottom-right. It is one of the simplest matrix invariants: it does not change under a change of basis, and it equals the sum of the A number saying how much a matrix stretches vectors along one special direction..
Trace properties
| Property | Formula |
|---|---|
| Linear | tr(A + B) = tr(A) + tr(B), tr(kA) = k·tr(A) |
| Transpose | tr(Aᵀ) = tr(A) |
| Cyclic | tr(AB) = tr(BA), tr(ABC) = tr(BCA) = tr(CAB) |
| Similarity | tr(P⁻¹AP) = tr(A) |
| 2 x 2 characteristic polynomial | λ² - tr(A)·λ + det(A) |
How to use it
- Enter a square matrix, one row per line.
- Read tr(A) in the header; open Show the work to see the diagonal added term by term.
- Use the eigenvalue check to confirm the trace equals λ1 + … + λn.
How to read the answer
- For a 2 x 2 matrix, trace and One number computed from a square matrix that tells you whether it can be inverted. fully determine the eigenvalues via λ² - tr·λ + det = 0.
- A trace of zero does not mean the matrix is zero or Describes a square matrix whose determinant is zero, so it has no inverse.; [1 0; 0 -1] has trace 0 and determinant -1.
- tr(A²) equals the sum of the squared eigenvalues, useful for checking eigenvalue computations.
Common mistakes
- Summing the anti-diagonal (top-right to bottom-left). The trace uses the main diagonal only.
- Taking the trace of a non-square matrix. It is undefined; the calculator reports the shape problem.
- Assuming tr(AB) = tr(A)·tr(B). The trace is not multiplicative; only the cyclic rule tr(AB) = tr(BA) holds.
How to type a matrix into this calculator
- Put each row on its own line. Separate the entries in a row with spaces or commas: 2 1 1 or 2, 1, 1.
- Fractions such as 1/3 and decimals such as 0.25 are accepted and kept exact, so 1/3 stays 1/3 instead of becoming 0.3333.
- Every row must have the same number of entries. A row with a missing entry produces a clear error instead of a wrong answer.
- The largest size supported is 8 x 8. Brackets and semicolons are ignored, so [1 2; 3 4] works too.
Worked examples
3 x 3 trace
Diagonal 4 + 3 + 6 = 13
Trace
13
2 x 2 with eigenvalue check
[2 1; 1 2]: eigenvalues 1 and 3 sum to 4
Trace
4
Trace zero
[1 5; 2 -1] has trace 0 but is not singular
Trace
0
Fractions
[1/2 3; 4 1/3] → 1/2 + 1/3 = 5/6
Trace
5/6
Not square
A 2 x 3 matrix has no trace
Trace
Error
Frequently asked questions
What is the trace of a matrix?+
The sum of the entries on the main diagonal of a square matrix. For [4 1; 0 3] the trace is 4 + 3 = 7.
Why does the trace equal the sum of the eigenvalues?+
The characteristic polynomial's λⁿ⁻¹ coefficient is -tr(A), and by Vieta's formulas that coefficient is also minus the sum of the roots, which are the eigenvalues.
Is the trace defined for non-square matrices?+
No. Only square matrices have a main diagonal running corner to corner, so only they have a trace.
Does tr(AB) equal tr(A)·tr(B)?+
No. The trace is additive, not multiplicative. What is true is the cyclic property tr(AB) = tr(BA).
Can the trace be zero for an invertible matrix?+
Yes. The trace and determinant are independent invariants; [1 0; 0 -1] has trace 0 and determinant -1.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
Related calculators
Eigenvalues and Eigenvectors Calculator
Find the eigenvalues and eigenvectors of a square matrix up to 8 x 8. Shows the characteristic polynomial, exact eigenvalues (including fractions, square roots, and complex pairs), eigenvector bases, multiplicities, and whether the matrix is diagonalizable.
Matrix Determinant Calculator
Find the determinant of any square matrix up to 8 x 8 with exact fractions. Shows cofactor expansion along any row or column for 3 x 3 (with a rule-of-Sarrus check), row-reduction steps for larger matrices, and tells you whether the matrix is invertible.
Characteristic Polynomial Calculator
Find the characteristic polynomial det(λI - A) of any square matrix up to 8 x 8 with exact coefficients. Shows the Faddeev-LeVerrier steps, trace and determinant checks, the factored form, the roots (eigenvalues), and a Cayley-Hamilton verification.
Matrix Transpose Calculator
Transpose any matrix up to 8 x 8 and check whether it is symmetric, skew-symmetric, or orthogonal. Shows AᵀA and AAᵀ, the row-to-column steps, and the transpose rules for products, determinants, and traces.
Matrix Power Calculator
Raise a square matrix up to 8 x 8 to any integer power from -30 to 30 with exact fractions. Shows each intermediate power, handles A^0 = I and negative powers through the inverse, and checks det(A^k) = det(A)^k.
Matrix Inverse Calculator
Invert any square matrix up to 8 x 8 with exact fractions. Gauss-Jordan elimination on [A | I] with every row operation shown, the adjugate route for small matrices, a singular-matrix explanation, and an A·A⁻¹ = I check.
Last updated: September 4, 2026