← Math|11 of 100
Linear Algebra

Determinants — Computing and Properties

Understand determinants, their geometric meaning, cofactor expansion, row operations, Cramer's Rule, and applications in AI/ML.

📂 Determinants📖 Lesson 11 of 100🎓 Free Course

Advertisement

Why It Matters

The determinant is one of the most powerful single-number summaries in all of mathematics. It answers questions that matter across science, engineering, and data analysis — from "can I invert this matrix?" to "does this system have a unique solution?" to "how much does a transformation stretch space?"

ℹ️ Why Determinants Are Essential

  • Invertibility Check: A matrix is invertible if and only if its determinant is non-zero. This is the fastest way to check if a system has a unique solution.
  • Geometric Scaling: The absolute value of the determinant measures how a linear transformation scales area (2D) or volume (3D). A determinant of 3 means the transformation triples the area of any region.
  • Orientation: The sign of the determinant tells you whether the transformation preserves or reverses orientation — critical in computer graphics, robotics, and 3D rendering.
  • Change of Variables: Multivariable calculus uses the Jacobian determinant to convert integrals between coordinate systems (e.g., Cartesian to polar).
  • Eigenvalues: The characteristic polynomial used to find eigenvalues is defined via determinants: det(AλI)=0\det(A - \lambda I) = 0.
  • Rank and Nullity: A zero determinant means the matrix has rank less than full, indicating redundant rows or columns.

Determinants appear in formulas for Cramer's Rule, matrix inverses (adjugate formula), and are foundational to understanding eigenvalues, positive definiteness, and quadratic forms. In machine learning, determinants measure the volume change induced by a weight matrix, play a role in Gaussian process inference, and appear in the Jacobians of generative models.


What is a Determinant?

The determinant is a single scalar value computed from a square matrix that encodes fundamental geometric and algebraic properties of the matrix.

DfDeterminant

The determinant of a square matrix ARn×nA \in \mathbb{R}^{n \times n}, denoted det(A)\det(A) or A|A|, is a scalar defined recursively by:

det(A)=j=1n(1)1+ja1jM1j\det(A) = \sum_{j=1}^{n} (-1)^{1+j} \, a_{1j} \, M_{1j}

where M1jM_{1j} is the minor — the determinant of the (n1)×(n1)(n-1) \times (n-1) submatrix obtained by deleting row 1 and column jj. The determinant is the unique function f:Rn×nRf: \mathbb{R}^{n \times n} \to \mathbb{R} satisfying:

  1. Alternating: f(,vi,,vj,)=f(,vj,,vi,)f(\ldots, \vec{v}_i, \ldots, \vec{v}_j, \ldots) = -f(\ldots, \vec{v}_j, \ldots, \vec{v}_i, \ldots) (swap two rows → sign flips)
  2. Multilinear: Linear in each row separately
  3. Normalized: det(I)=1\det(I) = 1

ℹ️ Geometric Meaning

The determinant is the signed volume scaling factor of the linear transformation represented by AA:

  • 2×2: det(A)|\det(A)| is the area scaling factor. A determinant of 2 means a unit square maps to a parallelogram of area 2.
  • 3×3: det(A)|\det(A)| is the volume scaling factor. A determinant of 4 means a unit cube maps to a parallelepiped of volume 4.
  • n×n: det(A)|\det(A)| is the n-dimensional hypervolume scaling factor.
  • Sign: A positive determinant preserves orientation; a negative determinant reverses it.
  • Zero determinant: The transformation collapses space to a lower dimension — it squishes a volume into a plane, line, or point.

2×2 Determinant

The determinant of a 2×2 matrix has a simple closed-form formula.

2×2 Determinant

det(abcd)=adbc\det\begin{pmatrix} a & b \\ c & d \end{pmatrix} = ad - bc

Here,

  • a,b,c,da, b, c, d=Elements of the 2×2 matrix
  • adbcad - bc=The determinant (scalar value)

📝Example: 2×2 Determinant

A=[3846]A = \begin{bmatrix} 3 & 8 \\ 4 & 6 \end{bmatrix}
det(A)=(3)(6)(8)(4)=1832=14\det(A) = (3)(6) - (8)(4) = 18 - 32 = -14

Since det(A)=140\det(A) = -14 \neq 0, the matrix is invertible. The negative sign indicates the transformation reverses orientation.

📝Example: Area of a Parallelogram

The area of the parallelogram formed by vectors u=[21]\vec{u} = \begin{bmatrix} 2 \\ 1 \end{bmatrix} and v=[34]\vec{v} = \begin{bmatrix} 3 \\ 4 \end{bmatrix} equals:

