MatrixCalc

Matrix Calculator

Add, subtract, multiply, transpose, determinant, inverse, rank, trace and power. Up to 50×50.

Matrix A
rows: 3
cols: 3
Matrix B
rows: 3
cols: 3
Operations
Result
Pick an operation to see the result here. Errors will show up in this area.

Tips: adjust sizes (max 50×50). For A×B, cols(A)=rows(B). det/inverse/trace/power require square matrices.

React, Tailwind & shadcn/ui. No external math deps. — English

Determinant calculator

Compute the determinant of any square matrix up to 50×50 and see every step — by Gaussian elimination, cofactor expansion, the rule of Sarrus or Montante's method.

Type your matrix above, open the Advanced tab and press det(A). The answer appears immediately; opening the step-by-step panel shows how it was reached, and lets you switch between four different methods for the same matrix — useful when your class was taught one of them in particular.

What the determinant tells you

It is a single number, defined only for square matrices, and its most important job is answering one question: is this matrix invertible? If the determinant is zero the matrix is singular — its rows are linearly dependent, it has no inverse, and a system built on it has either no solution or infinitely many. Any non-zero value means the matrix is invertible.

Geometrically it is the factor by which the transformation scales area in 2D or volume in 3D. A determinant of −2 doubles areas and flips orientation; a determinant of 0 flattens space onto a line or a point, which is precisely why the operation cannot be undone.

Worked example

For a 3×3 matrix, the rule of Sarrus adds the three down-right products and subtracts the three down-left ones:

213
041
520
= (2·4·0 + 1·1·5 + 3·0·2) − (3·4·5 + 2·1·2 + 1·0·0) = 5 − 64 = −59

The calculator uses the closed formula for 2×2 and 3×3, then switches to LU factorisation with partial pivoting from 4×4 upward — cofactor expansion costs n! operations and becomes unusable well before 50×50.

Common mistakes

  • Using Sarrus on a 4×4. There is no 4×4 version of the rule. Use elimination or cofactor expansion.
  • Reading the bars as absolute value. |A| is standard notation for the determinant, and it is very often negative.
  • Forgetting the sign on a row swap. Every swap during elimination multiplies the determinant by −1.
  • Expecting det(A + B) = det(A) + det(B). That is false. Determinants multiply, they do not add.

Frequently asked questions

Can a determinant be negative?
Yes. The sign says the transformation reverses orientation — it mirrors space. Only the magnitude describes the scaling factor.
What does a determinant of zero mean?
The matrix is singular: its rows are linearly dependent, it has no inverse, and it collapses space into a lower dimension.
Can a non-square matrix have a determinant?
No. The determinant is defined only for square matrices. For rectangular ones you probably want the rank instead.
Which method should I use by hand?
Up to 3×3 use the closed formulas. Beyond that, use Gaussian elimination — unless a row or column is mostly zeros, in which case cofactor expansion along it is faster.

Want the full explanation? Read the guide: How to calculate the determinant of a matrix

Other calculators