Home Calculators Categories Category: Math, Statistics & Education

Determinant Calculator

This determinant calculator finds the exact determinant of a numeric square matrix from 2×2 up to 5×5. Type or paste your matrix using integers, decimals, or fractions, and the calculator returns the determinant as an integer or a reduced fraction, tells you whether the matrix is singular or invertible, and can walk you through the worked calculation one step at a time.

Input
Semicolons can also separate rows. Use up to 18 digits per entry or per part of a fraction.

Use one row per line and separate entries with spaces or commas. Integers, decimals and fractions such as 3/7 are accepted.

Choosing an example replaces the current matrix. You can edit it after loading.
Visual
Matrix entries and worked steps Active entries have an orange outline. Related entries have a shaded background.
Output

Exact determinant

—

—

How to use the determinant calculator

  1. Enter the matrix in the field labeled Square matrix (2×2 to 5×5). Put each row on its own line, or separate rows with semicolons. Separate the entries within a row with spaces, tabs, or commas.
  2. Read the result. In Simple mode the calculator shows the Exact determinant, the matrix status (Singular or Invertible), and a picture of your matrix.
  3. Follow the work (optional). Choose Show worked steps to switch to Advanced mode. Use Previous and Next to move through the numbered steps. The picture highlights the entries involved in each step.
  4. Copy or print. Copy includes your entered matrix, the determinant, and the status. In Advanced mode it also includes the full worked calculation. Print opens your browser's print dialog, and in Advanced mode the worked calculation is included in the printout.

The calculator infers the size from the rows and columns you enter, so there is no size selector. Simple and Advanced modes use the same matrix field and the same exact calculation. The only difference is how much of the work is displayed.

The default matrix is 2 1; 3 4 in Simple mode. The Examples menu replaces the field with a preset that you can then edit. Once you change the matrix, the selection switches to Custom matrix and the result updates. Reset restores the opening 2×2 matrix and returns to Simple mode.

Matrix entry rules

Rule Details
Sizes 2×2, 3×3, 4×4, or 5×5 only. The matrix must be square.
Row separators Line breaks or semicolons
Entry separators Spaces, tabs, or commas
Accepted entries Signed integers, finite base-10 decimals, and fractions with integer numerators and denominators
Accepted examples -2, .25, 0.25, 3/7, 3/-7
Decimal point A period. A comma is only a separator, never a decimal point or thousands separator.
Fractions Keep them together with no spaces around the slash. The denominator must be nonzero.
Digit limit Up to 18 typed digits per integer or decimal entry, not counting the sign or decimal point. For a fraction, the cap applies separately to the numerator and the denominator.
Total length The whole input is limited to 1,200 characters.

Blank input, rectangular matrices, unsupported sizes, missing entries, malformed tokens, and values over the limits all produce an error. Where it applies, the error names the row and column. While the input is invalid, the result fields show em dashes and Copy is disabled.

Scientific notation (such as 1e3), arithmetic expressions (such as 2+3), symbolic variables, and complex numbers are not supported. Convert them to plain numbers first.

What the determinant tells you

The determinant is a single number computed from a square matrix. Its most practical meaning is a test for invertibility:

  • If det⁡(A)≠0\det(A)\neq 0, the matrix is invertible.
  • If det⁡(A)=0\det(A)=0, the matrix is singular and has no inverse.

The calculator applies this test exactly, with no near-zero tolerance. It reports Singular only when the exact determinant is zero, and Invertible for every other value.

For a singular matrix, the calculator also explains that the matrix has no inverse. For a linear system Ax=bAx=b, a zero determinant means you need the augmented matrix to tell whether the system has no solution or infinitely many. The calculator itself computes the determinant and reports invertibility. It does not compute the inverse, solve the system, or analyze measurement uncertainty.

How the calculator picks a method

The matrix size selects the method automatically. This matters if you searched for a specific technique, so here is exactly what each size uses.