Area=det(2314)=(2)(4)(3)(1)=83=5\text{Area} = \left|\det\begin{pmatrix} 2 & 3 \\ 1 & 4 \end{pmatrix}\right| = |(2)(4) - (3)(1)| = |8 - 3| = 5

💡 Geometric Interpretation

For the matrix [abcd]\begin{bmatrix} a & b \\ c & d \end{bmatrix}, the columns (or rows) can be seen as vectors in R2\mathbb{R}^2. The determinant equals the area of the parallelogram spanned by these vectors, with a sign indicating orientation.


3×3 Determinant

For 3×3 matrices, we expand along any row or column using cofactors.

3×3 Determinant (Cofactor Expansion along Row 1)

det(A)=a11(a22a33a23a32)a12(a21a33a23a31)+a13(a21a32a22a31)\det(A) = a_{11}(a_{22}a_{33} - a_{23}a_{32}) - a_{12}(a_{21}a_{33} - a_{23}a_{31}) + a_{13}(a_{21}a_{32} - a_{22}a_{31})

Here,

  • aija_{ij}=Element in row i, column j
  • a22a33a23a32a_{22}a_{33} - a_{23}a_{32}=2×2 minor (determinant of submatrix after removing row 1, col 1)
  • (1)i+j(-1)^{i+j}=Sign pattern (+/-) based on position

📝Example: 3×3 Determinant

A=[123456780]A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 0 \end{bmatrix}

Expanding along row 1:

det(A)=1568024670+34578\det(A) = 1\begin{vmatrix} 5 & 6 \\ 8 & 0 \end{vmatrix} - 2\begin{vmatrix} 4 & 6 \\ 7 & 0 \end{vmatrix} + 3\begin{vmatrix} 4 & 5 \\ 7 & 8 \end{vmatrix}
=1(048)2(042)+3(3235)= 1(0 - 48) - 2(0 - 42) + 3(32 - 35)
=48+849=27= -48 + 84 - 9 = 27

📝Example: Expansion Along Column 2

Expanding the same matrix along column 2 (instead of row 1):

det(A)=24670+5137081346\det(A) = -2\begin{vmatrix} 4 & 6 \\ 7 & 0 \end{vmatrix} + 5\begin{vmatrix} 1 & 3 \\ 7 & 0 \end{vmatrix} - 8\begin{vmatrix} 1 & 3 \\ 4 & 6 \end{vmatrix}
=2(042)+5(021)8(612)= -2(0 - 42) + 5(0 - 21) - 8(6 - 12)
=84105+48=27= 84 - 105 + 48 = 27

Same result — the determinant is the same regardless of which row or column you expand along.

💡 Choose the Simplest Row/Column

Expand along the row or column with the most zeros — this minimizes the number of 2×2 determinants you need to compute.


Cofactor Expansion (General)

The cofactor expansion generalizes determinants to any n×nn \times n matrix.

DfMinor and Cofactor

For element aija_{ij} of matrix AA:

  • The minor MijM_{ij} is the determinant of the (n1)×(n1)(n-1) \times (n-1) submatrix obtained by deleting row ii and column jj.
  • The cofactor is Cij=(1)i+jMijC_{ij} = (-1)^{i+j} M_{ij}.

Cofactor Expansion Along Row $i$

det(A)=j=1n(1)i+jaijMij=j=1naijCij\det(A) = \sum_{j=1}^{n} (-1)^{i+j} \, a_{ij} \, M_{ij} = \sum_{j=1}^{n} a_{ij} \, C_{ij}

Here,

  • (1)i+j(-1)^{i+j}=Checkerboard sign pattern starting with +
  • aija_{ij}=Element being expanded upon
  • MijM_{ij}=Minor (determinant of submatrix)
  • CijC_{ij}=Cofactor (signed minor)

Cofactor Expansion Along Column $j$

det(A)=i=1n(1)i+jaijMij=i=1naijCij\det(A) = \sum_{i=1}^{n} (-1)^{i+j} \, a_{ij} \, M_{ij} = \sum_{i=1}^{n} a_{ij} \, C_{ij}

Here,

  • (1)i+j(-1)^{i+j}=Checkerboard sign pattern starting with +
  • aija_{ij}=Element being expanded upon
  • MijM_{ij}=Minor (determinant of submatrix)

Checkerboard sign pattern for a 4×4 matrix:

(++++++++)\begin{pmatrix} + & - & + & - \\ - & + & - & + \\ + & - & + & - \\ - & + & - & + \end{pmatrix}

