Title: Default for 8.2 Solution by Inverse Matrix Method
Course: HELM Workbooks 2023-2024

Solving a system of two equations using the inverse matrix

If we have one linear equation \( ax=b\) in which the unknown is \(x\) and \(a\) and \(b\) are constants and \(a\neq 0\) then \(x=\dfrac{b}{a}= a^{-1}b\).

What happens if we have more than one equation and more than one unknown? In this worksheet we copy the algebraic solution \(x=a^{-1}b\) used for a single equation to solve a system of linear equations. As we shall see, this will be a very natural way of solving the system if it is first written in matrix form.

Consider the system \[\begin{matrix} 2x_1 & + & 3x_2&= & 5 \\ x_1 & - & 2x_2&= & -1. \end{matrix} \] In matrix form this becomes \[\qquad \left[\begin{array}{rr} 2&3\\ 1&-2\end{array}\right] \left[\begin{array}{c}x_1\\ x_2\end{array}\right]=\left[\begin{array}{r}5\\ -1\end{array}\right]\ \ \quad\text{which is of the form}\ \quad AX=B.\]

If \(A^{-1}\) exists then the solution is \[\qquad X=A^{-1}B.\qquad\text{(compare the solution} \ x=a^{-1}b \ \text{above)}\]

Example

Given the matrix \[A=\left[\begin{array}{rr}2&3\\ 1&-2\end{array}\right]\] find its determinant. What does this tell you about \(A^{-1}\)?

Solution

\[|A|=2\times (-2)-1\times 3=-7.\] Since \(|A|\neq 0\) then \(A^{-1}\) exists. Therefore, we can now find \(A^{-1}\):

\[A^{-1}=\dfrac{1}{(-7)}\left[\begin{array}{rr}-2&-3\\ -1&2\end{array}\right]=\dfrac{1}{7}\left[\begin{array}{rr}2&3\\ 1&-2\end{array}\right]\]

Example

Solve the system \(AX=B\) where \[A=\left[\begin{array}{rr}2&3\\ 1&-2\end{array}\right], \hspace{2mm} B = \left[\begin{array}{r}5\\ -1\end{array}\right].\]

Solution

In the previous example, we checked that \(A\) has an inverse and computed it. Therefore, \[X=A^{-1}B=\dfrac{1}{7}\left[\begin{array}{rr}2&3\\ 1&-2\end{array}\right]\left[\begin{array}{r} 5\\ -1\end{array}\right]=\dfrac{1}{7}\left[\begin{array}{c}7\\ 7\end{array}\right]=\left[\begin{array}{c}1\\ 1\end{array}\right].\]

Hence \(x_1=1,\ x_2=1.\)

Example

Use the inverse matrix method to solve \[\begin{matrix} 2x_1 & + & 3x_2 & = & 3 \\ 5x_1 & + & 4x_2 & = & 11 \\ \end{matrix} \]

Solution

The system in \(AX=B\) form is \[\left[\begin{matrix}2&3\\5&4\end{matrix}\right] \left[\begin{matrix}x_1\\x_2\end{matrix}\right]=\left[\begin{matrix}3\\11\end{matrix}\right] . \] We have \(|A|=2\times 4-3\times 5=-7 \neq 0\) and therefore \(A^{-1}\) exists. We can now compute \[A^{-1}=-\dfrac{1}{7}\left[\begin{matrix}4&-3\\-5&2\end{matrix}\right] . \] Using \(X=A^{-1}B\), we have \[X=\left[\begin{matrix}x_1\\x_2\end{matrix}\right]=-\dfrac{1}{7}\left[\begin{matrix}4&-3\\-5&2\end{matrix}\right] \left[\begin{matrix}3\\11\end{matrix}\right]=-\dfrac{1}{7}\left[\begin{matrix}4\times 3-3\times 11\\-5\times 3+2\times 11\end{matrix}\right]=-\dfrac{1}{7}\left[\begin{matrix}-21\\7\end{matrix}\right]= \left[\begin{matrix}3\\-1\end{matrix}\right] .\] Therefore, \(x_1=3,\ x_2=-1\).

Exercise

Solve the following linear system of equations using the inverse matrix method: \[\begin{matrix} [value] x_1 & + & [value] x_2 & = & [value] \\ [value] x_1 & + & [value] x_2 & = & [value] \\ \end{matrix}\]

