Welcome to the **inverse matrix calculator**, where you'll have the chance to learn all about inverting matrices. This operation is similar to searching for the fraction of a given number, except now we're multiplying matrices and want to **obtain the identity matrix as a result**.

But don't worry. Before we give, say, the inverse of a $4\times4$4×4 matrix, we'll look at some basic definitions, including a **singular and nonsingular matrix**. Then we'll move on to the general **inverse matrix formula** with a neat simplification for the inverse of a $2\times2$2×2 matrix and some useful matrix inverse properties. Last but not least, we give an example with thorough calculations of how to find the inverse of a $3\times3$3×3 matrix.

## What is a matrix?

In primary school, they teach you the **natural numbers**, $1$1, $2$2, or $143$143, and they make perfect sense – you have $1$1 toy car, $2$2 comic books, and terribly long $143$143 days until Christmas. Then they tell you that there are also fractions (or **rational numbers**, as they call them), such as $1/2$1/2, or decimals, like $1.25$1.25, which still seems reasonable. After all, you gave $1/2$1/2 of your chocolate bar to your brother, and it cost $\text{\textdollar}1.25$$1.25. Next, you meet the **negative numbers** like $-2$−2 or $-30$−30, and they're a bit harder to grasp. But, once you think about it, one guy from your class got $-2$−2 points on a test for cheating, and there was a $-\text{\textdollar}30$−$30 discount on jeans on Black Friday.

Lastly, the school introduces **real numbers** and some weird worm-like symbols that they keep calling square roots. What's even worse, while $\sqrt{4}$4 is a simple $2$2, $\sqrt{3}$3 is something like $1.73205...$1.73205... and the digits go on forever. They convince you that such numbers describe, for example, the diagonal of a rectangle. And then there's $\pi$π, which somehow appeared out of nowhere when you talked about circles. Fair enough, maybe those numbers are *real* in some sense. But **that's just about as far as it can go**, right?

**Wrong.** Mathematicians are busy figuring out various interesting and, believe it or not, **useful extensions of real numbers**. The most important one is complex numbers, which are the starting point for any modern physicist. Fortunately, that's not the direction we're taking here. **There is another.**

**A matrix is an array of elements** (usually numbers) **that has a set number of rows and columns.** An example of a matrix would be:

$\scriptsize A=\begin{pmatrix}3&-1\\0&2\\1&-1\end{pmatrix}$A=(301−12−1)

Moreover, we say that a matrix has **cells**, or **boxes**, in which we write the elements of our array. For example, matrix $A$A above has the value $2$2 in the cell that is **in the second row and the second column**. The starting point here is 1-cell matrices, which are basically the same thing as real numbers.

As you can see, matrices are a tool used to **write a few numbers concisely and operate with the whole lot as a single object**. As such, they are extremely useful when dealing with:

- Systems of equations, especially when using Cramer's rule or as we've seen in our condition numbers calculator;
- Vectors and vector spaces;
- 3-dimensional geometry (e.g., the dot product and the cross product);
- Eigenvalues and eigenvectors; and
- graph theory and discrete mathematics.

Calculations with matrices are **a great deal trickier than with numbers**. For instance, if we want to add them, we first have to make sure that we can. But, since we're here on the **inverse matrix calculator**, we leave addition for later. First, however, let's familiarize ourselves with a few definitions.

## Singular and nonsingular matrix, the identity matrix

Whether you want to find the inverse of a $2\times2$2×2 matrix or the inverse of a $4\times4$4×4 matrix, you have to understand one thing first: **it doesn't always exist**. Think of a fraction, say $a / b$a/b. Such a thing is perfectly fine **as long as** $b$b **is non-zero**. If it is, the expression doesn't make sense, and a similar thing happens for matrices.

