Determinant calculator

Free determinant calculator using cofactor expansion, Gaussian elimination, Sarrus, Leibniz and Montante, with every step shown in exact fractions.

Matrix A
Size
3

Matrices up to 10 × 10, with at most 24 characters per cell. Sarrus and triangle: 3 × 3 only. Leibniz: up to 7 × 7. Real numbers only. Exact calculation in fractions, done in your browser.

CALCULATION RECEIPT- / - / -
det(A)−3
What you entered
A =
123
456
7810
MethodExpand along a row
Size3 × 3
MatrixInvertible
PDF: receipt, chart and detailed table.

Step-by-step solution

  1. Expansion along row 1. Each term's sign follows the + − + checkerboard.

    det(A) = 1·M₁₁ − 2·M₁₂ + 3·M₁₃
    A =
    123
    456
    7810
  2. Minor: remove the row and column of the cell.

    M₁₁ = 5·10 − 6·8 = 2
    M₁₁ =
    56
    810
  3. Minor: remove the row and column of the cell.

    M₁₂ = 4·10 − 6·7 = −2
    M₁₂ =
    46
    710
  4. Minor: remove the row and column of the cell.

    M₁₃ = 4·8 − 5·7 = −3
    M₁₃ =
    45
    78
  5. Add the terms.

    det(A) = 1·2 − 2·(−2) + 3·(−3) = −3

What is this tool for?

A determinant is a single number worked out from a square matrix, meaning one with as many rows as columns. It tells you whether the matrix can be inverted: it can only if the number is not zero. It also tells you by how much the related transformation multiplies areas or volumes. With −3, volumes are multiplied by 3 and the orientation is reversed.

This calculator offers nine methods and shows the step-by-step solution for the one you choose. If you are a student, you can enter the matrix from your exercise, pick the method from your class, then compare each line with your own working.

If you are a researcher, you get exact fractions with no rounding error, for sizes up to 10 × 10: a 0 on the screen is a real 0, not a rounding residue. The calculation runs in your browser. To solve the related system, use the system of equations solver.

How to use it

  1. Set the size of the matrix with the + and − buttons, then fill in the cells. Fractions and decimals stay exact throughout the calculation.
  2. Choose the method. For an expansion or for getting zeros, also give the row or column number: pick the one with the most zeros.
  3. Read the determinant on the receipt and check each operation in the step-by-step solution. Switch methods to compare: the result never changes.

How it is calculated

det(a b ; c d) = ad − bc
det(A) = Σj (−1)i+j · aij · Mij
(+ − +) (− + −) (+ − +)
Ri ↔ Rj: det(A) → −det(A)
Ri ← Ri + k·Rj: det(A) → det(A)

For a 2 × 2 matrix with rows (a, b) and (c, d), the determinant is ad − bc. With rows (3, 8) and (4, 6): 3·6 − 8·4 = 18 − 32 = −14.

For larger sizes, expansion brings the calculation down to smaller determinants. Each cell of a row or column is multiplied by its minor Mᵢⱼ, with the sign from the + − + checkerboard: + when i + j is even, − when i + j is odd.

Swapping two rows changes the sign of the determinant. Adding a multiple of one row to another changes nothing. The same rules hold for columns. Once the matrix is triangular, the determinant is the product of its diagonal.

Worked examples

Expansion along row 1 of A, with rows (1, 2, 3), (4, 5, 6) and (7, 8, 10)

  1. Write the expansion with the signs + − +: det(A) = 1·M₁₁ − 2·M₁₂ + 3·M₁₃.
  2. Remove row 1 and column 1: M₁₁ = 5·10 − 6·8 = 2.
  3. Remove row 1 and column 2: M₁₂ = 4·10 − 6·7 = −2.
  4. Remove row 1 and column 3: M₁₃ = 4·8 − 5·7 = −3.
  5. Add the terms: 1·2 − 2·(−2) + 3·(−3) = 2 + 4 − 9 = −3.

det(A) = −3, so the matrix can be inverted.

