Matrix Inverse Algorithm

Algorithm
The purpose of this algorithm is to convert a matrix into its inverse, or to determine that such an inverse does not exist.

Let $\mathbf A$ be the $n \times n$ square matrix in question.

Let $\mathbf I$ be the unit matrix of order $n$.


 * Step $0$: Create the augmented matrix $\begin {bmatrix} \mathbf A & \mathbf I \end {bmatrix}$.


 * Step $1$: Perform elementary row operations until $\begin {bmatrix} \mathbf A & \mathbf I \end {bmatrix}$ is in reduced row echelon form.

Call this new augmented matrix $\begin {bmatrix} \mathbf H & \mathbf C \end {bmatrix}$.


 * Step $2$:


 * If $\mathbf H = \mathbf I$, then take $\mathbf C = \mathbf A^{-1}$.


 * If $\mathbf H \ne \mathbf I$, $\mathbf A$ is not invertible.

Proof
Follows from Transformation of Unit Matrix into Inverse and Matrix is Row Equivalent to Reduced Echelon Matrix.