Mathwords logoMathwords

Matrix Inversion Lemma — Definition, Formula & Example

The matrix inversion lemma is a formula for the inverse of a matrix that has received a low-rank change. If you already know A−1A^{-1}, you can find (A+UCV)−1(A + UCV)^{-1} by inverting only a small k×kk \times k matrix instead of redoing the full n×nn \times n inverse.

Let AA be an invertible n×nn \times n matrix and CC an invertible k×kk \times k matrix. Let UU be n×kn \times k and VV be k×nk \times n. Then A+UCVA + UCV is invertible if and only if C−1+VA−1UC^{-1} + VA^{-1}U is invertible. When it is, the Woodbury identity below holds. The case k=1k = 1, C=1C = 1, U=uU = \mathbf{u}, V=vTV = \mathbf{v}^T is the Sherman–Morrison formula: (A+uvT)−1=A−1−A−1uvTA−11+vTA−1u(A + \mathbf{u}\mathbf{v}^T)^{-1} = A^{-1} - \dfrac{A^{-1}\mathbf{u}\mathbf{v}^T A^{-1}}{1 + \mathbf{v}^T A^{-1}\mathbf{u}}, valid whenever 1+vTA−1u≠01 + \mathbf{v}^T A^{-1}\mathbf{u} \neq 0.

Key Formula

(A+UCV)−1=A−1−A−1U(C−1+VA−1U)−1VA−1(A + UCV)^{-1} = A^{-1} - A^{-1}U\left(C^{-1} + VA^{-1}U\right)^{-1}VA^{-1}
Where:
  • AA = Invertible n × n matrix whose inverse you already know
  • UU = n × k matrix (often k is much smaller than n)
  • CC = Invertible k × k matrix
  • VV = k × n matrix
  • C−1+VA−1UC^{-1} + VA^{-1}U = The small k × k matrix you actually have to invert

Worked Example

Problem: Find the inverse of M=(311131113)M = \begin{pmatrix}3&1&1\\1&3&1\\1&1&3\end{pmatrix} using the Sherman–Morrison formula.
Step 1: Write MM as an easy matrix plus a rank-one update. With A=2IA = 2I and u=v=(1,1,1)T\mathbf{u} = \mathbf{v} = (1,1,1)^T, you get M=A+uvTM = A + \mathbf{u}\mathbf{v}^T and A−1=12IA^{-1} = \tfrac{1}{2}I. Compute the scalar in the denominator.
1+vTA−1u=1+12(1+1+1)=1+32=521 + \mathbf{v}^T A^{-1}\mathbf{u} = 1 + \tfrac{1}{2}(1+1+1) = 1 + \tfrac{3}{2} = \tfrac{5}{2}
Step 2: Compute the numerator. Let J=uvTJ = \mathbf{u}\mathbf{v}^T, the 3×33 \times 3 matrix of all ones.
A−1uvTA−1=12⋅12 uvT=14JA^{-1}\mathbf{u}\mathbf{v}^T A^{-1} = \tfrac{1}{2}\cdot\tfrac{1}{2}\,\mathbf{u}\mathbf{v}^T = \tfrac{1}{4}J
Step 3: Substitute into the formula. The only division is by the scalar 52\tfrac{5}{2}.
M−1=12I−14J52=12I−110J=110(4−1−1−14−1−1−14)M^{-1} = \tfrac{1}{2}I - \frac{\tfrac{1}{4}J}{\tfrac{5}{2}} = \tfrac{1}{2}I - \tfrac{1}{10}J = \frac{1}{10}\begin{pmatrix}4&-1&-1\\-1&4&-1\\-1&-1&4\end{pmatrix}
Answer: M−1=110(4−1−1−14−1−1−14)M^{-1} = \frac{1}{10}\begin{pmatrix}4&-1&-1\\-1&4&-1\\-1&-1&4\end{pmatrix}. Check: since J2=3JJ^2 = 3J, (2I+J)(12I−110J)=I+(12−15−310)J=I(2I + J)(\tfrac{1}{2}I - \tfrac{1}{10}J) = I + (\tfrac{1}{2} - \tfrac{1}{5} - \tfrac{3}{10})J = I.

Why It Matters

In recursive least squares, and in the Kalman filter with scalar measurements, each new measurement adds a rank-one term to a matrix whose inverse you already track. Sherman–Morrison updates that inverse in about n2n^2 operations instead of the roughly n3n^3 needed to invert from scratch. The same identity speeds up Gaussian process regression and ridge regression in machine learning when kk is much smaller than nn.

Common Mistakes

Mistake: Assuming (A+UCV)−1=A−1+(UCV)−1(A + UCV)^{-1} = A^{-1} + (UCV)^{-1}, as if inverses split over sums.
Correction: Matrix inversion does not distribute over addition. Also, UCVUCV has rank at most kk, so for k<nk < n it is not even invertible. Use the full identity, and keep the products in the stated order, since VA−1UVA^{-1}U is k×kk \times k but UA−1VUA^{-1}V is generally not defined.

Related Terms

  • Algebraic Identity — The type of equation this inverse formula is
  • Identity — Holds for all compatible matrices, making it an identity
  • Matrix — The objects whose inverses this lemma updates
  • Adjugate — Gives the direct inverse formula this lemma lets you avoid
  • Compatible Matrices — Dimension rules that make the products UCV and VA^-1U defined
  • Inverse of a Matrix — The inverse that the lemma updates efficiently
  • Matrix Inverse — Defines the inverse that the lemma updates efficiently