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 identity matrix of order $n$.


 * Step 0: Create the augmented matrix $\left[{\mathbf{A} | \mathbf{I}}\right]$.


 * Step 1: Perform elementary row operations until $\left[{\mathbf{A} | \mathbf{I}}\right]$ is in reduced row echelon form. Call this new augmented matrix $\left[{\mathbf{H} | \mathbf{C}}\right]$


 * 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 Identity Matrix into Inverse and Matrix Row Equivalent to Reduced Echelon Matrix.