Matrix Determinant Calculator
📥 Export options
Exporting...
Instantly compute the determinant of any square matrix and learn the theory behind it.
What is a Determinant?
The determinant of a square matrix of dimension n is a real number which depends linearly on each column vector of the matrix. We denote by or the determinant of the square matrix A.

Properties of determinants
-
The determinant is equal to 0 if,
- Two lines in the matrix are equal.
- The matrix has at least one row or column equal to zero.
- The matrix is unique.
- Subtracting row i from row j n times does not change the value of the determinant.
- If two rows or columns are swapped, the sign of the determinant changes from positive to negative or from negative to positive.
- The determinant of the identity matrix is equal to 1,
- The determinants of A and its transpose are equal,
- If A and B have matrices of the same dimension,
- , if the matrix A is triangular et , the determinant is equal to the product of the diagonal of the matrix.
Methods to Calculate a Determinant
Cofactor Expansion (Laplace)
Cofactor expansion is used for small matrices because it becomes inefficient for large matrices compared to the matrix decomposition methods.
The formula for calculating the expansion of Place is given by:

Where is a fixed choice of and is the minor of element .
Example

Leibniz Formula
Permutation-based formula (theoretical, less efficient)


Example

Gauss Elimination
Efficient for large matrices, row operations explained
Gauss elimination is also used to find the determinant by transforming the matrix into a reduced row echelon form by swapping rows or columns, add to row and multiply of another row in order to show a maximum of zeros.
For each pivot we multiply by -1.

Rule of Sarrus
Quick trick for 3×3 matrices
The Sarrus Rule is used for computing only 3x3 matrix determinant. The method consists in adding the first two columns after the first three columns then calculating the product of the coefficients of each diagonal according to the following scheme:

Bareiss algorithm(Montante's method)
The Bareiss algorithm calculates the echelon form of the matrix with integer values. It looks a bit like the Gaussian elimination algorithm and in terms of the number of operations performed. Divisions made have no remainder.
The determinant is determined after several reductions of the matrix to the last row by dividing on a pivot of the diagonal with the formula:

Step-by-Step Examples
### Example 1: Determinant of a 2×2 Matrix For a 2×2 matrix: \[ A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} \] The determinant is computed as: \[ \det(A) = ad - bc \] **Example Calculation:** \[ A = \begin{bmatrix} 3 & 5 \\ 2 & 4 \end{bmatrix} \] \[ \det(A) = (3 \cdot 4) - (5 \cdot 2) = 12 - 10 = 2 \] --- ### Example 2: Determinant of a 3×3 Matrix (Rule of Sarrus) For a 3×3 matrix: \[ B = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} \] The determinant is computed using Sarrus’ Rule: \[ \det(B) = (ae i + b f g + c d h) - (c e g + a f h + b d i) \] **Example Calculation:** \[ B = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} \] \[ \det(B) = (1\cdot5\cdot9 + 2\cdot6\cdot7 + 3\cdot4\cdot8) - (3\cdot5\cdot7 + 1\cdot6\cdot8 + 2\cdot4\cdot9) \] \[ = (45 + 84 + 96) - (105 + 48 + 72) \] \[ = 225 - 225 = 0 \] Since the rows are linearly dependent, the determinant is **0**. --- ### Example 3: Determinant of a 4×4 Matrix (Gaussian Elimination) Consider the 4×4 matrix: \[ C = \begin{bmatrix} 1 & 2 & 0 & 1 \\ 3 & 4 & 1 & 0 \\ 0 & 2 & 3 & 4 \\ 5 & 0 & 2 & 1 \end{bmatrix} \] We will reduce this to upper triangular form using Gaussian elimination. **Step 1: Eliminate below first pivot (1)** Subtract \(3 \cdot R_1\) from \(R_2\), and \(5 \cdot R_1\) from \(R_4\): \[ R_2 \to R_2 - 3R_1, \quad R_4 \to R_4 - 5R_1 \] \[ \begin{bmatrix} 1 & 2 & 0 & 1 \\ 0 & -2 & 1 & -3 \\ 0 & 2 & 3 & 4 \\ 0 & -10 & 2 & -4 \end{bmatrix} \] --- **Step 2: Eliminate below second pivot (-2)** Add \(R_2\) to \(R_3\) and \(5R_2\) to \(R_4\): \[ R_3 \to R_3 + R_2, \quad R_4 \to R_4 + 5R_2 \] \[ \begin{bmatrix} 1 & 2 & 0 & 1 \\ 0 & -2 & 1 & -3 \\ 0 & 0 & 4 & 1 \\ 0 & 0 & 7 & -19 \end{bmatrix} \] --- **Step 3: Eliminate below third pivot (4)** \[ R_4 \to R_4 - \frac{7}{4} R_3 \] \[ \begin{bmatrix} 1 & 2 & 0 & 1 \\ 0 & -2 & 1 & -3 \\ 0 & 0 & 4 & 1 \\ 0 & 0 & 0 & -\frac{83}{4} \end{bmatrix} \] --- **Step 4: Compute determinant as product of diagonal entries:** \[ \det(C) = 1 \cdot (-2) \cdot 4 \cdot \left(-\frac{83}{4}\right) = 1 \cdot (-2) \cdot 4 \cdot -\frac{83}{4} = 166 \] So, the determinant of \(C\) is **166**. ---Key takeaways from examples
- 2×2 is straightforward: \( \det\! = ad - bc \).
- 3×3 can be solved quickly with Sarrus’ Rule.
- 4×4 or higher: Gaussian elimination is efficient and avoids tedious cofactor expansion.
Use the appropriate method depending on matrix size: direct formulas for small matrices, elimination or optimized algorithms for larger ones.