A **singular matrix** is one that doesn't have an inverse. A **nonsingular matrix** is (surprise, surprise) one that does. Therefore, whenever you face an exercise with an inverse matrix, you should begin by checking if it's nonsingular. Otherwise, there's no point sweating over calculations. **It just cannot be done.**

You can still get **pretty close** to a singular matrix's inverse by instead calculating its Moore-Penrose pseudoinverse. If you don't know what the pseudoinverse is, wait no more and jump to the pseudoinverse calculator!

By definition, **the inverse of a matrix** $A$A is a matrix $A^{-1}$A−1 for which:

$A\cdot A^{-1} = A^{-1}\cdot A = \mathbb{I}$A⋅A−1=A−1⋅A=I

Where $\mathbb{I}$Idenotes **the identity matrix**, i.e., a square matrix that has $1$1s on the main diagonal and $0$0s elsewhere. For example, the $3\times3$3×3 identity matrix is:

$\scriptsize\mathbb{I} = \begin{pmatrix}1&0&0\\0&1&0\\0&0&1\end{pmatrix}$I=(100010001)

In other words, when given an arbitrary matrix $A$A, we want to find another one for which **the product of the two** (in whatever order) **gives the identity matrix**. Think of $\mathbb{I}$I as $1$1 (the identity element) in the world of matrices. After all, for a fraction $a / b$a/b, its inverse is $b / a$b/a but not just because we "*flip it*" (at least, not by definition). It's because of a similar multiplication property:

$\scriptsize\frac{a}{b}\times\frac{b}{a}=\frac{b}{a}\times\frac{a}{b}=1$ba×ab=ab×ba=1

That was enough time spent reading through definitions, don't you think? Let's finally see **the inverse matrix formula** and learn how to find the inverse of a $2\times2$2×2, $3\times3$3×3, and $4\times4$4×4 matrix.

## How to find the inverse of a matrix: inverse matrix formula

Before we go into special cases, like the inverse of a $2\times2$2×2 matrix, let's take a look at **the general definition**.

Let $A$A be a square nonsingular matrix of size $n$n. Then the inverse $A^{-1}$A−1 (if it exists) is given by the formula:

$\scriptsize\frac{1}{|A|}\times\begin{pmatrix}(-1)^{1+1}\times A_{11}&(-1)^{1+2}\times A_{12}&\cdots&(-1)^{1+n}\times A_{1n}\\(-1)^{2+1}\times A_{21}&(-1)^{2+2}\times A_{22}&\cdots&(-1)^{2+n}\times A_{2n}\\\vdots&\vdots&\ddots&\vdots\\(-1)^{n+1}\times A_{n1}&(-1)^{n+2}\times A_{n2}&\cdots&(-1)^{n+n}\times A_{nn}\end{pmatrix}$∣A∣1×⎝⎛(−1)1+1×A11(−1)2+1×A21⋮(−1)n+1×An1(−1)1+2×A12(−1)2+2×A22⋮(−1)n+2×An2⋯⋯⋱⋯(−1)1+n×A1n(−1)2+n×A2n⋮(−1)n+n×Ann⎠⎞

The $|A|$∣A∣ is the determinant of $A$A (not to be confused with the absolute value of a number). The $A_{ij}$Aij denotes the $i,j$i,j-minor of $A$A, i.e., the determinant of the matrix obtained from $A$A by forgetting about its $i^{\mathrm{th}}$ith row and $j^{\mathrm{th}}$jth column (it is a square matrix of size $n-1$n−1). What we have obtained in called the cofactor matrix of $A$A. Lastly, the $^{\mathrm{T}}$T outside the array is the transposition. It means that once we know the cells inside, we have to "*flip them*" so that the $i^{\mathrm{th}}$ith row will become its $i^{\mathrm{th}}$ithh column and vice versa, as we taught you at the matrix transpose calculator. This leads to the *adjoint matrix* of $A$A. All these steps are detailed at Omni's adjoint matrix calculator, in case you need a more formal explanation.