Matrix size Method shown Method name in the calculator
2×2 Diagonal formula 2×2 diagonal formula
3×3 Cofactor expansion along the first row First-row cofactor expansion
4×4 and 5×5 Row reduction to an upper triangular matrix Row reduction

In other words, cofactor expansion is used for 3×3 matrices, and row reduction is used for 4×4 and 5×5 matrices. The calculator does not offer a choice of method for a given size.

2×2 determinant: the diagonal formula

For

A=(abcd),A=\begin{pmatrix}a&b\\c&d\end{pmatrix},

multiply the main-diagonal entries and subtract the product of the other diagonal:

det⁡(A)=ad−bc.\det(A)=ad-bc.

The calculator shows this as three worked steps: the two products, then their difference. For the default matrix (2134)\begin{pmatrix}2&1\\3&4\end{pmatrix}:

det⁡(A)=2⋅4−1⋅3=8−3=5.\det(A)=2\cdot 4-1\cdot 3=8-3=5.

3×3 determinant: first-row cofactor expansion

Write aija_{ij} for the entry in row ii, column jj. Let M1jM_{1j} be the 2×2 submatrix you get by deleting row 1 and column jj. The determinant of that submatrix is the minor value. Expanding along the first row uses the sign pattern +,−,++,-,+:

det⁡(A)=a11det⁡(M11)−a12det⁡(M12)+a13det⁡(M13).\det(A)=a_{11}\det(M_{11})-a_{12}\det(M_{12})+a_{13}\det(M_{13}).

The calculator reports each minor and each signed term, then adds the terms.

Worked example. Take the 3×3 · Cofactors preset:

A=(123045106).A=\begin{pmatrix}1&2&3\\0&4&5\\1&0&6\end{pmatrix}.

The three minors are:

  • Delete row 1 and column 1: det⁡(4506)=24\det\begin{pmatrix}4&5\\0&6\end{pmatrix}=24
  • Delete row 1 and column 2: det⁡(0516)=−5\det\begin{pmatrix}0&5\\1&6\end{pmatrix}=-5
  • Delete row 1 and column 3: det⁡(0410)=−4\det\begin{pmatrix}0&4\\1&0\end{pmatrix}=-4

Applying the signs +,−,++,-,+ and multiplying by the first-row entries 1,2,31,2,3 gives the signed terms:

+1⋅24=24,−2⋅(−5)=10,+3⋅(−4)=−12.+1\cdot 24=24,\qquad -2\cdot(-5)=10,\qquad +3\cdot(-4)=-12.

Adding them:

det⁡(A)=24+10−12=22.\det(A)=24+10-12=22.

4×4 and 5×5 determinants: row reduction

For larger matrices, the calculator reduces the matrix to an upper triangular form. The determinant then comes from the diagonal. The procedure works left to right through the pivot columns:

  1. Find a pivot. For column kk, use the first row r≥kr\ge k whose entry in that column is nonzero.
  2. Swap if needed. If that row is not row kk, swap it into row kk. Each row swap reverses the sign of the determinant.
  3. Clear below the pivot. For each row i>ki>k with a nonzero entry in column kk, replace the row. With uiku_{ik} the current entry to clear and ukku_{kk} the current pivot:
Ri←Ri−uikukkRk,i>k.R_i\leftarrow R_i-\frac{u_{ik}}{u_{kk}}R_k,\qquad i>k.

This operation does not change the determinant. The calculator does not scale pivot rows to make the pivots equal to 1, because scaling a row would change the determinant.

  1. Stop early if there is no pivot. If no nonzero entry exists at or below the current diagonal position, the determinant is 00 and the algorithm stops.
  2. Multiply the diagonal. Otherwise, if UU is the final upper triangular matrix and ss is the number of row swaps:
det⁡(A)=(−1)s∏k=1nukk.\det(A)=(-1)^s\prod_{k=1}^{n}u_{kk}.

Worked example (4×4). Take the 4×4 · Row swap preset:

