Matrix Diagonal Sum Calculator

Analyze matrices with primary, secondary, and trace totals. Spot center overlap and verify entered values. Export clear results quickly for study, checking, and reporting.

Enter Matrix Values

Use the controls below, then fill the square matrix and calculate the diagonal sums.

3 × 3 square matrix
Choose any size from 1 to 12.
Results display with your selected precision.
Applies only to odd-order matrices.
Reset Page

Matrix Input Grid

The calculator uses square matrices, so rows and columns stay equal.

Example Data Table

This sample demonstrates both diagonal calculations for a 3 × 3 matrix.

Row Column 1 Column 2 Column 3 Notes
Row 1 2 5 7 Primary uses 2, secondary uses 7.
Row 2 4 9 1 Center value 9 belongs to both diagonals.
Row 3 6 3 8 Primary uses 8, secondary uses 6.
Primary diagonal sum = 2 + 9 + 8 = 19. Secondary diagonal sum = 7 + 9 + 6 = 22. Unique combined diagonal sum = 19 + 22 - 9 = 32.

Formula Used

Primary diagonal sum

For an n × n matrix A = [aij], the primary diagonal sum is: Sprimary = Σ aii for i = 1 to n.

Secondary diagonal sum

The secondary diagonal sum is: Ssecondary = Σ ai,n-i+1 for i = 1 to n.

Combined diagonal sum

If the matrix order is odd, the center element appears in both diagonals. Count it once with: Sunique = Sprimary + Ssecondary - center. Count it twice with: Sdouble = Sprimary + Ssecondary.

The trace equals the primary diagonal sum. The anti-trace equals the secondary diagonal sum. This calculator also reports row sums, column sums, minimum value, maximum value, and matrix average.

How to Use This Calculator

  1. Choose the square matrix size.
  2. Select the number of decimal places for displayed results.
  3. Pick how the center overlap should be treated for odd sizes.
  4. Enter each matrix value into the grid.
  5. Press Calculate Diagonal Sum.
  6. Review the result section above the form.
  7. Download the output as CSV or PDF when needed.

FAQs

1. What does this calculator measure?

It calculates the primary diagonal sum, secondary diagonal sum, trace, anti-trace, and combined diagonal totals for a square matrix.

2. Why must the matrix be square?

Diagonal sum formulas pair row and column positions equally. A square matrix ensures each diagonal position is defined consistently from top to bottom.

3. What is the difference between trace and diagonal sum?

The trace is the sum of the primary diagonal only. A general diagonal sum may refer to primary, secondary, or both diagonals together.

4. Why does the center value matter in odd matrices?

In odd-order matrices, the center cell belongs to both diagonals. Combined results may count it once or twice, depending on your selected rule.

5. Can this tool handle decimals and negative values?

Yes. Each matrix cell accepts whole numbers, decimals, and negative values, and the result formatting follows your chosen decimal precision.

6. What is anti-trace?

Anti-trace is another name for the secondary diagonal sum. It adds values running from the top-right corner to the bottom-left corner.

7. What extra information does this page provide?

Besides diagonal sums, it reports row sums, column sums, overall total, average value, minimum, maximum, and whether the matrix is diagonal.

8. When is this calculator useful?

It helps in matrix practice, numerical checking, trace verification, algorithm testing, classroom demonstrations, and quick validation of diagonal-based computations.

Related Calculators

matrix determinant 4x4matrix power calculatormatrix addition calculatoridentity matrix calculatormatrix inverse 4x4matrix cofactor calculatormatrix null space calculatormatrix vector space calculatormatrix diagonalization 4x4matrix diagonalization 3x3

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.