3.5. Matrix inversion#
3.5.1. Motivation and definition#
Gauss-Jordan elimination works well for solving Ax = b, but the process needs to be repeated for every new b. Is there an alternative if we need to solve Ax = b for many different b?
A matrix is called nonsingular or invertible if it has an inverse, but singular if it does not.
If the inverse of A exists, it is unique and can be used to solve Ax = b.
Finding the inverse of A is usually hard. There is a general definition based on cofactors, as well as advanced numerical methods, that we will not cover. Instead, we focus on two options: a formula for 2 x 2 matrices, and use of Gauss-Jordan elimination for larger matrices.
3.5.2. Inverse of a 2 x 2 matrix#
For a 2 x 2 matrix,
the matrix inverse is
(Flip a and d, change the signs of b and c.)
Example: 2 x 2 inverse
To find the inverse of
First, compute its determinant:
Then, compute its inverse
3.5.3. Inverses using Gauss-Jordan elimination#
For larger matrices, we can use Gauss–Jordan elimination to solve \(\vv{A} \vv{A}^{-1} = \vv{I}\) as a generalization of Ax = b.
Check that \(|\vv{A}| \ne 0\) (i.e., A is invertible).
Form the 2n x n augmented matrix \([ \vv{A} \, | \, \vv{I} ]\)
Perform row operations to bring to \([ \vv{I} \, | \, \vv{A}^{-1} ]\).
3.5.4. Skill builder problems#
Solve using matrix inversion or explain why this is not possible:
(3.42)#\[\begin{align} 5x_1 - 2x_2 &= 20.9 \\ -x_1 + 4x_2 &= -19.3 \end{align}\]Solution
First, write in matrix form Ax = b with:
(3.43)#\[\begin{equation} \vv{A} = \begin{bmatrix} 5 & -2 \\ -1 & 4 \end{bmatrix} \qquad \vv{b} = \begin{bmatrix} 20.9 \\ -19.3 \end{bmatrix} \end{equation}\]Then, evaluate \(|\vv{A}|\) to check if an inverse exists:
(3.44)#\[\begin{equation} |\vv{A}| = (5 \cdot 4) - (-1 \cdot -2) = 18 \end{equation}\]\(|\vv{A}| \ne 0\), so an inverse can be found using the formula for a 2x2 matrix:
(3.45)#\[\begin{equation} \vv{A}^{-1} = \frac{1}{18} \begin{bmatrix} 5 & -2 \\ -1 & 4 \end{bmatrix} \end{equation}\]Last, solve for x:
(3.46)#\[\begin{align} \vv{x} = \vv{A}^{-1}\vv{b} &= \frac{1}{18} \begin{bmatrix} 5 & -2 \\ -1 & 4 \end{bmatrix} \begin{bmatrix} 20.9 \\ -19.3 \end{bmatrix} \\ &= \frac{1}{18} \begin{bmatrix} 4 \cdot 20.9 + 2 \cdot -19.3 \\ 1 \cdot 20.9 + 5 \cdot -19.3 \end{bmatrix} \\ &= \begin{bmatrix} 2.5 \\ -4.2 \end{bmatrix} \end{align}\]Therefore, \(x_1 = 2.5\) and \(x_2 = -4.2\).
Solve using matrix inversion or explain why this is not possible:
(3.47)#\[\begin{align} x_1 + 4x_2 = 8 \\ 2x_1 + 8x_2 = 17 \end{align}\]Solution
First, write in matrix form Ax = b with:
(3.48)#\[\begin{equation} \vv{A} = \begin{bmatrix} 1 & 4 \\ 2 & 8 \end{bmatrix} \qquad \vv{b} = \begin{bmatrix} 8 \\ 17 \end{bmatrix} \end{equation}\]Then, evalaute \(|\vv{A}|\) to check if an inverse exists:
(3.49)#\[\begin{equation} |\vv{A}| = (1 \cdot 8) - (2 \cdot 4) = 0 \end{equation}\]A is singular because \(|\vv{A}| = 0\), so these equations cannot be solved using an inverse.
Solve using matrix inversion or explain why this is not possible:
(3.50)#\[\begin{align} x_2 + x_3 = -2 \\ 4x_2 + 6x_3 = -12 \\ x_1 + x_2 + x_3 = 2 \end{align}\]Solution
First, write in matrix form Ax = b with:
(3.51)#\[\begin{equation} \vv{A} = \begin{bmatrix} 0 & 1 & 1 \\ 0 & 4 & 6 \\ 1 & 1 & 1 \end{bmatrix} \qquad \vv{b} = \begin{bmatrix} -2 \\ -12 \\ 2 \end{bmatrix} \end{equation}\]Then, evaluate \(|\vv{A}|\) to check if an inverse exists:
(3.52)#\[\begin{align} |\vv{A}| = 0 \cdot \begin{vmatrix} 4 & 6 \\ 1 & 1 \end{vmatrix} -1 \cdot \begin{vmatrix} 0 & 6 \\ 1 & 1 \end{vmatrix} + 1 \cdot \begin{vmatrix} 0 & 4 \\ 1 & 1 \end{vmatrix} \end{align}\](3.53)#\[\begin{equation} |\vv{A}| = -1 \cdot (0-6) + 1 \cdot (0-4) = 2 \end{equation}\]Since \(|\vv{A}| \ne 0\), A is invertible. Use Gauss-Jordan elimination to find the inverse. Start with the augmented matrix \([\vv{A} | \vv{I}]\), then rearrange the rows
(3.54)#\[\begin{align} \begin{bmatrix} 0 & 1 & 1 & 1 & 0 & 0 \\ 0 & 4 & 6 & 0 & 1 & 0 \\ 1 & 1 & 1 & 0 & 0 & 1 \end{bmatrix} &\to \begin{bmatrix} 1 & 1 & 1 & 0 & 0 & 1 \\ 0 & 1 & 1 & 1 & 0 & 0 \\ 0 & 4 & 6 & 0 & 1 & 0 \end{bmatrix} \begin{matrix} \vphantom{R_1} \\ \vphantom{R_1} \\ -4 R_1 \end{matrix} \\ &\to \begin{bmatrix} 1 & 1 & 1 & 0 & 0 & 1 \\ 0 & 1 & 1 & 1 & 0 & 0 \\ 0 & 0 & 2 & -4 & 1 & 0 \end{bmatrix} \begin{matrix} \vphantom{R_1} \\ \vphantom{R_1} \\ \div 2 \end{matrix} \\ &\to \begin{bmatrix} 1 & 1 & 1 & 0 & 0 & 1 \\ 0 & 1 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & -2 & 0.5 & 0 \end{bmatrix} \begin{matrix} -R_3 \\ -R_3 \\ \vphantom{R_1} \end{matrix} \\ &\to \begin{bmatrix} 1 & 1 & 0 & 2 & -0.5 & 1 \\ 0 & 1 & 0 & 3 & -0.5 & 0 \\ 0 & 0 & 1 & -2 & 0.5 & 0 \end{bmatrix} \begin{matrix} -R_2 \\ \vphantom{R_1} \\ \vphantom{R_1} \end{matrix} \\ &\to \begin{bmatrix} 1 & 0 & 0 & -1 & 0 & 1 \\ 0 & 1 & 0 & 3 & -0.5 & 0 \\ 0 & 0 & 1 & -2 & 0.5 & 0 \end{bmatrix} \end{align}\]Hence,
(3.55)#\[\begin{align} \vv{A}^{-1} = \begin{bmatrix} -1 & 0 & 1 \\ 3 & -0.5 & 0 \\ -2 & 0.5 & 0 \end{bmatrix} \end{align}\]and
(3.56)#\[\begin{align} \vv{x} = \vv{A}^{-1} \vv{b} &= \begin{bmatrix} -1 & 0 & 1 \\ 3 & -0.5 & 0 \\ -2 & 0.5 & 0 \end{bmatrix} \begin{bmatrix} -2 \\ -12 \\ 2 \end{bmatrix} \\ & = \begin{bmatrix} -1 \cdot -2 + 1 \cdot 2 \\ 3 \cdot -2 + -0.5 \cdot -12 \\ -2 \cdot -2 + 0.5 \cdot -12 \end{bmatrix} \\ &= \begin{bmatrix} 4 \\ 0 \\ -2 \end{bmatrix} \end{align}\]So, \(x_1 = 4\), \(x_2 = 0\), and \(x_3 = -2\).
Solve using matrix inversion or explain why this is not possible:
(3.57)#\[\begin{align} 4x_2 + 4x_3 = 24 \\ 3x_1 - 11x_2 - 2x_3 = -6 \\ 6x_1 - 17x_2 + x_3 = 18 \end{align}\]Solution
First, write in matrix form Ax = b with:
(3.58)#\[\begin{equation} \vv{A} = \begin{bmatrix} 0 & 4 & 4 \\ 3 & -11 & -2 \\ 6 & -17 & 1 \end{bmatrix} \qquad \vv{b} = \begin{bmatrix} 24 \\ -6 \\ 18 \end{bmatrix} \end{equation}\]Then, evaluate \(|\vv{A}|\) to check if an inverse exists:
(3.59)#\[\begin{align} |\vv{A}| = 0 \cdot \begin{vmatrix} -11 & -2 \\ -17 & 1 \end{vmatrix} -4 \cdot \begin{vmatrix} 3 & -2 \\ 6 & 1 \end{vmatrix} + 4 \cdot \begin{vmatrix} 3 & -11 \\ 6 & -17 \end{vmatrix} \end{align}\](3.60)#\[\begin{align} |\vv{A}| &= -4 (3 \cdot 1 - 6 \cdot -2) + 4 (3 \cdot -17 - 6 \cdot -11) \\ &= -4 \cdot 15 + 4 \cdot 15 \\ &= 0 \end{align}\]Since \(|\vv{A}| = 0\), A is not invertible.
Solve using matrix inversion or explain why this is not possible:
(3.61)#\[\begin{align} 2x_1 - x_2 + 3x_3 = -1 \\ -4x_1 + 2x_2 - 6x_3 = 2 \end{align}\]Solution
First, write in matrix form Ax = b with:
(3.62)#\[\begin{equation} \vv{A} = \begin{bmatrix} 2 & -1 & 3 \\ -4 & 2 & -6 \end{bmatrix} \qquad \vv{b} = \begin{bmatrix} -1 \\ 2 \end{bmatrix} \end{equation}\]Since A is not square, A is not invertible.