4. Matrix inverse, invertibility conditions
Ordinary numbers have a multiplicative inverse — 5\times\frac15=1 — for every nonzero number. §16.2 defined a matrix analogue of multiplication; this lesson asks when it has an analogue of division. The answer isn't "whenever the matrix is nonzero" — it's considerably more interesting, and ties directly back to whether the system A\vec x=\vec b (§16.1) has a unique solution.
Definition
An n\times n (square) matrix A is invertible (or nonsingular) if there exists a matrix A^{-1} with
AA^{-1}=A^{-1}A=I_n
If it exists, A^{-1} is unique — if B and C both inverted A, then B=BI=B(AC)=(BA)C=IC=C, using associativity from §16.2 twice. A matrix with no inverse is called singular. Only square matrices are ever invertible in this sense — a non-square A can have a one-sided inverse, but never a genuine two-sided one, since the shapes of A^{-1} would have to satisfy contradictory requirements.
Why invertibility matters: solving A\vec x=\vec b
If A^{-1} exists, the system A\vec x=\vec b (§16.1's system, recast using §16.2's matrix-vector product) has the unique solution
\vec x=A^{-1}\vec b
found by left-multiplying both sides by A^{-1}: A^{-1}A\vec x=A^{-1}\vec b\Rightarrow\vec x=A^{-1}\vec b. This is the matrix version of dividing both sides of ax=b by a — and it's exactly why invertibility is the right question to ask: it decides, in one shot and for every right-hand side \vec b at once, whether the system has a unique solution.
The 2\times2 formula
For A=\begin{pmatrix}a&b\\c&d\end{pmatrix}:
A^{-1}=\frac1{ad-bc}\begin{pmatrix}d&-b\\-c&a\end{pmatrix}
The quantity ad-bc is the determinant of A (§16.4 develops it in full generality); this formula already reveals the central fact about invertibility: it fails exactly when ad-bc=0, since division by zero is undefined. Swap the diagonal entries, negate the off-diagonal entries, divide by the determinant — worth memorizing for 2\times2, but the pattern does not generalize by direct analogy to larger sizes (§16.4 gives the general cofactor formula, and in practice the method below is what's actually used).
Computing A^{-1} by Gauss-Jordan elimination
For general n, augment A with the identity matrix and row-reduce the whole augmented block to RREF using §16.1's elementary row operations:
[A\mid I]\ \xrightarrow{\text{row reduce}}\ [I\mid A^{-1}]
If A row-reduces to I, the operations that did it, applied to I on the right, produce exactly A^{-1} — because each elementary row operation is left-multiplication by some invertible matrix (§16.5), and the whole sequence of them turns A into I, so that same sequence applied to I gives A^{-1}I=A^{-1}.
If A does not row-reduce to I — if elimination produces a zero row on the left block before finishing — A is singular, and no amount of further row-reducing will ever produce an inverse. This gives the single cleanest invertibility test available from elimination alone:
A\text{ is invertible}\iff A\text{ row-reduces to }I_n\iff A\text{ has }n\text{ pivots (full rank)}
Properties, and the invertibility list so far
(A^{-1})^{-1}=A,\qquad(AB)^{-1}=B^{-1}A^{-1},\qquad(A^T)^{-1}=(A^{-1})^T
The middle rule — the product's inverse reverses the order, exactly like transpose (§16.2) — makes sense from what "undoing" means: to undo "do A, then do B," undo B first, then undo A; check directly: (AB)(B^{-1}A^{-1})=A(BB^{-1})A^{-1}=AIA^{-1}=AA^{-1}=I ✓.
This course accumulates several equivalent ways to say "A is invertible" as new tools arrive — full rank and n pivots above, \det A\neq0 in §16.4, linearly independent columns in §17.1, trivial null space in §17.4, and 0 not an eigenvalue in §19.0. They are all the same statement; each new lesson just gives one more angle to check it from.
Doing it in Python
import numpy as np
A = np.array([[2., 1.], [5., 3.]])
Ainv = np.linalg.inv(A)
print("A^-1 =")
for row in Ainv.tolist():
print([round(v, 4) for v in row])
print("\nA @ A^-1 =")
for row in (A @ Ainv).tolist():
print([round(v, 10) or 0.0 for v in row])
A^-1 =
[3.0, -1.0]
[-5.0, 2.0]
A @ A^-1 =
[1.0, 0.0]
[0.0, 1.0]
A singular matrix, caught by elimination rather than by crashing:
import sympy as sp
A = sp.Matrix([[1, 2], [2, 4]]) # row 2 = 2 * row 1
rref, pivots = A.rref()
print("RREF:")
for row in rref.tolist():
print(row)
print("pivots:", pivots, " -> invertible:", len(pivots) == A.rows)
RREF:
[1, 2]
[0, 0]
pivots: (0,) -> invertible: False
Worked example
Find A^{-1} for A=\begin{pmatrix}2&1\\5&3\end{pmatrix}, then use it to solve A\vec x=(4,9).
\det A=2(3)-1(5)=1. By the 2\times2 formula:
A^{-1}=\frac11\begin{pmatrix}3&-1\\-5&2\end{pmatrix}=\begin{pmatrix}3&-1\\-5&2\end{pmatrix}
Check: AA^{-1}=\begin{pmatrix}2(3)+1(-5)&2(-1)+1(2)\\5(3)+3(-5)&5(-1)+3(2)\end{pmatrix}=\begin{pmatrix}1&0\\0&1\end{pmatrix} ✓.
\vec x=A^{-1}\begin{pmatrix}4\\9\end{pmatrix}=\begin{pmatrix}3(4)-1(9)\\-5(4)+2(9)\end{pmatrix}=\begin{pmatrix}3\\-2\end{pmatrix}
\boxed{\vec x=(3,-2)}
Sanity check. A\vec x=2(3)+1(-2)=4 ✓ and 5(3)+3(-2)=15-6=9 ✓ — confirming both the inverse itself and its use to solve the system.
Your turn
1. Find A^{-1} for A=\begin{pmatrix}4&3\\2&2\end{pmatrix} using the 2\times2 formula.
2. Is A=\begin{pmatrix}1&2\\3&6\end{pmatrix} invertible? Justify using the determinant.
3. True or false: if A and B are both invertible n\times n matrices, then A+B is always invertible.
Solutions
1. \det A=4(2)-3(2)=8-6=2. A^{-1}=\frac12\begin{pmatrix}2&-3\\-2&4\end{pmatrix}=\begin{pmatrix}1&-1.5\\-1&2\end{pmatrix}. Check: AA^{-1}=\begin{pmatrix}4(1)+3(-1)&4(-1.5)+3(2)\\2(1)+2(-1)&2(-1.5)+2(2)\end{pmatrix}=\begin{pmatrix}1&0\\0&1\end{pmatrix} ✓.
2. Not invertible. \det A=1(6)-2(3)=6-6=0 — the 2\times2 formula would require dividing by zero, so no inverse exists. (Notice row 2 is exactly 3\times row 1: the rows are dependent, which is exactly the kind of degeneracy §16.4's "determinant zero means the rows/columns are dependent" connects this to.)
3. False. A quick counterexample: A=I, B=-I, both invertible (each is its own inverse). A+B=0, the zero matrix, which is singular (nothing multiplies the zero matrix to give I, since 0\cdot X=0\neq I). Invertibility is a property of a single matrix's action, and addition doesn't interact with it the way multiplication does — there is no analogue of (AB)^{-1}=B^{-1}A^{-1} for sums.
Check yourself in code
For A=\begin{pmatrix}3&2\\1&4\end{pmatrix}, compute A^{-1} (rounded to 4 decimal places) and verify A A^{-1}=I, then solve A\vec x=(8,6).
Print exactly this:
A^-1 =
[0.4, -0.2]
[-0.1, 0.3]
A @ A^-1 == I: True
x = [2.0, 1.0]
import numpy as np
A = np.array([[3., 2.], [1., 4.]])
Ainv = np.linalg.inv(A)
print("A^-1 =")
for row in Ainv.tolist():
print([round(v, 4) for v in row])
# print whether A @ Ainv matches the identity (allclose), then solve A x = (8, 6)
import numpy as np
A = np.array([[3., 2.], [1., 4.]])
Ainv = np.linalg.inv(A)
print("A^-1 =")
for row in Ainv.tolist():
print([round(v, 4) for v in row])
I = np.eye(2)
print("A @ A^-1 == I:", bool(np.allclose(A @ Ainv, I)))
b = np.array([8., 6.])
x = Ainv @ b
print("x =", [round(v, 4) for v in x.tolist()])
A^{-1} exists precisely when A row-reduces to the identity — n pivots, full rank — and when it does, A\vec x=\vec b has the unique solution \vec x=A^{-1}\vec b for every \vec b. (AB)^{-1}=B^{-1}A^{-1} reverses order, exactly like the transpose. This is the first of several equivalent tests for invertibility this course collects; the next one, the determinant, gives a single number that decides it outright.
Next: determinants — a single scalar computed from any square matrix that is zero exactly when the matrix is singular, with a geometric meaning as an area or volume scale factor.