Rule of Sarrus on the same matrix

  1. Copy the first two columns to the right. The rows become (1, 2, 3, 1, 2), (4, 5, 6, 4, 5) and (7, 8, 10, 7, 8).
  2. Downward diagonals are positive: 1·5·10 = 50, 2·6·7 = 84 and 3·4·8 = 96.
  3. Upward diagonals are negative: 3·5·7 = 105, 1·6·8 = 48 and 2·4·10 = 80.
  4. Subtract: (50 + 84 + 96) − (105 + 48 + 80) = 230 − 233 = −3.

det(A) = −3, the same as with the expansion.

Each method explained

Expand along a row

The basic method, suited to small matrices and rows with many zeros.

Each cell of the row is multiplied by its minor and its checkerboard sign, and the results are added.

Row 1 of A: 1·2 − 2·(−2) + 3·(−3) = −3. Rows (3, 8) and (4, 6): 3·6 − 8·4 = −14.

Expand along a column

The same principle, for when a column has more zeros.

The same work on a column. The result does not change, because a matrix and its transpose have the same determinant.

Column 1 of A: 1·2 − 4·(−4) + 7·(−3) = −3. Column 2 of the 4 × 4 matrix with rows (1, 0, 2, −1), (3, 0, 0, 5), (2, 1, 4, −3) and (1, 0, 5, 0): − 1·(−30) = 30.

Get zeros in a row

It lightens the work by hand, since only one minor is left.

Subtract from columns a multiple of another column, which keeps the determinant, until only one non-zero cell is left in the row. Then expand along it.

Row 1 of A: C₂ ← C₂ − 2·C₁ and C₃ ← C₃ − 3·C₁, then (−3)·(−11) − (−6)·(−6) = −3.

Get zeros in a column

The same idea with row operations, which are often more familiar.

Subtract from rows a multiple of another row until only one non-zero cell is left in the column. Then expand along it, with its sign.

Column 1 of A: R₂ ← R₂ − 4·R₁ and R₃ ← R₃ − 7·R₁, then 1 · (−3) = −3.

Gaussian elimination

It suits large matrices and is also used for a linear system.

Clear the cells below each pivot. The determinant is the product of the diagonal, with one sign change per row swap.

A becomes rows (1, 2, 3), (0, −3, −6) and (0, 0, 1), so 1·(−3)·1 = −3. With 9 instead of 10, a whole row becomes zero and the determinant is 0.

Triangle's rule (3×3)

A direct formula for 3 × 3, presented with triangles.

Add the main diagonal and two triangles, then subtract the other diagonal and its two triangles.

On A: (1·5·10 + 2·6·7 + 3·4·8) − (3·5·7 + 1·6·8 + 2·4·10) = −3.

Rule of Sarrus (3×3)

The most visual way to calculate a 3 × 3 determinant by hand.

Copy the first two columns on the right: downward diagonals are positive, upward ones negative. These are the same six products as in the triangle rule.

On A: 230 going down, 233 going up, so 230 − 233 = −3.

Leibniz formula

The definition of the determinant, useful in proofs and limited here to 7 × 7.

For each permutation, multiply one cell per row and per column, with the permutation's sign, then add. The solution shows 24 terms at most.

For n = 3, with 6 permutations: 50 − 48 − 80 + 84 + 96 − 105 = −3. For n = 2: 18 − 32 = −14.

Montante's method (Bareiss)

It avoids intermediate fractions: with whole numbers, everything stays whole.

Each cell outside the pivot row becomes (pivot × cell − cell in the pivot's column × cell in the pivot's row) ÷ previous pivot. The last pivot gives the determinant, up to the sign of the swaps.

On A, the pivots are 1, −3 and −3, so det(A) = −3.

