I will now explain how to calculate the inverse matrix using the two methods that can be calculated, both by the Gauss-Jordan method and by determinants, with exercises resolved step by step.
Índice de Contenidos
- 1 What is the inverse or inverse matrix of an matrix?
- 2 Elementary operations in any matrix
- 3 How to calculate the inverse matrix. Gauss-Jordan method
- 4 Example of calculation of the inverse of a matrix by Gauss step by step
- 5 How to calculate the inverse of a matrix by determinants
- 6 Resolved exercise on how to calculate the inverse matrix with determinants
What is the inverse or inverse matrix of an matrix?
The inverse matrix is the one that when multiplied by the original matrix, the result is the matrix identity:
The inverse matrix does not always exist. For an inverse matrix to exist, its determinant has to be different from zero:
Before you know how to calculate the inverse of an array, you must be very clear about the operations you can perform with the rows of an array.
Elementary operations in any matrix
Within an array, we can perform operations with its rows and the array will not be affected. Each time we perform an operation with the rows of an array, we will have an array equivalent to the previous one.
These are the operations we can do with the rows:
1- Swap rows or columns with each other
We can exchange one row for another at our convenience:
i and j correspond to the row numbers in the matrix.
2- Multiply or divide a row by a number other than zero
We can multiply or divide the row we want by the number we want. That number can be either an integer or a fraction;
3- Add two rows i and j, multiplied by any two numbers and the result take them to row i or to row j
Rows can be added and subtracted, multiplied by any number and the result put in the row that suits us.
Later on, we will apply these elementary operations to calculate the inverse and you will better understand how they work.
How to calculate the inverse matrix. Gauss-Jordan method
The Gauss-Jordan method allows us to calculate the inverse of a matrix by performing elementary operations between its rows.
In the same matrix divided into two parts, in the left part is placed the matrix to which we want to calculate its inverse and in the right part is placed the matrix identity:
Running elementary operations between the rows of this matrix, we have to make sure that on the left side we have the matrix identity. Once we get it, the matrix we have on the right side will be the inverse matrix:
Example of calculation of the inverse of a matrix by Gauss step by step
We are going to calculate the inverse of a 3×3 dimensional matrix using the Gauss-Jordan method, step by step.
Many times, if you are not clear about the objective you want to achieve when you perform operations between rows, calculating the inverse matrix can become a labyrinth from which we will not know how to get out.
That’s why I’m going to explain to you the elementary operations that you have to perform so that the inverse is calculated almost directly
We are going to see it very slowly: Calculate the inverse matrix of the following matrix:
First, we place in the same matrix, matrix A in the left part and inverse matrix I in the right part:
And is left:
Now we are going to start with the elementary operations between the rows. Remember that we have to get the matrix identity on the left side.
Where do we start?
The first thing we want to achieve is that in the first element of the first column there is a 1:
In this case we already have it, so we don’t have to do anything. If you didn’t have it, then you have several ways to get it: dividing the first row by the number we have, exchanging it for another row that has one, adding or subtracting another row multiplied by another number…
Remember that the elements of an array can also be fractions.
Once we have 1 in the first element of the first column, the next step is to get the elements that are below 1 in that first column to be 0:
The third element is already a 0, but the second is not. To get it I’m going to add row 1 to row 2 and the result I’m going to leave in row 2:
Rows 1 and 3 remain the same. The matrix we have left is:
We already have the first column ready.
We continue with the second column. Now, we have to get the second element of the second column to be a 1:
I could divide the second row by 2 and I would have it, but in row 3, I have a 1, so it’s easier to swap row 2 for row 3:
And we are left:
The next thing we have to achieve is that both the first element and the third element of the second column are 0:
The first element is already a 0, so we don’t have to do anything. To get 2 to be a 0, I’m going to subtract row 2 twice from row 3:
I take advantage of the fact that in row 2 I have a 1. Having a 1, I only have to multiply that row by the number that suits me, in this case a 2, and subtract it from the row in which I want to have the result (this is another of the objectives of having 1 in the previous step).
We have left:
We already have 2 columns like the ones in the identity matrix. Let’s go for the third column:
We have to get the third element of the third column to be a 1:
We have a -1, so to get a 1, I’m going to multiply row 3 by -1:
And we have left:
The next step is to make the elements above 1 0:
The first element is already a 0 and to get the second element to be a 0, I’m going to subtract row 1 twice from row 2 and I’m going to leave the result in row 2:
Again I have taken advantage of 1.
We are left:
At this point, we have the matrix identity on the left side, which means that on the right side we have the inverse matrix:
Therefore, the inverse matrix of A is:
Checking the inverse calculation
We are going to check that we have calculated the inverse matrix correctly. To know if it is OK, we have to multiply the original matrix by the inverse matrix and the result must give the matrix identity:
We perform the multiplication of A matrices by its inverse:
Y effectively, the result of multiplication is the matrix identity, so the inverse is well calculated.
How to calculate the inverse of a matrix by determinants
To calculate the inverse matrix using determinants we will use the following formula:
The reverse matrix of an A matrix is equal to the attached matrix of its transposed matrix, divided by its determinant.
Thus said, it seems a little messy but let’s see it step by step with an example:
Resolved exercise on how to calculate the inverse matrix with determinants
Calculate the inverse matrix of the following matrix A:
We solve power and determinants of order 2:
Y we continue to operate.
The determinant of A is equal to 3, therefore it is different from 0 and therefore the inverse matrix exists and we can continue calculating.
The next step is to get the matrix transposed from A.
To get the matrix transposed from A, we just have to exchange the rows for the columns and we have:
Y now we are going to calculate the attached matrix of this transposed matrix.
To calculate the attached matrix, we obtain the attachments of each of the elements of the matrix and replace them with the original elements.
We are going to calculate them from left to right, row by row.
Attachment of 5:
Attachment of 1:
Attachment of 2:
Attachment de 3:
Attachment of 4:
Attachment of 0:
Attachment of -1:
Attachment of 2:
Attachment of -1:
Once we have all the attachments of all the elements, we form the attached matrix substituting the original elements with their attachments and we are left with:
We already have everything we need to calculate the inverse matrix, so we replace in the formula, both the determinant and the attached matrix of the matrix transposed:
Multiply the fraction for each of the elements of the matrix and simplify the elements that can:
And this is the inverse matrix of matrix A.