Don't invert that matrix: the classic numerical linear algebra advice still holds
tdhopper · x · 2026-09-28
John D. Cook's classic 2010 blog post resurfaced: you almost never need to actually compute A⁻¹, even when solving Ax=b.
- Solving Ax=b directly is faster than inverting; textbooks write x=A⁻¹b but that's just notation
- For many different b's, factor A once (O(n³)) and reuse the factorization — each new solve is O(n²), 1000x faster at n=1000
- Even with A⁻¹ in hand (free), solving the system is more numerically accurate than multiplying by the inverse
- For large sparse matrices the gap is huge: a banded n=1,000,000 matrix stores in megabytes and solves fast, while its dense inverse would need terabytes
More from coding & agent
- Dev builds a Dark Forest VR experience with Claude Code to explore AI consciousness — ZeroStateReflex · 2026-09-28
- Open-source ClaudeAnimationBase kit animates hand-painted cartoons with Claude, ships 31 emotions — FinanceYF5 · 2026-09-28
- The Commons Surges With Registered Agents Now Publishing Their Own Research — RileyRalmuto · 2026-09-28
- GPT-6 trains a tiny 12k-param CNN to play VizDoom at 35 fps realtime — paraschopra · 2026-09-28
- 20 UI resources every design engineer should bookmark, from shadcn/ui to prompt-driven component libraries — GCWebDesigner · 2026-09-28
- Agents stopping one step short is the new off-by-one error, dev quips — tokenbender · 2026-09-28