Skip to main content
Home / Matrices / Matrix Determinant
Calculating...
Matrix Operation

Matrix Determinant Calculator

Calculate the determinant of a square matrix with detailed step-by-step explanations using cofactor expansion. The determinant tells us about matrix invertibility and volume scaling.

Home Matrix Operations Matrix Determinant
Square matrix required

Enter Matrix A

Enter the entries of your square matrix (4×4 max). Use fractions like 1/3 or decimals.

Matrix A
×
Square
r1
r2
r3
r4
c1
c2
c3
c4
(max size)
Square matrix required: Determinant is only defined for square matrices (n×n). The dimension controls are locked to keep rows = columns.

Learn About Matrix Determinant

Understanding the concepts behind the calculations.


What is a Determinant?

The determinant is a special number that can be calculated from a square matrix. It reveals fundamental properties of the matrix and the linear transformation it represents.

Definition: For a square matrix A, the determinant det(A) (or |A|) is a scalar that indicates whether the matrix is invertible and how it scales area/volume.

$$ \boxed{\det(A) = \sum_{j=1}^{n} (-1)^{i+j} a_{ij} \det(M_{ij})} $$

This is the cofactor expansion formula (Laplace expansion) along row i.

⚠️ Important: Determinants are only defined for SQUARE matrices (same number of rows and columns).

The Big Picture

  • det(A) = 0 → Matrix is singular (not invertible, collapses space)
  • det(A) ≠ 0 → Matrix is invertible (non-singular, preserves dimension)
  • |det(A)| = factor by which area/volume is scaled
  • Sign of det(A) = orientation (positive = preserves, negative = flips)

How to Calculate the Determinant

1×1 Matrix

$$ \det([a]) = a $$

The determinant is simply the single entry.

2×2 Matrix

$$ \det\begin{pmatrix} a & b \\ c & d \end{pmatrix} = ad - bc $$

Memory Trick: Multiply diagonal (a·d) minus multiply anti-diagonal (b·c).

3×3 Matrix (Cofactor Expansion)

For a 3×3 matrix, we expand along the first row (or any row/column). The pattern of signs is:

$$ \begin{pmatrix} + & - & + \\ - & + & - \\ + & - & + \end{pmatrix} $$

The cofactor expansion along the first row is:

$$ \det(A) = a_{11} \cdot C_{11} + a_{12} \cdot C_{12} + a_{13} \cdot C_{13} $$

Where each cofactor C₁ⱼ = (-1)^{1+j} · det(M₁ⱼ) and M₁ⱼ is the 2×2 minor matrix (remove row 1 and column j).

💡 Key Insight: Cofactor expansion breaks a 3×3 determinant into three 2×2 determinants!


Cofactor Expansion Method (Detailed)

The Sign Pattern (Checkerboard)

$$ \begin{bmatrix} + & - & + & - & \cdots \\ - & + & - & + & \cdots \\ + & - & + & - & \cdots \\ - & + & - & + & \cdots \\ \vdots & \vdots & \vdots & \vdots & \ddots \end{bmatrix} $$

The sign for position (i,j) is (-1)^{i+j}. This alternates like a checkerboard!

For a 3×3 Matrix

$$ \det\begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{pmatrix} = a_{11} \begin{vmatrix} a_{22} & a_{23} \\ a_{32} & a_{33} \end{vmatrix} - a_{12} \begin{vmatrix} a_{21} & a_{23} \\ a_{31} & a_{33} \end{vmatrix} + a_{13} \begin{vmatrix} a_{21} & a_{22} \\ a_{31} & a_{32} \end{vmatrix} $$

Step-by-Step Process:

  1. Choose a row or column to expand along (usually the row with the most zeros)
  2. For each element in that row, compute its cofactor = (-1)^{i+j} × det(minor matrix)
  3. Multiply each element by its cofactor
  4. Sum all the products

Example of a minor matrix for position (1,1):

Remove row 1 and column 1:

$$ \begin{bmatrix} \cancel{a_{11}} & \cancel{a_{12}} & \cancel{a_{13}} \\ \cancel{a_{21}} & a_{22} & a_{23} \\ \cancel{a_{31}} & a_{32} & a_{33} \end{bmatrix} \rightarrow M_{11} = \begin{bmatrix} a_{22} & a_{23} \\ a_{32} & a_{33} \end{bmatrix} $$

Geometric Interpretation (The Most Important Insight)

The determinant tells you how a linear transformation scales area (2D) or volume (3D).

In 2D (Area Scaling)