\(x =\)
Feedback: We first check if \(A \) is invertible by, for instance, computing the determinant. Since \[ \det A = [value] \neq 0, \] A is invertible. From the equation \(Ax = b\), since \(A \) is invertible, we can obtain the solution using \(x = A^{-1}Ax = A^{-1}b\). We compute \(A^{-1} = [value]\). Finally we find \(x = A^{-1}b = [value]\times [value]=[value]\).

Engineering Example: Currents in two loops

In the circuit shown below find the currents \((i_1,\ i_2)\) in the loops:

[Image: Figure displaying currents in two loops]

Figure 1

Solution

We note that the current across the \(3\ \Omega\) resistor (travelling top to bottom in the diagram) is given by \((i_1-i_2)\). With this proviso we can apply Kirchhoff’s law: \[\begin{matrix} \text{In the left-hand loop} & 3(i_1-i_2)+5i_1=3 & \rightarrow & 8i_1-3i_2=3 \\ \text{In the right-hand loop} & 3(i_2-i_1)+6i_2=4 & \rightarrow & -3i_1+9i_2=4 \\ \end{matrix}\]

In matrix form: \[\left[ \begin{matrix} 8 & -3\\ -3 & 9 \\ \end{matrix} \right] \left[ \begin{matrix} i_1 \\ i_2 \\ \end{matrix} \right]= \left[\begin{matrix} 3 \\ 4 \\ \end{matrix} \right].\]

The inverse of \[\left[\begin{matrix}\hfill 8& -3 \\ -3& 9\end{matrix}\right]\] is \[\dfrac{1}{63}\left[\begin{matrix}9&3\\3&8\end{matrix}\right]\] so solving gives \[\left[\begin{matrix}i_1\\ i_2\end{matrix}\right]=\dfrac{1}{63}\left[\begin{matrix}9&3\\3&8\end{matrix}\right] \left[\begin{matrix}3\\ 4\end{matrix}\right] =\dfrac{1}{63}\left[\begin{matrix}39\\ 41\end{matrix}\right]\] so \(\displaystyle{i_1= \frac{39}{63}}\), \(\displaystyle{i_2= \frac{41}{63}}\).

Non-unique solutions

The key to obtaining a unique solution of the system \(AX=B\) is to find \(A^{-1}\). What happens when \(A^{-1}\) does not exist?

Consider the system \[\begin{matrix} 2x_1 & + & 3x_2 & = & 5 & \qquad(1) \\ 4x_1& + & 6x_2 & = & 10 & \qquad (2) \\ \end{matrix}\] In matrix form this becomes \[\left[\begin{matrix} 2&3\\ 4&6\end{matrix}\right]\left[\begin{matrix} x_1\\ x_2\end{matrix}\right]=\left[\begin{matrix} 5\\ 10\end{matrix}\right].\]

Example

Identify the matrix \(A\) and hence find \(A^{-1}\) if it exists.

Solution

\[A=\left[\begin{matrix} 2 & 3\\ 4 & 6 \end{matrix}\right]\] and \(|A|=2\times 6-4 \times 3=0.\) Hence \(A^{-1}\) does not exist.

Looking at the original system we see that Equation (2) is simply Equation (1) with all coefficients doubled. In effect we have only one equation for the two unknowns \(x_1\) and \(x_2\). The equations are consistent and have infinitely many solutions.

If we let \(x_2\) assume a particular value, \(t\) say, then \(x_1\) must take the value \(x_1=\dfrac{1}{2}(5-3t)\), i.e., the solution to the given equations is:

\[x_2=t,\qquad x_1=\dfrac{1}{2}(5-3t)\] where \(t\) is called a parameter.

For each value of \(t\) there are unique values for \(x_1\) and \(x_2\) which satisfy the original system of equations. For example, if \(t=1\), then \(x_2=1\), \(x_1=1\), if \(t=-3\) then \(x_2=-3\), \(x_1=7\) and so on.

We can think of the initial problem as finding a point of intersection of the lines given by the equations. Equation (2) is simply equation (1) multiplied by \(2\) and describes the same line. Every point on the line is a point of intersection.

Now consider the system \[\begin{matrix} 2x_1 & + & 3x_2 & = & 5 & \qquad (3) \\ 4x_1 & + & 6x_2 & = & 9 & \qquad (4)\\ \end{matrix}\] Since the left-hand sides are the same as those in the previous system then \(A\) is the same and again \(A^{-1}\) does not exist. There is no solution to the Equations (3) and (4).

Indeed, if we double Equation (3) we obtain \[4x_1+6x_2=10\] which conflicts with Equation (4). There are thus no solutions to (3) and (4) and the equations are said to be inconsistent.

