CCalclabhub

Linear Algebra

How To Calculate A Matrix Determinant

A determinant collapses a square matrix into a single number that tells you how much the matrix stretches space and whether it collapses it flat.

Quick Answer

2x2: det = ad - bc. 3x3: sum the three down-right diagonals and subtract the three down-left ones.

det
The determinant, a single signed number
a, b, c, d
The entries of a 2 by 2 matrix, read row by row
|det|
The area or volume scale factor of the transformation
0
A determinant of zero means the matrix is singular

For a 2 by 2 matrix multiply the main diagonal and subtract the other one: 3 times 6 minus 8 times 4 is minus 14. For a 3 by 3 use Sarrus rule, which gives minus 306 for the classic textbook example.

What Is A Matrix Determinant?

The determinant is a single number computed from a square matrix. It summarises the whole matrix in one value, which is remarkable given how much information a matrix carries.

Geometrically it is a scale factor. A 2 by 2 matrix maps the unit square to a parallelogram, and the absolute value of the determinant is that parallelogram's area. In three dimensions the same idea gives a volume.

The sign carries orientation. A positive determinant keeps handedness, and a negative one flips it, which is why a reflection has a determinant of negative one while a rotation has positive one.

A determinant of zero is the alarm bell. It means the matrix squashes space into a lower dimension, the rows are linearly dependent, and the matrix has no inverse. Everything that needs an inverse stops there.

For a 2 by 2 matrix the rule is short: multiply the main diagonal, multiply the other diagonal, and subtract. With entries 3, 8, 4 and 6 that is 18 minus 32, which is minus 14.

For a 3 by 3 matrix the standard shortcut is Sarrus rule. Copy the first two columns to the right of the matrix, add the three down-right diagonal products, and subtract the three down-left ones.

Sarrus rule is a memory aid, not a general method. It works only for 3 by 3 matrices, and anyone who tries to extend it to 4 by 4 gets the wrong answer.

The general method is cofactor expansion. Pick a row, multiply each entry by the determinant of the smaller matrix left after deleting its row and column, and alternate the signs plus, minus, plus.

Several properties make determinants quick to evaluate. Swapping two rows flips the sign, multiplying a row by k multiplies the determinant by k, and adding a multiple of one row to another leaves it unchanged.

The determinant of a product is the product of the determinants. That single identity explains why a product of two invertible matrices is invertible, and why a product involving a singular one cannot be.

Transposing does nothing. The determinant of a matrix and of its transpose are equal, so any theorem about rows applies equally to columns, and you may expand along whichever is more convenient.

Triangular matrices are free. If everything below the diagonal is zero, the determinant is just the product of the diagonal entries, which is why row reduction is the practical way to handle a large matrix.

Cramer's rule solves a linear system by replacing columns with the constants and taking ratios of determinants. It is elegant but slow, and it fails outright when the determinant is zero.

Cost is the reason nobody expands a 10 by 10 matrix by hand. Cofactor expansion grows factorially, while row reduction grows cubically, so software always reduces first.

Only square matrices have determinants. A rectangular matrix transforms between dimensions of different size, and there is no single number that plays the same role.

Formula

det = a x d - b x c

Formula page →

Main diagonal minus the off diagonal, the shortest determinant rule.

SymbolMeaning
detDeterminant
a, dMain diagonal
b, cOff diagonal

det = aei + bfg + cdh - ceg - bdi - afh

Formula page →

Three down-right diagonal products minus three down-left ones. Only valid for 3 by 3.

SymbolMeaning
a ... iMatrix entries
aei + bfg + cdhDown-right terms
ceg + bdi + afhDown-left terms

det = a11 x (a22 x a33 - a23 x a32) - a12 x (a21 x a33 - a23 x a31) + a13 x (a21 x a32 - a22 x a31)

Formula page →

The general rule, and the only one that scales beyond 3 by 3.

SymbolMeaning
detDeterminant
a1jRow entries
M1jMinors