If you apply matrix A to the unit square (area = 1):

  • |det(A)| = 2 → Area doubles
  • |det(A)| = 0.5 → Area halves
  • det(A) = 0 → Area collapses to 0 (line or point)
  • det(A) = 1 → Area preserved
  • det(A) = -2 → Area doubles AND orientation flips

In 3D (Volume Scaling)

If you apply matrix A to the unit cube (volume = 1):

  • |det(A)| = 3 → Volume triples
  • det(A) = 0 → Volume collapses to 0 (plane, line, or point)
  • det(A) = 1 → Volume preserved
  • det(A) = -1 → Volume preserved, orientation reversed
$$ \text{Area after transformation} = |\det(A)| \times \text{Area before} $$

Key Properties of Determinants

1. Determinant of Identity

$$\det(I) = 1$$

2. Determinant of Product

$$\det(AB) = \det(A) \cdot \det(B)$$

The determinant of a product is the product of determinants.

3. Determinant of Inverse

$$\det(A^{-1}) = \frac{1}{\det(A)}$$

4. Determinant of Transpose

$$\det(A^T) = \det(A)$$

5. Determinant of Scalar Multiple

$$\det(cA) = c^n \det(A)$$

For an n×n matrix.

6. Triangular Matrix

$$\det(\text{triangular}) = \text{product of diagonal entries}$$

Row Operation Effects on Determinant

Row OperationEffect on DeterminantExample Swap two rowsMultiplies by -1det flips sign Multiply row by scalar kMultiplies by kdet = k × original Add multiple of row to anotherNo changedet stays same

Step-by-Step Examples

Example 1: 2×2 Determinant

Problem: Find det(A) where:

$$ A = \begin{bmatrix} 3 & 8 \\ 4 & 6 \end{bmatrix} $$

Step 1: Apply formula ad - bc

$$ \det(A) = (3)(6) - (8)(4) $$

Step 2: Multiply

$$ = 18 - 32 $$

Step 3: Subtract

$$ \det(A) = -14 $$

Solution: det(A) = -14 (non-zero → matrix is invertible)

Example 2: 3×3 Determinant (Cofactor Expansion)

Problem: Find det(B) where:

$$ B = \begin{bmatrix} 2 & 1 & 3 \\ 4 & 0 & 1 \\ -1 & 2 & 5 \end{bmatrix} $$

Step 1: Choose to expand along the first row (i = 1).

The formula is:

$$ \det(B) = a_{11}C_{11} + a_{12}C_{12} + a_{13}C_{13} $$

Where C₁ⱼ = (-1)^{1+j} · det(M₁ⱼ)

Step 2: Find the minor matrix M₁₁ (remove row 1, column 1):

$$ M_{11} = \begin{bmatrix} 0 & 1 \\ 2 & 5 \end{bmatrix} $$

det(M₁₁) = (0)(5) - (1)(2) = -2

Cofactor C₁₁ = (-1)^{1+1} · det(M₁₁) = (+1) · (-2) = -2

Step 3: Find the minor matrix M₁₂ (remove row 1, column 2):

$$ M_{12} = \begin{bmatrix} 4 & 1 \\ -1 & 5 \end{bmatrix} $$

det(M₁₂) = (4)(5) - (1)(-1) = 20 + 1 = 21

Cofactor C₁₂ = (-1)^{1+2} · det(M₁₂) = (-1) · (21) = -21

Step 4: Find the minor matrix M₁₃ (remove row 1, column 3):

$$ M_{13} = \begin{bmatrix} 4 & 0 \\ -1 & 2 \end{bmatrix} $$

det(M₁₃) = (4)(2) - (0)(-1) = 8 - 0 = 8

Cofactor C₁₃ = (-1)^{1+3} · det(M₁₃) = (+1) · (8) = 8

Step 5: Multiply each element by its cofactor and sum:

$$ \begin{aligned} \det(B) &= a_{11} \cdot C_{11} + a_{12} \cdot C_{12} + a_{13} \cdot C_{13} \\\\ &= (2)(-2) + (1)(-21) + (3)(8) \\\\ &= -4 - 21 + 24 \\\\ &= -1 \end{aligned} $$

Solution: det(B) = -1 (non-zero → matrix is invertible)

Example 3: 3×3 with a Zero Row (Smart Expansion)

Problem: Find det(C) where:

$$ C = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 0 & 0 \\ 4 & 5 & 6 \end{bmatrix} $$

Smart choice: Expand along row 2 (the zero row)!

Expanding along row 2:

$$ \det(C) = a_{21}C_{21} + a_{22}C_{22} + a_{23}C_{23} = 0 \cdot C_{21} + 0 \cdot C_{22} + 0 \cdot C_{23} = 0 $$

