# Inverse Matrix Calculator

**
Instructions:
**
Use this calculator to find the inverse of a matrix that you provide, showing step by step.
First, click on one of the buttons below to specify the dimension of the matrix.

Then, click on the first cell and type the value, and move around the matrix by pressing "TAB" or by clicking on the corresponding cells, to define ALL the matrix values.

## More about this Invertible Matrix Calculator with steps

The concept of inverse of matrix will appear in so many contexts in Algebra. First, for matrices, the idea is to be able to operate them in a similar manner as we would do with numbers. And in fact there are reasonable operations of sum, subtraction and multiplication of matrices.

But how about the "division" of matrices? When we have a number, 3, for example, I can define the (multiplicative) inverse of that number, which I could write as \(3^{-1}\), or more commonly written as \(\displaystyle \frac{1}{3}\).

One crucial property of this inverse is that when multiplied to the original number, it gives you 1, this is \(3 \cdot \displaystyle \frac{1}{3} = 1\).

## How to Identify and invertible matrix

- Find that its determinant is different from zero
- Get its row-echelon form and get a diagonal matrix without zeros
- Find that the RREF of the matrix is the identity

## How do you define the inverse of a matrix?

For matrices, the role of the "1" is played by the identity matrix \(I\), and given a matrix \(A\), we will say that \(A^{-1}\) is the inverse of \(A\) if \(A A^{-1} = I = A^{-1} A\).

So in other words, the inverse of a given matrix \(A\) is a matrix that has the property that multiplying that matrix by the original, leads to the identity matrix I.

## How do you calculate inverse matrix?

There are many, many different ways to compute the inverse of a given matrix \(A\). One of the most commonly used methods is the adjoint formula, which is based on the calculator of a whole bunch of determinants of sub-matrices obtained by removing one row and one column of \(A\).

Observe that this inverse calculator also gives you the option to compute the inverse using the Gaussian reduction method to calculate the reduced row echelon form of an augmented matrix.

There is also the pivoting method to convert the initial \(A\) matrix into the identity using elementary matrices, while keeping track of the multiplication of those elementary matrices, that turns out to be the inverse.

\[ E_1 E_2 \cdots E_k A = I \Rightarrow E_1 E_2 \cdots E_k = A^{-1}\]There is also invertibility methods based on some decompositions as well, and ultimately, matrices with a specific useful structures can be processed faster in terms of finding their inverse using specialized methods, only applicable to certain structures.

## What is the formula for the inverse matrix?

Using the adjoint formula, we find that the formula for the inverse of a matrix \(A\) is:

\[ A^{-1} = \displaystyle \frac{1}{\det(A)} adj(A)\]At first sight this looks simple! But it is not so much when the size of the matrix is large. Indeed, the above formula is telling you that in order to find the inverse you need to compute the determinant of the matrix, and also you need to compute the adjoint matrix.

Unlike what appearances may suggest, this could be very labor intensive with the size of the matrix is large (like \(n > 4\)). So, it is good we have a compact formula, but that does not necessarily means that it won't be labor intensive.

## How Can you invert a 2x2 matrix?

First, you have to make sure that \(\det(A) \ne 0\). Assume that we have a 2x2 matrix, we will use the adjoint formula. Let

\[ A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}\]so using the adjoint formula we would get

\[ A^{-1} = \displaystyle \frac{1}{\det(A)} adj(A) = \displaystyle \frac{1}{\det(A)} C^T\]For the general 2x2 matrix \(A\) its determinant is

\[ \det(A) = ad - bc\]Also, the cofactor matrix is

\[ C = \begin{bmatrix} (-1)^{1+1} d & (-1)^{1+2} c \\\\ (-1)^{2+1} b & (-1)^{2+2} a \end{bmatrix} = \begin{bmatrix} d & -c \\\\ -b & a \end{bmatrix}\]So now, we need to transpose the matrix \(C\):

\[ C^T = \begin{bmatrix} d & -c \\ -b & a \end{bmatrix}^T = \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}\]So finally, we have the formula for the inverse:

\[ A^{-1} = \displaystyle \frac{1}{\det(A)} C^T = \displaystyle \frac{1}{ad - bc} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}\]Easy enough, huh? You want to try for 3x3?

### How do I find the inverse of a 3x3 matrix?

The first requirement, as with all matrices, is to compute the determinant and make sure that \(\det(A) \ne 0\). Then, we need to recall the generic adjoint formula