How To Calculate A Matrix Determinant

  1. 1

    Confirm the matrix is square

    Determinants exist only for square matrices. A 2 by 3 or 3 by 2 matrix has no determinant, so check the shape before doing any arithmetic.

  2. 2

    For a 2 by 2, cross multiply and subtract

    Multiply the main diagonal, 3 times 6, which is 18. Multiply the other diagonal, 8 times 4, which is 32. Subtract to get minus 14.

  3. 3

    For a 3 by 3, apply Sarrus rule

    Copy the first two columns to the right. The down-right products are minus 84, 10 and 32, adding to minus 42. The down-left products are minus 4, 28 and 240, adding to 264.

  4. 4

    Subtract and interpret the sign

    Minus 42 minus 264 is minus 306. The absolute value of 306 is the volume scale factor, and the negative sign says the transformation flips orientation.

Examples

Example 1: The 2 by 2 matrix with rows 3, 8 and 4, 6

Matrix size
2 by 2
Row 1
3, 8
Row 2
4, 6
StepCalculationResult
Main diagonal product3 x 618
Off diagonal product8 x 432
Subtract18 - 32-14
Absolute value, the area scale factorabs(-14)14

Result: The determinant is minus 14, so the matrix stretches area by a factor of 14 and flips orientation. The negative sign alone is what tells you the handedness changed.

Example 2: The 3 by 3 matrix with rows 6, 1, 1 and 4, -2, 5 and 2, 8, 7

Matrix size
3 by 3
Row 1
6, 1, 1
Row 2
4, -2, 5
Row 3
2, 8, 7
StepCalculationResult
Down-right diagonal products6 x (-2) x 7 + 1 x 5 x 2 + 1 x 4 x 8-42
Down-left diagonal products1 x (-2) x 2 + 1 x 4 x 7 + 6 x 5 x 8264
Subtract the two sums-42 - 264-306
Absolute value, the volume scale factorabs(-306)306

Result: Sarrus rule gives a determinant of minus 306, meaning the matrix scales volume by 306 and reverses orientation. Because the value is not zero, the matrix has an inverse.

Calculator

Determinant

-14

Absolute value
14
Down-right diagonal terms
18
Down-left diagonal terms
32
Sum of the main diagonal
9

Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.

Prefer a full-width tool? Open the A Matrix Determinant calculator page.

Common Mistakes

  • Using Sarrus rule on a 4 by 4 matrix

    Sarrus is a 3 by 3 shortcut only. A 4 by 4 matrix needs cofactor expansion or row reduction, and the shortcut silently misses terms.

  • Subtracting the wrong three products

    The down-left diagonals are the ones subtracted. Getting the direction wrong turns minus 306 into plus 222 for the textbook example.

  • Dropping the minus in the 2 by 2 case

    The formula is ad minus bc, not ad plus bc. Adding gives 50 instead of minus 14, which changes both the size and the orientation reading.

  • Reporting the absolute value when the sign matters

    The sign tells you whether orientation flipped. Cramer's rule, inverses and eigenvalue work all need the signed value, not its magnitude.

  • Trying to take the determinant of a rectangular matrix

    Only square matrices have determinants. A 2 by 3 matrix maps between dimensions of different size and has no single scale factor.

  • Assuming a zero determinant is a rounding artefact

    Exactly zero means the rows are dependent and there is no inverse. If a calculation lands near zero, check the entries before trusting any inverse built from it.

FAQ

What is the determinant of a 2 by 2 matrix?

Multiply the main diagonal and subtract the off diagonal. For entries a, b, c, d read row by row, the determinant is a times d minus b times c.

How do you find the determinant of a 3 by 3 matrix?

Use Sarrus rule: add the three down-right diagonal products, subtract the three down-left ones. Cofactor expansion gives the same answer and also works for larger matrices.

What does a determinant of zero mean?

The matrix is singular. Its rows are linearly dependent, it squashes space flat, and it has no inverse, so any method that needs one breaks down.

What does a negative determinant mean?

The transformation reverses orientation. The magnitude still gives the area or volume scale factor, and the sign says the handedness flipped, as it does in a reflection.

Can a non square matrix have a determinant?

No. Determinants are defined only for square matrices, because the scale factor idea needs the input and output spaces to have the same dimension.

Does swapping two rows change the determinant?

It flips the sign and leaves the magnitude alone. Adding a multiple of one row to another leaves it completely unchanged, which is the basis of row reduction.

References

  1. [1]Wikipedia, Determinant — https://en.wikipedia.org/wiki/Determinant
  2. [2]Wikipedia, Rule of Sarrus — https://en.wikipedia.org/wiki/Rule_of_Sarrus
  3. [3]Wikipedia, Cramer's rule — https://en.wikipedia.org/wiki/Cramer%27s_rule