Worked example

a: 1	2
3	4
det(A) = −2
A⁻¹ = (1/−2) × [[4, −2], [−3, 1]]

→ [[-2,1],[1.5,-0.5]]

Method and scope

Square matrices use pivoted Gauss–Jordan elimination on [A|I]. Singular or numerically unreliable results are rejected. The residual ‖AA⁻¹−I‖∞ and condition estimate κ∞ are shown. Large κ means input rounding may greatly affect the inverse.

[A | I] → [I | A⁻¹]; κ∞ = ‖A‖∞‖A⁻¹‖∞

Sources