II.16 · Linear Algebra
Can a transformation recover the input it just changed?
Transform an input vector, then recover it with an inverse constructed from exact row operations on [A | I]. Singular maps show where information has been lost.
Construct the map that undoes A
Apply A, then undo with A⁻¹
Original x (2, 1), transformed Ax (5, 3), reconstructed (2, 1).
- Original coefficient matrix
- [2, 1; 1, 1]
- Pivot count / image dimension
- 2
- Independent null directions
- 0
- Null-space basis
- none: only the zero vector
- Inverse from [A | I]
- [1, −1; −1, 2]
- Both multiplication checks
- I and I, exactly
- Reconstructed input
- (2, 1)
Exact values use =; numerical companions use ≈. Rank and zero decisions are exact.
Rank 2: 2 independent image directions and 0 null directions. Full rank: the square map is invertible.
Begin with [A | I]
The original equations. Coefficients are left of the augmentation boundary. The same operation acts on all columns of [A | I].
| R1 | 2 | 1 | 1 | 0 |
|---|---|---|---|---|
| R2 | 1 | 1 | 0 | 1 |
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
Move the input vector and compare its original position with . Replay the construction on the identity block. Switch to Repeated columns and explain why no undoing map appears. The Small 3×3 preset keeps the derivation exact without inventing a planar picture of three-dimensional action.
Intuition: an undoing transformation
A rotation changes coordinates without losing information, so another rotation can recover the input. A collapse onto a line loses a direction: several inputs become the same output. No single-valued transformation can then recover which input was used.
An inverse therefore describes recoverability of the whole transformation. It is not an array of entrywise reciprocals.
Definition
For square , an inverse is a matrix satisfying
The identity sends every vector to itself. These identities imply and . An inverse exists exactly when has full rank. A rectangular map may have a one-sided inverse under suitable rank conditions, but the ordinary two-sided inverse taught here requires a square matrix.
Mechanics: one row operation, two blocks
The live trace starts with . Every swap, scaling and row addition acts on both blocks. If the left block reaches , the right block is the inverse. If the coefficient rank is too small, the lesson reports that the inverse does not exist.
The plane shows , , and the exactly reconstructed at the input tip. The inspector calculates both multiplication identities rather than accepting rounded agreement as proof. Input-vector drag, keyboard movement and numeric entry all update the same state. Exact 2×2 and small 3×3 matrices are supported.
Derivation: why the identity block becomes the inverse
Each elementary row operation is left multiplication by an invertible elementary matrix. Let their composition be . Applying the trace to yields , while applying it to the identity yields . The final augmented state is therefore , with .
This works because the same reversible operations transform every column. Equivalently, each identity column is a right-hand side: solve and collect the resulting as inverse columns. The derivation uses elimination already learned in II.14; it does not hide inverse construction behind a black box.
Worked examples
For , reducing the augmented matrix gives
Thus . The opening vector becomes ; applying the inverse returns . Replay the opening trace to see where each inverse entry came from. Multiplication in either order yields diagonal entries and off-diagonal entries .
For , the inverse is
Choose Small 3×3 and inspect the full six-column augmented trace. For repeated columns the left block cannot become ; a nonzero null direction makes unique recovery impossible.
Replay the worked derivation
Begin with [A | I]
The original equations. Coefficients are left of the augmentation boundary. The same operation acts on all columns of [A | I].
| R1 | 2 | 1 | 1 | 0 |
|---|---|---|---|---|
| R2 | 1 | 1 | 0 | 1 |
Executable reference code
The Fraction reference constructs the inverse from the identity block and checks both products. NumPy demonstrates an inverse when the map itself is needed, then uses a direct solve when only an input is required.
"""Construct [A | I] -> [I | inverse] through exact row operations."""
from fractions import Fraction as F
def inverse(a):
n = len(a)
rows = [[F(x) for x in row] + [F(i == j) for j in range(n)] for i, row in enumerate(a)]
for j in range(n):
pivot = next((i for i in range(j, n) if rows[i][j]), None)
if pivot is None:
return None
rows[j], rows[pivot] = rows[pivot], rows[j]
factor = rows[j][j]
rows[j] = [x/factor for x in rows[j]]
for i in range(n):
if i != j:
factor = rows[i][j]
rows[i] = [x-factor*y for x, y in zip(rows[i], rows[j])]
return [row[n:] for row in rows]
A = [[2, 1], [1, 1]]
B = inverse(A)
assert B == [[1, -1], [-1, 2]]
assert inverse([[1, 2], [2, 4]]) is None
for left, right in ((A, B), (B, A)):
assert [[sum(left[i][k]*right[k][j] for k in range(2)) for j in range(2)] for i in range(2)] == [[1, 0], [0, 1]]import numpy as np
A = np.array([[2., 1.], [1., 1.]])
x = np.array([2., 1.])
y = A @ x
B = np.linalg.inv(A) # Display an undoing map when it is actually needed.
assert np.allclose(B @ y, x)
assert np.allclose(B @ A, np.eye(2)) and np.allclose(A @ B, np.eye(2))
assert np.allclose(np.linalg.solve(A, y), x) # Preferred for solving one system.Explore
Compare an independent map, a zero map and a rank-one collapse. In the close preset, inspect the large inverse coefficients; move between exact existence and numerical sensitivity without confusing them. Recover several input vectors. Check a 3×3 inverse by multiplying one row against each original column.
Common mistakes
The transpose is an inverse only for square orthogonal matrices. Entrywise reciprocals fail because matrix multiplication mixes entries. A singular map does not gain an inverse by ignoring zero rows. To undo , undo first and second: .
Numerical considerations
Although is a valid identity for an invertible matrix, numerical software should generally solve directly using an appropriate factorization. Explicit inverse formation usually costs more work and can introduce avoidable error. The exact identity checks here concern entered rationals; they do not remove coefficient uncertainty or conditioning problems. An extremely thin image can be exactly invertible while giving unstable recovered coordinates.
Engineering and ML connections
Inverse transforms recover coordinate systems and reversible maps. Solvers recover forces, states and parameters from constraints. Most ML least-squares problems are rectangular or noisy, so ordinary inverses are often absent; projection and pseudoinverses provide the relevant replacement in the next chapters.
Exercises
Summary and checkpoints
An inverse recovers every input and output through both identity products. Derive it from , connect its existence to exact rank, and distinguish the algebraic inverse identity from the practical choice to solve directly.