\[ A^{-1} = \displaystyle \frac{1}{\det(A)} adj(A) = \displaystyle \frac{1}{\det(A)} C^T\]where \(C\) is the matrix of cofactors. If you were to write this explicitly, you would get something like this: for \(A\) a generic 3x3 matrix:

\[ A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}\]we would get

\[ A^{-1} = \displaystyle \frac{1}{\det(A)} adj(A) = \displaystyle \frac{1}{\det(A)} C^T\]For the general 3x3 matrix \(A\) its determinant is

\[ \det(A) = a(e i - hf) - b(d i - g f) + c(d h - g e)\]Also, the cofactor matrix is

\[ C = \begin{bmatrix} (-1)^{1+1} \begin{vmatrix} e & f\\\\ h& i \end{vmatrix} & (-1)^{1+2} \begin{vmatrix} d & f\\\\ g & i \end{vmatrix} & (-1)^{1+3} \begin{vmatrix} d & e\\\\ g & h \end{vmatrix} \\\\ (-1)^{2+1} \begin{vmatrix} b & c \\\\ h & i \end{vmatrix} & (-1)^{2+2} \begin{vmatrix} a & c\\\\ g & i \end{vmatrix} & (-1)^{2+3} \begin{vmatrix} a & b\\\\ g & h \end{vmatrix} \\\\ (-1)^{3+1} \begin{vmatrix} b & c\\\\ e & f \end{vmatrix} & (-1)^{3+2} \begin{vmatrix} a & c\\\\ d& f \end{vmatrix} & (-1)^{3+3} \begin{vmatrix} a & b\\\\ d & e \end{vmatrix} \end{bmatrix}\] \[ = \begin{bmatrix} ei-fh & - (di - gf) & dh - ge \\ - (bi - hc) & ai - gc & - (ah - gb) \\ bf - ec & - (af-dc) & ae - db \end{bmatrix}\] \[ = \begin{bmatrix} ei-fh & gf - di & dh - ge \\ hc - bi & ai - gc & gb - ah \\ bf - ec & dc - af & ae - db \end{bmatrix}\]So now, we need to transpose the matrix \(C\):

\[ C^T = \begin{bmatrix} ei-fh & gf - di & dh - ge \\ hc - bi & ai - gc & gb - ah \\ bf - ec & dc - af & ae - db \end{bmatrix}^T = \begin{bmatrix} ei - fh & hc - bi & bf - ec \\ gf - di & ai - gc & dc - af \\ dh - ge & gb - ah & ae - db \end{bmatrix}\]So finally, we have the formula for the inverse:

\[ A^{-1} = \displaystyle \frac{1}{\det(A)} C^T = \displaystyle \frac{1}{a(e i - hf) - b(d i - g f) + c(d h - g e))} \begin{bmatrix} ei - fh & hc - bi & bf - ec \\ gf - di & ai - gc & dc - af \\ dh - ge & gb - ah & ae - db \end{bmatrix} \]Ready to memorize that? Of course not. Not that you have to, really. This is just a teaser of how complicated it gets when you try to get a general formula for a simple 3x3 matrix. It gets really messy, and rather useless for \(n > 3\).

So, it is much more practical to apply a set of steps for finding the inverse:

### What are the steps to follow to compute the inverse of a matrix?

**Step 1:** Compute the determinant of the given matrix A. Notice that this could be calculation consuming for large matrices, so make use to
calculate the determinant by the row/column with the most zeroes.

**Step 2:** Compute the cofactor matrix associated to the matrix A. You need to compute it component by component, by computing the determinant of
the sub-matrix obtained by removing row i and column j, multiplied by the sign \((-1)^{i+j}\). Again here, when computing the sub-determinants
make sure you choose the row/column with the most zeros.

**Step 3:** Once you have the determinant of the original matrix and the cofactor matrix, divide each component of the cofactor matrix by the
determinant, and the result of that is finally, the inverse matrix.

### How to use this inverse calculator

- Specify the size of the matrix
- Type in the numbers that determine the matrix
- Select the method you prefer to use to compute the inverse: "Adjoint Formula" or "Reduced Row Echelon Form"
- Click on "Calculate Inverse"

### Example: Calculating the inverse of a given matrix

**Question: ** Consider the following matrix:

Find its inverse using the adjoint formula.

Solution: We need to compute the inverse of a \(3 \times 3\) matrix that has been provided.

### Step 1: Compute the Determinant of the Matrix

Using the sub-determinant formula we get:

\[ \begin{vmatrix} \displaystyle 1&\displaystyle 2&\displaystyle 1\\[0.6em]\displaystyle 2&\displaystyle 1&\displaystyle 4\\[0.6em]\displaystyle 1&\displaystyle 1&\displaystyle 1 \end{vmatrix} = 1 \cdot \left( 1 \cdot \left( 1 \right) - 1 \cdot \left(4 \right) \right) - 2 \cdot \left( 2 \cdot \left( 1 \right) - 1 \cdot \left(4 \right) \right) + 1 \cdot \left( 2 \cdot \left( 1 \right) - 1 \cdot \left(1 \right) \right)\] \[ = 1 \cdot \left( -3 \right) - 2 \cdot \left( -2 \right) + 1 \cdot \left( 1 \right) = 2\]Since \(\det(A) = 2 \ne 0\), we conclude that the matrix is invertible, and we can continue with the calculation of the inverse of the given matrix \(A\).

### Step 2: Compute the Cofactor Matrix

First we compute the minors matrix. We have that, by definition, the minors matrix \(M\) is defined by the formula

\[ M_{ij} = \det A^{i,j}\]where in this case \( A^{i,j}\) is the matrix \(A\) after deleting row \(i\) and column \(j\).

Therefore, and based on the matrix \(A\) provided we get the following coefficients of the minors matrix:

For \(A^{ 1, 1}\):

\[M_{ 1 1} = \det A^{ 1 1} = \begin{vmatrix} \displaystyle 1&\displaystyle 4\\[0.6em]\displaystyle 1&\displaystyle 1 \end{vmatrix} = 1 \cdot \left( 1 \right) - 1 \cdot \left(4 \right) = -3\]For \(A^{ 1, 2}\):

\[M_{ 1 2} = \det A^{ 1 2} = \begin{vmatrix} \displaystyle 2&\displaystyle 4\\[0.6em]\displaystyle 1&\displaystyle 1 \end{vmatrix} = 2 \cdot \left( 1 \right) - 1 \cdot \left(4 \right) = -2\]For \(A^{ 1, 3}\):

\[M_{ 1 3} = \det A^{ 1 3} = \begin{vmatrix} \displaystyle 2&\displaystyle 1\\[0.6em]\displaystyle 1&\displaystyle 1 \end{vmatrix} = 2 \cdot \left( 1 \right) - 1 \cdot \left(1 \right) = 1\]For \(A^{ 2, 1}\):

\[M_{ 2 1} = \det A^{ 2 1} = \begin{vmatrix} \displaystyle 2&\displaystyle 1\\[0.6em]\displaystyle 1&\displaystyle 1 \end{vmatrix} = 2 \cdot \left( 1 \right) - 1 \cdot \left(1 \right) = 1\]For \(A^{ 2, 2}\):

\[M_{ 2 2} = \det A^{ 2 2} = \begin{vmatrix} \displaystyle 1&\displaystyle 1\\[0.6em]\displaystyle 1&\displaystyle 1 \end{vmatrix} = 1 \cdot \left( 1 \right) - 1 \cdot \left(1 \right) = 0\]For \(A^{ 2, 3}\):

\[M_{ 2 3} = \det A^{ 2 3} = \begin{vmatrix} \displaystyle 1&\displaystyle 2\\[0.6em]\displaystyle 1&\displaystyle 1 \end{vmatrix} = 1 \cdot \left( 1 \right) - 1 \cdot \left(2 \right) = -1\]For \(A^{ 3, 1}\):

\[M_{ 3 1} = \det A^{ 3 1} = \begin{vmatrix} \displaystyle 2&\displaystyle 1\\[0.6em]\displaystyle 1&\displaystyle 4 \end{vmatrix} = 2 \cdot \left( 4 \right) - 1 \cdot \left(1 \right) = 7\]For \(A^{ 3, 2}\):

\[M_{ 3 2} = \det A^{ 3 2} = \begin{vmatrix} \displaystyle 1&\displaystyle 1\\[0.6em]\displaystyle 2&\displaystyle 4 \end{vmatrix} = 1 \cdot \left( 4 \right) - 2 \cdot \left(1 \right) = 2\]For \(A^{ 3, 3}\):

\[M_{ 3 3} = \det A^{ 3 3} = \begin{vmatrix} \displaystyle 1&\displaystyle 2\\[0.6em]\displaystyle 2&\displaystyle 1 \end{vmatrix} = 1 \cdot \left( 1 \right) - 2 \cdot \left(2 \right) = -3\]Summarizing, the minors matrix is:

\[M = \begin{bmatrix} \displaystyle -3&\displaystyle -2&\displaystyle 1\\[0.6em]\displaystyle 1&\displaystyle 0&\displaystyle -1\\[0.6em]\displaystyle 7&\displaystyle 2&\displaystyle -3 \end{bmatrix} \]Now, we can compute the elements of the cofactor matrix \(C\) using the formula

\[ C_{ij} = (-1)^{i+j}M_{ij}\]The above formula can be used directly because the minors are known already. We get

\[ C_{ 1 1} = (-1)^{ 1+1} \left(-3\right)= (-1)^{ 2} \left(-3\right) = -3\] \[C_{ 1 2} = (-1)^{ 1+2} \left(-2\right)= (-1)^{ 3} \left(-2\right) = 2\] \[C_{ 1 3} = (-1)^{ 1+3} \cdot 1 = (-1)^{ 4} \cdot 1 = 1\] \[C_{ 2 1} = (-1)^{ 2+1} \cdot 1 = (-1)^{ 3} \cdot 1 = -1\] \[C_{ 2 2} = (-1)^{ 2+2} \cdot 0 = (-1)^{ 4} \cdot 0 = 0\] \[C_{ 2 3} = (-1)^{ 2+3} \left(-1\right)= (-1)^{ 5} \left(-1\right) = 1\] \[C_{ 3 1} = (-1)^{ 3+1} \cdot 7 = (-1)^{ 4} \cdot 7 = -7\] \[C_{ 3 2} = (-1)^{ 3+2} \cdot 2 = (-1)^{ 5} \cdot 2 = -2\] \[C_{ 3 3} = (-1)^{ 3+3} \left(-3\right)= (-1)^{ 6} \left(-3\right) = 3\]Summarizing, the cofactor matrix is:

\[C = \begin{bmatrix} \displaystyle -3&\displaystyle 2&\displaystyle 1\\[0.6em]\displaystyle -1&\displaystyle 0&\displaystyle 1\\[0.6em]\displaystyle -7&\displaystyle -2&\displaystyle 3 \end{bmatrix} \]### Step 3: Compute the Adjoint Matrix from the cofactor Matrix

Now, we need just need to transpose the cofactor matrix we have found to compute the adjoint matrix. We get:

\[adj(A) = C^T = \begin{bmatrix} \displaystyle -3&\displaystyle 2&\displaystyle 1\\[0.6em]\displaystyle -1&\displaystyle 0&\displaystyle 1\\[0.6em]\displaystyle -7&\displaystyle -2&\displaystyle 3 \end{bmatrix} ^T = \begin{bmatrix} \displaystyle -3&\displaystyle -1&\displaystyle -7\\[0.6em]\displaystyle 2&\displaystyle 0&\displaystyle -2\\[0.6em]\displaystyle 1&\displaystyle 1&\displaystyle 3 \end{bmatrix} \]### Step 4: Compute the Inverse from the cofactor Matrix

Finally, we need to multiply \(\displaystyle \frac{1}{\det(A)} = \frac{1}{2}\) to every component of the adjoint matrix. So we get:

\[A^{-1} = \frac{1}{\det(A)} adj(A) = \frac{1}{2} \begin{bmatrix} \displaystyle -3&\displaystyle -1&\displaystyle -7\\[0.6em]\displaystyle 2&\displaystyle 0&\displaystyle -2\\[0.6em]\displaystyle 1&\displaystyle 1&\displaystyle 3 \end{bmatrix} = \begin{bmatrix} \displaystyle \frac{1}{2}\times\left(-3\right)&\displaystyle \frac{1}{2}\times\left(-1\right)&\displaystyle \frac{1}{2}\times\left(-7\right)\\[0.6em]\displaystyle \frac{1}{2}\times2&\displaystyle \frac{1}{2}\times0&\displaystyle \frac{1}{2}\times\left(-2\right)\\[0.6em]\displaystyle \frac{1}{2}\times1&\displaystyle \frac{1}{2}\times1&\displaystyle \frac{1}{2}\times3 \end{bmatrix} = \begin{bmatrix} \displaystyle -\frac{3}{2}&\displaystyle -\frac{1}{2}&\displaystyle -\frac{7}{2}\\[0.6em]\displaystyle 1&\displaystyle 0&\displaystyle -1\\[0.6em]\displaystyle \frac{1}{2}&\displaystyle \frac{1}{2}&\displaystyle \frac{3}{2} \end{bmatrix} \]which concludes the calculation of the inverse of the matrix \(A\).