📝Example: 4×4 Determinant via Cofactor Expansion

A=[1021310210102131]A = \begin{bmatrix} 1 & 0 & 2 & -1 \\ 3 & 1 & 0 & 2 \\ -1 & 0 & 1 & 0 \\ 2 & -1 & 3 & 1 \end{bmatrix}

Expanding along column 2 (which has two zeros):

det(A)=0M12+1M220M32+(1)M42\det(A) = -0 \cdot M_{12} + 1 \cdot M_{22} - 0 \cdot M_{32} + (-1) \cdot M_{42}
=1M221M42= 1 \cdot M_{22} - 1 \cdot M_{42}

Where M22M_{22} and M42M_{42} are 3×3 determinants that can each be computed by cofactor expansion.

ℹ️ Computational Complexity

Cofactor expansion is O(n!)O(n!) — impractical for large matrices. For n>4n > 4, use LU decomposition or Gaussian elimination instead, which run in O(n3)O(n^3) time. This is why numerical libraries rarely use cofactor expansion.


Properties of Determinants

These properties are essential for both theoretical understanding and practical computation.

ThProperties of Determinants

  1. Identity Matrix: det(I)=1\det(I) = 1
  2. Row Swap: Swapping two rows multiplies the determinant by 1-1
  3. Scalar Multiplication: Multiplying a row by kk multiplies the determinant by kk
  4. Row Addition: Adding a multiple of one row to another does not change the determinant
  5. Product Rule: det(AB)=det(A)det(B)\det(AB) = \det(A) \cdot \det(B)
  6. Transpose: det(AT)=det(A)\det(A^T) = \det(A)
  7. Inverse: det(A1)=1det(A)\det(A^{-1}) = \frac{1}{\det(A)}
  8. Singular Matrix: det(A)=0\det(A) = 0 if and only if AA is not invertible
  9. Power Rule: det(Ak)=det(A)k\det(A^k) = \det(A)^k for any positive integer kk
  10. Scalar Matrix: det(kA)=kndet(A)\det(kA) = k^n \det(A) for an n×nn \times n matrix
  11. Triangular Matrix: The determinant of an upper or lower triangular matrix is the product of its diagonal entries
  12. Block Diagonal: det(A00B)=det(A)det(B)\det\begin{pmatrix} A & 0 \\ 0 & B \end{pmatrix} = \det(A) \cdot \det(B)
PropertyFormulaKey Insight
Identitydet(I)=1\det(I) = 1The identity preserves volume (no scaling)
Row Swapdet(swap rows)=det(A)\det(\text{swap rows}) = -\det(A)Swapping flips orientation
Scalar Rowdet(row ×k)=kdet(A)\det(\text{row } \times k) = k \cdot \det(A)Scaling one row scales the determinant
Row Additiondet(rowi+krowj)=det(A)\det(\text{row}_i + k \cdot \text{row}_j) = \det(A)Shearing preserves volume
Productdet(AB)=det(A)det(B)\det(AB) = \det(A)\det(B)Determinants multiply
Transposedet(AT)=det(A)\det(A^T) = \det(A)Rows and columns contribute equally
Inversedet(A1)=1/det(A)\det(A^{-1}) = 1/\det(A)Inverting reciprocates the determinant
Scalar Multipledet(kA)=kndet(A)\det(kA) = k^n \det(A)All rows scaled, so effect is knk^n
Triangulardet(T)=aii\det(T) = \prod a_{ii}Diagonal product is the determinant
Powerdet(Ak)=det(A)k\det(A^k) = \det(A)^kFollows from product rule

📝Example: Using Properties

If det(A)=5\det(A) = 5 for a 3×3 matrix, find:

  • det(2A)=23det(A)=8×5=40\det(2A) = 2^3 \det(A) = 8 \times 5 = 40
  • det(A1)=1det(A)=15=0.2\det(A^{-1}) = \frac{1}{\det(A)} = \frac{1}{5} = 0.2
  • det(A2)=det(A)2=25\det(A^2) = \det(A)^2 = 25
  • det(3AT)=33det(AT)=27×5=135\det(3A^T) = 3^3 \det(A^T) = 27 \times 5 = 135
  • det(A1A2)=det(A1)det(A2)=0.2×25=5\det(A^{-1} A^2) = \det(A^{-1}) \cdot \det(A^2) = 0.2 \times 25 = 5

Row Operations and Determinants

Understanding how elementary row operations affect the determinant is key to efficient computation.

ThRow Operations and Determinants

