# Matrix Trace Calculator

Created by Anna Szczepanek, PhD
Reviewed by Rijk de Wet
Last updated: Jan 18, 2024

Omni's matrix trace calculator is here to help you learn about the important mathematical concept of the trace of a matrix. Although it's not hard to learn how to calculate the trace of a matrix, it is important to understand the theoretical properties of the matrix trace. After reading the article below, you'll be able to answer the following questions:

• What is the trace of a matrix?
• What properties does the matrix trace have?
• What's the connection between trace and eigenvalues?
• Is the trace of a matrix a linear transformation?
• ... and many more!

Let's go!

## What is the trace of a matrix?

We define the trace of a matrix as the sum of all the diagonal elements of this matrix. The matrix in question must be square, i.e., it must have as many columns as it has rows. For instance, the trace of the $2 × 2$ matrix, $A$,

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

is equal to $1 + 4 = 5$. The trace of matrix $A$ is denoted by $\operatorname{tr}(A)$.

As you can see, it's not difficult to learn how to calculate the trace of a matrix. Let's now talk about the properties of the trace.

## Matrix trace properties

If $A$, $B$, and $C$ are all square matrices, then their traces satisfy the following properties:

• $\operatorname{tr}(A + B) = \operatorname{tr}(A) + \operatorname{tr}(B)$

• $\operatorname{tr}(k A) = k \operatorname{tr}(A)$, where $k$ is a scalar. You can visit the matrix by scalar calculator if you're unsure about this type of multiplication.

• $\operatorname{tr}(AB) = \operatorname{tr}(BA)$

• $\operatorname{tr}(ABC) = \operatorname{tr}(BCA) = \operatorname{tr}(CAB)$

• $\operatorname{tr}(A^T) = \operatorname{tr}(A)$, where $A^T$ is the matrix transpose of $A$

• $\operatorname{tr}(A \otimes B) = \operatorname{tr}(A) \operatorname{tr}(B)$, where $\otimes$ denotes the tensor product (aka the Kronecker product) of matrices.

• $\operatorname{tr}(A)$ is equal to the sum of the eigenvalues of $A$.

• $\operatorname{tr}(I_n) = n$, where $I_n$ is the $n \times n$ identity matrix.

💡 One can show that the first four properties above describe the trace operator uniquely. That is, if you're given an operator on matrices that satisfies them, it must be the trace operator! Nice, isn't it?

## What is the cyclicity of the trace?

The trace is famous for its cyclic property. It basically means that the trace is invariant under cyclic permutations — the cyclical rearrangement of the matrices in a matrix product expression. For instance, for three matrices $A$, $B$, and $C$, we have

$\footnotesize \operatorname{tr}(ABC) = \operatorname{tr}(BCA) = \operatorname{tr}(CAB)$

and for four matrices we have

$\footnotesize \operatorname{tr}(ABCD) = \operatorname{tr}(BCDA) \\= \operatorname{tr}(CDAB) = \operatorname{tr}(DABC)$

Do you see the pattern? In general, for $n$ matrices, we get

$\footnotesize \operatorname{tr}(A_1 \ldots A_n) = \operatorname{tr}(A_2 \ldots A_n A_1) \\ = \operatorname{tr}(A_3 \ldots A_n A_1 A_2) = \ldots$

This is the cyclic property of the trace operator. It's good to remember this properly as it is often very useful in various math problems with matrix trace.

❗ The trace is the same for cyclic permutations, but it is not immune to any permutation! It may happen that $\operatorname{tr}(ABC) \neq \operatorname{tr}(ACB)$! Can you come up with an example?

## How do I calculate the trace of a matrix?

To calculate the trace of a matrix by hand, you need to:

1. Write down the coefficients of the matrix.
2. Identify the diagonal entries — the diagonal going from the upper-left corner to the bottom-right corner.
3. Add all the diagonal entries together.
4. The result you've got in Step 3 is exactly the trace of your matrix!

To verify if your computations are correct, use Omni's matrix trace calculator!

## How to use this matrix trace calculator?

This trace of a matrix calculator is very user-friendly! To use it, you need to:

1. Choose the matrix size.
2. Enter the matrix coefficients.
3. The trace of your matrix gets calculated and displayed immediately.
4. Remember the blank fields are interpreted as zeros!

## FAQ

### What is the trace of projection matrix?

The trace of a projection matrix is equal to the dimension of the space that the matrix projects onto (the target space). This is a special case of a more general result that the trace of an idempotent matrix (recall A is called idempotent when A² = A) is equal to the rank of this matrix.

### Is the trace of a matrix a linear transformation?

Yes, the trace operation is linear. That is, it satisfies tr(x·A + y·B) = x × tr(A) + y × tr(B), where A and B are square matrices of the same size, and x and y are scalars.

### How do I calculate the eigenvalues of a 2×2 matrix given trace and determinant?

Recall that the eigenvalues are the roots of the characteristic polynomial of a matrix. Since the characteristic polynomial of a 2×2 matrix A reads p(λ) = x² − tr(A)·λ + det(A), the formula for its eigenvalues is ½ tr(A) ± ½√(tr(A)² − 4·det(A)).

Anna Szczepanek, PhD
Matrix size
2 × 2
 ⌈ a₁ a₂ ⌉ ⌊ b₁ b₂ ⌋
Enter the coefficients in the fields below.
Blanks are interpreted as zeros. Precision: 6 decimal places.
First row
a₁
a₂
Second row
b₁
b₂
Results
00
00
Trace: 0
People also viewed…

### BMR - Harris-Benedict equation

Harris-Benedict calculator uses one of the three most popular BMR formulas. Knowing your BMR (basal metabolic weight) may help you make important decisions about your diet and lifestyle.

### Error function

Our error function calculator can determine the values of the error function, complementary error function, inverse error function, and inverse complementary error function.

### Free fall

Our free fall calculator can find the velocity of a falling object and the height it drops from.

### LCD - Least Common Denominator

With this LCD calculator you can find the lowest common denominator of up to five fractions.