Mathwords logoMathwords

Matrix Determinant Lemma — Definition, Formula & Example

The matrix determinant lemma is a shortcut for finding the determinant of a matrix after you add a rank-one update uvTuv^T to it. If you already know det⁡(A)\det(A) and A−1A^{-1}, you multiply det⁡(A)\det(A) by one scalar correction factor instead of expanding a whole new determinant.

Let AA be an invertible n×nn \times n matrix and let u,v∈Rnu, v \in \mathbb{R}^n be column vectors. Then det⁡(A+uvT)=(1+vTA−1u)det⁡(A)\det(A + uv^T) = (1 + v^T A^{-1} u)\det(A). A version that holds for every square AA, invertible or not, is det⁡(A+uvT)=det⁡(A)+vTadj⁡(A) u\det(A + uv^T) = \det(A) + v^T \operatorname{adj}(A)\, u.

Key Formula

det⁡ ⁣(A+uvT)=(1+vTA−1u)det⁡(A)\det\!\left(A + uv^T\right) = \left(1 + v^T A^{-1} u\right)\det(A)
Where:
  • AA = An invertible n×nn \times n matrix
  • u,vu, v = Column vectors with nn entries each
  • uvTuv^T = Their outer product, an n×nn \times n matrix of rank one (when u,v≠0u, v \neq 0)
  • vTA−1uv^T A^{-1} u = A single number (a 1×11 \times 1 result)

How It Works

First prove the special case A=IA = I. Direct multiplication gives the block identity (I0vT1)(I+uvTu01)(I0−vT1)=(Iu01+vTu)\begin{pmatrix} I & 0 \\ v^T & 1 \end{pmatrix}\begin{pmatrix} I + uv^T & u \\ 0 & 1 \end{pmatrix}\begin{pmatrix} I & 0 \\ -v^T & 1 \end{pmatrix} = \begin{pmatrix} I & u \\ 0 & 1 + v^T u \end{pmatrix}. Each outer factor is block triangular with determinant 1. Taking determinants of both sides therefore gives det⁡(I+uvT)=1+vTu\det(I + uv^T) = 1 + v^T u. For a general invertible AA, write A+uvT=A(I+A−1u vT)A + uv^T = A(I + A^{-1}u\,v^T) and apply the special case with A−1uA^{-1}u in place of uu.

Worked Example

Problem: Let A=(200040005)A = \begin{pmatrix} 2 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & 5 \end{pmatrix}, u=(111)u = \begin{pmatrix} 1 \\ 1 \\ 1 \end{pmatrix}, and v=(2410)v = \begin{pmatrix} 2 \\ 4 \\ 10 \end{pmatrix}. Use the matrix determinant lemma to find det⁡(A+uvT)\det(A + uv^T).
Step 1: Since AA is diagonal, its determinant is the product of its diagonal entries. Its inverse just flips each diagonal entry, so A−1uA^{-1}u is easy to compute.
det⁡(A)=2⋅4⋅5=40,A−1u=(121415)\det(A) = 2 \cdot 4 \cdot 5 = 40, \qquad A^{-1}u = \begin{pmatrix} \tfrac{1}{2} \\ \tfrac{1}{4} \\ \tfrac{1}{5} \end{pmatrix}
Step 2: Take the dot product of vv with A−1uA^{-1}u to get the scalar vTA−1uv^T A^{-1} u.
vTA−1u=2⋅12+4⋅14+10⋅15=1+1+2=4v^T A^{-1} u = 2\cdot\tfrac{1}{2} + 4\cdot\tfrac{1}{4} + 10\cdot\tfrac{1}{5} = 1 + 1 + 2 = 4
Step 3: Apply the lemma.
det⁡(A+uvT)=(1+4)(40)=200\det(A + uv^T) = (1 + 4)(40) = 200
Answer: det⁡(A+uvT)=200\det(A + uv^T) = 200. You can confirm this by expanding A+uvT=(441028102415)A + uv^T = \begin{pmatrix} 4 & 4 & 10 \\ 2 & 8 & 10 \\ 2 & 4 & 15 \end{pmatrix} directly, but the lemma needed only one dot product.

Why It Matters

Statistics and machine learning code often updates a covariance matrix by one rank-one term at a time, for example when adding a single data point. The lemma updates the determinant, and the log-likelihood that depends on it, in O(n2)O(n^2) operations instead of recomputing it in O(n3)O(n^3). It is the determinant counterpart of the Sherman–Morrison inverse formula, and code that updates a matrix's inverse with Sherman–Morrison often updates its determinant with this lemma at the same time.

Common Mistakes

Mistake: Assuming determinants add, so that det⁡(A+uvT)=det⁡(A)+det⁡(uvT)\det(A + uv^T) = \det(A) + \det(uv^T).
Correction: Determinants are not additive. For n≥2n \ge 2 the matrix uvTuv^T has rank at most one, so det⁡(uvT)=0\det(uv^T) = 0. That shortcut would wrongly return 4040 in the example above. The lemma's correct correction is the factor 1+vTA−1u1 + v^T A^{-1} u, which multiplies det⁡(A)\det(A).

Related Terms

  • Determinant — The quantity this lemma updates after a rank-one change
  • Matrix Determinant — Ways to compute the determinant the lemma starts from
  • Adjugate — Replaces the inverse in the lemma's version for singular matrices
  • Singular Matrix — Results when the correction factor equals zero
  • Cofactor Matrix — Its transpose is the adjugate in the general form
  • Matrix Inversion Lemma — The companion formula for the inverse after a rank-one update