All formulas

Linear algebra

Determinant

linalg.determinantAlso called determinant, det, matrix determinant

det⁡A=∑σ∈Snsgn⁡(σ)∏i=1nAi,σ(i)\det A = \sum_{\sigma \in S_n} \operatorname{sgn}(\sigma) \prod_{i=1}^{n} A_{i,\sigma(i)}

Signed volume scaling of a square matrix, written as the Leibniz sum over permutations σ of 1..n.

Notation

AA

square matrix

A ∈ ℝn×n

nn

matrix size

Size, at least 1

det⁡A\det A

Result: the determinant

scalar

Worked examples

Each result is solved exactly and confirmed by two independent computations.

  1. Given

    A=[[1,2],[3,4]]A = \left[\left[1, 2\right], \left[3, 4\right]\right]

    Result

    det⁡A=−2\displaystyle \det A = -2
  2. Given

    A=[[2,0,0],[0,3,0],[0,0,4]]A = \left[\left[2, 0, 0\right], \left[0, 3, 0\right], \left[0, 0, 4\right]\right]

    Result

    det⁡A=24\displaystyle \det A = 24
  3. Given

    A=[[1,2,3],[4,5,6],[7,8,10]]A = \left[\left[1, 2, 3\right], \left[4, 5, 6\right], \left[7, 8, 10\right]\right]

    Result

    det⁡A=−3\displaystyle \det A = -3

Common mistakes

  • Returns the absolute value

    The sign from row exchanges or orientation is lost.

    Fix: Track the permutation sign, or use numpy.linalg.det.

  • Multiplies the diagonal of A

    The product of the diagonal equals the determinant only for triangular matrices.

    Fix: Factor A first (LU or QR) and multiply the diagonal of the factor, with the permutation sign.

Sources

  • Golub and Van Loan 2013

    Golub, Gene H.; Van Loan, Charles F. Matrix Computations. 4th ed. Johns Hopkins University Press, 2013.

  • Horn and Johnson 2013

    Horn, Roger A.; Johnson, Charles R. Matrix Analysis. 2nd ed. Cambridge University Press, 2013.