OperationEffect on det(A)\det(A)Example
Row Swap (RiRjR_i \leftrightarrow R_j)Multiplies by 1-1det(A)=det(A)\det(A') = -\det(A)
Scale a Row (RikRiR_i \leftarrow k \cdot R_i)Multiplies by kkdet(A)=kdet(A)\det(A') = k \cdot \det(A)
Row Addition (RiRi+kRjR_i \leftarrow R_i + k \cdot R_j)No changedet(A)=det(A)\det(A') = \det(A)
Row Scaling (Ri0R_i \leftarrow 0)Becomes 00det(A)=0\det(A') = 0

💡 Strategy for Computing Determinants

Use Gaussian elimination to reduce AA to an upper triangular matrix UU, tracking row swaps and scalar multiplications:

  1. Start with det(A)\det(A)
  2. Apply row additions (no effect on det) to eliminate below diagonal
  3. Track any row swaps (each multiplies det by 1-1)
  4. Track any row scalings (each multiplies det by the scaling factor)
  5. The determinant of UU is the product of its diagonal entries
  6. Reverse the tracking to find det(A)\det(A)

This is O(n3)O(n^3), much faster than cofactor expansion's O(n!)O(n!).

📝Example: Computing via Row Reduction

A=[213456279]A = \begin{bmatrix} 2 & 1 & 3 \\ 4 & 5 & 6 \\ 2 & 7 & 9 \end{bmatrix}

Step 1: R2R22R1R_2 \leftarrow R_2 - 2R_1, R3R3R1R_3 \leftarrow R_3 - R_1 (no effect on det):

[213030066]\begin{bmatrix} 2 & 1 & 3 \\ 0 & 3 & 0 \\ 0 & 6 & 6 \end{bmatrix}

Step 2: R3R32R2R_3 \leftarrow R_3 - 2R_2 (no effect on det):

[213030006]\begin{bmatrix} 2 & 1 & 3 \\ 0 & 3 & 0 \\ 0 & 0 & 6 \end{bmatrix}

This is upper triangular. No swaps were needed:

det(A)=236=36\det(A) = 2 \cdot 3 \cdot 6 = 36

Determinant and Invertibility

The relationship between determinant and invertibility is one of the most important facts in linear algebra.

ThInvertibility Criterion

A square matrix ARn×nA \in \mathbb{R}^{n \times n} is invertible if and only if det(A)0\det(A) \neq 0.

If det(A)=0\det(A) = 0, the matrix is called singular (non-invertible).

Why? If det(A)=0\det(A) = 0, the transformation collapses space — it maps a nonzero vector to the zero vector, destroying information that cannot be recovered. Conversely, if det(A)0\det(A) \neq 0, the transformation stretches and rotates space without collapsing it, so every point can be uniquely reversed.

ℹ️ Connection to Systems of Equations

For the system Ax=bA\vec{x} = \vec{b}:

  • det(A)0\det(A) \neq 0: Unique solution exists: x=A1b\vec{x} = A^{-1}\vec{b}
  • det(A)=0\det(A) = 0: Either no solution (inconsistent) or infinitely many solutions (dependent)

This directly connects to the rank of AA: if det(A)=0\det(A) = 0, then rank(A)<n\text{rank}(A) < n, meaning the columns are linearly dependent.

📝Example: Checking Invertibility

Is the following matrix invertible?

B=[1224]B = \begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix}
det(B)=(1)(4)(2)(2)=0\det(B) = (1)(4) - (2)(2) = 0

Not invertible. The second row is exactly twice the first — the columns are linearly dependent.


Geometric Interpretation

The determinant provides a direct geometric interpretation of linear transformations.

2D: Area and Orientation

For a 2×2 matrix with columns u\vec{u} and v\vec{v}:

  • det(A)|\det(A)| = area of the parallelogram spanned by u\vec{u} and v\vec{v}
  • det(A)>0\det(A) > 0 = orientation preserved (right-hand rule)
  • det(A)<0\det(A) < 0 = orientation reversed
  • det(A)=0\det(A) = 0 = vectors are collinear (degenerate parallelogram)

3D: Volume and Orientation

For a 3×3 matrix with columns u\vec{u}, v\vec{v}, and w\vec{w}:

  • det(A)|\det(A)| = volume of the parallelepiped spanned by the three vectors
  • det(A)>0\det(A) > 0 = right-hand rule orientation
  • det(A)<0\det(A) < 0 = left-hand rule orientation
  • det(A)=0\det(A) = 0 = vectors are coplanar (degenerate parallelepiped)

Volume of a Parallelepiped

Volume=det(uvw)=det(u1v1w1u2v2w2u3v3w3)\text{Volume} = |\det(\vec{u} \mid \vec{v} \mid \vec{w})| = |\det\begin{pmatrix} u_1 & v_1 & w_1 \\ u_2 & v_2 & w_2 \\ u_3 & v_3 & w_3 \end{pmatrix}|

Here,

  • u,v,w\vec{u}, \vec{v}, \vec{w}=Edge vectors of the parallelepiped
  • det(A)\det(A)=Signed volume (positive = right-handed orientation)

📝Example: Volume Calculation

Find the volume of the parallelepiped spanned by u=[100]\vec{u} = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, v=[020]\vec{v} = \begin{bmatrix} 0 \\ 2 \\ 0 \end{bmatrix}, w=[003]\vec{w} = \begin{bmatrix} 0 \\ 0 \\ 3 \end{bmatrix}.

det(100020003)=123=6\det\begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix} = 1 \cdot 2 \cdot 3 = 6

Volume = 6=6|6| = 6 cubic units.

ℹ️ Absolute Value vs. Signed Value

The absolute value of the determinant gives the geometric measure (area, volume). The signed determinant includes orientation information. In most geometric applications, you care about det(A)|\det(A)|. In change-of-variables formulas for integrals, you use det(J)|\det(J)|.


Cramer's Rule

Cramer's Rule uses determinants to solve systems of linear equations directly.

Cramer's Rule

xi=det(Ai)det(A)x_i = \frac{\det(A_i)}{\det(A)}

Here,

  • xix_i=The i-th component of the solution vector
  • det(A)\det(A)=Determinant of the coefficient matrix
  • det(Ai)\det(A_i)=Determinant of A with column i replaced by the constants vector \vec{b}

For a system Ax=bA\vec{x} = \vec{b} where AA is n×nn \times n:

Ai=[a11a1,i1b1a1,i+1a1na21a2,i1b2a2,i+1a2nan1an,i1bnan,i+1ann]A_i = \begin{bmatrix} a_{11} & \cdots & a_{1,i-1} & b_1 & a_{1,i+1} & \cdots & a_{1n} \\ a_{21} & \cdots & a_{2,i-1} & b_2 & a_{2,i+1} & \cdots & a_{2n} \\ \vdots & & \vdots & \vdots & \vdots & & \vdots \\ a_{n1} & \cdots & a_{n,i-1} & b_n & a_{n,i+1} & \cdots & a_{nn} \end{bmatrix}

📝Example: Solving with Cramer's Rule

Solve the system:

{2x+3y=8xy=1\begin{cases} 2x + 3y = 8 \\ x - y = -1 \end{cases}

Coefficient matrix and constants:

A=[2311],b=[81]A = \begin{bmatrix} 2 & 3 \\ 1 & -1 \end{bmatrix}, \quad \vec{b} = \begin{bmatrix} 8 \\ -1 \end{bmatrix}
det(A)=(2)(1)(3)(1)=23=5\det(A) = (2)(-1) - (3)(1) = -2 - 3 = -5

Replace column 1 with b\vec{b}:

A1=[8311],det(A1)=(8)(1)(3)(1)=8+3=5A_1 = \begin{bmatrix} 8 & 3 \\ -1 & -1 \end{bmatrix}, \quad \det(A_1) = (8)(-1) - (3)(-1) = -8 + 3 = -5

Replace column 2 with b\vec{b}:

A2=[2811],det(A2)=(2)(1)(8)(1)=28=10A_2 = \begin{bmatrix} 2 & 8 \\ 1 & -1 \end{bmatrix}, \quad \det(A_2) = (2)(-1) - (8)(1) = -2 - 8 = -10
x=det(A1)det(A)=55=1,y=det(A2)det(A)=105=2x = \frac{\det(A_1)}{\det(A)} = \frac{-5}{-5} = 1, \quad y = \frac{\det(A_2)}{\det(A)} = \frac{-10}{-5} = 2

Solution: x=1,y=2x = 1, y = 2. Verify: 2(1)+3(2)=82(1) + 3(2) = 8 ✓ and 12=11 - 2 = -1 ✓.

ℹ️ When to Use Cramer's Rule

  • Pros: Direct formula, no matrix inversion needed, useful for theoretical proofs
  • Cons: O(nn!)O(n \cdot n!) — computationally expensive for large systems. Only practical for n4n \leq 4. For larger systems, use Gaussian elimination or LU decomposition.

Python Implementation

import numpy as np

# 2×2 determinant
A = np.array([[3, 8], [4, 6]])
det_2x2 = np.linalg.det(A)
print(f"det(A) = {det_2x2:.4f}")  # -14.0

# 3×3 determinant
B = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 0]])
det_3x3 = np.linalg.det(B)
print(f"det(B) = {det_3x3:.4f}")  # 27.0

