If A is nxn invertible matrix,
and the inverse is already computed:
x = A⁻¹b
If 2x2, just take the inverse and solve:
x = A⁻¹b
If 3x3 or higher, check if the RREF is already computed,
and if so, then just take the inverse and solve:
x = A⁻¹b
Otherwise, it is more efficient to decompose and then solve.
Use LU Decomposition and solve Ax = b.
LU Decomposition:
- Equation to solve: Ax = b
- LU Decomposition produces: PA = LU
- Substitute: LUx = Pb, or Pb = LUx
- Can rewrite as Pb = L(Ux)
- Can say y = Ux
- Then can rewrite as Pb = Ly
- Solve for y (we know Pb and L)
- Solve for x in y = Ux once we know y
Solving triangular systems Ly = Pb and Ux = y
- Solve for Ly = Pb using forward substitution
1 / ᵢ₋₁ \
yᵢ = --- | bᵢ - ∑ Lᵢⱼyⱼ |
Lᵢᵢ \ ʲ⁼¹ /
- Solve for Ux = y using back substitution
1 / m \
xᵢ = --- | yᵢ - ∑ Uᵢⱼxⱼ |
Uᵢᵢ \ ʲ⁼ⁱ⁺¹ /