Phew, that was **a lot of symbols and a lot of technical mumbo-jumbo**, but that's just the way mathematicians like it. Some of us wind down by watching romcoms, and others write down definitions that sound smart. **Who are we to judge them?**

In the next section, we point out **a few important facts to take into account** when looking for the inverse of a $4\times4$4×4 matrix, or whatever size it is. But before we see them, let's take some time to look at **what the above matrix inverse formula becomes** when it's the inverse of a $2\times2$2×2 matrix that we're looking for.

Let:

$\scriptsize A = \begin{pmatrix}a&b\\c&d\end{pmatrix}$A=(acbd)

Then the minors (the $A_{ij}$Aijs above) come from crossing out one of the rows and one of the columns. But if we do that, we'll be left with **a single cell**! And the determinant of such a thing (a $1\times1$1×1 matrix) is just the number in that cell. For example, $A_{12}$A12 comes from forgetting the first row and the second column, which means that only $c$c remains (or rather $\begin{pmatrix}c\end{pmatrix}$(c) since it's a matrix). Therefore,

$\scriptsize A^{-1} = \frac{1}{|A|}\times\begin{pmatrix}(-1(^{1+1}\times d& (-1)^{1+2}\times c\\(-1)^{2+1}\times b&(-1)^{2+2}\times a\end{pmatrix}^{\mathrm{T}}$A−1=∣A∣1×((−1(1+1×d(−1)2+1×b(−1)1+2×c(−1)2+2×a)T

Also, in this special case, **the determinant is simple enough**: $|A| = a\times d - b\times c$∣A∣=a×d−b×c. So after taking the minuses and the transposition, we arrive at **a nice and pretty formula** for the inverse of a $2\times2$2×2 matrix:

$\scriptsize A^{-1} = \frac{1}{a\times d-b\times c}\times\begin{pmatrix}d&-b\\-c&a\end{pmatrix}$A−1=a×d−b×c1×(d−c−ba)

Arguably, the inverse of a $4\times4$4×4 matrix is not as easy to calculate as the $2\times2$2×2 case. **There is an alternative way of calculating the inverse of a matrix**; the method involves **elementary row operations** and the so-called **Gaussian elimination** (for more information, be sure to check out the (reduced) row echelon form calculator). As an example, we describe below how to find the inverse of a $3\times3$3×3 matrix using the alternative algorithm.

Say that you want to calculate the inverse of a matrix:

$\scriptsize\begin{pmatrix}a_1&a_2&a_3 \\b_1&b_2&b_3\\c_1&c_2&c_3\end{pmatrix}$(a1b1c1a2b2c2a3b3c3)

We then construct a matrix with three rows and twice as many columns like the one below:

$\scriptsize\begin{pmatrix}a_1&a_2&a_3&\vdots&1&0&0 \\b_1&b_2&b_3&\vdots&0&1&0\\c_1&c_2&c_3&\vdots&0&0&1\end{pmatrix}$⎝⎛a1b1c1a2b2c2a3b3c3⋮⋮⋮100010001⎠⎞

and use Gaussian elimination on the 6-element rows of the matrix to transform it into something of the form:

$\scriptsize\begin{pmatrix}1&0&0&\vdots &x_1&x_2&x_3\\0&1&0&\vdots&y_1&y_2&y_3\\0&0&1&\vdots&z_1&z_2&z_3\end{pmatrix}$⎝⎛100010001⋮⋮⋮x1y1z1x2y2z2x3y3z3⎠⎞

where the $x$x's, $y$y's, and $z$z's are obtained along the way from the transformations. Then:

$\scriptsize A^{-1} = \begin{pmatrix}x_1&x_2&x_3\\y_1&y_2&y_3\\z_1&z_2&z_3\end{pmatrix}$A−1=(x1y1z1x2y2z2x3y3z3)

Whichever method you prefer, it might be useful to check out a few **matrix inverse properties** to make our studies a little easier.

## Matrix inverse properties

Below we list a few observations and matrix inverse properties.

**The inverse of a matrix doesn't always exist.**Let's take a closer look at the inverse matrix formula in the section above. It contains the determinant of the matrix. This means that, first of all, we need to have**a square matrix**even to start thinking about its inverse. Secondly, the determinant appears in the denominator of a fraction in the inverse matrix formula. Therefore, if that determinant is equal to $0$0, then that expression doesn't make any sense, and the inverse doesn't exist.**The inverse of an inverse is the initial matrix.**In other words, if you invert a matrix twice, you'll obtain what you started with. Symbolically, we can write this property as $(A^{-1})^{-1} = A$(A−1)−1=A for an arbitrary nonsingular matrix $A$A.**The inverse of a product is the product of the inverses in the reverse order.**This means that if you have two square matrices $A$A and $B$B of the same size and want to calculate the inverse of their product, then, alternatively, you can find their individual inverses and multiply them but in the reverse order. In short, $(A\cdot B)^{-1} = B^{-1}\cdot A^{-1}$(A⋅B)−1=B−1⋅A−1.**The inverse of the transpose is the transpose of the inverse.**In essence, it doesn't matter if you first transpose a matrix and then calculate its inverse or first find the inverse and only transpose it then. In symbolic notation, this translates to $(A^{\mathrm{T}})^{-1} = (A^{-1})^{\mathrm{T}}$(AT)−1=(A−1)T. In particular, observe that this relies on the fact that**the determinant of a matrix stays the same after transposition**.

We hope that you're **sufficiently intrigued** by the theory and can't wait to tell your friends about it over a cup of coffee. However, before you go spreading knowledge, let's go together through an example and see **how to find the inverse of a $3\times3$3×3 matrix in practice**.

## Example: using the inverse matrix calculator

We'll now **study step-by-step how to find the inverse of a $3\times3$3×3 matrix**. Say that you're given an array:

$\scriptsize A = \begin{pmatrix}1&0&5\\2&1&6\\3&4&0\end{pmatrix}$A=(123014560)

Before we move on to the calculations, let's see how we can use **the inverse matrix calculator** to do it all for us.

First of all, we're dealing with a $3\times3$3×3 matrix, so we have to **tell the calculator that** by choosing the proper option under "*Matrix size*." This will show us **a symbolic example of such an array** with cells denoted $a_1$a1, $a_2$a2, and so on. We have to input the numbers given by our matrix under the correct symbols from the picture. For example, $a_3$a3 is in the first row in the third column, so we find the corresponding cell in our matrix and check that it has $5$5 in there. Therefore, we put $a_3 = 5$a3=5 into the inverse matrix calculator. Similarly, we get the other cells:

We define the other cells:

$\scriptsize \begin{split}a_1&=1\\a_2&=0\\a_3&=5\end{split}$a1a2a3=1=0=5

Then:

$\scriptsize \begin{split}b_1&=2\\b_2&=1\\b_3&=6\end{split}$b1b2b3=2=1=6

And:

$\scriptsize \begin{split}c_1&=3\\c_2&=4\\c_3&=0\end{split}$c1c2c3=3=4=0

The moment we input the last number, the inverse matrix calculator **will spit out the answer** or tell us that the inverse doesn't exist. But, if you don't want any spoilers, we can also **do the calculations by hand**.

A priori, we don't even know if $A^{-1}$A−1 exists, maybe it's just a fairytale like vampires? To make sure, let's calculate its determinant:

$\scriptsize\begin{split}|A| = 1\times1\times0+0\times6\times3+5\times2\times4\\-5\times1\times3-0\times2\times0-1\times6\times4\\=0+0+40-15-0-24=1\end{split}$∣A∣=1×1×0+0×6×3+5×2×4−5×1×3−0×2×0−1×6×4=0+0+40−15−0−24=1

Phew, **no vampires today**, just a nonsingular matrix and **good ol' mathematics**.

Recall the matrix inverse formula and observe that it's now **time to calculate the** $A_{ij}$Aijs for $i$i and $j$j between $1$1 and $3$3. As an example, let's take, say, $A_{11}$A11, and $A_{23}$A23. The first of the two is the determinant of what we get by forgetting the first row and the first column of $A$A. This means that:

$\scriptsize A_{11} = \begin{vmatrix}1&6\\4&0\end{vmatrix}$A11=∣∣1460∣∣

Similarly, $A_{23}$A23 comes from crossing out the second row and the third column:

$\scriptsize A_{23} = \begin{vmatrix}1&0\\3&4\end{vmatrix}$A23=∣∣1304∣∣

This gives:

$\scriptsize A_{11} = 1\times0-6\times4=-23$A11=1×0−6×4=−23

And:

$\scriptsize A_{23} = 1\times4-0\times3=4$A23=1×4−0×3=4

The complete first row is:

$\scriptsize \begin{split}A_{11} & = -23\\A_{12} & = -18\\A_{13} & = 5\\\end{split}$A11A12A13=−23=−18=5

For the second row, we find:

$\scriptsize \begin{split}A_{21} & = -20\\A_{22} & = -15\\A_{23} & = 4\\\end{split}$A21A22A23=−20=−15=4

And the third row is:

$\scriptsize \begin{split}A_{31} & = -5\\A_{32} & = -4\\A_{33} & = 1\\\end{split}$A31A32A33=−5=−4=1

It only remains to **use the inverse matrix formula** and plug in all the numbers we've calculated above:

$\scriptsize \begin{split}A^{-1} &= \frac{1}{|A|}\!\times\!\begin{pmatrix}(-1)^{1+1}\times A_{11}&(-1)^{1+2}\times A_{12}&(-1)^{1+3}\times A_{13}\\(-1)^{2+1}\times A_{21}&(-1)^{2+2}\times A_{22}&(-1)^{2+3}\times A_{23}\\(-1)^{3+1}\times A_{31}&(-1)^{3+2}\times A_{32}&(-1)^{3+3}\times A_{33}\end{pmatrix}^{\mathrm{\!\!T}}\\[1.5em]&= \frac{1}{|A|}\!\times\!\begin{pmatrix}(-1)^{1+1}\times (-23)&(-1)^{1+2}\times (-18)&(-1)^{1+3}\times 5\\(-1)^{2+1}\times (-20)&(-1)^{2+2}\times(-15)&(-1)^{2+3}\times 4\\(-1)^{3+1}\times (-5)&(-1)^{3+2}\times(-4)&(-1)^{3+3}\times1\end{pmatrix}^{\mathrm{\!\!T}}\\[1.5em]&=1\!\times\!\begin{pmatrix}-23&18&5\\20&-15&-4\\-5&4&1\end{pmatrix}^{\mathrm{\!\!T}}\\[1.5em]&=\begin{pmatrix}-23&20&-5\\18&-15&4\\5&-4&1\end{pmatrix}\end{split}$A−1=∣A∣1×((−1)1+1×A11(−1)2+1×A21(−1)3+1×A31(−1)1+2×A12(−1)2+2×A22(−1)3+2×A32(−1)1+3×A13(−1)2+3×A23(−1)3+3×A33)T=∣A∣1×((−1)1+1×(−23)(−1)2+1×(−20)(−1)3+1×(−5)(−1)1+2×(−18)(−1)2+2×(−15)(−1)3+2×(−4)(−1)1+3×5(−1)2+3×4(−1)3+3×1)T=1×(−2320−518−1545−41)T=(−2318520−15−4−541)

**Wasn't so bad, was it?** Still, the inverse matrix calculator is **quite useful** as it saves us all that hassle. Now that we've learned something, we deserve a short nap in the hammock, don't we?