# 4×4 determinant
C = np.array([[1, 0, 2, -1],
              [3, 1, 0, 2],
              [-1, 0, 1, 0],
              [2, -1, 3, 1]])
det_4x4 = np.linalg.det(C)
print(f"det(C) = {det_4x4:.4f}")

# Check invertibility
print(f"A invertible: {np.linalg.det(A) != 0}")  # True

# Inverse using determinant
A_inv = np.linalg.inv(A)
print(f"A⁻¹:\n{A_inv}")

# Verify: A @ A⁻¹ ≈ I
print(f"A × A⁻¹:\n{A @ A_inv}")

# Solve system using Cramer's rule (manual implementation)
def cramer_solve(A, b):
    """Solve Ax = b using Cramer's Rule."""
    n = len(b)
    det_A = np.linalg.det(A)
    if abs(det_A) < 1e-10:
        raise ValueError("Matrix is singular (det ≈ 0)")
    x = np.zeros(n)
    for i in range(n):
        A_i = A.copy()
        A_i[:, i] = b
        x[i] = np.linalg.det(A_i) / det_A
    return x

# Example system
A_sys = np.array([[2, 3], [1, -1]], dtype=float)
b_sys = np.array([8, -1], dtype=float)
solution = cramer_solve(A_sys, b_sys)
print(f"Solution: x = {solution[0]}, y = {solution[1]}")  # x=1, y=2