A=(0200110023300014).A=\begin{pmatrix}0&2&0&0\\1&1&0&0\\2&3&3&0\\0&0&1&4\end{pmatrix}.

The first column has a zero in the top position, so the first nonzero entry at or below it is in row 2. Swap rows 1 and 2 (one swap, s=1s=1):

(1100020023300014).\begin{pmatrix}1&1&0&0\\0&2&0&0\\2&3&3&0\\0&0&1&4\end{pmatrix}.

Clear the 2 in row 3 with R3←R3−2R1R_3\leftarrow R_3-2R_1:

(1100020001300014).\begin{pmatrix}1&1&0&0\\0&2&0&0\\0&1&3&0\\0&0&1&4\end{pmatrix}.

In column 2 the pivot is 22. Clear the 1 below it with R3←R3−12R2R_3\leftarrow R_3-\tfrac12R_2:

(1100020000300014).\begin{pmatrix}1&1&0&0\\0&2&0&0\\0&0&3&0\\0&0&1&4\end{pmatrix}.

In column 3 the pivot is 33. Clear the 1 below it with R4←R4−13R3R_4\leftarrow R_4-\tfrac13R_3:

U=(1100020000300004).U=\begin{pmatrix}1&1&0&0\\0&2&0&0\\0&0&3&0\\0&0&0&4\end{pmatrix}.

The diagonal is 1,2,3,41,2,3,4, so

det⁡(A)=(−1)1⋅(1⋅2⋅3⋅4)=−24.\det(A)=(-1)^1\cdot(1\cdot 2\cdot 3\cdot 4)=-24.

Worked example (5×5 with fractions). The 5×5 · Fractions preset is

A=(01200011000023000014000015).A=\begin{pmatrix}0&\tfrac12&0&0&0\\1&1&0&0&0\\0&2&3&0&0\\0&0&1&4&0\\0&0&0&1&5\end{pmatrix}.

It also needs one row swap to bring the 11 in row 2 to the top. After the swap, the remaining eliminations use multipliers 44, 13\tfrac13, and 14\tfrac14. For example, clearing the 22 in row 3 uses R3←R3−21/2R2=R3−4R2R_3\leftarrow R_3-\frac{2}{1/2}R_2=R_3-4R_2. The final diagonal is 1,12,3,4,51,\tfrac12,3,4,5, so

det⁡(A)=(−1)1⋅(1⋅12⋅3⋅4⋅5)=−30.\det(A)=(-1)^1\cdot\left(1\cdot\tfrac12\cdot 3\cdot 4\cdot 5\right)=-30.

The Advanced view lets you step through every one of these row operations. After each operation, the picture shows the matrix as it stands.

Built-in examples

The Examples menu contains four presets. Semicolons below stand for row breaks.

Preset label Matrix input Exact determinant
2×2 · Diagonal products 2 1; 3 4 5
3×3 · Cofactors 1 2 3; 0 4 5; 1 0 6 22
4×4 · Row swap 0 2 0 0; 1 1 0 0; 2 3 3 0; 0 0 1 4 −24
5×5 · Fractions 0 1/2 0 0 0; 1 1 0 0 0; 0 2 3 0 0; 0 0 1 4 0; 0 0 0 1 5 −30

Loading a preset restarts the step sequence, and you can edit the preset to try your own variations.

Exact results: integers and reduced fractions

Every accepted entry is treated as an exact rational number. A decimal with kk digits after the point is read as a signed integer over 10k10^k and then reduced, so 0.25 is exactly 1/41/4. All arithmetic uses arbitrary-precision integer numerators and denominators and simplifies fractions exactly, so there is no floating-point rounding.

The Exact determinant is shown as an integer or as a reduced fraction with a positive denominator. For example, the matrix 0.5 0; 0 1/3 gives

det⁡(A)=12⋅13−0⋅0=16,\det(A)=\tfrac12\cdot\tfrac13-0\cdot 0=\tfrac16,

and the calculator displays 1/6.