Thinking of the geometry, the problem is now to find the intersection of two different but parallel lines. Of course such parallel lines will never meet so there are no points of intersection.

Exercise

Consider the following linear system of equations: \[\begin{matrix} [value] \\ [value] \\ \end{matrix}\]

1. Consider the matrix form \(AX = B\) of the system and identify \(A\)
\(A=\)

2. Find the determinant of \(A\):
\(|A| =\)
3. Determine if the system has no solution, a unique solution, or infinitely many solutions.
4. If it has a unique solution or infinitely many solutions, these are:
\(x =\)
\(y =\)
Give all the solutions if there is more than one. If there are no solutions, fill the gaps for \(x \) and \(y \) with the word null.
Feedback: 1. In matrix form \(AX = B\), the matrix \(A \) is \[ A = [value].\] 2. \( \det A = [value] \). 3. Since the determinant of \(A \) is \( 0 \), we already know that the system has either no solution or infinitely many solutions. Note that if we multiply the first equation by \([value] \) we obtain \[ [value] \cdot ([value]) = [value] \cdot ([value]) \Leftrightarrow [value] = [value] \] which is the second equation. Therefore, the system has infinitely many solutions. 4. Since both equations are equivalent, we can ignore one of them, say the second one. From the first equation, if we set \(y = t \), where \( t \) can be any real number, we obtain all the solutions to the system \[ x = [value], \qquad y = [value]. \]

Exercise

Consider the following linear system of equations: \[\begin{matrix} \displaystyle{[value]} \\ [value] \\ \end{matrix}\]

1. Consider the matrix form \(AX = B\) of the system and identify \(A\)
\(A=\)

2. Find the determinant of \(A\):
\(|A| =\)
3. Determine if the system has no solution, a unique solution, or infinitely many solutions.
4. If it has a unique solution or infinitely many solutions, these are:
\(x =\)
\(y =\)
Give all the solutions if there is more than one. If there are no solutions, fill the gaps for \(x \) and \(y \) with the word null.
Feedback: 1. In matrix form \(AX = B\), the matrix \(A \) is \[ A = [value].\] 2. \( \det A = [value] \). 3. Since the determinant of \(A \) is \( 0 \), we already know that the system has either no solution or infinitely many solutions. Note that if we multiply the first equation by \([value] \) we obtain \[ [value] \cdot ([value]) = [value] \cdot ([value]) \Leftrightarrow [value] = [value] \] which is in conflict with the second equation. Therefore, the system is incompatible, i.e., there are no solutions. 4. We have already found that there are no solutions to this system. As indicated in the question, you should enter the word null in both \(x \) and \(y \) as an answer to this part.

Solving three equations in three unknowns

It is much more tedious to use the inverse matrix to solve a system of three equations although in principle, the method is the same as for two equations.

Example

Consider the system \[\begin{matrix} x_1 &- & 2x_2 & + & x_3 & = & 3\\ 2x_1 & + & x_2 & - & x_3 & = & 5\\ 3x_1 & - & x_2 & + & 2x_3 & = & 12 \\ \end{matrix}\]

and its matrix form \(AX = B\). One can find that \(|A|=10\) (check it!). Hence \(A^{-1}\) exists.

Solve it using the inverse matrix method.

Solution

1. Find \(A^{-1}\) by the method of determinants.
Form the matrix where each element of \(A\) is replaced by its minor:
\(\left[\begin{array}{ccc}\left|\begin{array}{rr}1&-1\\ -1&2\end{array}\right|&\left|\begin{array}{rr}2&-1\\ 3&2\end{array}\right|&\left|\begin{array}{rr}2&1\\ 3&-1\end{array}\right|\\ \\ \left|\begin{array}{rr}-2&1\\ -1&2\end{array}\right|&\left|\begin{array}{cc}1&1\\ 3&2\end{array}\right|&\left|\begin{array}{rr}1&-2\\ 3&-1\end{array}\right|\\ \\ \left|\begin{array}{rr}-2&1\\ 1&-1\end{array}\right|&\left|\begin{array}{rr}1&1\\ 2&-1\end{array}\right|&\left|\begin{array}{rr}1&-2\\ 2&1\end{array}\right|\end{array}\right]=\left[\begin{array}{rrr}1&7&-5\\ -3&-1&5\\ 1&-3&5\end{array}\right].\)
Now use the \(3\times 3\) array of signs to obtain the matrix of cofactors:
The array of signs is \[\left[\begin{matrix} +&-&+\\ -&+&-\\ +&-&+ \\ \end{matrix}\right]\] so that we obtain \[\left[\begin{matrix} 1&-7&-5\\ 3&-1&-5\\ 1&3&5 \\ \end{matrix}\right].\]
2. Transpose this matrix and divide by \(|A|\) to obtain \(A^{-1}\).
Transposing gives \[\left[\begin{matrix} 1&3&1\\ -7&-1&3\\ -5&-5&5 \\ \end{matrix}\right].\] Finally, \[A^{-1} = \frac{1}{10} \left[\begin{matrix} 1&3&1 \\ -7&-1&3 \\ -5&-5&5 \\ \end{matrix}\right].\]
3. Now use \(X=A^{-1} B\) to solve the system of linear equations.
\[X=\frac{1}{10}\left[\begin{matrix}1&3&1\\ -7&-1&3\\ -5&-5&5\end{matrix}\right]\left[\begin{matrix} 3\\ 5\\ 12\end{matrix}\right]=\frac{1}{10}\left[\begin{matrix}30\\ 10\\ 20\end{matrix}\right]=\left[\begin{matrix} 3\\ 1\\ 2\end{matrix}\right]\] Then \(x_1=3,\ x_2=1,\ x_3=2\).