# Determinant properties verification
print(f"det(AB) = det(A)*det(B): {np.linalg.det(A @ B):.4f} ≈ {np.linalg.det(A) * np.linalg.det(B):.4f}")
print(f"det(A^T) = det(A): {np.linalg.det(A.T):.4f} ≈ {np.linalg.det(A):.4f}")
print(f"det(A⁻¹) = 1/det(A): {np.linalg.det(np.linalg.inv(A)):.4f} ≈ {1/np.linalg.det(A):.4f}")

# Diagonal matrix: determinant is product of diagonal entries
D = np.diag([2, 5, 3])
print(f"det(diag([2,5,3])) = {np.linalg.det(D):.4f}")  # 30.0

Applications in AI/ML

Determinants play several important roles in machine learning and artificial intelligence.

1. Jacobian Determinant in Change of Variables

In generative models (normalizing flows, VAEs), the change of variables formula requires the Jacobian determinant:

Change of Variables Formula

p(x)=p(z)det(zx)p(\vec{x}) = p(\vec{z}) \left| \det\left( \frac{\partial \vec{z}}{\partial \vec{x}} \right) \right|

Here,

  • x\vec{x}=Target random variable
  • z\vec{z}=Source random variable with known distribution
  • det(J)\det(J)=Jacobian determinant measuring local volume change

This tells us how probability density transforms when we apply a nonlinear mapping. The absolute value of the Jacobian determinant measures how the transformation stretches or compresses space at each point.

2. Gaussian Process Inference

The log-likelihood of a Gaussian process involves the log-determinant of the covariance matrix:

logp(yX)=12yTK1y12logKn2log(2π)\log p(\vec{y} | X) = -\frac{1}{2} \vec{y}^T K^{-1} \vec{y} - \frac{1}{2} \log |K| - \frac{n}{2} \log(2\pi)

where KK is the kernel matrix. The determinant logK\log|K| acts as a complexity penalty — models that fit the data well with simple (low-determinant) covariance matrices are preferred.

3. Volume of Data Regions

The determinant of the covariance matrix (or precision matrix) determines the volume of the confidence ellipsoid. A larger determinant indicates data spread across more dimensions.

4. Numerical Stability

In deep learning, the determinant of a weight matrix indicates whether information is preserved (|det| ≈ 1), amplified (|det| >> 1), or vanishing (|det| << 1) as it propagates through layers.

ℹ️ Practical Tip

When training neural networks, monitoring the determinant of weight matrices can help detect:

  • Exploding gradients: det grows rapidly
  • Vanishing gradients: det shrinks toward zero
  • Collapsed representations: det = 0 means the layer maps inputs to a lower-dimensional subspace

Common Mistakes

