In this explainer, we will learn how to use elementary row operations to find the inverse of a matrix, if possible.
In linear algebra, one of the most persistently useful and versatile concepts is that of the (multiplicative) inverse of a square matrix. Being similar to the concept of division in conventional algebra, the inverse of a matrix in some senses provides a complete algebraic structure to linear algebra. Irrespective of the specific use that we might have in mind, it is often very helpful to know the inverse of a matrix, especially when understood in tandem with the algebraic properties of a matrix inverse.
In conventional algebra, if we were to multiply a number by the reciprocal , then we would find , providing that . We can think of the reciprocal as the “inverse” of and we should reasonably expect that the inverse of a matrix would obey similar properties. This is actually a very accurate assumption, as the inverse of a matrix follows nearly identical algebraic properties to the analogous operation in conventional algebra. There are several caveats to this statement. Firstly, the matrix inverse only exists for square matrices. Secondly, just as we cannot take the inverse when , there is a similar condition for the calculation of a matrix inverse . Specifically, it is not possible to find for a matrix if it has a determinant of value zero, which means that the matrix is “singular.” With these two restrictions in mind, we now formally define the matrix inverse.
Definition: The Inverse of a Square Matrix
For a square matrix of order , the “multiplicative inverse” (if it exists) is a square matrix such that where is the identity matrix.
Necessarily, the matrix would also be a square matrix of order . The existence of an inverse matrix is certainly not guaranteed, only existing if the matrix in question is nonsingular. There are several methods for finding whether a matrix is singular or nonsingular, either by use of the determinant or alternatively by suitable row operations to calculate the rank of the matrix. In this explainer, we will demonstrate how the question can be answered as an inherent part of the method for calculating the inverse of a matrix, known as Gauss–Jordan elimination. It is also possible to use the adjoint matrix method to calculate the inverse and this will be covered in other explainers.
Before moving on to matrices, we will first demonstrate the concept for matrices. Suppose that we had the matrix and that we were told that the inverse matrix exists and has the form
Then, by the definition above, we could check that this is true by calculating
Since the result is the identity matrix, we have confirmed that is the multiplicative inverse of . Equally, we could confirm that . There is a well-known method for calculating the inverse of a matrix that is easy to remember and make use of. However, often this method is produced without an understanding of how it is derived and it does not generalize in any simple way to inverses of square matrices which have a larger order. In contrast, there is a well-known method for calculating the inverse of a square matrix having any order, simply by using elementary row operations. We will provide one example of this method for the matrix that is given above, for which the inverse is known. After this demonstration, we will apply the same method to matrices having order , bearing in mind how the technique will generalize to matrices with even larger orders.
Theorem: Calculating the Multiplicative Inverse of a Square Matrix
Suppose that the matrix has order and that an inverse does exist. Then, this inverse can be calculated by creating the joined matrix and using elementary row operations to manipulate this larger matrix into the form where is the identity matrix.
As we will see later, if the matrix is not invertible, then it will not be possible to complete these calculations. To describe the above method, we will now reconsider the matrix
Following the method above, we use the identity matrix and then write this next to the original matrix to give
We have included a separating line between the two matrices so that we can avoid confusion when trying to identify which entries should be removed next. It is generally useful to highlight the first nonzero elements in each row, which are known as the “pivots”:
We then complete the process of Gauss–Jordan elimination and reduce the matrix to the desired form. The process that we are about to complete is equivalent to finding the reduced echelon form of the matrix above.
We already have a 1 in the top-left entry and we should try to leave this entry unchanged if possible, as the identity matrix has a 1 in the top-lefty entry, as well as every diagonal entry. We consequently aim to remove the pivot entry in the second row. This can be achieved with the elementary row operation , which gives the matrix
We now have a zero entry in the bottom-left, meaning that the first column is equal to that of the identity matrix. We can move further towards the desired form by focusing on the pivot entry in the second row. To make the left-hand side most similar to that of the identity matrix, we should make this entry equal to 1. We can scale the whole second row by a constant using the row operation , giving
The left-hand side is now identical to the identity matrix except for the second entry of the first row. In order to make this entry equal to zero, we use the row operation :
Now the left-hand side is equal to and we have reached the expression
We have therefore found that which is identical to the form given above. We have already checked that this is indeed the correct inverse for , so there is no need to do so now, although generally it is wise to check that the inverse is correct, especially for matrices of a higher order.
We will now apply the technique above to a matrix. Rather than start with matrices that are populated with many nonzero entries, we will begin with matrices for which the inverse is less vexing to calculate. We should also bear in mind that it may not be possible to calculate the inverse of a matrix, meaning that at some point the above method would not be possible to use. In plainer terms, if we are not able to obtain the relevant identity matrix on the left side of the joined matrix, then the given matrix will not have an inverse.
Example 1: Finding the Inverse of a 3 × 3 Matrix
Find the multiplicative inverse of the following matrix:
Labeling the above matrix as , we can see already that it is similar to the identity matrix :
This indicates that there should be comparatively little effort required to maneuver the matrix into the form , if it is possible at all. We create the joined matrix
The pivot entries have all been highlighted, reiterating the similarity of the left-hand side to the identity matrix:
We only need to remove the entry in the first row and second column, which is completed by the row operation :
We have already obtained the identity matrix on the left-hand side, which means that the expression on the right-hand side is the inverse matrix
Although it is unlikely in the above example, it is always possible that we made an error of calculation when finding the inverse of a matrix. To confirm that we have the correct result for , we would need to check that
Example 2: Finding the Inverse of a 3 × 3 Matrix
Find the multiplicative inverse of the following matrix:
If the above matrix is denoted , then we have and it is clear that the two matrices are fairly similar. We write the joined matrix
We highlight the pivot entries of each row. We should leave the top-left entry unchanged, as this entry is shared with the identity matrix:
The pivot entries in the second and third rows need to be made into zeros by using elementary row operations. We can change the pivot entry in the second row by using the first row with the operation . This gives the resultant matrix which is more similar to the identity matrix. The pivot entry in the third row should be changed with the row operation , leaving
We have successfully obtained the correct form on the left-hand side of the matrix, meaning that the right-hand side is in fact the identity matrix
It is poor form to finish such a question without checking that is the correct multiplicative inverse of . Although it is unlikely that we made a mistake in the above question due to the simplicity of , we recommend that this be completed as a matter of routine. For more complicated matrices (such as those in the questions below), it would be depressingly easy to make an arithmetic error which proliferates through the resulting calculations, producing a matrix which is most definitely not the multiplicative inverse.
Example 3: Finding the Inverse of a Matrix with Elementary Row Operations
Using elementary row operations, find for the matrix
We begin by joining together the matrix with the identity matrix
We join together these two matrices as with the aim of using elementary row operations to transform this matrix into the form . To this end, we highlight the pivot entries as shown:
It will be convenient to swap rows 1 and 3 so that there is a 1 in the top-left entry. We use the row operation to give
The pivot in the second row can be turned into a zero entry by use of the row operation , giving
A similar row operation can be applied to the pivot in the third row. The row operation thus obtains a leftmost column which is identical to that of the identity matrix:
At this point, we choose to change the new pivot in the third row, so that it is equal to 1. We use the row operation to find
To obtain the identity matrix on the left side, we need to remove the two nonzero entries which are above the pivot in the third row. The row operations and give
We have obtained precisely the form that we were looking for, which means that the right side of the joined matrix is the inverse
It can be confirmed that this is the correct identity matrix by showing that or that .
So far, every square matrix that we have seen has been invertible, meaning that we were able to use elementary row operations to transform the matrix into the matrix . We repeatedly specified that this is not always possible, although we gave no indication as to how we might recognize or even predict this property when calculating the inverse of a matrix. To this end, we give the following theorem that will specify the conditions that will allow us to determine whether we can complete the Gauss–Jordan process to find the matrix inverse.
Theorem: Pivot Entries and the Matrix Inverse
Consider a square matrix with order and the joined matrix , where is the identity matrix. If it is possible to perform elementary row operations on such that a pivot entry appears in the right-hand side, then the matrix cannot be inverted.
Example 4: Using Elementary Row Operations to Find the Inverse of a Matrix
Using elementary row operations, find for the matrix
We begin with the two matrices
The two matrices are not overtly similar and therefore we expect that we will have to complete several row operations at least to find the inverse (if it exists). We create the joined matrix
We highlight the pivot entries, which are the first nonzero elements in each row:
Given that we hope to use row operations to obtain the form , it will be useful if we can immediately adjust the matrix to better resemble the identity matrix on the left-hand side. If we were to swap row 1 with row 2, then we would have a 1 in the top-left entry, which is also true of the identity matrix . We should then perform the row operation , giving
The pivot entry in the second row is nonzero, which is a situation that we should change. A simple row operation to achieve this uses the first row: , which returns the matrix
Now we focus on the pivot entry in the third row, which is also nonzero. This can be rectified with the row operation . The resulting matrix then has a first column that is identical to that of the identity matrix:
The nonzero pivot entry of the third row is now in the second entry. We can make this entry zero by completing . This gives the matrix
We are now in the situation where the pivot entry of one of the rows is on the right side of the matrix. This means that the matrix is not invertible. In other words, there is no matrix such that .
No matter what further row operations we tried in the above question, we would never have been able to achieve the form from the joined matrix. There was little way of knowing this prior to beginning the Gauss–Jordan elimination process, unless we had happened to notice that the third row could be constructed from the first and second rows using the row operations given. Usually this will be hard to notice, so there is no disadvantage to starting the Gauss–Jordan method, even if we eventually find that it is not possible to calculate the inverse.
We will now move towards the calculation of the inverse for a matrix. As we will see, there is little difference from the method that we applied to the previous problems. Although it is likely that there will be a greater number of row operations (and hence a greater chance of making an error), the method is no more difficult in principle.
Example 5: Finding the Inverse of a 4 × 4 Matrix
Find , given that
We begin by taking the identity matrix and then we join this with to give and then we join this with to give
We will use row operations to manipulate this matrix into the form , if this is possible. The pivots are first highlighted:
To begin moving towards the desired form, we must eliminate all pivot entries that appear below the pivot in the first row. This can be achieved by applying the row operations , , and , giving
The pivot in the third row can also be turned into a zero entry, using the row operation to give
To delay introducing fractions into our calculations, we scale the fourth row with the row operation :
Now it is simple to remove the pivot entry in the fourth row with the row operation , leaving
Our focus must now be on removing all nonzero entries that appear above the pivot in the fourth row. This can be achieved in many ways, but we will choose to first scale the fourth row as :
Now all of the entries above the pivot in the fourth row can be removed with the row operations , , and . The result is
Since we now have many entries which are fractions, we might as well rescale the second, third, and fourth rows so that the pivot entries are all equal to 1. We use the row operations , , and to give
We have nearly completed the process and now only need the row operation : followed by the row operation :
As the left side is now equal to the identity matrix, the matrix on the right side is therefore the inverse matrix
- For a square matrix of order , the inverse matrix is also of order and has the property , where is the identity matrix.
- We find the inverse of (if it exists) by taking the joined matrix and using elementary row operations to move this into the form .
- When performing this process, if a pivot entry appears in the right half of the matrix, then the inverse does not exist.