TwiddleLab / Math / Vectors and Matrices
Undoing a Matrix
What you will learn
- The inverse A⁻¹ undoes A: A⁻¹ A = I, the do-nothing matrix.
- For [[a, b], [c, d]]: swap a and d, flip the signs of b and c, divide by ad - bc.
- If det = 0 there is no inverse. Solving A x = b means finding which x landed on b.
How the lesson goes
A spy scrambles a picture with a matrix. Can every scramble be undone?
Build an undo machine for this scramble.
The grid shows the scramble A, then your machine. Drag your machine's heads until the grid is square again.
[[1, -1], [-1, 2]] times [[2, 1], [1, 1]] is [[1, 0], [0, 1]], the do-nothing matrix.
Rewind two scrambles.
One has det 1, the other det 0.
An undo machine is the inverse matrix.
The inverse A⁻¹ undoes A: A⁻¹ A = I, the matrix that changes nothing.
Recipe: swap a and d, flip the signs of b and c, divide by ad - bc.
If det = 0, there is no inverse.
Use the recipe: invert [[3, 1], [5, 2]].
Its det is 1, so no dividing needed.
Inverse = 1/(ad - bc) [[d, -b], [-c, a]] = 1/1 [[2, -1], [-5, 3]].
Make your own secret scrambler.
Anything, as long as it does not flatten the plane.
Any matrix with det not 0 has an inverse.
Game: rewind race. Rescue four scrambled flags.
Tap the card that undoes each scramble. Wrong cards cost a mistake.
The Hill cipher hides letters with a matrix.
H = 7 and I = 8. The key is [[1, 1], [0, 1]]. What is the first secret number?
[[1, 1], [0, 1]] (7, 8) = (7 + 8, 8) = (15, 8): P and I.
Which input did A = [[2, 1], [1, 1]] send to (10, 7)?
That is the system 2x + y = 10, x + y = 7. Drag the input until the output hits the target.
x = A⁻¹ b = [[1, -1], [-1, 2]] (10, 7) = (3, 4).
The inverse undoes a matrix, unless det is 0.
Your secret machine and its undo, on the logo.
Previous lesson: Area Scaling: the Determinant · Next lesson: Project: Pixel Art Transformer · Part of the course: Vectors and Matrices
Lessons are interactive and need JavaScript. Turn it on to play them.