2.3. Solving systems of linear equations using the inverse matrix#

Given the system of linear equations \(A \vec{x} = \vec{b}\) then we can use matrix algebra to solve for the variable vector \(\vec{x}\)

\[\begin{split} \begin{align*} A\vec{x} &= \vec{b}\\ A^{-1}A \vec{x} &= A^{-1}\vec{b}\\ \vec{x} &= A^{-1}\vec{b} \qquad \text{(since $I = A^{-1}A$)}. \end{align*} \end{split}\]

So we can use the inverse of the coefficient matrix \(A\) to solve for \(\vec{x}\).

Theorem 2.1 (Solution of a linear system of equations using the inverse matrix)

The solution to a system of linear equations \(A\vec{x} = \vec{b}\) can be calculated using \(\vec{x} = A^{-1}\vec{b}\).

Consider the system of linear equations from the previous section

\[\begin{split} \begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} = \begin{pmatrix} 4 \\ 10 \end{pmatrix}. \end{split}\]

The coefficient matrix and constant vector are

\[\begin{split} \begin{align*} A &= \begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix}, & \vec{b} &= \begin{pmatrix} 4 \\ 10 \end{pmatrix}, \end{align*} \end{split}\]

and the inverse of this coefficient matrix can be easily calculated using the adjoint-determinant formula to give

\[\begin{split} A^{-1} = \begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix}^{-1} = \frac{1}{2} \begin{pmatrix} 3 & -1 \\ -4 & 2 \end{pmatrix}. \end{split}\]

Using \(\vec{x} = A^{-1}\vec{b}\) the solution is

\[\begin{split} \vec{x} = \frac{1}{2} \begin{pmatrix} 3 & -1 \\ -4 & 2 \end{pmatrix} \begin{pmatrix} 4 \\ 10 \end{pmatrix} = \begin{pmatrix} 1 \\ 2 \end{pmatrix},\end{split}\]

so \(x_1 = 1\) and \(x_2 = 2\) (which we saw when we used algebra to solve this system). We can check whether this is the correct solution by substituting \(\vec{x}\) into \(A\vec{x} = \vec{b}\)

\[\begin{split}A \vec{x} = \begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix} \begin{pmatrix} 1 \\ 2 \end{pmatrix} = \begin{pmatrix} 4 \\ 10 \end{pmatrix} = \vec{b}.\end{split}\]

Example 2.1

Solve the following systems of linear equations using the inverse of the coefficient matrix:

(i)   \(\begin{array}{rl} x_1 - 2x_2 \!\!\!\! &= 11, \\ 2x_1 + 4x_2 \!\!\!\! &= -18. \end{array}\)

Solution

Here \(A = \begin{pmatrix} 1 & -2 \\ 2 & 4 \end{pmatrix}\) and \(\vec{b} = \begin{pmatrix} 11 \\ -18 \end{pmatrix}\). Calculating \(A^{-1}\)

\[\begin{split} \begin{align*} \det\begin{pmatrix} 1 & -2 \\ 2 & 4 \end{pmatrix} &= 8, \\ \operatorname{adj}\begin{pmatrix} 1 & -2 \\ 2 & 4 \end{pmatrix} &= \begin{pmatrix} 4 & -2 \\ 2 & 1 \end{pmatrix}^\mathsf{T} = \begin{pmatrix} 4 & 2 \\ -2 & 1 \end{pmatrix},\\ \therefore A^{-1} &= \frac{1}{8} \begin{pmatrix} 4 & 2 \\ -2 & 1 \end{pmatrix}. \end{align*} \end{split}\]

So the solution is

\[\begin{split} \begin{align*} \vec{x} &= \frac{1}{8} \begin{pmatrix} 4 & 2 \\ -2 & 1 \end{pmatrix} \begin{pmatrix} 11 \\ -18 \end{pmatrix} = \frac{1}{8} \begin{pmatrix} 8 \\ -40 \end{pmatrix} = \begin{pmatrix} 1 \\ -5 \end{pmatrix}. \end{align*} \end{split}\]

Checking the solution

\[\begin{split}A\vec{x} = \begin{pmatrix} 1 & -2 \\ 2 & 4 \end{pmatrix} \begin{pmatrix} 1 \\ -5 \end{pmatrix} = \begin{pmatrix} 11 \\ -18 \end{pmatrix} = \vec{b} \qquad \checkmark\end{split}\]

(ii)   \(\begin{array}{rl} x_1 - 2x_2 + 3x_3 \!\!\!\! &= -7, \\ 2x_2 - 4x_3 \!\!\!\! &= 8, \\ 3x_1 + x_2 - 4x_3 \!\!\!\! &= 7. \end{array}\)

Solution

Here \(A = \begin{pmatrix} 1 & -2 & 3 \\ 0 & 2 & -4 \\ 3 & 1 & -4 \end{pmatrix}\) and \(\vec{b} = \begin{pmatrix}-7 \\ 8 \\ 7 \end{pmatrix}\). Calculating \(A^{-1}\)

\[\begin{split} \begin{align*} \det \begin{pmatrix} 1 & -2 & 3 \\ 0 & 2 & -4 \\ 3 & 1 & -4 \end{pmatrix} &= \begin{vmatrix} 2 & -4 \\ 1 & -4 \end{vmatrix} + 3 \begin{vmatrix} -2 & 3 \\ 2 & -4 \end{vmatrix} = -4 + 3(2) = 2, \\ \operatorname{adj} \begin{pmatrix} 1 & -2 & 3 \\ 0 & 2 & -4 \\ 3 & 1 & -4 \end{pmatrix} &= \begin{pmatrix} -4 & -12 & -6 \\ -5 & -13 & -7 \\ 2 & 4 & 2 \end{pmatrix}^\mathsf{T} = \begin{pmatrix} -4 & -5 & 2 \\ -12 & -13 & 4 \\ -6 & -7 & 2 \end{pmatrix}, \\ \therefore A^{-1} &= \frac{1}{2} \begin{pmatrix} -4 & -5 & 2 \\ -12 & -13 & 4 \\ -6 & -7 & 2 \end{pmatrix}. \end{align*} \end{split}\]

So the solution is

\[\begin{split} \begin{align*} \vec{x} &= \frac{1}{2} \begin{pmatrix} -4 & -5 & 2 \\ -12 & -13 & 4 \\ -6 & -7 & 2 \end{pmatrix} \begin{pmatrix}-7 \\ 8 \\ 7 \end{pmatrix} = \frac{1}{2} \begin{pmatrix} 2 \\ 8 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\4 \\ 0 \end{pmatrix}. \end{align*} \end{split}\]

Checking the solution

\[\begin{split}A \vec{x} = \begin{pmatrix} 1 & -2 & 3 \\ 0 & 2 & -4 \\ 3 & 1 & -4 \end{pmatrix} \begin{pmatrix} 1 \\ 4 \\ 0 \end{pmatrix} = \begin{pmatrix} -7 \\ 8 \\ 7 \end{pmatrix} = \vec{b} \qquad \checkmark\end{split}\]