Writing many equations as , solving them with the two formulas from school, measuring vectors and matrices with norms, and discovering why the formulas break down for real problems.
Kirchhoff's voltage law around each loop of a three-loop circuit gives three equations for the loop currents (amperes).
Find . Then ask: how would the same method cope with 25 loops, or 25 000?
Module 2: Newton for systems needs a linear solve at every step.
Linear systems on their own: the school formulas, their cost, and how sensitive the answer is.
input A (n×n), b
D ← det(A)
if D = 0: stop (singular)
for i = 1 … n:
Aᵢ ← A with column i := b
x[i] ← det(Aᵢ) / D
return x
det(M): # cofactor expansion
if size 1: return m₁₁
return Σⱼ (−1)^(1+j) m₁ⱼ det(M₁ⱼ)The recursion in det is where all the work goes: one call of size makes calls of size .
input A (n×n), b
D ← det(A)
if D = 0: stop (singular)
for i, j = 1 … n:
C[i][j] ← (−1)^(i+j) · det(minor(A, i, j))
Ainv ← transpose(C) / D
for i = 1 … n:
x[i] ← Σⱼ Ainv[i][j] · b[j]
return xcofactors, each a determinant of size : even more work than Cramer for one right-hand side.
Below the smallest double (, Lecture 2), so the computer stores 0 and Cramer reports "singular". Yet the system is trivial: .
Overflows to infinity, and every becomes = NaN. The size of the determinant says nothing useful about the system.
Even with a good method for the inverse, it costs about operations, three times elimination, and adds extra rounding errors. Numerical analysts rarely form .
A small determinant does not mean trouble, and a large one does not mean safety. What does measure trouble? The condition number, next.
Cramer's rule: operations, years at operations per second. Elimination: 11 325 operations, about 11 µs. Real circuit simulators (SPICE) solve systems with thousands of unknowns many times per second.
det3 is cofactor expansion along row 1inv[j][i])Rule of thumb: formulas for 2×2 and 3×3 on paper; elimination for everything a computer solves.
| Method | Operations (about) | New costs | Best for | ||
|---|---|---|---|---|---|
| Cramer (cofactors) | 59 | impossible | everything again | 2×2, 3×3 by hand | |
| Adjugate inverse | ≈ 65 | impossible | tiny matrices, formulas | ||
| Gaussian elimination | 28 | 0.67 s | one system (L12) | ||
| LU factorisation | once | 28 | 0.67 s | many right-hand sides (L13) | |
| Jacobi, Gauss–Seidel | per sweep nonzeros | — | fast if sparse | iterate again | huge sparse systems (L14) |
Times assume operations per second. "Impossible" means more than years.
The formulas are exact but hopelessly slow, and blind to floating point. Each limitation has a fix:
Click a card: each one solves a small linear system, or inverts a matrix, at a specific step.
Where exactly: the mesh-current method of circuit analysis. Each loop gives one linear equation; the coefficient matrix is symmetric (shared resistors appear twice).
Change the 12 V source (top-right number) and watch all three currents change. Real simulators do the same with elimination (Lecture 12).
Where exactly: fitting to data. Least squares (Lecture 23) gives a 2×2 system, the normal equations; solving it by Cramer gives the formula in every statistics book.
| data | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| data | 2 | 3 | 5 | 6 |
, , , , . , , : the line .
Where exactly: image warping (rotate, shear, scale). To fill output pixel , the program looks up input pixel ; the 2×2 inverse formula is applied for every pixel.
Here the inverse is worth computing: the same tiny matrix is used millions of times.
Where exactly: the Hill cipher, a classic matrix cipher. Letters become numbers (A = 0, …, Z = 25); pairs are multiplied by a key matrix mod 26. Decryption needs mod 26, built with the adjugate formula.
The adjugate formula works in modular arithmetic, where Gaussian elimination with decimals would not.
Cramer: , , , so A. The inverse gives the same. For 25 loops, Cramer would need years: we need elimination.
Gaussian and Gauss–Jordan elimination. The systematic version of school elimination: operations, and pivoting to protect against rounding.