Matrix Trace Calculator

Sum the diagonal entries of a square matrix.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter a square matrix to add up its main diagonal. For [2 7 1; 3 5 9; 4 6 8] the trace is 2 + 5 + 8 = 15.

How to use

1
Step 1
Type a square matrix.
2
Step 2
Choose trace.
3
Step 3
Press Calculate.

How it works

The trace adds the entries from top-left to bottom-right. It equals the sum of the eigenvalues, and it is unchanged by transposing or by similarity transforms, which makes it a useful check on an eigenvalue calculation.

tr(A) = Σ Aᵢᵢ = Σ λᵢ      tr(AB) = tr(BA)

Worked example

A 3×3 matrix

Input
[2 7 1; 3 5 9; 4 6 8]
Output
15
Walkthrough
Diagonal entries 2, 5 and 8: 2 + 5 + 8 = 15.

Limitations

  • Square matrices only: [1 2 3; 4 5 6] returns a square-matrix error.

Questions

What is the trace of [2 7 1; 3 5 9; 4 6 8]?
15.
How is the trace related to eigenvalues?
It is their sum. For [4 1; 2 3] the trace 7 equals 2 + 5.
Does the trace change when you transpose?
No, the diagonal is untouched.

Features

  • Instant result
  • Steps shown
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Introduction to scientific notation

    Khan Academy

    Scientific notation for calculator and number tools.

    Watch on YouTube
  • Finding a percentage

    Khan Academy

    Percentage basics used across many calculator pages.

    Watch on YouTube
  • Percentages

    Math is Fun

    Percent of / percent change patterns for everyday calculators.

  • Data Index

    Math is Fun

    Stats and probability explainers for data tools.