gizmobench

Matrix Determinant Calculator

The determinant of a square matrix is the single number that says how much the matrix scales area or volume, and whether it can be undone at all: zero means it cannot. This page opens the matrix calculator on det A, so the first screen is already showing the determinant of [1 2; 3 4], which is -2, with the second grid put away because a determinant needs only one matrix. Type over the cells, up to 8 rows by 8 columns, and the number changes on the keystroke. The elimination runs on exact fractions rather than decimals, so a matrix of fractions returns a fraction, [1/2 1/3; 1/4 1/5] gives 1/60, and the singular [1 2 3; 4 5 6; 7 8 9] returns exactly 0 where a floating-point calculator returns about 0.00000000000000067. The rank of A is reported beside the answer, and the answer copies out as plain text or as LaTeX.

A2 × 2
RowsColumns
-2
Display

The scale factor of the matrix. Zero means the matrix is singular and has no inverse.

  • Determinantnot zero, so A can be inverted
    -2
  • Rank of Athe most a 2×2 matrix can have
    2
  • det Aexact fractions
    -2

Computed by Bareiss elimination in exact rational arithmetic, so nothing here is rounded.

Every entry is a fraction, not a decimal. Numbers here are held as one whole number over another and are added, multiplied and divided without rounding at any step, so the inverse of an integer matrix arrives as fractions and stays readable: 1/3 is 1/3, not 0.3333333333. It also fixes the failure that matters most. A singular matrix has determinant exactly 0, but in decimals it usually does not: the determinant of [1 2 3; 4 5 6; 7 8 9] comes out at about 0.00000000000000067, so a calculator that trusts that number inverts the matrix anyway and hands back entries around a thousand trillion. This one gets 0, and says the matrix is singular. Switch the display to Decimal whenever a decimal is what you need: it rounds the same exact values for reading, and never for calculating.

Common questions

How do I find the determinant of a 2×2 matrix?
Type the four numbers into grid A and read the large number to the right of the equals sign. The rule is ad − bc, the product of the main diagonal less the product of the other one. The page opens on [1 2; 3 4], where that is 1×4 − 2×3, so the answer on screen is -2. Put [4 7; 2 6] in instead and it is 24 − 14, or 10. A cell takes a whole number, a decimal like 0.5, a fraction like 1/3, exponent notation like 1.5e1, or the long minus sign that comes with anything pasted out of a PDF or a textbook, and a cell left blank counts as zero.
How does it work out a 3×3 or an 8×8 determinant?
By Bareiss elimination, which is row reduction arranged so that every division comes out exact, rather than by cofactor expansion. The result is the same number and the work is far smaller: expanding an 8×8 by cofactors is 40,320 signed products, while elimination gets the same number out of 140 entry updates, so an 8×8 of whole numbers answers on the keystroke even when its determinant runs to twelve digits. The row and column steppers under grid A take it anywhere from 1×1 up to 8×8. The textbook 3×3 [6 1 1; 4 -2 5; 2 8 7] comes out at -306 here, and a 4×4 such as [2 -1 0 0; -1 2 -1 0; 0 -1 2 -1; 0 0 -1 2] comes out at 5.
What does a determinant of 0 mean?
That the matrix is singular: it flattens space instead of scaling it, it has no inverse, and at least one row is a combination of the others. The tool says so in the Determinant cell under the stage, and the Rank of A cell beside it counts the rows that are genuinely independent. Type [1 2 3; 4 5 6; 7 8 9] in and you get 0, with rank 2 of a possible 3, because the third row is twice the second minus the first. Getting an honest 0 there is the point of the exact arithmetic: in floating point that determinant comes out at about 0.00000000000000067, which is not zero, so a calculator that trusts it will go on to invert a matrix that has no inverse. A repeated row is the same story: [1 2; 1 2] gives 0.
Why is my determinant showing as a fraction?
Because it is one. Fractions in give a fraction out: [1/2 1/3; 1/4 1/5] gives 1/60, and the 3×3 Hilbert matrix [1 1/2 1/3; 1/2 1/3 1/4; 1/3 1/4 1/5] gives 1/2160 exactly. Decimals you type are converted exactly on the way in as well, so [0.5 1.5; 2 4] gives -1 rather than something ending in stray digits. When a decimal is what you need, the Display switch under the stage turns the same exact value into one at 0 to 10 places on the stepper: 1/2160 reads 0.0005 at four places and 0.000462963 at ten, while the value behind it is still exactly 1/2160.
Can I take the determinant of a rectangular matrix?
No, and neither can anything else: the determinant is only defined for a square matrix. Ask for one anyway and the page holds the answer back and says which shape it got, in full: Only a square matrix has a determinant, and A is 2×3. Give A the same number of rows and columns. Square the grid with the row and column steppers, or switch the operation to rank A or rref A, which both accept a rectangular matrix: [1 2 3; 4 5 6] has rank 2 and reduces to [1 0 -1; 0 1 2].
Does swapping or scaling a row change the determinant?
Yes, in fixed ways, and retyping a matrix here is the quickest way to watch them. Swapping two rows flips the sign: [6 1 1; 4 -2 5; 2 8 7] is -306, and with its last two rows exchanged it is 306. Multiplying one row by k multiplies the determinant by k: double the first row of that same matrix and it becomes -612. Adding a multiple of one row to another leaves the determinant alone, which is exactly why elimination can be used to compute it. A triangular matrix is the easy case, since the answer is the product of its diagonal: [2 0 0; 5 3 0; 9 8 4] is 2 × 3 × 4, or 24.
Does opening this page change the calculator I use for other operations?
No. det A is set for this page alone, ahead of whatever the calculator last remembered, and that memory is left untouched: open the full matrix calculator again and it is on the operation you left it on. The matrix you typed does travel with you, since it is usually the one you are still working on. The determinant is not hidden on the other operations either, because the Determinant cell and the Rank of A cell sit beside the result whichever operation is selected, with a Copy button on each number, and the determinant cell names A's shape instead when A is not square. Everything runs in your browser, so nothing is uploaded and no account is involved.

Exact: matrices are computed in rational arithmetic, so an inverse of an integer matrix is shown as fractions rather than rounded decimals, and a singular matrix is reported as singular instead of producing huge numbers.