Matrix inversion (source code)

= Matrix inversion

<Matrix inversion> computes the <matrix inverse> $A^{-1}$ of a square <matrix> satisfying $AA^{-1}=A^{-1}A=I$. It is possible exactly when $A$ has full <rank>. One method applies <Gauss-Jordan elimination> to $[A\mid I]$; another factors $A$ and solves a <linear system> for each column of $I$.

For $A=\left(\begin{smallmatrix}a&b\\c&d\end{smallmatrix}\right)$ with $ad-bc\ne0$, the inverse is $(ad-bc)^{-1}\left(\begin{smallmatrix}d&-b\\-c&a\end{smallmatrix}\right)$. To solve a single numerical system $Ax=b$, a factorization followed by triangular solves is usually preferable to explicitly forming the inverse. A large <condition number> can amplify input errors regardless of the inversion method.