04 Solving systems of linear equations
The inverse-matrix method
- Write the system as AX = B, then X = A⁻¹B, provided det A ≠ 0.
- Example: 2x + 3y = 7 and x − 2y = −7.
A = [[2, 3], [1, −2]], det A = −4 − 3 = −7, A⁻¹ = (−1/7)[[−2, −3], [−1, 2]]. - X = A⁻¹B = (−1/7)[[−2·7 + (−3)(−7)], [−1·7 + 2(−7)]] = (−1/7)[[7], [−21]] = [[−1], [3]], so x = −1 and y = 3.
Cramerx27;s rule
- For AX = B with det A ≠ 0: x = Dx/D, y = Dy/D, z = Dz/D, where D = det A and Dx is D with the x-column replaced by B.
- Same system: D = −7, Dx = |[[7, 3], [−7, −2]]| = −14 + 21 = 7 → x = 7/(−7) = −1.
- Dy = |[[2, 7], [1, −7]]| = −14 − 7 = −21 → y = (−21)/(−7) = 3.
- Both methods give the same answer; Cramerx27;s rule is faster for a single unknown, the inverse method is better when several right-hand sides share the same A.
Interpreting the determinant
1≠ 0
System AX = B
- Unique solution
2= 0 and consistent
System AX = B
- Infinitely many solutions
3= 0 and inconsistent
System AX = B
- No solution