# Examples

Example 1.

For a matrix

$$\mathbf{A} = \begin{bmatrix} 2 & 3 \\ 1 & 2 \end{bmatrix}$$

find $\mathbf{A^{-1}}$.

Solution:

$$\mathbf{[A|I]} =\left[\begin{array}{cc|cc} 2 & 3 & 1 & 0 \\ 1 & 2 & 0 & 1 \end{array} \right] \sim^{1} \left[\begin{array}{cc|cc} 1 & 2 & 0 & 1 \\ 2 & 3 & 1 & 0 \end{array} \right] \sim^{2} \left[\begin{array}{cc|cc} 1 & 2 & 0 & 1 \\ 0 & -1 & 1 & -2 \end{array} \right] \sim^{3}$$

$$\sim^{3} \left[\begin{array}{cc|cc} 1 & 0 & 2 & -3 \\ 0 & -1 & 1 & -2 \end{array} \right] \sim^{4} \left[\begin{array}{cc|cc} 1 & 0 & 2 & -3 \\ 0 & 1 & -1 & 2 \end{array} \right] = \mathbf{[I|A^{-1}]}.$$

In the order, we apply the following transformations:

(1.) interchange the first and the second row,

(2.) the first row multiplied by $-2$ added to second row.

(3.) the second row multiplied by $2$ added to first row,

(4.) the first row multiplied by $-1$.

An inverse matrix of the given matrix $\mathbf{A}$ is

$$\mathbf{A^{-1}}= \begin{bmatrix} 2 & -3 \\ -1 & 2 \end{bmatrix}.$$

Example 2.

Using the elementary transformations of matrices, find the inverse matrix of matrix

$$\mathbf{A} = \begin{bmatrix} 1 & -1 & 2 \\ 1 & 2 & -1\\ -4 & 4 & 1\end{bmatrix}.$$

Solution:

With $R_i$ we will denote a row in which we perform elementary transformations.

\mathbf{[A|I]} =\left[\begin{array}{ccc|ccc} 1 & -1 & 2 & 1 & 0 & 0 \\ 1 & 2 & -1 & 0 & 1 & 0 \\ -4 & 4 & 1 & 0 & 0 & 1\end{array} \right]\begin{aligned} \xrightarrow{-1R_1 + R_2}\\ \xrightarrow{4R_1 + R_2} \end{aligned} $\left[\begin{array}{ccc|ccc} 1 & -1 & 2 & 1 & 0 & 0 \\ 0 & 3 & -3 & -1 & 1 & 0 \\ 0 & 0 & 9 & 4 & 0 & 1 \\ \end{array} \right]$

\begin{aligned} &\xrightarrow{\frac{1}{3} \cdot R_2}\\&\xrightarrow{\frac{1}{9} \cdot R_3}\end{aligned}\left[\begin{array}{ccc|ccc} 1 & -1 & 2 & 1 & 0 & 0 \\ 0 & 1 & -1 & -\frac{1}{3} & \frac{1}{3} & 0 \\ 0 & 0 & 1 & \frac{4}{9} & 0 & \frac{1}{9} \end{array} \right]\begin{aligned}\xrightarrow{R_3 + R_2}\\\xrightarrow{-2R_3+R_1}\end{aligned}\left[\begin{array}{ccc|ccc} 1 & -1 & 0 & \frac{1}{9} & 0 & -\frac{2}{9} \\ 0 & 1 & 0 & \frac{1}{9} & \frac{1}{3} & \frac{1}{9} \\ 0 & 0 & 1 & \frac{4}{9} & 0 & \frac{1}{9} \end{array} \right]

\begin{aligned}\xrightarrow{R_2+R_1}\end{aligned}\left[\begin{array}{ccc|ccc} 1 & 0 & 0 & \frac{2}{9} & \frac{1}{3} & -\frac{1}{9} \\ 0 & 1 & 0 & \frac{1}{9} & \frac{1}{3} & \frac{1}{9} \\ 0 & 0 & 1 & \frac{4}{9} & 0 & \frac{1}{9} \end{array} \right].

Therefore, an inverse matrix of a matrix $\mathbf{A}$ is