Conclusion: det(C) = 0 → Matrix is singular. A row of zeros (or linearly dependent rows) makes the determinant zero!

Example 4: Upper Triangular Matrix (Simplified)

Problem: Find det(D) where:

$$ D = \begin{bmatrix} 2 & 3 & 1 \\ 0 & 4 & 2 \\ 0 & 0 & 5 \end{bmatrix} $$

Key Property: For triangular matrices, the determinant is simply the product of the diagonal entries.

$$ \det(D) = 2 \cdot 4 \cdot 5 = 40 $$

Why? When expanding along the first column, a₁₁ = 2, and its minor is also triangular. All terms with a₂₁ = 0 and a₃₁ = 0 vanish.

Insight: For triangular matrices, just multiply the diagonal entries – it's that simple!

Example 5: 3×3 with Linearly Dependent Rows

Problem: Find det(E) where:

$$ E = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 4 & 5 & 6 \end{bmatrix} $$

Observation: Row 2 is 2 × Row 1. This means rows are linearly dependent.

Step 1: Expand along row 1:

$$ \begin{aligned} \det(E) &= 1 \cdot \det\begin{bmatrix} 4 & 6 \\ 5 & 6 \end{bmatrix} - 2 \cdot \det\begin{bmatrix} 2 & 6 \\ 4 & 6 \end{bmatrix} + 3 \cdot \det\begin{bmatrix} 2 & 4 \\ 4 & 5 \end{bmatrix} \\\\ &= 1 \cdot (24 - 30) - 2 \cdot (12 - 24) + 3 \cdot (10 - 16) \\\\ &= 1 \cdot (-6) - 2 \cdot (-12) + 3 \cdot (-6) \\\\ &= -6 + 24 - 18 \\\\ &= 0 \end{aligned} $$

Conclusion: det(E) = 0. Linearly dependent rows (or columns) always produce a zero determinant!


Special Cases to Remember

Matrix TypeDeterminant ValueReason
Identity matrix I1Preserves area/volume
Diagonal matrixProduct of diagonalsNo off-diagonal contributions
Triangular matrix (upper/lower)Product of diagonalsCofactor expansion simplifies
Singular matrix0Collapses area/volume to 0
Zero matrix0Collapses everything to 0
Rotation matrix (2×2)1Preserves area
Reflection matrix (2×2)-1Preserves area, flips orientation
Orthogonal matrix±1Preserves length/area/volume
Matrix with two identical rows0Rows are linearly dependent
Matrix with a zero row/column0Determinant vanishes

Real-World Applications

📐 Engineering

  • Structural Analysis: Determinant zero indicates unstable structure
  • Control Systems: Characteristic equation roots (eigenvalues) use determinant
  • Fluid Dynamics: Jacobian determinant for coordinate transforms

📊 Data Science

  • Feature Selection: Determinant of correlation matrix measures redundancy
  • PCA: Determinant of covariance matrix = volume of data cloud
  • Anomaly Detection: Mahalanobis distance uses determinant

🔬 Physics

  • Quantum Mechanics: Determinant of transformation = phase space volume
  • Electromagnetism: Jacobian determinant for coordinate changes
  • Statistical Mechanics: Partition functions involve determinants

🤖 Machine Learning

  • Gaussian Processes: Determinant of kernel matrix
  • Normalizing Flows: Determinant of Jacobian for density transformation
  • Bayesian Inference: Determinant in multivariate normal distribution

📐 Multivariate Normal Distribution:

$$ f(x) = \frac{1}{\sqrt{(2\pi)^k |\Sigma|}} \exp\left(-\frac{1}{2}(x-\mu)^T \Sigma^{-1}(x-\mu)\right) $$

The determinant |Σ| appears in the normalization constant!


Common Mistakes to Avoid

  1. Calculating determinant for non-square matrices → Only defined for square matrices!
  2. Forgetting the sign pattern in cofactor expansion → Signs follow checkerboard: + - + - ... starting from (1,1) = +
  3. Using wrong sign for 2×2 formula → It's ad - bc, NOT ab - cd or ac - bd
  4. Assuming det(A+B) = det(A) + det(B) → FALSE! Determinant is NOT linear over addition
  5. Confusing det(cA) vs c det(A) → For n×n, det(cA) = cⁿ det(A)
  6. Incorrectly computing minor matrices → Double-check which row and column are removed
  7. Missing the sign when expanding → Cofactor = (-1)^{i+j} × minor determinant

Frequently Asked Questions

Q: What does a determinant of zero mean?

