← mapVectors & Matrices

Matrix Inverses

⚗ Dr. Möbius, from the lab

You know from the Sets stratum that a function has an inverse if and only if it's bijective. Well, a matrix is a function — so when the hell does it have an inverse? Exactly when it doesn't squash the plane, which we now know means exactly when its determinant is nonzero. We built all this machinery precisely so that this moment would feel inevitable rather than magical. The 2×22\times 2 inverse formula is not a rabbit from a hat; it's the logical terminus of everything that came before it.

THE BIG IDEA

The inverse A⁻¹ of a matrix A exists precisely when det(A) ≠ 0, and is given by the adjugate divided by the determinant; solving Ax = b then reduces to x = A⁻¹b.

The inverse as the undo machine

In the Sets stratum you proved that a function ff has an inverse f1f^{-1} if and only if ff is bijective (injective and surjective). A matrix AA is a linear function RnRn\mathbb{R}^n \to \mathbb{R}^n. So AA has an inverse when the corresponding function is bijective.

The matrix inverse A1A^{-1} is the matrix such that:

AA1=IandA1A=IAA^{-1} = I \quad \text{and} \quad A^{-1}A = I

In words: applying AA then A1A^{-1} puts you back where you started — undoes all the damage AA did. Both conditions are required — for square matrices they turn out to be equivalent (a theorem from the Vector Spaces stratum), but stating both is the honest definition.

The identity matrix II plays the role of "1": it's the do-nothing transformation, so AA1=IAA^{-1} = I says "undo of AA composes with AA to give the identity," exactly the way f1f=idf^{-1} \circ f = \text{id} in the Sets stratum. Same fucking move, matrix clothes.

Invertible iff det ≠ 0: three ways to say one thing

From the geometric picture:

  • If det(A)0\det(A) \ne 0: AA is a bijective transformation (it neither collapses the plane nor misses any point). An inverse exists.
  • If det(A)=0\det(A) = 0: AA collapses the plane to a line (or point). Multiple inputs map to the same output — not injective; many outputs are unreachable — not surjective. No inverse exists.

These three statements are equivalent and should be remembered as one fact — tattoo them on your brain:

A is invertible    det(A)0    A’s columns are linearly independentA \text{ is invertible} \iff \det(A) \ne 0 \iff A\text{'s columns are linearly independent}

A singular matrix (zero determinant) is not invertible. The word "singular" is historically ominous — something went badly wrong with this transformation, and no amount of wishful thinking will fix it.

The 2×22\times 2 inverse formula

For A=(abcd)A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} with det(A)=adbc0\det(A) = ad - bc \ne 0:

A1=1adbc(dbca)A^{-1} = \frac{1}{ad - bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}

The recipe: swap the diagonal entries (aa and dd exchange places); negate the off-diagonal entries (bbb \to -b, ccc \to -c); divide every entry by det(A)\det(A).

Verify it directly. Let δ=adbc\delta = ad-bc. Then: AA1=1δ(abcd)(dbca)=1δ(adbcab+bacddcbc+da)=1δ(δ00δ)=IAA^{-1} = \frac{1}{\delta}\begin{pmatrix}a&b\\c&d\end{pmatrix}\begin{pmatrix}d&-b\\-c&a\end{pmatrix} = \frac{1}{\delta}\begin{pmatrix}ad-bc & -ab+ba\\cd-dc & -bc+da\end{pmatrix} = \frac{1}{\delta}\begin{pmatrix}\delta & 0\\0&\delta\end{pmatrix} = I

The 1det(A)\frac{1}{\det(A)} out front is what forces the diagonal entries to be 11 rather than det(A)\det(A). This is why zero determinant kills the formula — you'd be dividing by zero.

Solving Ax = b

One of the most important uses of the inverse: solving Ax=bA\vec{x} = \vec{b}.

If AA is invertible, multiply both sides on the LEFT by A1A^{-1}:

A1(Ax)=A1bIx=A1bx=A1bA^{-1}(A\vec{x}) = A^{-1}\vec{b} \quad \Rightarrow \quad I\vec{x} = A^{-1}\vec{b} \quad \Rightarrow \quad \vec{x} = A^{-1}\vec{b}

Order matters: multiply on the LEFT. bA1\vec{b}A^{-1} is often not even defined (or is a completely different operation). This is the non-commutativity of matrix multiplication showing up where it matters.

