Inverse matrix: method of Gaussian elimination

The calculation of the inverse matrix is an indispensable tool in linear algebra.

Given the matrix $$A$$, its inverse $$A^{-1}$$ is the one that satisfies the following:

$$$A\cdot A^{-1}=I$$$

where $$I$$ is the identity matrix, with all its elements being zero except those in the main diagonal, which are $$1$$.

Let be the matrix:

$$$A=\left( \begin{array}{ccc} 1 & 1 & 0 \\ 1 & 0 & 1 \\ 0 & 1 & 0 \end{array} \right)$$$

How can we find the inverse matrix using the Gaussian elimination method?

1) The identity matrix is added to matrix $$A$$.

$$$\left( \begin{array}{cccccc} 1 & 1 & 0 & 1 & 0 & 0\\ 1 & 0 & 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 0 & 0 & 1 \end{array} \right)$$$

(Note that $$I=\left( \begin{array}{ccc} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{array} \right)$$)

2) By means of the Gaussian method, we will try to pass the identity matrix to the left side. The matrix that will remain on the right side will be the inverse matrix. That is, we want to obtain

$$$\left( \begin{array}{cccccc} 1 & 0 & 0 & \fbox{ } & \fbox{ } & \fbox{ }\\ 0 & 1 & 0 & \fbox{ } & \fbox{ } & \fbox{ }\\ 0 & 0 & 1 & \fbox{ } & \fbox{ } & \fbox{ } \end{array} \right)$$$

The elements that will end in the empty spaces will form the inverse matrix $$A^{-1}$$.

What is the inverse of the following matrix?

$$$A=\left( \begin{array}{ccc} 1 & 1 & 0 \\ 1 & 0 & 1 \\ 0 & 1 & 0 \end{array} \right)$$$

We must follow the procedure step by step.

1) First of all the identity matrix is added to the right of the original matrix:

$$$\left( \begin{array}{cccccc} 1 & 1 & 0 & 1 & 0 & 0\\ 1 & 0 & 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 0 & 0 & 1 \end{array} \right)$$$

2) We have to "move" the identity matrix to the left by means of the Gaussian method.

This method needs some intuition since it is not an exact guideline. Anyway, intuition can be replaced by practice and the Gaussian method ends up being much easier than it seems at first.

$$$\left( \begin{array}{cccccc} 1 & 1 & 0 & 1 & 0 & 0\\ 1 & 0 & 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 0 & 0 & 1 \end{array} \right) \rightarrow (row2-row1)\rightarrow \left( \begin{array}{cccccc} 1 & 1 & 0 & 1 & 0 & 0\\ 0 & -1 & 1 & -1 & 1 & 0\\ 0 & 1 & 0 & 0 & 0 & 1 \end{array} \right)$$$

$$$\left( \begin{array}{cccccc} 1 & 1 & 0 & 1 & 0 & 0\\ 0 & -1 & 1 & -1 & 1 & 0\\ 0 & 1 & 0 & 0 & 0 & 1 \end{array} \right) \rightarrow (row3+row2)\rightarrow \left( \begin{array}{cccccc} 1 & 1 & 0 & 1 & 0 & 0\\ 0 & -1 & 1 & -1 & 1 & 0\\ 0 & 0 & 1 & -1 & 1 & 1 \end{array} \right)$$$

$$$\left( \begin{array}{cccccc} 1 & 1 & 0 & 1 & 0 & 0\\ 0 & -1 & 1 & -1 & 1 & 0\\ 0 & 0 & 1 & -1 & 1 & 1 \end{array} \right) \rightarrow (row2-row3)\rightarrow \left( \begin{array}{cccccc} 1 & 1 & 0 & 1 & 0 & 0\\ 0 & -1 & 0 & 0 & 0 & -1\\ 0 & 0 & 1 & -1 & 1 & 1 \end{array} \right)$$$

$$$\left( \begin{array}{cccccc} 1 & 1 & 0 & 1 & 0 & 0\\ 0 & -1 & 0 & 0 & 0 & -1\\ 0 & 0 & 1 & -1 & 1 & 1 \end{array} \right) \rightarrow (row1+row2)\rightarrow \left( \begin{array}{cccccc} 1 & 0 & 0 & 1 & 0 & -1\\ 0 & -1 & 0 & 0 & 0 & -1\\ 0 & 0 & 1 & -1 & 1 & 1 \end{array} \right)$$$

Finally, $$row2$$ is multiplied by $$(-1)$$ and so we have the identity to the left.

$$$\left( \begin{array}{cccccc} 1 & 0 & 0 & 1 & 0 & -1\\ 0 & -1 & 0 & 0 & 0 & -1\\ 0 & 0 & 1 & -1 & 1 & 1 \end{array} \right) \rightarrow ((-1)\cdot row2)\rightarrow \left( \begin{array}{cccccc} 1 & 0 & 0 & 1 & 0 & -1\\ 0 & 1 & 0 & 0 & 0 & 1\\ 0 & 0 & 1 & -1 & 1 & 1 \end{array} \right)$$$

And we can identify:

$$$A^{-1}=\left( \begin{array}{ccc} 1 & 0 & -1\\ 0 & 0 & 1\\ -1 & 1 & 1 \end{array} \right)$$$

Check:

It is recommended to check after the calculation because errors are frequent. To do this we will use the definition of the inverse matrix itself:

$$$A\cdot A^{-1}=\left( \begin{array}{ccc} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{array} \right)$$$

Indeed, it is verified:

$$$\left( \begin{array}{ccc} 1 & 1 & 0\\ 1 & 0 & 1\\ 0 & 1 & 0 \end{array} \right)\cdot\left( \begin{array}{ccc} 1 & 0 & -1\\ 0 & 0 & 1\\ -1 & 1 & 1 \end{array} \right)=\left( \begin{array}{ccc} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{array} \right)$$$