Names and notation

  • Determinant: from the Latin determinare, to fix. Gauss used the word, then Cauchy gave it its present meaning.
  • det(A): the determinant of matrix A, also written |A|. This is not an absolute value: it can be negative.
  • Minor Mᵢⱼ: the determinant left after removing row i and column j. From the Latin minor, meaning smaller.
  • Cofactor: the minor with its checkerboard sign, the factor that goes with the cell in the expansion.
  • Pivot: the cell used to clear the others. This French word means the part a mechanism turns on.
  • Laplace expansion: another name for expansion, after the French scientist Pierre-Simon de Laplace (1749-1827).
  • Sarrus: Pierre Frédéric Sarrus (1798-1861), a French mathematician and professor in Strasbourg.
  • Triangle's rule: the name describes the shape of the products, not a person.
  • Leibniz: Gottfried Wilhelm Leibniz (1646-1716), a German philosopher and mathematician.
  • Permutation and sgn(σ): σ is a new ordering of the numbers 1 to n, and σ(i) is the column chosen in row i. Its sign sgn(σ), from the Latin signum, is +1 after an even number of swaps and −1 after an odd number.
  • Montante and Bareiss: two closely related methods without intermediate fractions, named after the Mexican teacher René Mario Montante Pardo and after Erwin Bareiss, who published his in 1968.
  • Gauss: Carl Friedrich Gauss (1777-1855), a German mathematician. Ancient Chinese texts already described the principle of his method.
  • L₂, R₂ and C₂: L₂ is row 2 in classes taught in French and Arabic, R₂ the same row in English, and C₂ is column 2. R₂ ← R₂ − 4·R₁ replaces row 2 with itself minus 4 times row 1.

Tips and limitations

  • Take the row or column with the most zeros: on the 4 × 4 matrix above, column 2 leaves only one term.
  • Enter 1/3 rather than 0.33, which the tool reads as exactly 33/100. To simplify a fraction, use the fractions calculator.
  • To find a mistake, use the method and row from your own working, then compare the steps. The result stays indicative: check your input.
  • Only real numbers are accepted, with no complex numbers or variables. For a characteristic polynomial, see eigenvalues and eigenvectors.
  • From 5 × 5 upward, an expansion gives each minor without its working. To see everything, choose getting zeros or Gaussian elimination.

Mistakes to avoid

  • Using Sarrus on a 4 × 4 matrix: the tool refuses it, because the rule only holds for 3 × 3.
  • Forgetting the checkerboard sign: along row 1 of A, writing + instead of − before the term for the cell 2 gives 2 − 4 − 9 = −11 instead of −3.
  • Forgetting the sign change after a swap: swapping rows 1 and 2 of A gives a determinant of 3, not −3.
  • Confusing a minor with a cofactor: in A, the minor M₁₂ is −2, but its cofactor is 2.

Frequently asked questions

Which method is fastest?

By hand, use Sarrus for a 3 × 3 matrix and getting zeros for anything larger. Gaussian elimination stays the most efficient for big matrices. The Leibniz formula is mainly theoretical because the number of terms explodes: 120 for 5 × 5 and 5,040 for 7 × 7.

What does a zero determinant mean?

The matrix cannot be inverted: its rows are dependent, and the related system has no unique solution. Geometrically, the transformation flattens space onto a smaller dimension. You can check the consequence with the matrix calculator.

Does the rule of Sarrus work for a 4 × 4 matrix?

No. Sarrus and the triangle rule only hold for 3 × 3. A 4 × 4 matrix has 24 products, while the diagonal pattern gives only 8. Use an expansion, getting zeros or Gaussian elimination instead.

Why do all the methods give the same value?

Because they calculate the same sum of signed products, the one in the Leibniz formula. An expansion groups it by row or column, Sarrus and the triangle rule write it out directly for 3 × 3, and Gauss, Montante and getting zeros use operations whose effect is known. A difference in your own working therefore signals a calculation mistake.

How do I find the determinant of a triangular matrix?

Multiply the cells of its diagonal. For example, the matrix with rows (1, 2, 3), (0, −3, −6) and (0, 0, 1) has determinant 1·(−3)·1 = −3. If a diagonal cell is 0, the determinant is 0.

What is the determinant of a product of matrices?

For two square matrices of the same size, det(A × B) = det(A) × det(B). The matrix with rows (3, 8) and (4, 6) has determinant −14, so its product with itself has determinant (−14) × (−14) = 196. This rule does not hold for a sum. You can calculate the product with the matrix calculator.