A: det(A) = 0 means the matrix is singular (not invertible). Geometrically, it means the transformation collapses area/volume to zero (e.g., maps 2D plane to a line).

Q: Can a determinant be negative?

A: Yes! A negative determinant indicates that the transformation reverses orientation (like a reflection). The absolute value still gives the area/volume scaling factor.

Q: Is the determinant always an integer if the matrix has integers?

A: Yes! The determinant of an integer matrix is always an integer (since it's sums/products of integers).

Q: How is determinant related to eigenvalues?

A: The determinant equals the product of all eigenvalues: det(A) = λ₁ · λ₂ · ... · λₙ. This is a powerful connection!

Q: What's the fastest way to compute a determinant for 3×3 matrices?

A: Cofactor expansion along the row/column with the most zeros. If there are no zeros, all three methods (Sarrus, cofactor, row reduction) take similar effort.

Q: Why does cofactor expansion give the same result regardless of which row/column I choose?

A: This is the Laplace Expansion Theorem – the determinant is well-defined and independent of the expansion path!


Practice Problems

Beginner

  1. Find det([[2, 5], [3, 7]])
  2. Find det([[1, 0, 0], [0, 2, 0], [0, 0, 3]])
  3. If det(A) = 4 for a 3×3 matrix, what is det(2A)?

Intermediate (Use Cofactor Expansion)

  1. Find the determinant using cofactor expansion:

    $$ \begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 4 \\ 0 & 0 & 2 \end{bmatrix} $$
  2. Find the determinant using cofactor expansion:

    $$ \begin{bmatrix} 2 & 0 & 1 \\ 3 & 1 & 0 \\ -1 & 2 & 4 \end{bmatrix} $$
  3. Find the determinant (hint: expand along row 2):

    $$ \begin{bmatrix} 4 & 1 & 2 \\ 0 & 0 & 0 \\ 3 & 5 & 1 \end{bmatrix} $$

Advanced

  1. For what value of k is the matrix singular?
  2. $$ \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & k \end{bmatrix} $$
Click to reveal solutions

1. (2)(7) - (5)(3) = 14 - 15 = -1

2. (1)(2)(3) = 6 (diagonal matrix)

3. det(2A) = 2³·det(A) = 8·4 = 32

4. Upper triangular → product of diagonals = 1·1·2 = 2

5. Expand along row 1: 2·det([[1,0],[2,4]]) - 0·det(...) + 1·det([[3,1],[-1,2]]) = 2·(4-0) + 1·(6+1) = 8 + 7 = 15

6. Expand along row 2 (all zeros) → det = 0

7. Set determinant = 0: Compute = 1·det([[5,6],[8,k]]) - 2·det([[4,6],[7,k]]) + 3·det([[4,5],[7,8]]) = 1(5k-48) - 2(4k-42) + 3(32-35) = (5k-48) - (8k-84) + (-9) = -3k + 27 = 0 → k = 9



Summary

🎯 Key Takeaways

  • Determinant = scalar that measures area/volume scaling
  • det(A) = 0 → Singular matrix (not invertible)
  • det(A) ≠ 0 → Invertible matrix
  • 2×2 formula: ad - bc
  • 3×3 formula: Cofactor expansion: a₁₁·C₁₁ + a₁₂·C₁₂ + a₁₃·C₁₃
  • Cofactor: Cᵢⱼ = (-1)^{i+j} × det(minor matrix)
  • Larger matrices: Cofactor expansion or row reduction
  • det(AB) = det(A)·det(B) - Multiplicative property
  • det(A⁻¹) = 1/det(A) - Inverse relationship
  • Geometric meaning: |det(A)| = factor by which area/volume scales

💡 Quick Check: If you can quickly compute the determinant, you instantly know if a matrix is invertible!

Try It Yourself!

Use the calculator above to compute determinants:

  1. Enter your square matrix (2×2 up to 6×6)
  2. Click "Calculate" to see:
    • Step-by-step determinant calculation
    • The final determinant value
    • Whether the matrix is invertible

📐 Test these examples:

  • 2×2 invertible: [[3, 1], [2, 4]] → det = 10
  • 2×2 singular: [[1, 2], [2, 4]] → det = 0
  • 3×3 identity: [[1,0,0],[0,1,0],[0,0,1]] → det = 1
  • 3×3 triangular: [[2,1,0],[0,3,0],[0,0,4]] → det = 24
  • 3×3 with zero row: [[1,2,3],[0,0,0],[4,5,6]] → det = 0

📐 Pro Tip: For triangular matrices, just multiply the diagonal entries – it's that simple! For larger matrices, always expand along the row/column with the most zeros to save work.

Press / to search operations