EditSafely

Find Matrix Diagonal Sum

Sum of diagonals or antidiagonals. Runs entirely in your browser, so your data never leaves your device.

0 chars · 0 lines

Output

The result appears here as you type.

Options

How to use Find Matrix Diagonal Sum

  1. 1. Paste your matrix. Enter a square matrix in the input pane, one row per line. Diagonal and antidiagonal sums are defined for square matrices where rows equal columns.
  2. 2. Choose which diagonal to sum. Pick Main diagonal, Antidiagonal, or Both from the Diagonal setting to control whether you get the top-left-to-bottom-right sum, the top-right-to-bottom-left sum, or both.
  3. 3. Copy the result. Copy the diagonal sum, or both sums, from the output pane into your calculation, proof, or spreadsheet.

When to use Find Matrix Diagonal Sum

Find Matrix Diagonal Sum adds up the elements along a square matrix's main diagonal, its antidiagonal, or both. It is a quick way to get the trace or the cross-sum without manually picking out the right cells.

  • Computing a matrix's trace quickly. You need the sum of the main diagonal elements as part of a larger eigenvalue or characteristic polynomial calculation, and reading it directly saves picking out cells by hand.
  • Checking a magic square puzzle. A magic square puzzle requires both diagonals to sum to the same value as the rows and columns, and computing Both confirms whether a candidate grid actually qualifies.
  • Verifying symmetry in a transformation matrix. A matrix used in a graphics or physics transform should have a particular diagonal sum by design, and this confirms the constructed matrix matches expectations.
  • Solving a linear algebra textbook exercise. A homework problem asks for both the main diagonal and antidiagonal sums of a given matrix, and setting Diagonal to Both returns both figures in one pass.

Examples

Main diagonal sum

Input

1 2
3 40

Output

41

Both diagonals

Input

1 2
3 40

Output

Main diagonal: 41
Antidiagonal: 5

About the Find Matrix Diagonal Sum tool

Find Matrix Diagonal Sum runs as plain JavaScript in your browser tab, with no server behind it. Sum of diagonals or antidiagonals. Whatever you put in stays on your device from start to finish.

The tool is part of EditSafely's Math Tools section, 234 single-purpose utilities built around the same idea: open the page, get the result, keep your data to yourself.

You can shape the output with the Diagonal setting, and the result refreshes the moment you change it. 2 worked examples further down the page show exactly what the tool produces for real inputs.

That local-first design has practical benefits beyond privacy. The tool keeps working on a flaky connection once the page has loaded, results are instant because nothing round-trips to a server, and it is safe to use with confidential material.

Frequently asked questions

Does Find Matrix Diagonal Sum cost anything?

Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.

How much text can I process at once?

There is no fixed limit. Because the work happens on your own device rather than on a shared server, the practical ceiling is your machine's memory, which comfortably handles inputs far larger than typical online tools allow.

Do I need to sign up or install anything?

Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.

Related tools

All Math Tools