When would you actually do this? The formula x=A1b\vec{x} = A^{-1}\vec{b} is clean and satisfying, but in practice — say, when solving a 100×100100 \times 100 system — computing A1A^{-1} and then multiplying is slower than running Gaussian elimination directly on [Ab][A | \vec{b}] (next lesson). Don't be the person who inverts a hundred-by-hundred matrix to solve one system. The inverse formula shines for 2×22\times 2 systems and for theoretical understanding. For large-scale computation, elimination is smarter.

The socks-and-shoes formula

For invertible matrices AA and BB:

(AB)1=B1A1(AB)^{-1} = B^{-1}A^{-1}

Socks and shoes: if you put on socks (BB) then shoes (AA), to reverse the process you take off shoes (A1A^{-1}) then socks (B1B^{-1}). The order reverses.

Proof: (AB)(B1A1)=A(BB1)A1=AIA1=AA1=I(AB)(B^{-1}A^{-1}) = A(BB^{-1})A^{-1} = A \cdot I \cdot A^{-1} = AA^{-1} = I

Similarly (B1A1)(AB)=B1(A1A)B=B1IB=I(B^{-1}A^{-1})(AB) = B^{-1}(A^{-1}A)B = B^{-1}IB = I. Both identities verified.

The full generalization: (ABC)1=C1B1A1(ABC)^{-1} = C^{-1}B^{-1}A^{-1}. The entire product reverses.

🔬 SPECIMENS (worked examples)

Worked example 1 — computing a 2x2 inverse and actually verifying it

Find A1A^{-1} for A=(3152)A = \begin{pmatrix} 3 & 1 \\ 5 & 2 \end{pmatrix} and verify AA1=IAA^{-1} = I.

Step 1: Compute the determinant. det(A)=(3)(2)(1)(5)=65=1\det(A) = (3)(2) - (1)(5) = 6 - 5 = 1

Nonzero — good, A1A^{-1} exists.

Step 2: Apply the formula: swap diagonal, negate off-diagonal, divide by det=1\det = 1. A1=11(2153)=(2153)A^{-1} = \frac{1}{1}\begin{pmatrix}2 & -1 \\ -5 & 3\end{pmatrix} = \begin{pmatrix}2 & -1 \\ -5 & 3\end{pmatrix}

Step 3: Verify AA1=IAA^{-1} = I. (1,1)(3)(2)+(1)(5)=65=1.(1,2)(3)(1)+(1)(3)=3+3=0.(1,1)\text{: }(3)(2)+(1)(-5)=6-5=1. \quad (1,2)\text{: }(3)(-1)+(1)(3)=-3+3=0. (2,1)(5)(2)+(2)(5)=1010=0.(2,2)(5)(1)+(2)(3)=5+6=1.(2,1)\text{: }(5)(2)+(2)(-5)=10-10=0. \quad (2,2)\text{: }(5)(-1)+(2)(3)=-5+6=1. AA1=(1001)=IAA^{-1} = \begin{pmatrix}1&0\\0&1\end{pmatrix} = I \checkmark

Always run this check — it takes ten seconds and catches every arithmetic error.

Worked example 2 — solving Ax = b with the inverse

Solve 3x+y=73x + y = 7, 5x+2y=125x + 2y = 12 using matrix inversion.

Set up: A=(3152)A = \begin{pmatrix}3&1\\5&2\end{pmatrix}, b=(712)\vec{b} = \begin{pmatrix}7\\12\end{pmatrix}.

From Example 1, A1=(2153)A^{-1} = \begin{pmatrix}2&-1\\-5&3\end{pmatrix}.

Solve: x=A1b\vec{x} = A^{-1}\vec{b}. x=(2153)(712)=((2)(7)+(1)(12)(5)(7)+(3)(12))=(141235+36)=(21)\vec{x} = \begin{pmatrix}2&-1\\-5&3\end{pmatrix}\begin{pmatrix}7\\12\end{pmatrix} = \begin{pmatrix}(2)(7)+(-1)(12)\\(-5)(7)+(3)(12)\end{pmatrix} = \begin{pmatrix}14-12\\-35+36\end{pmatrix} = \begin{pmatrix}2\\1\end{pmatrix}

So x=2x = 2, y=1y = 1.

Verify in the original equations: 3(2)+1(1)=6+1=73(2)+1(1) = 6+1 = 7. 5(2)+2(1)=10+2=125(2)+2(1) = 10+2 = 12. Both satisfied.

Worked example 3 — socks-and-shoes: the reversal that trips everyone

Given A=(2111)A = \begin{pmatrix}2&1\\1&1\end{pmatrix} and B=(1301)B = \begin{pmatrix}1&3\\0&1\end{pmatrix}, find (AB)1(AB)^{-1} by computing it two ways: (a) directly from ABAB, and (b) via B1A1B^{-1}A^{-1}.