$$\mathbf{A^{-1}} = \begin{bmatrix} \frac{2}{9} & \frac{1}{3} & -\frac{1}{9} \\ \frac{1}{9} & \frac{1}{3} & \frac{1}{9} \\ \frac{4}{9} & 0 & \frac{1}{9} \end{bmatrix}.$$

Example 3.

Solve the following system of equations by using the Cramer’s rule:

$$x_1 + 2x_2 – x_3 + x_4 = -1,$$

$$2x_1 + 5x_2 – x_3 + 2x_4 = -2,$$

$$3x_1 – x_2 – 2x_3 + x_4 = 5,$$

$$x_1 – x_2 + 3x_3 – 5x_4 = 6.$$

Solution:

Firstly, we write the system in a matrix form:

$$\begin{bmatrix} 1 & 2 & -1 & 1 \\ 2 & 5 & -1 & 2\\ 3 & -1 & -2 & 1 \\ 1 & -1 & 3 & -5 \end{bmatrix} \cdot \begin{bmatrix} x_1 \\ x_2\\ x_3 \\ x_4 \end{bmatrix} = \begin{bmatrix} -1 \\ -2\\ 5 \\ 6 \end{bmatrix}.$$

Let a matrix $\mathbf{A}$ be a matrix of the system above, that is

$$\mathbf{A} =\begin{bmatrix} 1 & 2 & -1 & 1 \\ 2 & 5 & -1 & 2\\ 3 & -1 & -2 & 1 \\ 1 & -1 & 3 & -5 \end{bmatrix}.$$

The determinant of a matrix $\mathbf{A}$ is $D = det (\mathbf{A}) = -34$ (check it!).

Now we need to calculate the determinant $D_1$ of a matrix $\mathbf{A_1}$ in which the first column is replaced with the column matrix of free coefficients, that is

$$\mathbf{A_1} = \begin{bmatrix} -1 & 2 & -1 & 1 \\ -2 & 5 & -1 & 2\\ 5 & -1 & -2 & 1 \\ 6 & -1 & 3 & -5 \end{bmatrix}.$$

The determinant of a matrix $\mathbf{A_1}$ is $D_1 = -68$.

Analogously we treat for the remaining columns of the matrix $\mathbf{A}$ – determinants of matrices that we get, in the order amounts $D_2 = 34$, $D_3 = -34$, $D_4 = 0$. According to the Cramer’s rule, we get the final solutions:

$$x_1 = \frac{D_1}{D} = \frac{-68}{-34} = 2,$$

$$x_2 = \frac{D_2}{D} = \frac{34}{-34} = -1,$$

$$x_3 = \frac{D_3}{D} = \frac{-34}{-34} = 1,$$

$$x_4 = \frac{D_4}{D} = \frac{0}{-34} = 0.$$

Therefore, the solution of a given system of equations is ordered 4 – tuple: $(2, -1, 1, 0)$.

Example 4.

Using the elementary transformations, solve the following system of equations:

$$x_1 + 2x_2 + 2x_3 + 3x_4 + x_5 = 3,$$

$$2x_1 – x_3 – x_4 + 5x_5 = 2,$$

$$x_1 + 2x_2 + 6x_3 – x_4 + 5x_5 = 3,$$

$$x_1 – 2x_2 + 5x_3 – 12x_4 + 12x_5 = -1.$$

Solution:

\left[\begin{array}{ccccc|c} 1 & 2 & 2 & 3 & 1 & 3 \\ 2 & 0 & -1 & -1 & 5 & 2 \\ 1 & 2 & 6 & -1 & 5 & 3 \\ 1 & -2 & 5 & -12 & 12 & -1 \end{array} \right]\begin{aligned} \xrightarrow{-2 \cdot R_1 + R_2}\\ \xrightarrow{-1 \cdot R_1+R_3} \\\xrightarrow{-1 \cdot R_1+R_4}\end{aligned} $\left[\begin{array}{ccccc|c} 1 & 2 & 2 & 3 & 1 & 3 \\ 0 & -4 & -5 & -7 & 3 & -4 \\ 0 & 0 & 4 & -4 & 4 & 0 \\ 0 & -4 & 3 & -15 & 11 & -4 \end{array} \right]$