MistakeCorrect ApproachWhy
Computing adbcad - bc for 3×3 matricesUse cofactor expansion or row reductionThe 2×2 formula only applies to 2×2 matrices
Forgetting the checkerboard sign patternUse (1)i+j(-1)^{i+j} for each cofactorSigns alternate in a checkerboard pattern
Expanding along a row with no zerosExpand along the row/column with the most zerosMinimizes the number of 2×2 determinants
Assuming det(A+B)=det(A)+det(B)\det(A+B) = \det(A) + \det(B)No general formula — compute directlyDeterminants are not additive
Assuming det(kA)=kdet(A)\det(kA) = k\det(A)Use det(kA)=kndet(A)\det(kA) = k^n\det(A) for n×nn \times n matrixAll nn rows are scaled
Using cofactor expansion for large matricesUse LU decomposition (O(n3)O(n^3))Cofactor expansion is O(n!)O(n!) — impractical for n>4n > 4
Forgetting det(AT)=det(A)\det(A^T) = \det(A)Compute along any row OR column (they give the same result)Transpose doesn't change the determinant
Confusing determinant with traceDeterminant = product of eigenvalues; Trace = sumThey measure completely different properties

📝Example: Common Error

Wrong: det(123456789)=159267=4584=39\det\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix} = 1 \cdot 5 \cdot 9 - 2 \cdot 6 \cdot 7 = 45 - 84 = -39

Right: Use cofactor expansion:

det=1568924679+34578\det = 1\begin{vmatrix} 5 & 6 \\ 8 & 9 \end{vmatrix} - 2\begin{vmatrix} 4 & 6 \\ 7 & 9 \end{vmatrix} + 3\begin{vmatrix} 4 & 5 \\ 7 & 8 \end{vmatrix}
=1(4548)2(3642)+3(3235)=3+129=0= 1(45-48) - 2(36-42) + 3(32-35) = -3 + 12 - 9 = 0

The wrong approach only uses diagonal entries and ignores off-diagonal structure.


Interview Questions

Q1: What does it mean if det(A)=0\det(A) = 0?

Answer: If det(A)=0\det(A) = 0, the matrix AA is singular (non-invertible). Geometrically, the linear transformation collapses space to a lower dimension. The columns of AA are linearly dependent, the system Ax=bA\vec{x} = \vec{b} has either no solution or infinitely many solutions, and the matrix has no inverse.

Q2: How does swapping two rows affect the determinant?

Answer: Swapping two rows multiplies the determinant by 1-1. This is because swapping two vectors reverses the orientation of the parallelepiped they span, flipping the sign of the signed volume.

Q3: If det(A)=5\det(A) = 5, what is det(2A)\det(2A) for a 3×3 matrix?

Answer: det(kA)=kndet(A)\det(kA) = k^n \det(A) for an n×nn \times n matrix. So det(2A)=235=85=40\det(2A) = 2^3 \cdot 5 = 8 \cdot 5 = 40. Each of the 3 rows is scaled by 2, contributing a factor of 2 to the determinant.

Q4: Is there a fast way to compute the determinant of a large matrix?

Answer: Yes — use LU decomposition (O(n3)O(n^3)). Factor A=LUA = LU where LL is lower triangular and UU is upper triangular. Then det(A)=det(L)det(U)=liiuii\det(A) = \det(L)\det(U) = \prod l_{ii} \cdot \prod u_{ii}. Cofactor expansion is O(n!)O(n!) and only practical for small matrices (n4n \leq 4).

Q5: What is the geometric interpretation of a negative determinant?

Answer: A negative determinant means the transformation reverses orientation. In 2D, it means the transformation flips the plane (like a mirror). In 3D, it converts a right-handed coordinate system to a left-handed one. The absolute value still gives the scaling factor, but the sign indicates the orientation flip.

Q6: How do you use determinants to solve a system of equations?

Answer: Cramer's Rule: for Ax=bA\vec{x} = \vec{b}, each component is xi=det(Ai)det(A)x_i = \frac{\det(A_i)}{\det(A)}, where AiA_i is AA with column ii replaced by b\vec{b}. Requires det(A)0\det(A) \neq 0. Only practical for small systems (n4n \leq 4).

Q7: Prove that det(AB)=det(A)det(B)\det(AB) = \det(A)\det(B).

Answer: This is a standard theorem. The key idea: the composition of two linear transformations scales volume by the product of their individual scaling factors. More formally, one can prove it using the alternating multilinear property of determinants, or by noting that ABAB has the same effect on volumes as doing BB then AA.


Practice Problems

Problem 1

Find the determinant of A=[2134]A = \begin{bmatrix} 2 & -1 \\ 3 & 4 \end{bmatrix}.

Problem 2

Compute the determinant of B=[102311021]B = \begin{bmatrix} 1 & 0 & 2 \\ 3 & 1 & -1 \\ 0 & 2 & 1 \end{bmatrix}.

