Skip to content
Tactiverge

School/✦ Research Engineer/Week 2

Inverses: undoing a linear map

A sensor matrix turns true forces into readings. Can you always run it backwards to turn readings into forces?

About 40 min · 3 goals · Checked by automated tests

1.Why should I care?

Inverting a calibration, a coordinate change or a mixing matrix is a daily engineering task. Knowing when it is impossible (and when it is merely dangerous) prevents confident nonsense.

  • ◇ Compute the inverse of a 2×2 matrix and verify A·A⁻¹ = I.
  • ◇ State when an inverse exists and find a 3×3 inverse by Gauss–Jordan elimination.
  • ◇ Explain why solving is preferred to inverting in numerical work.

2.Predict

A = [[2, 4], [1, 2]]. Does A⁻¹ exist?

Guess first. Being wrong here is how the surprise works.

3.Discover

Open the Code Lab. Write inv2(A) using the formula below and test it on five random matrices by checking A·inv2(A) ≈ I. Then try a matrix with determinant 10⁻⁹ and look at the entries.

Can't use the interactive? Read a description instead

This activity is code-based: implement the 2×2 inverse formula, verify A times its inverse equals the identity on random matrices, and observe the very large entries that appear when the determinant is tiny.

4.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1 · a fresh version every time

A = [[2, -5], [1, 6]]. What is the entry in row 2, column 1 of A⁻¹? (Give a decimal.)

5.Understand

What an inverse is

A⁻¹ is the matrix with A⁻¹A = AA⁻¹ = I. It exists exactly when A is square with det A ≠ 0 (rank n). Then Ax = b has the unique solution x = A⁻¹b. Geometrically, the map must not squash any direction to zero, or it cannot be undone.

Gauss–Jordan for bigger matrices

Write [A | I] and row-reduce all the way to [I | X]: eliminate below and above each pivot and scale pivots to 1. Then X = A⁻¹. If a zero pivot cannot be fixed by swapping, A is singular.

Solve, don't invert

In computation, forming A⁻¹ costs about three times more than an LU solve and is typically less accurate. Libraries offer solve(A, b) for this reason. Inverses remain useful on paper, for small fixed matrices, and when you genuinely need the entries (for example a covariance matrix).

Explain it another way

If a map is a recipe for scrambling, the inverse is the unscrambling recipe. Scrambling that throws ingredients away (det 0) cannot be unscrambled.

Derivation: The 2×2 inverse formula
  1. Let A = [[a, b], [c, d]]. We want X with AX = I.

  2. Try X = k·[[d, −b], [−c, a]] (swap the diagonal, negate the off-diagonal).

  3. Then AX = k·[[ad − bc, −ab + ba], [cd − dc, −cb + da]] = k·(ad − bc)·I.

  4. Choosing k = 1/(ad − bc) gives AX = I, so A⁻¹ = (1/det A)·[[d, −b], [−c, a]].

  5. This only works if det A = ad − bc ≠ 0; when it is zero there is no inverse.

Worked example 1

Invert A = [[3, 1], [2, 5]] and check.

det A = 15 − 2 = 13. A⁻¹ = (1/13)[[5, −1], [−2, 3]]. Check: A·A⁻¹ = (1/13)[[15 − 2, −3 + 3], [10 − 10, −2 + 15]] = I. ✓

Common mix-ups

  • Every square matrix has an inverse.
    ✓ Only those with det A ≠ 0.
  • A small determinant means nearly singular.
    ✓ Scaling changes det without changing difficulty: 0.1·I in 10D has det 10⁻¹⁰ yet is perfectly conditioned. Use the condition number (week 5).

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2

Which matrix has no inverse?

Practice 3

What is (AB)⁻¹?

Practice 4 · a fresh version every time

A = [[-1, 3], [4, 6]]. What is the entry in row 1, column 2 of A⁻¹? (Give a decimal.)

Practice 5

A colleague computes x = inv(A) * b for a 5000×5000 system. Best advice?

7.Apply it

Find the inverse of the sensor-mixing matrix [[1, 0.5], [0.25, 1]] and use it to recover the true quantities for three different readings. Then make the cross-talk 0.99 and 0.99: what happens to the inverse's entries?

8.Reflect

Concepts: Matrices and linear transformations · Linear systems, elimination and rank