\begin{aligned}\xrightarrow{1/4 \cdot R_3}\\\end{aligned}\left[\begin{array}{ccccc|c} 1 & 2 & 2 & 3 & 1 & 3 \\ 0 & -4 & -5 & -7 & 3 & -4 \\ 0 & 0 & 1 & -1 & 1 & 0 \\ 0 & -4 & 3 & -15 & 11 & -4 \end{array} \right]\begin{aligned}\xrightarrow{-1 \cdot R_3 + R_1}\\\xrightarrow{5 \cdot R_3 + R_2}\\\xrightarrow{-3 \cdot R_3 + R_4}\\\end{aligned}\left[\begin{array}{ccccc|c} 1 & 2 & 0 & 5 & -1 & 3 \\ 0 & -4 & 0 & -12 & 8 & -4 \\ 0 & 0 & 1 & -1 & 1 & 0 \\ 0 & -4 & 0 & -12 & 8 & -4 \end{array} \right]

\begin{aligned}\xrightarrow{-1/4 \cdot R_2}\\\xrightarrow{-1/4 \cdot R_4}\\\xrightarrow{R_4 + R_2}\\\xrightarrow{-2 \cdot R_4 + R_1}\\\end{aligned}\left[\begin{array}{ccccc|c} 1 & 0 & 0 & -1 & 3 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & -1 & 1 & 0 \\ 0 & 1 & 0 & 3 & -2 & 1 \end{array} \right]\begin{aligned}\xrightarrow{R_2 \leftrightarrow R_4}\end{aligned}\left[\begin{array}{ccccc|c} 1 & 0 & 0 & -1 & 3 & 1 \\ 0 & 1 & 0 & 3 & -2 & 1 \\ 0 & 0 & 1 & -1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \end{array} \right]

The rank of a matrix $\mathbf{A}$ (matrix of the system) and augmented matrix is $3$. Therefore, the solution depends on the two free parameters. We have (from the system above):

$$x_1 – x_4 + 3x_5 = 1,$$

$$x_2 + 3x_4 – 2x_5 = 1,$$

$$x_3 – x_4 + x_5 = 0.$$

If $x_4 = t$ and $x_5 = s$; $t, s \in \mathbb{R}$, then

$$x_1 =1 + t – 3s,$$

$$x_2 = 1 -3 t + 2s,$$

$$x_3 = t – s.$$

We can write the solution in a matrix form:

$$\begin{bmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5 \end{bmatrix} = \begin{bmatrix} 1 + t – 3s \\ 1 – 3t + 2s \\ t – s \\t \\ s \end{bmatrix} = t \begin{bmatrix} 1 \\ -3 \\ 1 \\ 1 \\ 0 \end{bmatrix} + s \begin{bmatrix} -3 \\ 2 \\ -1 \\ 0 \\ 1 \end{bmatrix} + \begin{bmatrix} 1 \\ 1 \\ 0 \\ 0\\ 0 \end{bmatrix}.$$

Example 5.

Solve the following system of equations:

$$15 x_1 + 2x_2 + 7x_4 = -1,$$

$$x_2 + 2x_3 + 5x_4 = -1,$$

$$2x_1 + 4x_2 + 7x_3 – 2x_4 = 0,$$

$$x_2 + 2x_3 + 5x_4 = 3.$$

Solution:\left[\begin{array}{cccc|c} 15 & 2 & 0 & 7 & -1 \\ 0 & 1 & 2 & 5 & -1 \\ 2 & 4 & 7 & -2 & 0 \\ 0 & 1 & 2 & 5 & 3 \end{array} \right]\begin{aligned}\xrightarrow{R_2 – R_4}\end{aligned}\left[\begin{array}{cccc|c} 15 & 2 & 0 & 7 & -1 \\ 0 & 1 & 2 & 5 & -1 \\ 2 & 4 & 7 & -2 & 0 \\ 0 & 0 & 0 & 0 & -4 \end{array} \right]

The $4$-th row gives the equation $0=-4$, which is not possible. Therefore, the given system of equations does not have solutions.