This approach, and another known as Cramer's rule (which is not covered here) are both rather tedious! The advantage of the inverse matrix method is that we can determine when there is a unique solution and we can operate on matrix equations abstractly, i.e. if we have \(AX+B=C\) and we know that \(A\) has an inverse then we can rewrite \(X=A^{-1}(C-B)\). By this we can simplify a problem algebraically before attempting any calculations.

There are cases where the matrix is more simple than a general \(3 \times 3\) matrix due to the presence of zeros. In these cases the calculation will take less time and become more feasible.

We will soon see Gaussian elimination which is superior method for general matrices.

Exercise

Consider the linear system of equations \(AX = B\), where

 \[ A =[value], \hspace{2mm} B = [value]. \]

1. Find the inverse of \( A\), if it is invertible.
\(A^{-1}=\)

2. Solve the system \(AX = B \) using the inverse matrix method.
\(X=\)
Feedback: 1. We find the inverse of \( A \) using the Gauss elimination method (use the determinant method if you prefer). Augment matrix \({\bf A}\) with a 3 by 3 identity matrix: \[[value]\] There is +1 in the upper left-hand corner so create 0's below it by adding \([value]\) times row 1 to row 2 and \([value]\) times row 1 to row 3 \[[value]\] Now there is +1 in entry [2,2] of the matrix so create 0's above and below it by adding \([value]\) times row 2 to row 1 and \([value]\) times row 2 to row 3 \[[value]\] Now there is +1 in entry [3,3] of the matrix so create 0's above it by adding \([value]\) times row 3 to row 1 and \([value]\) times row 3 to row 2 \[[value]\] The left half of this matrix is the identity matrix and the right half is the inverse of \({\bf A}\) Therefore \({\bf A^{-1}} = [value]\) 2. Since \(A \) is invertible, we can apply the inverse matrix method to solve the system of equations. Multiply the matrix equation \(A X = B \) by \(A^{-1} \) from the left to obtain \[ X = A^{-1} A X = A^{-1} B = [value] [value] = [value]. \]

Equations with no unique solution

If \(|A|=0\), \(A^{-1}\) does not exist and therefore it is easy to see that the system of equations has no unique solution. But it is not obvious whether this is because the equations are inconsistent and have no solution or whether they are consistent and have infinitely many solutions.

Example

Consider the systems \[\text{(a)}\ \ \ \ \begin{array}{rrrrr}x_1-x_2+x_3&=&4\\ 2x_1+3x_2-2x_3&=&3\\ 3x_1+2x_2-x_3&=&7\end{array} \qquad\ \ \ \text{(b)}\ \ \ \ \begin{array}{rrrrr}x_1-x_2+x_3&=&4\\ 2x_1+3x_2-2x_3&=&3\\ x_1-11x_2+9x_3&=&13\end{array}\]

