Determinants

Master the computation and interpretation of determinants. Learn how this powerful scalar value reveals matrix properties, invertibility, and geometric transformations.

Intermediate

What is a determinant?

The determinant is a scalar value computed from a square matrix that encodes important properties:

  • Invertibility: a matrix is invertible if and only if its determinant is non-zero.
  • Volume scaling: |det(A)| tells how much the transformation scales volumes.
  • Orientation: the sign indicates whether the transformation preserves or reverses orientation.
  • Linear independence: a zero determinant means the columns are linearly dependent.

Interactive calculator

Calculate determinants for 2×2 and 3×3 matrices. See step-by-step calculations and geometric interpretation.

|
|
Determinant
det(A) = 10
Matrix is invertible (preserves orientation)

Calculation Steps:

Formula for 2×2: det(A) = ad - bc

Where matrix A = |3 1|
|2 4|
det(A) = (3) × (4) - (1) × (2)
= 12 - 2
= 10

Geometric Interpretation

For a 2×2 matrix, the determinant represents the signed area of the parallelogram formed by the column vectors.

v₁ = [3, 2]v₂ = [1, 4]
• Blue vector: First column [3, 2]
• Red vector: Second column [1, 4]
• Area: |det(A)| = |10| = 10
• Sign: Positive (counterclockwise)
Multiplicative
det(AB) = det(A)×det(B)
Transpose
det(Aᵀ) = det(A)
Inverse
det(A⁻¹) = 1/det(A)
Scalar Multiple
det(kA) = k^n×det(A)
Row Swap
Swapping rows negates det
Invertibility
det(A) ≠ 0 ⟺ A is invertible

Understanding the formula

2×2 determinant: ad − bc

For a 2×2 matrix, multiply the main diagonal elements and subtract the product of the off-diagonal elements.

|a  b|
|c  d| = (a×d) − (b×c)

3×3 determinant: cofactor expansion

For a 3×3 matrix, expand along the first row. Each element is multiplied by its minor (the determinant of the 2×2 submatrix) with alternating signs.

det(A) = a₁₁M₁₁ − a₁₂M₁₂ + a₁₃M₁₃

(+ − + pattern continues)

Implementation

Python
import numpy as np

# Computing Determinants in Linear Algebra

# ==========================================
# 2×2 DETERMINANT
# ==========================================

# Define a 2x2 matrix
A_2x2 = np.array([
    [3, 1],
    [2, 4]
])

print("Matrix A (2×2):")
print(A_2x2)

# Calculate determinant
det_A = np.linalg.det(A_2x2)
print(f"\ndet(A) = {det_A}")

# Manual calculation: ad - bc
a, b = A_2x2[0]
c, d = A_2x2[1]
det_manual = a*d - b*c
print(f"Manual: {a}×{d} - {b}×{c} = {det_manual}")

# ==========================================
# 3×3 DETERMINANT
# ==========================================

A_3x3 = np.array([
    [3, 1, 2],
    [2, 4, 1],
    [1, 3, 2]
])

print("\n" + "="*40)
print("Matrix A (3×3):")
print(A_3x3)

# Calculate determinant
det_A_3x3 = np.linalg.det(A_3x3)
print(f"\ndet(A) = {det_A_3x3:.2f}")

# Manual calculation using cofactor expansion
# Expand along first row: a11*M11 - a12*M12 + a13*M13

# Minor M11 (remove row 1, col 1)
M11 = np.linalg.det(A_3x3[1:, 1:])  # [[4,1],[3,2]]
print(f"\nM11 = {M11}")

# Minor M12 (remove row 1, col 2)
M12 = np.linalg.det(A_3x3[1:, [0,2]])  # [[2,1],[1,2]]
print(f"M12 = {M12}")

# Minor M13 (remove row 1, col 3)
M13 = np.linalg.det(A_3x3[1:, :2])  # [[2,4],[1,3]]
print(f"M13 = {M13}")

# Cofactor expansion
a11, a12, a13 = A_3x3[0]
det_manual_3x3 = a11*M11 - a12*M12 + a13*M13
print(f"\nManual: {a11}×{M11} - {a12}×{M12} + {a13}×{M13} = {det_manual_3x3}")

# ==========================================
# DETERMINANT PROPERTIES
# ==========================================

B = np.array([
    [1, 2],
    [3, 4]
])

print("\n" + "="*40)
print("PROPERTIES")
print("="*40)

