Omni Calculator logo

Matrix Determinant Calculator

Created by Maciej Kowalski, PhD candidate
Reviewed by Anna Szczepanek, PhD and Jack Bowater
Last updated: Jun 05, 2023


Welcome to the matrix determinant calculator, where you'll have a chance to compute, well, matrix determinants, using the easy to use determinant formula for any square matrix up to 4×4 in size. Also, we'll look into some of the basic properties of determinants that can help solve larger ones, such as the determinant of a 4×4 matrix.

"What is a determinant, and why should I care?" We'll show you the determinant definition in a little while, but let's just say that, among other uses, it is extremely helpful when dealing with systems of equations - check our system of equations calculator for more details. Basically, how to solve a system of three equations is the same as how to find the determinant of a 3×3 matrix.

Convinced? Encouraged? Excited? Let's move on then, shall we?

What is a determinant?

Why don't we start with what a matrix is? Believe it or not, it's not only the sci-fi classic from the '90s. In mathematics, it's the name we give to an array of elements (usually numbers) with a set number of rows and columns. An example of a matrix is:

A=[310211]A = \begin{bmatrix} 3 & -1 \\ 0 & 2\\ 1 & -1 \end{bmatrix}

As you can see, the numbers are arranged between two big square brackets, [[ and ]]. Also, we say that, for example, the number 22 is in the cell in the second row and the second column.

The determinant definition states that it is a number that is obtained by multiplying and adding the cells of a square matrix according to a given rule. Let's take a closer look at a few important things here.

  • As the determinant definition suggests, we need to have a square matrix to even start the calculations. This means that we can find the determinant of a 2×2 matrix or the determinant of a 4×4 matrix, but not, for example, of something that looks like the AA above, which is a 3×2 (three rows and two columns) matrix;
  • The determinant formula for larger matrices gets quite complicated. Its number of summands is equal to the number of permutations of the number that is the matrix's side. This means that the determinant of a 2×2 matrix has only two summands, but for 5×5 matrices, we get 120 summands;
  • There are ways to make the calculations easier. For example, finding the determinant of a 4×4 matrix can be changed into the problem of how to find the determinant of a 3×3 matrix. We'll look into some such properties of determinants in "Properties of determinants" section; and
  • The determinant of a matrix, AA, is denoted by A|A| (simply replace the square brackets of a matrix with vertical lines |) or det(A)\det(A). Do not mistake the first notation with the absolute value! In general, the determinant can be a negative number.

So, what is a determinant? It's a number; we've learned that much. But why is it useful? Where does it appear?

The matrix determinant is an extremely helpful and often-used tool in linear algebra. Whenever we have a matrix and want to understand it, the determinant is one of the first things we turn to. For instance, every system of linear equations can be described by a matrix. Its determinants help us find the solution, for example, by using Cramer's rule, which you can find in our Cramer's rule calculator. Moreover, when we use matrices to describe a linear transformation, it's often best to diagonalize them. How do we do that? With determinants, of course.
The determinant of a matrix also tells us whether the matrix has an inverse and whether the inverse must be approximated with the Moore-Penrose pseudoinverse.
Lastly, we usually need the eigenvalues of such a transformation. Yes, you guessed it - for that, we also use determinants.

🙋 To find eigenvalues and the corresponding eigenvectors of any matrix, feel free to use Omni's eigenvalue and eigenvector calculator

Hopefully, we've managed to convince you that it's worthwhile to learn the determinant definition. But how do we calculate it? Is there some short, neat determinant formula for everyday use?

The general determinant formula

Before we see some specific examples, like how to find the determinant of a 3×3 matrix, let's take a look at the monstrosity that is the general determinant definition.

Let AA be a square matrix of size nn, where nn is some natural number. Denote the cells of AA by ai,ja_{i,j}, where ii is the number of the row, and jj is the number of the column. Then:

A=(1)sgn(σ)ai,σ(i),|A| = \sum(-1)^{\mathrm{sgn}(\sigma)}\prod a_{i,\sigma(i)},

