Linear Algebra, Live
Strang §2.5 · Inverse matrices

The inverse matrix: undo what A does

Lesson 2 solved Ax = b by elimination, one row step at a time. Now we ask a bigger question: is there a matrix that simply undoes A? You know this from money. Changing euros into dollars multiplies by the exchange rate, and changing back divides by it, so you end with the euros you started with. For numbers, 3 is undone by 1/3, because (1/3)·3 = 1. For matrices, the inverse A⁻¹ does the same job: A turns an input x into an output Ax, and A⁻¹ turns that output back into x. The matrix that plays the part of the number 1 is the identity I, which changes nothing. When A⁻¹ exists, it solves Ax = b in one step: x = A⁻¹b. Some matrices cannot be undone, and this slide shows how to spot them.

Lesson 3 · slide 1The inverse
A⁻¹A = I     Ax = b  ⇔  x = A⁻¹b
Key ideas
  1. The inverse A⁻¹ undoes A: A⁻¹A = I and AA⁻¹ = I, where I is the identity matrix.
  2. If A has an inverse, Ax = b has exactly one solution, x = A⁻¹b.
  3. A matrix that sends two different inputs to the same output cannot be undone.
  4. A square matrix has an inverse exactly when all its pivots are nonzero, or, equivalently, when no column is a combination of the others (lesson 4 calls this independent). A matrix that has an inverse is called invertible.

Undo for numbers first

Multiplying by 3 is undone by multiplying by 1/3. The pair cancels and leaves 1, the number that changes nothing:

(1/3)·3 = 1    so   3x = 12  →  x = (1/3)·12 = 4

The number 0 has no undo: 0·x is 0 for every x, so from the answer 0 you can never tell what x was. Matrices work the same way, with one twist: many matrices besides the zero matrix (all entries 0) have no undo either.

The identity: the matrix that changes nothing

For matrices, the role of 1 is played by the identity matrix I from lesson 2: 1s on the diagonal and 0s everywhere else. I times any vector gives the same vector back:

I·47 = 100147 = 1·4 + 0·70·4 + 1·7 = 47

So "A⁻¹ undoes A" means: A⁻¹ times A is I. Inverses only exist for square matrices (lesson 4 shows why), and for them the undo works both ways: AA⁻¹ = I too.

Example: undo “add the second entry to the first”

Take S = 1101. Multiply it by a vector pq, by rows as in lesson 1: S·pq = p + qq. S adds the second entry to the first and keeps the second entry. Start from 12:

S·12 = 1 + 22 = 32
S works on 12 one row at a time. Row 1 adds both numbers, row 2 keeps the second one. The output is 32.

To undo S, take the second entry away from the first one again: pq goes to p − qq. That is the matrix S⁻¹ = 1−101. Feed it the output 32:

S⁻¹·32 = 3 − 22 = 12  ✓ back where we started
Now S⁻¹ works on the output 32. Row 1 takes the 2 away again, and out comes the starting vector 12.

That worked for one vector. To be sure it works for every vector, multiply the two matrices, as in lesson 2. The product should be I:

S⁻¹S = 1−1011101 = 1 + 01 − 10 + 00 + 1 = 1001 ✓
Each row of S⁻¹ meets each column of S. All four numbers come out as the identity: 1s on the diagonal, 0s elsewhere.

The lab draws each vector as an arrow from the origin, as in lesson 1. Multiplying by S gives a new arrow. Follow v = 12: S sends it to 32. Your S⁻¹ should bring it back.

Why the inverse solves equations

Start with Ax = b and multiply both sides on the left by A⁻¹. Since A⁻¹A = I and Ix = x, the left side is just x:

Ax = b  →  A⁻¹Ax = A⁻¹b  →  x = A⁻¹b

Try it with S. To solve Sx = 52, multiply 52 by S⁻¹:

x = S⁻¹·52 = 5 − 22 = 32
Check: S·32 = 3 + 22 = 52 ✓

If the inverse exists, this x is the one and only solution.

When there is no inverse

Some matrices can't be undone. Here is one. Its second column is just twice the first:

A = 1224

Feed it two different inputs:

A·20 = 24    A·01 = 24

Different inputs, same output. If all you see is 24, you can't tell which input made it. So nothing can undo A, and A has no inverse. The same happens with A·2−1 = 2 − 24 − 4 = 00: this input lands on 00, just like the input 00 does.

Every output of A is a combination of its columns 12 and 24. They point the same way, so all outputs land on one line, and many inputs share each output.

A matrix that has an inverse is called invertible. For a square matrix, each of these says the same thing: A is invertible.

  • Every pivot is nonzero (lesson 2). For A above, row 2 − 2·row 1 gives 00, so the second pivot is 0.
  • No column is a combination of the others. Otherwise the outputs miss part of the space (in the plane: they all land on one line, as in lesson 1's column space), so some outputs are shared. Lesson 4 calls columns like that, with no column a combination of the others, independent. For A, column 2 = 2·column 1.
  • Ax = 0 only when x = 0. For A, x = 2−1 also gives 0.

So one failed test means all of them fail. The next slide adds a quick number test for 2 by 2 matrices.

A bigger example: a 3 × 3 inverse

Lesson 2's elimination matrix E₂₁ subtracts 2 times row 1 from row 2. Its undo adds 2 times row 1 back:

E₂₁ = 100−210001    E₂₁⁻¹ = 100210001
Row 2 of E₂₁⁻¹E₂₁ mixes the rows of E₂₁ using the numbers in row 2 of E₂₁⁻¹ (lesson 2, slide 5): 2·100 + 1·−210 + 0·001 = 010 ✓
Rows 1 and 3 of both matrices are rows of I, so they stay 100 and 001. The product is I.

A matrix with zeros everywhere off the diagonal is called a diagonal matrix, often named D. It multiplies each entry of a vector by its own number, so its inverse divides by those numbers:

D = 200040005    D⁻¹ = ½000¼000⅕    D⁻¹·245 = 111

The idea is the same for a matrix with a thousand rows: A⁻¹ is the matrix whose product with A is I.

Next: How do we actually find A⁻¹? For a 2 by 2 matrix there is a short recipe, and one number tells at once whether the inverse exists.

Examples

Example 1 · Undo a diagonal matrix

D = 2005 is diagonal: D·pq = 2p5q. It multiplies the first entry by 2 and the second by 5.

Show solutionHide solution
D⁻¹ = ½00⅕: divide the first entry by 2 and the second by 5

Example 2 · Undo a swap with a sign

R = 0−110 sends pq to −qp: the entries trade places and the new first entry gets a minus sign. For example R·10 = 01.

Show solutionHide solution
R⁻¹ = 01−10 sends pq to q−p, which brings −qp back to pq
RR⁻¹ = I

Example 3 · Solve with the inverse

Suppose A⁻¹ = 2111. Then Ax = b with b = 12 is solved by one multiplication:

Show solutionHide solution
x = A⁻¹b = 2·1 + 1·21·1 + 1·2 = 43

Example 4

Does 2613 have an inverse?

Show solutionHide solution

No. Column 2 = 3·column 1, so the columns lie on one line (slide 2 gives a quick number test for this). Two different inputs give the same output, so there is no way back.

Example 5

The matrix 1031 adds 3 times the first entry to the second: pq goes to p3p + q. Write its inverse.

Show solutionHide solution

Take the 3 times the first entry away again: 10−31.

Exercise Fill in S_inv so that the last arrow lands back on v. Edit the code and press Run.
slide_1.py Loading Python…
1
Output · Ctrl+Enter runs
Press Run to execute this slide's code. Ctrl+Enter works too.

Enjoying lesson 3? Get the full course: all 8 lessons through the SVD and PCA, your progress saved lesson by lesson, every solution and 5 extra problems per lesson. $20 once, yours for life.

Questions and comments

Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.

The full course

From Ax = b to PCA, by running it

Lessons 1 to 3 are free. Finish all eight and you will be able to:

You get: all 8 lessons with Python labs · every worked example and solution · 5 extra problems per lesson · your progress tracked · answers to your questions · every future update.

$20 once · lifetime access
Continue to checkout →

Already a member? Log in to the course