Visual walkthrough — Solving systems using matrix inversion
This is the parent recipe drawn out slowly, one picture per step. We start with two ordinary equations and end with the single boxed formula — but every symbol earns its place before we use it, and every move gets a picture.
We will keep one running example the whole way:
Two straight lines on a flat sheet. Where they cross is the answer. Watch how matrices repackage that crossing point into one clean formula.
Step 1 — Two equations are two lines
WHAT we did: turned each equation into a line. WHY: a solution must satisfy both promises, so it must lie on both lines. Geometry replaces algebra — we now hunt for an intersection. WHAT IT LOOKS LIKE: two chalk lines crossing at one dot.

The dot in the figure is the answer we are chasing: . Everything below is machinery to compute that dot without eyeballing the graph.
Step 2 — Stack the numbers into a grid , a stack , a stack
Before any symbol appears, here is what each grid is.
Reading term by term: the top row is the coefficients of the first equation (); the bottom row is the second (). The column holds the "" and "".
WHAT we did: peeled the numbers away from the letters. WHY: the numbers alone (the grid ) carry all the structure of the system. Later we can work on the grid without dragging around. WHAT IT LOOKS LIKE: colouring each equation and watching its numbers march into a row.
Step 3 — What "row times column" means (so rebuilds the system)
We have never multiplied a grid by a column yet, so here is the single rule, built from a picture.
Doing this for both rows of stacks two results into a column:
Now set that column equal to :
WHAT we did: showed is literally the two original equations. WHY: this is the whole justification for the repackaging — the compact form loses nothing. Row times reproduces equation exactly. WHAT IT LOOKS LIKE: a row sliding down the column, pairing up terms, then dropping into a slot of the answer column.
Step 4 — is a machine that moves points
So the whole question becomes: "which arrow does the machine send to the arrow ?"
WHAT we did: reframed "solve the system" as "reverse-engineer a machine's input." WHY: because machines that can be reversed have a clean undo button — and that button will hand us directly. WHAT IT LOOKS LIKE: an input arrow on the left, the machine , an output arrow on the right. We know the output ; we're missing the input.
Step 5 — The undo machine
Why does mean "undo"? Because applying then is the same as applying the do-nothing machine — you end up where you started.
WHAT we did: named the reverse machine and the do-nothing machine. WHY: we cannot "divide by a matrix", but we can undo a machine. is the matrix world's version of dividing. WHAT IT LOOKS LIKE: the output arrow fed backwards through , landing on the input arrow .
The concrete recipe for the undo machine (see Adjoint and Inverse of a Matrix): Here is a single number measuring "how much the machine stretches or squashes area" (see Determinants), and is the transpose of the cofactor matrix (see Cofactors and Minors).
Step 6 — The derivation, one line at a time
Now the algebra, each move justified.
Start from the packed form: Here sits on the left of . Remember that for matrices, order matters — cancels but is a different order, so we must be careful which side we act on.
Multiply both sides on the left by : We chose the left because must sit right next to the it is cancelling. Sliding it in from the right would give nothing to cancel.
Regroup (matrix multiplication is associative — brackets can shift):
Replace by (Step 5's definition), and by (do-nothing machine):
WHAT we did: peeled off by cancelling it with . WHY each step: left-multiply → to line against ; regroup → to bring together; simplify → because and does nothing. WHAT IT LOOKS LIKE: the and annihilating each other, leaving alone on the left.
Plugging in our numbers ():
X=\frac{1}{-5}\begin{bmatrix}-1&-3\\-1&2\end{bmatrix}\begin{bmatrix}5\\1\end{bmatrix}=\frac{1}{-5}\begin{bmatrix}-8\\-3\end{bmatrix}=\begin{bmatrix}8/5\\3/5\end{bmatrix}.$$ That is exactly the crossing dot from Step 1. ✓ --- ## Step 7 — The degenerate case: when the machine flattens space Everything above needed $\det A\neq0$. Watch what breaks otherwise. > [!intuition] > $\det A$ measures how the machine changes area. If $\det A=0$, the machine **squashes the whole plane onto a single line** — every point collapses onto that line. Once space is flat, two different inputs can land on the *same* output, so there is no unique undo — $A^{-1}$ does not exist (you'd be dividing by $\det A=0$). Two sub-cases decide the fate of the system. Multiply $AX=B$ by $\operatorname{adj}(A)$ and use the identity $\operatorname{adj}(A)\,A=(\det A)I$: $$(\det A)\,X=(\operatorname{adj}A)\,B.$$ When $\det A=0$ the left side is the zero column $O$, forcing $(\operatorname{adj}A)B=O$: > [!definition] The $\det A=0$ fork > - $(\operatorname{adj}A)B\neq O$ → **impossible** → ==no solution== (lines are parallel, never meet). > - $(\operatorname{adj}A)B= O$ → ==infinitely many solutions== (the two lines are the *same* line) — or none; confirm by substitution. **WHAT** we did: covered the case the boxed formula cannot touch. **WHY**: the reader must never hit an unsolvable input and be surprised — every scenario is now shown. **WHAT IT LOOKS LIKE**: left panel, two parallel lines that never cross (no solution); right panel, two lines lying exactly on top of each other (infinitely many). See [[Consistency of Linear Systems]]. > [!mistake] Reaching for $A^{-1}$ before checking $\det A$ > **Why it tempts:** the recipe feels universal. > **The fix:** $A^{-1}$ divides by $\det A$. Always compute $\det A$ **first**. If it is zero, abandon inversion and use the fork above. --- ## The one-picture summary The whole journey on one board: system → grid $AX=B$ → machine view → cancel $A$ with $A^{-1}$ → $X=A^{-1}B$, with the $\det A=0$ trapdoor drawn to the side. > [!recall]- Feynman: tell the whole walkthrough to a friend > We had two straight lines and wanted their crossing point. First we noticed each equation is a line, and the answer is where they meet. Then we stripped the numbers into a tidy grid $A$, stacked the unknowns into a column $X$, and the answers into a column $B$ — and checked that "grid times column", done by pairing-and-adding, rebuilds the original equations exactly, so nothing was lost. Next we pictured $A$ as a machine that pushes an input arrow to an output arrow; we know the output $B$ but not the input $X$. If the machine can be reversed, its undo button is $A^{-1}$, defined so that doing $A$ then $A^{-1}$ leaves you where you started. To get $X$ alone we left-multiplied $AX=B$ by $A^{-1}$ — *left*, because the $A^{-1}$ has to touch the $A$ it cancels — and out popped $X=A^{-1}B$. Finally, the warning: if the machine flattens the plane ($\det A=0$) you can't undo it. Then either the lines are parallel (no answer) or the very same line (endless answers). > [!mnemonic] > **Grid it, machine it, undo it: $X=A^{-1}B$ — but only if $\det A$ isn't zero.** --- ## Connections - [[Solving systems using matrix inversion]] — the parent recipe this page draws out. - [[Determinants]] — the $\det A$ that decides if the machine is reversible. - [[Adjoint and Inverse of a Matrix]] — how the undo machine $A^{-1}$ is actually built. - [[Cofactors and Minors]] — the ingredients inside $\operatorname{adj}(A)$. - [[Consistency of Linear Systems]] — the $\det A=0$ fork in Step 7. - [[Cramer's Rule]] — a sibling solver gated by the same $\det A\neq0$. - [[Gaussian Elimination]] — the practical alternative for big grids.