where:

  • \sum is the sum of all permutations of the set {1,2,n}\{1,2\ldots,n\}; and
  • \prod is the product of ii-s from 11 to nn.

Pretty, isn't it? If we translate the funny symbols into something more understandable, it means more or less this:

💡 To calculate the determinant, look at your matrix, take nn numbers, one from each row and every column, and multiply them together. Take all such nn-tuples, change their sign sometimes, and sum it all up.

Don't worry; now that we've put this general determinant definition out into the open, we'll not think about it anymore. We'll stick to the easy cases, where the matrix is not too big, to show what it really means.

The determinant of a 2×2, 3×3, and 4×4 matrix

As it often is in life, size matters. In this particular case, the smaller the matrix, the easier the determinant formula. For consistency, we use the notation below, as in the matrix determinant calculator.

If

A=[a1a2b1b2]A = \begin{bmatrix} a_1 & a_2 \\ b_1 & b_2 \end{bmatrix}

then the determinant of AA is

A=a1b2a2b1|A| = a_1 \cdot b_2 - a_2 \cdot b_1.

Note that this is equivalent to taking the numbers of one of the diagonals of the square matrix (from the top left corner to the bottom right) minus the other one (from the top right corner to the bottom left).

Next, if

B=[a1b1c1a2b2c2a3b3c3]B = \begin{bmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{bmatrix}

then the determinant of BB is:

B=a1b2c3+a2b3c1+a3b1c2a3b2c1a1b3c2a2b1c3.\footnotesize \begin{split} |B| =&\, a_1 \!\cdot\! b_2 \!\cdot\! c_3 + a_2 \!\cdot\! b_3 \!\cdot\! c_1 + a_3 \!\cdot\! b_1 \!\cdot\! c_2 \\ &-\!a_3 \!\cdot\! b_2 \!\cdot\! c_1 - a_1 \!\cdot\! b_3 \!\cdot\! c_2 - a_2 \!\cdot\! b_1 \!\cdot\! c_3. \end{split}

Here again, we can use some diagonals to remember the formula. To see it clearly, let's write the two top rows again beneath the matrix:

a1b1c1a2b2c2a3b3c3a1b1c1a2b2c2\begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{vmatrix}\\ \kern{.4em} \begin{matrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \end{matrix}

Now, as in the 2×2 case, start with the diagonal of the original square matrix, that goes from the top left corner to the bottom right - this is the first summand, a1b2c3a_1 \cdot b_2 \cdot c_3. Then we take this whole diagonal and move it one step down, i.e., in each column take the element under the one we took before. Here the expanded array we drew above helps us to see that this gives the second summand, a2b3c1a_2 \cdot b_3 \cdot c_1. We do this one more time to get a3b1c2a_3 \cdot b_1 \cdot c_2 and this finishes the down-right diagonals and the summands that appear with a plus.

Next, we move on to the other diagonal of the original matrix (from the top right corner to the bottom left) and get the first negative summand in the formula, a3b2c1a_3 \cdot b_2 \cdot c_1. We do the same thing as before - moving the diagonal down. The expanded form above lets us easily see that this gives the other two negative summands, a1b3c2a_1 \cdot b_3 \cdot c_2 and a2b1c3a_2 \cdot b_1 \cdot c_3.

Lastly, if

C=[a1b1c1d1a2b2c2d2a3b3c3d3a4b4c4d4]C = \begin{bmatrix} a_1 & b_1 & c_1 & d_1 \\ a_2 & b_2 & c_2 & d_2 \\ a_3 & b_3 & c_3 & d_3 \\ a_4 & b_4 & c_4 & d_4 \\ \end{bmatrix}

then the determinant of such a 4×4 matrix is:

C=a1b2c3d4a2b1c3d4+a3b1c2d4a1b3c2d4+a2b3c1d4a3b2c1d4+a3b2c4d1a2b3c4d1+a4b3c2d1a3b4c2d1+a2b4c3d1a4b2c3d1+a4b1c3d2a1b4c3d2+a3b4c1d2a4b3c1d2+a1b3c4d2a3b1c4d2+a2b1c4d3a1b2c4d3+a4b2c1d3a2b4c1d3+a1b4c2d3a4b1c2d3.\scriptsize \begin{split} \!|C| \!=&\kern{.9em} a_1 \!\cdot\! b_2 \!\cdot\! c_3 \!\cdot\! d_4 - a_2 \!\cdot\! b_1 \!\cdot\! c_3 \!\cdot\! d_4 + a_3 \!\cdot\! b_1 \!\cdot\! c_2 \!\cdot\! d_4\\ &\! - a_1 \!\cdot\! b_3 \!\cdot\! c_2 \!\cdot\! d_4 + a_2 \!\cdot\! b_3 \!\cdot\! c_1 \!\cdot\! d_4 - a_3 \!\cdot\! b_2 \!\cdot\! c_1 \!\cdot\! d_4 \\ &\! + a_3 \!\cdot\! b_2 \!\cdot\! c_4 \!\cdot\! d_1 - a_2 \!\cdot\! b_3 \!\cdot\! c_4 \!\cdot\! d_1 + a_4 \!\cdot\! b_3 \!\cdot\! c_2 \!\cdot\! d_1 \\ &\! - a_3 \!\cdot\! b_4 \!\cdot\! c_2 \!\cdot\! d_1 + a_2 \!\cdot\! b_4 \!\cdot\! c_3 \!\cdot\! d_1 - a_4 \!\cdot\! b_2 \!\cdot\! c_3 \!\cdot\! d_1 \\ &\! + a_4 \!\cdot\! b_1 \!\cdot\! c_3 \!\cdot\! d_2 - a_1 \!\cdot\! b_4 \!\cdot\! c_3 \!\cdot\! d_2 + a_3 \!\cdot\! b_4 \!\cdot\! c_1 \!\cdot\! d_2 \\ &\! - a_4 \!\cdot\! b_3 \!\cdot\! c_1 \!\cdot\! d_2 + a_1 \!\cdot\! b_3 \!\cdot\! c_4 \!\cdot\! d_2 - a_3 \!\cdot\! b_1 \!\cdot\! c_4 \!\cdot\! d_2 \\ &\! + a_2 \!\cdot\! b_1 \!\cdot\! c_4 \!\cdot\! d_3 - a_1 \!\cdot\! b_2 \!\cdot\! c_4 \!\cdot\! d_3 + a_4 \!\cdot\! b_2 \!\cdot\! c_1 \!\cdot\! d_3 \\ &\! - a_2 \!\cdot\! b_4 \!\cdot\! c_1 \!\cdot\! d_3 + a_1 \!\cdot\! b_4 \!\cdot\! c_2 \!\cdot\! d_3 - a_4 \!\cdot\! b_1 \!\cdot\! c_2 \!\cdot\! d_3. \end{split}

Whew, that was a long one, wasn't it? You can see now that it's super easy to find the determinant of a 2×2 matrix, and we can learn how to find the determinant of a 3×3 matrix in an hour or so. But the determinant of a 4×4 matrix is a whole new problem. Don't get us wrong, it's perfectly doable, but who's going to pay us for that time spent calculating and, later, looking for where we took a1a_1 instead of a2a_2?

So, how do we use the diagonal trick here? The answer is simple: we don't. Unfortunately, it doesn't work for matrices of that are 4 or larger.

"So, how can I efficiently calculate what is a 4×4 determinant? Or 5×5?" Well, how convenient of you to ask! We'll show you that in the next section.

Properties of determinants

We'll now list a few important properties of determinants that may come useful. We begin with simple ones and bring out the big guns at the very end.

  1. The determinant of a product is the product of the determinants. In other words, if we multiply two square matrices and want to find the determinant of the result, then we can get the answer by calculating the determinants of the factors and multiplying them together.

  2. The determinant of a matrix is equal to that of its transpose. In essence, if instead of the matrix we started with, we "flip it" so that its first row will be the first column, the first column will be the first row, etc. (this is called the transposition of a matrix), then their determinants will be the same. For example:

1410236115=1064211135\begin{vmatrix} 1 & 4 & -1 \\ 0 & 2 & -3 \\ 6 & 11 & 5 \end{vmatrix} = \begin{vmatrix} 1 & 0 & 6 \\ 4 & 2 & 11 \\ -1 & -3 & 5 \end{vmatrix}
  1. If we exchange two rows or two columns, the determinant will stay the same but with the opposite sign. This means that, for instance, if we want to know how to find the determinant of a 3×3 matrix, then we can exchange, say, its first column with its third to obtain the same number but with a different sign (see the example below):
1410236115= ⁣1413205116\begin{vmatrix} 1 & 4 & -1 \\ 0 & 2 & -3 \\ 6 & 11 & 5 \end{vmatrix} = -\! \begin{vmatrix} -1 & 4 & 1 \\ -3 & 2 & 0 \\ 5 & 11 & 6 \end{vmatrix}
  1. We can add any non-zero multiple of a row to some other row (or a column to a column) and not change the determinant. This is similar to what we do in Gaussian elimination when we want to find the row echelon form of a system of equations, except that there we only dealt with rows (which corresponded to equations). Our reduced row echelon form calculator uses this property. It means that if we add, say, two copies of the first row to the second one, we'll obtain a matrix with the same determinant. For example:
1410236115=1410+212+243+2(1)6115\footnotesize \begin{vmatrix} 1 &\! 4 &\! -1 \\ 0 &\! 2 &\! -3 \\ 6 &\! 11 &\! 5 \end{vmatrix} = \begin{vmatrix} 1 &\! 4 &\! -1 \\ 0\!+\!2\!\cdot\!1 &\! 2\!+\!2\!\cdot\!4 &\! -3\!+\!2\!\cdot\!(-\!1) \\ 6 &\! 11 &\! 5 \end{vmatrix}

which gives:

1410236115=14121056115\begin{vmatrix} 1 & 4 & -1 \\ 0 & 2 & -3 \\ 6 & 11 & 5 \end{vmatrix} = \begin{vmatrix} 1 & 4 & -1 \\ 2 & 10 & -5 \\ 6 & 11 & 5 \end{vmatrix}
  1. (Laplace expansion) Remember the "What is a determinant of a 5×5 matrix?" question from the above section? Finally, we can touch upon this topic and introduce a powerful tool to help us with the determinant formula.

Let AA be a square matrix of size nn. Say that the jj-th row (or column) of AA has elements a1a_1, a2a_2,…, ana_n. Denote by AiA_i the matrix obtained from AA by removing the whole row and column in which we had aia_i (AiA_i is then a square matrix of size n1n-1). Then:

A=(1)j+1a1A1+(1)j+2a2A2++(1)j+nanAn.\footnotesize \begin{split} |A| \!&=\! (-1)^{j+1} \!\cdot\! a_1 \!\cdot\! |A_1| + (-1)^{j+2} \!\cdot\! a_2 \!\cdot\! |A_2| \\ &\;\;+ \ldots + (-1)^{j+n} \!\cdot\! a_n \!\cdot\! |A_n|. \end{split}

Now, that's a useful tool if we've ever seen one. And it's quite fun to use! For example, if they ask us how to find the determinant of a 3×3 matrix, we can grab a piece of paper, pick, say, the third row of the matrix, and write enthusiastically:

1410236115=(1)3+164123+(1)3+2111103+(1)3+351402\footnotesize \begin{split} \begin{vmatrix} 1 & 4 & -1 \\ 0 & 2 & -3 \\ 6 & 11 & 5 \end{vmatrix} =& (-1)^{3+1} \!\cdot\! 6 \!\cdot\! \begin{vmatrix} 4 & -1 \\ 2 & -3 \end{vmatrix} \\ +& (-1)^{3+2} \!\cdot\! 11 \!\cdot\! \begin{vmatrix} 1 & -1 \\ 0 & -3 \end{vmatrix} \\ +& (-1)^{3+3} \!\cdot\! 5 \!\cdot\! \begin{vmatrix} 1 & 4 \\ 0 & 2 \end{vmatrix} \end{split}

It must have taken ages to read through all this theory! If you want to learn more, visit our dedicated cofactor expansion calculator. And we'll finally look at an example.

Example: using the matrix determinant calculator

Say that you want to calculate the determinant of the following matrix:

A=[2513417968327814]A = \begin{bmatrix} 2 & 5 & 1 & 3 \\ 4 & 1 & 7 & 9 \\ 6 & 8 & 3 & 2 \\ 7 & 8 & 1 & 4 \end{bmatrix}

The determinant of a 4×4 matrix, huh? We saw the determinant formula for one in the section "The determinant of a 2×2, 3×3, and 4×4 matrix", so we know it's not going to be very entertaining, is it? But we've learned some properties of determinants since then, so why don't we make them work in our favor?

Before we do that, however, let's use the matrix determinant calculator to see how our tool simplifies such problems. First of all, we're dealing with a 4×4 matrix, so we need to tell that to the calculator by choosing the appropriate option under "Matrix size."

This will show us an example of such a matrix with symbolic notation for its elements. As we can see, a1a_1, b1b_1, c1c_1, and d1d_1 denote the numbers in the first row, so let's scroll to where we input data and feed the matrix determinant calculator with what we have in our exercise:

  • a1=2a_1=2, b1=5b_1=5, c1=1c_1=1, d1=3d_1=3.

Similarly, for the other rows, we have:

  • a2=4a_2=4, b2=1b_2=1, c2=7c_2=7, d2=9d_2=9;
  • a3=6a_3=6, b3=8b_3=8, c3=3c_3=3, d3=2d_3=2;
  • a4=7a_4=7, b4=8b_4=8, c4=1c_4=1, d4=4d_4=4.

The moment we write the last number, the matrix determinant calculator will do its magic and spit out the answer:

A=630|A| = 630.

Alright, now that we have this spoiler of an answer, let's see how we can obtain this answer by hand. Obviously, one way is to simply use the 24-term determinant formula, but we'd like some extra points for creativity and want to use the properties of determinants.

We'll use the Laplace expansion, but in a clever way. We pick an arbitrary row or column, say the first row of the matrix, and try to make the expansion a little easier. After all, if we use the formula straight away, we'll get the sum of four 3×3 determinants. Not terrible, but not great either. We can, however, do something first - use elementary column operations.

We've seen in the above section that the determinant will stay the same if we add any non-zero multiple of a column to another column. So why don't we add a (2)(-2)-multiple of the third column to the first one?

A=2 ⁣+ ⁣(2) ⁣ ⁣15134 ⁣+ ⁣(2) ⁣ ⁣71796 ⁣+ ⁣(2) ⁣ ⁣38327 ⁣+ ⁣(2) ⁣ ⁣1814|A| = \begin{vmatrix} 2\!+\!(-2)\!\cdot\!1 & 5 & 1 & 3 \\ 4\!+\!(-2)\!\cdot\!7 & 1 & 7 & 9 \\ 6\!+\!(-2)\!\cdot\!3 & 8 & 3 & 2 \\ 7\!+\!(-2)\!\cdot\!1 & 8 & 1 & 4 \end{vmatrix}

which gives:

A=05131017908325814|A| = \begin{vmatrix} 0 & 5 & 1 & 3 \\ -10 & 1 & 7 & 9 \\ 0 & 8 & 3 & 2 \\ 5 & 8 & 1 & 4 \end{vmatrix}

And why have we done that? Recall that in the Laplace expansion, the summands were like this: (1)(-1) to some power times the element of the row or column we've chosen times a smaller determinant. Therefore, if we now expand A|A| with respect to the first row, the summand corresponding to the first cell in the first row will be (1)(-1) to some power times 00 times some determinant. And this is zero because anything times zero is zero.

Great, we've reduced the number of summands by one! So how about we repeat the procedure and get even fewer? To do that, we want to have more zeros in the first row, so let's make the 55 and the 33 into 00-s. As we did before, we add to those columns the right multiple of the third column (the one with 11):

A=05+(5)113+(3)1101+(5)779+(3)708+(5)332+(3)358+(5)114+(3)1\footnotesize |A| \!=\! \begin{vmatrix} 0 & 5\!+\!(-5)\!\cdot\!1 & 1 & 3\!+\!(-3)\!\cdot\!1 \\ -10 & 1\!+\!(-5)\!\cdot\!7 & 7 & 9\!+\!(-3)\!\cdot\!7 \\ 0 & 8\!+\!(-5)\!\cdot\!3 & 3 & 2\!+\!(-3)\!\cdot\!3 \\ 5 & 8\!+\!(-5)\!\cdot\!1 & 1 & 4\!+\!(-3)\!\cdot\!1 \end{vmatrix}

which gives:

A=0010103471207375311|A| = \begin{vmatrix} 0 & 0 & 1 & 0 \\ -10 & -34 & 7 & -12 \\ 0 & -7 & 3 & -7 \\ 5 & 3 & 1 & 1 \end{vmatrix}

Now this is more like it! With this form, if we use the Laplace expansion to the first row, we'll only get one summand because the three others will be 00 times something, which is 00. To be precise, we get:

A ⁣= ⁣(1)1+3 ⁣ ⁣1 ⁣ ⁣10 ⁣34 ⁣120 ⁣7 ⁣75 ⁣3 ⁣1\small |A| \!=\! (-1)^{1+3} \!\cdot\! 1 \!\cdot\! \begin{vmatrix} -10 &\! -34 &\! -12 \\ 0 &\! -7 &\! -7 \\ 5 &\! 3 &\! 1 \end{vmatrix}

And we know quite well how to find the determinant of a 3×3 matrix, don't we? But remember that if you'd like to have some more fun, you could use the Laplace expansion again to get a determinant of a 2×2 matrix. Otherwise, we can just use the determinant formula and, based on the above, get:

A=(1)(10(7)1+(34)(7)5+(12)05(12)(7)5(10)(7)3(34)01)=630\footnotesize \begin{split} |A| =& (-1)⁴ \!\cdot\! (-10 \!\cdot\! (-7) \!\cdot\! 1 + (-34) \!\cdot\! (-7) \!\cdot\! 5 \\ &+ (-12) \!\cdot\! 0 \!\cdot\! 5 - (-12) \!\cdot\! (-7) \!\cdot\! 5 \\ &- (-10) \!\cdot\! (-7) \!\cdot\! 3 - (-34) \!\cdot\! 0 \!\cdot\! 1) \\ =&\; 630 \end{split}

Yay, it agrees with what we had above! See how much time the matrix determinant calculator can save us.

Maciej Kowalski, PhD candidate
Matrix size
2x2
A=
a₁b₁
a₂b₂
First row
a₁
b₁
Second row
a₂
b₂
Result
Determinant |A|
Check out 35 similar linear algebra calculators 🔢
Adjoint matrixCharacteristic polynomialCholesky decomposition… 32 more
People also viewed…

Ideal egg boiling

Quantum physicist's take on boiling the perfect egg. Includes times for quarter and half-boiled eggs.

Korean age

If you're wondering what would your age be from a Korean perspective, use this Korean age calculator to find out.

Potato

The potato calculator is here to help you solve the mystery of dehydrating potatoes and the actual weight lost compared to a percentage.

Triangle ratio

The triangle ratio calculator allows you to determine the angles in a triangle when you know their ratio.
Copyright by Omni Calculator sp. z o.o.
Privacy, Cookies & Terms of Service