Course Webpage

Given the matrix

$$ A=\left(\begin{array}{crc} 1 & 1 & 3\\ 3 & 0 & 1\\ 1 & -2 & 1 \end{array}\right) $$

Find the inverse of $A$ by Gauss-Jordan method.


Introduction

Gauss-Jordan method

As in Gauss Elimination, Gauss-Jordan performs the following row reduction operations

  • Multiply a row by a real one and add it to another row: $r_{i}\rightarrow r_{i}+\lambda r_{j},\quad j\neq i$
  • Swap rows: $r_{i}\leftrightarrow r_{j}$ (if we use the pivoting)

And also

  • Multiply a row by a real number: $r_{i}\rightarrow \lambda r_{i}\quad \lambda \ne 0$

The method is similar to Gauss but the zeros are made above and below the pivot.

Now the objective is to go from any system to an equivalent diagonal system (non-zero elements only on the diagonal), which gives us the solution directly. For example, the equivalent diagonal system

$$ \left(\begin{array}{crc} 1 & 1 & 3\\ 3 & 0 & 1\\ 1 & -2 & 1 \end{array}\right) \left(\begin{array}{c} x\\ y\\ z \end{array}\right) = \left(\begin{array}{c} -2\\ -1\\ -3 \end{array}\right) \quad \Longleftrightarrow \quad \left(\begin{array}{crc} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{array}\right) \left(\begin{array}{c} x\\ y\\ z \end{array}\right) = \left(\begin{array}{r} 0\\ 1\\ -1 \end{array}\right) $$

And the solution is direct $$ x = 0 \quad y = 1 \quad z = -1 $$

To solve a single system, the Gaussian method is more efficient from the point of view of the number of operations. But when we solve several systems simultaneously with the same coefficient matrix, Gauss-Jordan can be more efficient. This is the case for the computation of the inverse matrix.

Calculating the inverse matrix

The inverse matrix of an $n\times n$ matrix $A$, if it exists, is a $n\times n$ matrix that we will call $A^{-1}$ that verifies

$$AA^{-1}=I=A^{-1}A.$$

That is

$$ A\,A^{-1}= \left(\begin{array}{cccc} a_{11} & a_{12} & \ldots & a_{1n}\\ a_{21} & a_{22} & \ldots & a_{2n}\\ \vdots & \vdots & \ddots & \vdots\\ a_{n1} & a_{n2} & \ldots & a_{nn} \end{array}\right) \left(\begin{array}{cccc} c_{11} & c_{12} & \ldots & c_{1n}\\ c_{21} & c_{22} & \ldots & c_{2n}\\ \vdots & \vdots & \ddots & \vdots\\ c_{n1} & c_{n2} & \ldots & c_{nn} \end{array}\right) = \left(\begin{array}{cccc} 1 & 0 & \ldots & 0\\ 0 & 1 & \ldots & 0\\ \vdots & \vdots & \ddots & \vdots\\ 0 & 0 & \ldots & 1 \end{array}\right)=I $$

By the definition of the product of matrices, we can write

$$ A \left(\begin{array}{c} c_{11} \\ c_{21} \\ \vdots \\ c_{n1} \end{array}\right) = \left(\begin{array}{cccc} 1 \\ 0 \\ \vdots \\ 0 \end{array}\right), \quad A \left(\begin{array}{c} c_{12} \\ c_{22} \\ \vdots \\ c_{n2} \end{array}\right) = \left(\begin{array}{cccc} 0 \\ 1 \\ \vdots \\ 0 \end{array}\right), \quad\dots\quad, A \left(\begin{array}{c} c_{1n} \\ c_{2n} \\ \vdots \\ c_{nn} \end{array}\right) = \left(\begin{array}{cccc} 0 \\ 0 \\ \vdots \\ 1 \end{array}\right) $$

That is, the columns of the inverse matrix are the solutions of these $n$ linear systems that share the same matrix of coefficients. Therefore, if we solve all these systems simultaneously and write the augmented matrix

$$\left(\begin{array}{cccc|cccc} a_{11} & a_{12} & \ldots & a_{1n} & 1 & 0 & \ldots & 0 \\ a_{21} & a_{22} & \ldots & a_{2n} & 0 & 1 & \ldots & 0\\ \vdots & \vdots & \ddots & \vdots &\vdots & \vdots & \ddots & \vdots \\ a_{n1} & a_{n2} & \ldots & a_{nn} &0 & 0 & \ldots & 1 \end{array}\right)$$

And we perform row operations so that the equivalent matrix is the diagonal identity matrix. The solutions will be the columns of the inverse matrix.

$$\left(\begin{array}{cccc|cccc} 1 & 0 & \ldots & 0 & c_{11} & c_{12} & \ldots & c_{1n} \\ 0 & 1 & \ldots & 0 & c_{21} & c_{22} & \ldots & c_{2n} \\ \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \ldots & 1 & c_{n1} & c_{n2} & \ldots & c_{nn} \end{array}\right)$$