Problem 3

If det(A)=6\det(A) = 6 for a 3×3 matrix, what is det(2A)\det(2A)?

Problem 4

Is [1224]\begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix} invertible? Justify your answer.

Problem 5

Use Cramer's Rule to solve:

{x+2y=53x+4y=11\begin{cases} x + 2y = 5 \\ 3x + 4y = 11 \end{cases}

💡Solutions

Problem 1:

det(A)=(2)(4)(1)(3)=8+3=11\det(A) = (2)(4) - (-1)(3) = 8 + 3 = 11

Problem 2: Expanding along row 1:

det(B)=1112103101+23102\det(B) = 1\begin{vmatrix} 1 & -1 \\ 2 & 1 \end{vmatrix} - 0\begin{vmatrix} 3 & -1 \\ 0 & 1 \end{vmatrix} + 2\begin{vmatrix} 3 & 1 \\ 0 & 2 \end{vmatrix}
=1(1+2)0+2(60)=3+12=15= 1(1+2) - 0 + 2(6-0) = 3 + 12 = 15

Problem 3:

det(2A)=23det(A)=86=48\det(2A) = 2^3 \cdot \det(A) = 8 \cdot 6 = 48

Problem 4:

det=(1)(4)(2)(2)=0\det = (1)(4) - (2)(2) = 0

Not invertible — the determinant is zero, so the matrix is singular.

Problem 5:

A=[1234],b=[511]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}, \quad \vec{b} = \begin{bmatrix} 5 \\ 11 \end{bmatrix}
det(A)=(1)(4)(2)(3)=2\det(A) = (1)(4) - (2)(3) = -2
A1=[52114],det(A1)=2022=2A_1 = \begin{bmatrix} 5 & 2 \\ 11 & 4 \end{bmatrix}, \quad \det(A_1) = 20 - 22 = -2
A2=[15311],det(A2)=1115=4A_2 = \begin{bmatrix} 1 & 5 \\ 3 & 11 \end{bmatrix}, \quad \det(A_2) = 11 - 15 = -4
x=22=1,y=42=2x = \frac{-2}{-2} = 1, \quad y = \frac{-4}{-2} = 2

Solution: x=1,y=2x = 1, y = 2. Verify: 1+2(2)=51 + 2(2) = 5 ✓ and 3(1)+4(2)=113(1) + 4(2) = 11 ✓.


Quick Reference

ConceptFormulaNotes
2×2 Determinantdet(abcd)=adbc\det\begin{pmatrix} a & b \\ c & d \end{pmatrix} = ad - bcDirect formula
3×3 Cofactordet(A)=j=13(1)1+ja1jM1j\det(A) = \sum_{j=1}^{3} (-1)^{1+j} a_{1j} M_{1j}Expand along any row or column
CofactorCij=(1)i+jMijC_{ij} = (-1)^{i+j} M_{ij}Signed minor
Adjugate InverseA1=1det(A)adj(A)A^{-1} = \frac{1}{\det(A)} \text{adj}(A)Works for any invertible matrix
Product Ruledet(AB)=det(A)det(B)\det(AB) = \det(A)\det(B)Determinants multiply
Scalar Multipledet(kA)=kndet(A)\det(kA) = k^n \det(A)For n×nn \times n matrix
Transposedet(AT)=det(A)\det(A^T) = \det(A)Rows/columns contribute equally
Inversedet(A1)=1/det(A)\det(A^{-1}) = 1/\det(A)Inverting reciprocates det
Invertibilitydet(A)0    A\det(A) \neq 0 \iff A invertibleFundamental criterion
Cramer's Rulexi=det(Ai)/det(A)x_i = \det(A_i)/\det(A)Direct formula for solutions
Row SwapMultiplies det by 1-1Flips orientation
Row ScaleMultiplies det by kkScales volume
Row AdditionNo change to detShearing preserves volume
Triangular Matrixdet(T)=aii\det(T) = \prod a_{ii}Product of diagonal entries

Cross-References

  • Previous: Matrix Operations — Matrix algebra, transpose, inverse, and operations
  • Next: Eigenvalues and Eigenvectors — Characteristic polynomial det(AλI)=0\det(A - \lambda I) = 0 uses determinants
  • Related: Linear Systems — Systems of equations and Cramer's Rule
  • Related: SVD — Singular value decomposition connects to determinant properties
  • Related: Positive Definite Matrices — Determinant relates to eigenvalues and positive definiteness
  • Applications: Matrix Calculus — Jacobian determinants in change of variables
Lesson Progress11 / 100