Exactness is relative to the numbers you type. A rounded decimal is a different number from the fraction it approximates. For instance, 0.3333 is exactly 3333/100003333/10000, not 1/31/3. Compare these two matrices:

  • 0.3333 0; 0 3 has determinant 0.99990.9999 (shown as 9999/10000).
  • 1/3 0; 0 3 has determinant 11.

If you want the determinant of a matrix that contains one-third, enter 1/3.

Long values may be abbreviated inside the matrix picture. The full value is available in the cell's tooltip, and the determinant itself always keeps its full exact value.

Singular matrices: a quick example

The matrix

(123456789)\begin{pmatrix}1&2&3\\4&5&6\\7&8&9\end{pmatrix}

has first-row minors −3-3, −6-6, and −3-3. The signed terms are −3-3, 1212, and −9-9, which add to 00. The calculator therefore reports Singular, meaning the matrix has no inverse. Because the arithmetic is exact, the zero is a true zero and not a rounding artifact.

Why row operations give the right determinant

Three facts explain the row-reduction method:

  • Replacing a row with itself minus a multiple of another row leaves the determinant unchanged. This is the only elimination operation the calculator uses.
  • Swapping two rows multiplies the determinant by −1-1. The calculator counts the swaps as ss and applies (−1)s(-1)^s at the end.
  • For an upper triangular matrix, the determinant is the product of the diagonal entries.

The calculator never rescales a pivot row. That is why the final diagonal in the 5×5 example contains 12\tfrac12 rather than 11.

Frequently asked questions

How do I calculate a 3×3 determinant with this calculator?

Enter nine numbers on three rows, such as 1 2 3; 0 4 5; 1 0 6. The calculator uses first-row cofactor expansion, reports each minor and signed term, and adds them. Select Show worked steps to see them in order.

Does the calculator show a 4×4 or 5×5 determinant with steps?

Yes. For these sizes it uses row reduction and shows each row swap and row replacement in Advanced mode, one numbered step at a time, with the matrix pictured after each operation.

Can I choose between cofactor expansion and row reduction?

No. The method is selected by matrix size: the diagonal formula for 2×2, first-row cofactor expansion for 3×3, and row reduction for 4×4 and 5×5.

Can I enter fractions and decimals?

Yes. Enter fractions like 3/7 with no spaces around the slash. Decimals use a period, such as .25 or 0.25. A comma only separates entries, so 0,25 is read as two entries, not as one decimal number.

Why does the calculator show an error?

The input must be one numeric square matrix from 2×2 to 5×5, within 1,200 characters. Common causes of errors are a missing entry, a rectangular matrix, a zero denominator, spaces inside a fraction, scientific notation, or an entry with more than 18 digits. The message identifies the row and column when applicable.

What does Singular mean?

It means the exact determinant is zero, so the matrix has no inverse. Any nonzero determinant gives the status Invertible.

Can it find the inverse of the matrix or solve a system of equations?

No. This calculator computes the determinant and reports whether the matrix is singular or invertible. It does not compute the inverse, solve Ax=bAx=b, or analyze measurement uncertainty.

What does Copy include?

Copy includes your entered matrix, the exact determinant, and the status. In Advanced mode it also includes the full worked calculation. If the input is invalid, Copy is disabled.

Calculation Methodology Documented

Read the formula definitions, supported input ranges, and limitations before using this estimate.

Review Methodology
Debjeet Bhowmick
Author Debjeet Bhowmick AWS Certified Solutions Architect • Cloud & DevOps Consultant

AWS Certified Solutions Architect Professional and Senior Cloud & DevOps Consultant with over 14 years of hands-on expertise architecting resilient cloud infrastructure across AWS, GCP, and Azure. Specializes in infrastructure as code, continuous delivery automation, and telemetry across Terraform, Ansible, Docker, Kubernetes, ELK, Python, and SQL. Creator of OrangeCalc, delivering client-side high-precision computational tools.