We can summarize the process as

  • Write an array $n\times2n$ with the matrix $A$ to the left and the $n\times n$ identity matrix $I$ of dimension to the right $\left[A|I\right]$.
  • Using row operations, transform the matrix $A$ into the matrix $I$, so we go from $\left[A|I\right]$ to $\left[I|A^{-1}\right].$

Exercise

We write the matrix $\left[A|I\right]$. As the pivot is $\mathbf{{\color{red}1}}$ we left it as it is. We make zeros below the pivot in the first column.

$$ \begin{array}{c} r_{1}\\ r_{2}\\ r_{3} \end{array}\left(\begin{array}{rrr|rrr} {\mathbf{{\color{red}1}}} & 1 & 3 & 1 & 0 & 0\\ \mathbf{\color{blue}3} & 0 & 1 & 0 & 1 & 0\\ \mathbf{\color{ForestGreen}1} & -2 & 1 & 0 & 0 & 1 \end{array}\right) \begin{array}{rrl} r_{1}\\ r_{2} & = & r_{2}-\mathbf{\color{blue}3}r_{1}\\ r_3 & = & r_{3}-\mathbf{\color{ForestGreen}1}r_{1} \end{array} $$

Now the pivot is $\mathbf{{\color{red}{-3}}}$ and to convert it into $1$ we divide its row by it.

$$ \begin{array}{c} r_{1}\\ r_{2}\\ r_{3} \end{array}\left(\begin{array}{rrr|rrr} 1 & \mathbf{\color{blue}1} & 3 & 1 & 0 & 0\\ 0 & \mathbf{\color{red}{-3}} & -8 & -3 & 1 & 0\\ 0 & \mathbf{\color{ForestGreen}{-3}} & -2 & -1 & 0 & 1 \end{array}\right) \begin{array}{rrl} & &\\ r_{2} & = & r_{2}/(\mathbf{\color{red}{-3}})\\ & & \end{array} $$

We make zeros above and below the pivot $\mathbf{{\color{red}{1}}}$.

$$ \begin{array}{c} r_{1}\\ r_{2}\\ r_{3} \end{array}\left(\begin{array}{rrr|rrr} 1 & \mathbf{\color{blue}1} & 3 & 1 & 0 & 0\\ 0 & \mathbf{\color{red}{1}} & 8/3 & 1 & -1/3 & 0\\ 0 & \mathbf{\color{ForestGreen}{-3}} & -2 & -1 & 0 & 1 \end{array}\right) \begin{array}{rrl} r_{1} & = & r_{1}-\mathbf{\color{blue}1}r_{2}\\ r_{2}\\ r_3 & = & r_{3}-(\mathbf{\color{ForestGreen}{-3}})r_{2} \end{array} $$

Now the pivot is $\mathbf{{\color{red}{6}}}$ and to convert it to $1$ we divide its row by its value.

$$ \begin{array}{c} r_{1}\\ r_{2}\\ r_{3} \end{array}\left(\begin{array}{rrr|rrr} 1 & 0 & \mathbf{\color{blue}{1/3}} & 0 & 1/3 & 0\\ 0 & 1 & \mathbf{\color{ForestGreen}{8/3}} & 1 & -1/3 & 0\\ 0 & 0 & \mathbf{\color{red}6} & 2 & -1 & 1 \end{array}\right) \begin{array}{rrl} & &\\ & &\\ r_{3} & = & r_{3}/(\mathbf{\color{red}{6}}) \end{array} $$

We make zeros above the pivot $\mathbf{{\color{red}{1}}}$.

$$ \begin{array}{c} r_{1}\\ r_{2}\\ r_{3} \end{array}\left(\begin{array}{rrr|rrr} 1 & 0 & \mathbf{\color{blue}{1/3}} & 0 & 1/3 & 0\\ 0 & 1 & \mathbf{\color{ForestGreen}{8/3}} & 1 & -1/3 & 0\\ 0 & 0 & \mathbf{\color{red}1} & 1/3 & -1/6 & 1/6 \end{array}\right) \begin{array}{rrl} r_{1} & = & r_{1}-(\mathbf{\color{blue}{1/3}})\,r_{3}\\ r_{2}& = & r_{2}-(\mathbf{\color{ForestGreen}{8/3}})\,r_{3}\\ r_3 \end{array} $$

And we already have the identity matrix $I$ on the left

$$ \begin{array}{c} r_{1}\\ r_{2}\\ r_{3} \end{array}\left(\begin{array}{rrr|rrr} 1 & 0 & 0 & -1/9 & 7/18 & -1/18\\ 0 & 1 & 0 & 1/9 & 1/9 & -4/9\\ 0 & 0 & 1 & 1/3 & -1/6 & 1/6 \end{array}\right) $$

Since we already have the matrix $I$ on the left, the matrix on the right will be $A^{-1}$.

$$ A^{-1} = \left(\begin{array}{rrr} -1/9 & 7/18 & -1/18\\ 1/9 & 1/9 & -4/9\\ 1/3 & -1/6 & 1/6 \end{array}\right) $$