# Property 1: det(AB) = det(A) × det(B)
C = A_2x2 @ B
det_C = np.linalg.det(C)
det_product = np.linalg.det(A_2x2) * np.linalg.det(B)
print(f"\n1. Multiplicative Property:")
print(f"   det(AB) = {det_C:.2f}")
print(f"   det(A)×det(B) = {det_product:.2f}")

# Property 2: det(A^T) = det(A)
det_A_T = np.linalg.det(A_2x2.T)
print(f"\n2. Transpose Property:")
print(f"   det(A) = {np.linalg.det(A_2x2):.2f}")
print(f"   det(A^T) = {det_A_T:.2f}")

# Property 3: det(kA) = k^n × det(A) for n×n matrix
k = 2
kA = k * A_2x2
det_kA = np.linalg.det(kA)
det_scaled = (k**2) * np.linalg.det(A_2x2)
print(f"\n3. Scalar Multiplication (k={k}, n=2):")
print(f"   det({k}A) = {det_kA:.2f}")
print(f"   {k}^2 × det(A) = {det_scaled:.2f}")

# Property 4: det(A^-1) = 1/det(A)
if np.linalg.det(A_2x2) != 0:
    A_inv = np.linalg.inv(A_2x2)
    det_A_inv = np.linalg.det(A_inv)
    det_inverse = 1 / np.linalg.det(A_2x2)
    print(f"\n4. Inverse Property:")
    print(f"   det(A^-1) = {det_A_inv:.2f}")
    print(f"   1/det(A) = {det_inverse:.2f}")

# ==========================================
# GEOMETRIC INTERPRETATION (2×2)
# ==========================================

print("\n" + "="*40)
print("GEOMETRIC MEANING")
print("="*40)

# The determinant represents the signed area of the parallelogram
# formed by the column vectors

v1 = A_2x2[:, 0]  # First column
v2 = A_2x2[:, 1]  # Second column

print(f"\nColumn vectors:")
print(f"v1 = {v1}")
print(f"v2 = {v2}")

area = abs(np.linalg.det(A_2x2))
print(f"\nArea of parallelogram formed by v1 and v2: {area}")
print(f"Determinant (signed area): {np.linalg.det(A_2x2):.2f}")

if np.linalg.det(A_2x2) > 0:
    print("Positive det → vectors in counterclockwise orientation")
elif np.linalg.det(A_2x2) < 0:
    print("Negative det → vectors in clockwise orientation")
else:
    print("Zero det → vectors are collinear (linearly dependent)")

# ==========================================
# INVERTIBILITY CHECK
# ==========================================

def check_invertibility(matrix):
    det = np.linalg.det(matrix)
    print(f"\nDeterminant: {det:.4f}")
    
    if abs(det) < 1e-10:  # Close to zero
        print("→ Matrix is SINGULAR (not invertible)")
        print("→ Columns are linearly dependent")
        print("→ No unique solution to Ax=b")
    else:
        print("→ Matrix is INVERTIBLE")
        print("→ Columns are linearly independent")
        print("→ Unique solution exists for Ax=b")

print("\n" + "="*40)
print("INVERTIBILITY")
print("="*40)

check_invertibility(A_2x2)

# Singular matrix example
singular = np.array([[1, 2], [2, 4]])
print("\nSingular matrix:")
print(singular)
check_invertibility(singular)

Key properties

Multiplicative

det(AB) = det(A) × det(B)

The determinant of a product equals the product of the determinants.

Invertibility test

det(A) ≠ 0 ⟺ A is invertible

A non-zero determinant means the inverse exists.

Transpose invariant

det(Aᵀ) = det(A)

Transposing doesn't change the determinant.

Geometric meaning

|det(A)| = volume scaling factor

The absolute value is the area (2D) or volume (3D) scaling.

Applications

System solvability

Check whether the system Ax = b has a unique solution (det(A) ≠ 0).

Area & volume

Calculate the area of a parallelogram or the volume of a parallelepiped.

Eigenvalues

Find eigenvalues by solving det(A − λI) = 0.

Matrix inverse

Compute the inverse using A⁻¹ = (1/det(A)) × adj(A).

Related topics

Eigenvalues & Eigenvectors

Coming soon

Solve the characteristic equation using determinants

Cramer's Rule

Coming soon

Solve linear systems using determinants

Discussion

Questions, ideas or a different approach? Join the conversation.