logo

Laplace Expansion 📂Matrix Algebra

Laplace Expansion

Theorem

Let a square matrix $A_{n \times n} = (a_{ij})$ be given.

  • [1]: For a selected row $i$, $$ \det A = \sum_{j=1}^{n} a_{ij} C_{ij} = \sum\limits_{j=1}^{n}a_{ij}[\operatorname{adj}(A)]_{ji} $$
  • [2]: For a selected column $j$, $$ \det A = \sum_{i=1}^{n} a_{ij} C_{ij} = \sum\limits_{i=1}^{n}a_{ij}[\operatorname{adj}(A)]_{ji} $$

  • The determinant $M_{ij}$ of the matrix obtained by removing the $i$th row and $j$th column of the square matrix $A_{n \times n} = (a_{ij})$ is called a minor, and correspondingly $C_{ij} := (-1)^{i + j} M_{ij}$ is called a cofactor.
  • The transpose of the matrix $C=[C_{ij}]$ whose entries are the cofactors is called the adjugate matrix. $$ \operatorname{adj}(A) = C^{T} $$

Explanation

Laplace expansion is a theorem also called cofactor expansion, and its usefulness is beyond words. For a start, it is far easier than computing the determinant from the definition alone. Its advantage is multiplied even further when computing the determinant of a matrix that satisfies special conditions, so this fact at least must be known without fail.

Example

As an example that can be put to use right away when determining whether a matrix is invertible, consider the following Laplace expansion.

$$ \begin{align*} \displaystyle \det \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} =& 1 \cdot \begin{vmatrix} 5 & 6 \\ 8 & 9 \end{vmatrix} - 2 \cdot \begin{vmatrix} 4 & 6 \\ 7 & 9 \end{vmatrix} + 3 \cdot \begin{vmatrix} 4 & 5 \\ 7 & 8 \end{vmatrix} \\ =& 1 \cdot (-3) - 2 \cdot (-6) + 3 \cdot (-3) \\ =& 0 \end{align*} $$

Therefore, one can easily confirm that $\displaystyle \det \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}$ has no inverse.

Code

The following is code that implements and verifies Laplace expansion in Julia. It is practically a near-verbatim transcription of the formulas, and in fact it is implemented very inefficiently. Regarding this, it is good to refer to the following post:

function laplace(A::AbstractMatrix)
    n = size(A, 1)
    @assert n == size(A, 2) "matrix $A is not square"

    if n |> isone
        aijCij = A
    else
        aijCij = [A[1,j] * (-(-1)^j) * laplace(A[2:end, setdiff(1:n, j)]) for j in 1:n]
    end
    return sum(aijCij)
end
B = [2 3; 4 6]
laplace(B)
C = [7 1; 9 3]
laplace(C)

M = rand(3,3)
laplace(M)

using LinearAlgebra
det(M)
abs(det(M) - laplace(M))