Inverting a matrix feels like magic until you see what it's actually doing: solving n systems of equations at once by row-reducing a doubled matrix. The method is mechanical, and once you see it, you don't forget it.
The setup
Take your matrix A and write the identity next to it — [A | I]. Now row-reduce until the left side becomes the identity. The right side is A⁻¹. That's the whole method: Gaussian elimination on a wider matrix.
[A | I] → row operations → [I | A⁻¹]Every operation that turns A into I, applied to I, produces the inverse — because A⁻¹ is literally "the operations that undo A," and I is just where we track them.
Why it works
Row operations are left-multiplications by elementary matrices. Doing enough of them to get A → I means their product is A⁻¹ by definition. Applying the same product to I gives you A⁻¹. The trick is that you're computing the inverse without ever writing it down in advance.
When it breaks
A matrix with no inverse — singular, determinant zero — just won't reduce to I. You'll hit a row of zeros. That's the determinant doing its job: it detects linearly dependent rows, which is exactly what "no inverse exists" means. On a computer, use numpy.linalg.inv and accept that floating-point will give you nearly-zero instead of zero.
$ tail -f /forums
Discussion
Comments live on the community forums — sign in there to reply.