Compute ABAB:

(AB)11=(2)(1)+(1)(0)=2(AB)_{11} = (2)(1)+(1)(0)=2. (AB)12=(2)(3)+(1)(1)=7(AB)_{12} = (2)(3)+(1)(1)=7. (AB)21=(1)(1)+(1)(0)=1(AB)_{21} = (1)(1)+(1)(0)=1. (AB)22=(1)(3)+(1)(1)=4(AB)_{22} = (1)(3)+(1)(1)=4. AB=(2714)AB = \begin{pmatrix}2&7\\1&4\end{pmatrix}

(a) Direct: det(AB)=(2)(4)(7)(1)=87=1\det(AB) = (2)(4)-(7)(1) = 8-7=1. (AB)1=(4712)(AB)^{-1} = \begin{pmatrix}4&-7\\-1&2\end{pmatrix}

(b) Via B1A1B^{-1}A^{-1}:

det(A)=(2)(1)(1)(1)=1\det(A) = (2)(1)-(1)(1)=1, so A1=(1112)A^{-1} = \begin{pmatrix}1&-1\\-1&2\end{pmatrix}.

det(B)=(1)(1)(3)(0)=1\det(B) = (1)(1)-(3)(0)=1, so B1=(1301)B^{-1} = \begin{pmatrix}1&-3\\0&1\end{pmatrix}.

B1A1=(1301)(1112)B^{-1}A^{-1} = \begin{pmatrix}1&-3\\0&1\end{pmatrix}\begin{pmatrix}1&-1\\-1&2\end{pmatrix}

(1,1)(1,1): (1)(1)+(3)(1)=1+3=4(1)(1)+(-3)(-1)=1+3=4. (1,2)(1,2): (1)(1)+(3)(2)=16=7(1)(-1)+(-3)(2)=-1-6=-7. (2,1)(2,1): (0)(1)+(1)(1)=1(0)(1)+(1)(-1)=-1. (2,2)(2,2): (0)(1)+(1)(2)=2(0)(-1)+(1)(2)=2.

B1A1=(4712)B^{-1}A^{-1} = \begin{pmatrix}4&-7\\-1&2\end{pmatrix}

Both methods give the same answer. The socks-and-shoes law is verified numerically.

☠ KNOWN HAZARDS

  • Using the formula when det(A)=0\det(A) = 0. The formula requires dividing by det(A)\det(A). If det(A)=0\det(A) = 0, there is no inverse to compute — not a hard one, not a different one, just none. Always check the determinant first.

  • Applying the swap-and-negate trick to non-2×22\times 2 matrices. The formula 1det(dbca)\frac{1}{\det}\begin{pmatrix}d&-b\\-c&a\end{pmatrix} is ONLY for 2×22\times 2. Using it on a 3×33\times 3 is completely wrong. Larger matrices require row-reducing [AI][A|I] (next lesson).

  • Forgetting to multiply on the left. From Ax=bA\vec{x} = \vec{b}, the correct move is A1(Ax)=A1bA^{-1}(A\vec{x}) = A^{-1}\vec{b}, giving x=A1b\vec{x} = A^{-1}\vec{b}. Multiplying on the right gives something that doesn't simplify to x\vec{x} — it's the kind of mistake that ends careers.

  • Confusing (AB)1=A1B1(AB)^{-1} = A^{-1}B^{-1} with the correct formula. The order REVERSES: (AB)1=B1A1(AB)^{-1} = B^{-1}A^{-1}. The wrong formula can be verified to fail: multiply ABAB by A1B1A^{-1}B^{-1} and you will NOT get II.

TL;DR

  • A1A^{-1} satisfies AA1=A1A=IAA^{-1} = A^{-1}A = I. It exists if and only if det(A)0\det(A) \ne 0.

  • 2×22\times 2 formula: for A=(abcd)A = \begin{pmatrix}a&b\\c&d\end{pmatrix}, A1=1adbc(dbca)A^{-1} = \frac{1}{ad-bc}\begin{pmatrix}d&-b\\-c&a\end{pmatrix}.

  • Solving Ax=bA\vec{x} = \vec{b}: multiply on the left by A1A^{-1} to get x=A1b\vec{x} = A^{-1}\vec{b}.

  • (AB)1=B1A1(AB)^{-1} = B^{-1}A^{-1}: the socks-and-shoes law. The order reverses.

  • In practice, computing A1A^{-1} to solve a single system is often wasteful; Gaussian elimination is more efficient at scale.

unlocks