Matrix equations: multiply by the inverse, on the correct side
Why this matters
There's no dividing by a matrix. To free X from AX = B, you multiply both sides by A⁻¹, the matrix that undoes A. Since AB and BA are usually different, A⁻¹ has to go on the same side as A. You'll use that move on systems, the eigenvalue equation, a model's best weights and a layer run backward, and check its conditions each time.
- Free X from AX = B or XA = B by multiplying by A⁻¹ on the side where A is, and show that the other side gives a wrong answer
- Undo sums and number multiples as usual, and flip the order to undo a product: (AB)⁻¹ = B⁻¹A⁻¹ and (AB)ᵀ = BᵀAᵀ
- State the conditions: a square matrix, a determinant that isn't 0, and shapes that fit
- Rearrange Ax = λx into det(A − λI) = 0, and say why that determinant must be 0
- Solve with np.linalg.solve, check with np.allclose, and turn around the normal equations and a linear layer
The math: undo a matrix from the side it's on
Purpose. Free an unknown matrix or vector from a matrix equation, and know when you can.
The inverse A⁻¹ undoes A: A⁻¹A = AA⁻¹ = I (lesson 59). The identity I changes nothing: IX = X (lesson 57). And order matters: AB and BA are usually different (lesson 56).
So there's no dividing by a matrix: "B ÷ A" could mean A⁻¹B or BA⁻¹. Instead, multiply both sides by A⁻¹, on the side where A is:
| Equation | X on its own |
|---|---|
| A + X = B | X = B − A: take A away |
| kX = B | X = B/k: divide by the number k (k not 0) |
| AX = B | X = A⁻¹B: A⁻¹ on the left, where A is |
| XA = B | X = BA⁻¹: A⁻¹ on the right, where A is |
| Xᵀ = B | X = Bᵀ: transpose both sides |
On A's side, A⁻¹ meets A and cancels it: A⁻¹AX = IX = X. On the far side, the two never meet.