< Matrix Trace Calculator - Find the Trace of a Matrix

Matrix Calculator

🌐 English
A (3×3)
Rows: 3
Cols: 3
B (3×3)
Rows: 3
Cols: 3
Supports: fractions (1/2), decimals (0.5), constants (pi, e). Empty cells are treated as 0.

Calculation Results

1. Definition & Formula: What is the trace of a matrix?

The trace of an $n\times n$ square matrix $A=[a_{ij}]$ is the sum of its diagonal entries:

$$\mathrm{tr}(A)=\sum_{i=1}^n a_{ii}$$

Trace is only defined for square matrices and is a simple, useful invariant in linear algebra.

Key properties:

  • Linearity: $\mathrm{tr}(A+B)=\mathrm{tr}(A)+\mathrm{tr}(B)$ and $\mathrm{tr}(cA)=c\,\mathrm{tr}(A)$.
  • Similarity invariance: if $B=P^{-1}AP$, then $\mathrm{tr}(B)=\mathrm{tr}(A)$.
  • Cyclic property: $\mathrm{tr}(AB)=\mathrm{tr}(BA)$ (when dimensions agree).

2. How to compute trace (quick rule)

To compute the trace, simply add the diagonal entries of a square matrix. You do not need row reduction, determinants, or inversion.

Only square matrices have a trace. For non-square matrices, the trace is undefined.

3. Worked examples

Example 1 (2×2)

$$A=\begin{bmatrix}3 & 1 \\ 2 & 4\end{bmatrix}$$

Compute the trace:

$$\mathrm{tr}(A)=3+4=7$$

Example 2 (3×3)

$$B=\begin{bmatrix}-1 & 0 & 2 \\ 4 & 5 & 6 \\ 7 & 8 & 10\end{bmatrix}$$

Compute the trace:

$$\mathrm{tr}(B)=-1+5+10=14$$

4. Common mistakes

  • Applying trace to non-square matrices: trace is not defined for non-square matrices.
  • Including off-diagonal entries: only add diagonal elements $a_{11},a_{22},\dots$.
  • Forgetting signs: negative diagonal entries must be included correctly.
  • Expecting trace to equal determinant: trace and determinant are different invariants.

5. Practice problems (answers hidden)

Try these; click Show Answer to reveal the trace.

Exercise 1

$$M_1=\begin{bmatrix}1 & 3 \\ 4 & 2\end{bmatrix}$$
Show Answer
$$\mathrm{tr}(M_1)=1+2=3$$

Exercise 2

$$M_2=\begin{bmatrix}5 & -1 & 0 \\ 3 & 2 & 8 \\ 9 & 7 & -4\end{bmatrix}$$
Show Answer
$$\mathrm{tr}(M_2)=5+2+(-4)=3$$

Exercise 3

$$M_3=\begin{bmatrix}10 & 0 \\ 0 & -10\end{bmatrix}$$
Show Answer
$$\mathrm{tr}(M_3)=10+(-10)=0$$

Exercise 4

$$M_4=\begin{bmatrix}-2 & 5 & 7 \\ 0 & 3 & 8 \\ 4 & 6 & 1\end{bmatrix}$$
Show Answer
$$\mathrm{tr}(M_4)=-2+3+1=2$$

Copyright Notice: This article is original content from the Matrix Calculator website. Please credit the source when sharing or reproducing it. For more matrix computation tools, visit matrixcalcu.com.

Learn matrix multiplication more easily in just 2 minutes with this free game.

Matrix Multiplication Game