1. In system (a) add the first equation to the second. What does this tell you about the system?
The sum is \(3x_1+2x_2-x_3=7\), which is identical to the third equation. Thus, essentially, there are only two equations \[\begin{matrix} x_1 & - & x_2 & + & x_3 & = & 4 \\ 3x_1 & + & 2x_2 & - & x_3 & = & 7 \\ \end{matrix}\] Now adding these two gives \(4x_1+x_2=11\) or, equivalently, \(x_2=11-4x_1\). Therefore, \[x_3=4-x_1+x_2=4-x_1+11-4x_1=15-5x_1\] Hence if we give \(x_1\) a value, \(t\) say, then \(x_2=11-4t\) and \(x_3=15-5t\). Thus there is an infinite number of solutions (one for each value of \(t\)).
2. In system (b) take the combination \( 5 \) times the first equation minus \(2\) times the second equation. What does this tell you about the system?
The combination is \(x_1-11x_2+9x_3=14\), which conflicts with the third equation. There is thus no solution.

In practice, systems containing three or more linear equations are best solved by Gauss Elimination.

Exercise

Consider the following linear system of equations: \[\begin{matrix} [value] \\ [value] \\ [value] \\ \end{matrix}\]

1. Consider the matrix form \(AX = B\) of the system and identify \(A\)
\(A=\)

2. Find the determinant of \(A\):
\(|A| =\)
3. Determine if the system has no solution, a unique solution, or infinitely many solutions.
4. If it has a unique solution or infinitely many solutions, these are:
\(x =\)
\(y =\)
\(z =\)
Give all the solutions if there is more than one. If there are no solutions, fill the gaps for \(x, y \) and \(z \) with the word null.
Feedback: 1. In matrix form \(AX = B\), the matrix \(A \) is \[ A = [value].\] 2. \( \det A = [value] \). 3. Since the determinant of \(A \) is \( 0 \), we already know that the system has either no solution or infinitely many solutions. Note that if we consider the linear combination the first equation plus \([value]\) times the second equation we get \[ [value] + [value] \cdot ([value]) = [value] + [value] \cdot ([value]) \] which becomes \[ [value] = [value].\] Note that this is the third equation. Therefore, the system has infinitely many solutions. 4. Since the third equation is a linear combination of the other two, we can ignore it. Setting \(z = t \), where \( t \) can be any real number, we can obtain all the solutions to the system with \( t \) as a parameter: \[ x = [value], \qquad y = [value], \qquad z = [value]. \] You could also have chosen to set \(x = t \) (resp. \(y = t \)), and obtain equivalent expressions.

Exercise

Consider the following linear system of equations: \[\begin{matrix} [value] \\ [value] \\ [value] \\ \end{matrix}\]

1. Consider the matrix form \(AX = B\) of the system and identify \(A\)
\(A=\)

2. Find the determinant of \(A\):
\(|A| =\)
3. Determine if the system has no solution, a unique solution, or infinitely many solutions.
4. If it has a unique solution or infinitely many solutions, these are:
\(x =\)
\(y =\)
\(z =\)
Give all the solutions if there is more than one. If there are no solutions, fill the gaps for \(x, y \) and \(z \) with the word null.
Feedback: 1. In matrix form \(AX = B\), the matrix \(A \) is \[ A = [value].\] 2. \( \det A = [value] \). 3. Since \( \det A = [value] \neq 0 \), the system has a unique solution. Furthermore, the matrix \(A \) is invertible. 4. We can compute the inverse of \( A \) \[ A^{-1} = [value] \] and apply the inverse matrix method to solve the system of equations. Multiply the matrix equation \(A X = B \) by \(A^{-1} \) from the left to obtain \[ X = A^{-1} A X = A^{-1} B = [value] [value] = [value]. \]

Exercise

Consider the following linear system of equations: \[\begin{matrix} \displaystyle{[value]} \\ \displaystyle{[value]} \\ \end{matrix}\]

1. Consider the matrix form \(AX = B\) of the system and identify \(A\)
\(A=\)

2. Find the determinant of \(A\):
\(|A| =\)
3. Determine if the system has no solution, a unique solution, or infinitely many solutions.
4. If it has a unique solution or infinitely many solutions, these are:
\(x =\)
\(y =\)
Give all the solutions if there is more than one. If there are no solutions, fill the gaps for \(x \) and \(y \) with the word null.
Feedback: 1. In matrix form \(AX = B\), the matrix \(A \) is \[ A = [value].\] 2. \( \det A = [value] \). 3. Since the determinant of \(A \) is \( 0 \), we already know that the system has either no solution or infinitely many solutions. Note that if we multiply the first equation by \([value] \) we obtain \[ [value] \cdot ([value]) = [value] \cdot ([value]) \Leftrightarrow [value] = [value] \] which is in conflict with the second equation. Therefore, the system is incompatible, i.e., there are no solutions. 4. We have already found that there are no solutions to this system. As indicated in the question, you should enter the word null in both \(x \) and \(y \) as an answer to this part.