Matrix Determinant Calculator
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 4x4 in size. Also, we'll look into some of the basic properties of determinants that can help with solve larger ones, such as the determinant of a 4x4 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. Basically, how to solve a system of three equations is the same as how to find the determinant of a 3x3 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
As you can see, the numbers are arranged between two big square brackets,
]. Also, we say that, for example, the number
2 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 2x2 matrix or the determinant of a 4x4 matrix, but not, for example, of something that looks like the
Aabove, which is a 3x2 (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 2x2 matrix has only two summands, but for 5x5 matrices, we get 120 summands;
- There are ways to make the calculations easier. For example, finding the determinant of a 4x4 matrix can be changed into the problem of how to find the determinant of a 3x3 matrix. We'll look into some such properties of determinants in section; and
- The determinant of a matrix,
Ais denoted by
|A|(simply replace the square brackets of a matrix with vertical lines
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 learnt 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, and its determinants help us find the solution, for example, by using Cramer's rule. 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.
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 3x3 matrix, let's take a look at the monstrosity that is the general determinant definition.
A be a square matrix of size
n is some natural number. Denote the cells of
A by ai,j, where
i is the number of the row, and
j is the number of the column. Then:
|A| = Σ (-1)sgn(σ) Π ai,σ(i)
Σis the some of all permutations of the set
Πis the product of
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
n numbers, one from each row and every column, and multiply them together. Take all such
n-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 2x2, 3x3, and 4x4 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 have used the same notation below as in the matrix determinant calculator.
then the determinant of
|A| = a₁*b₂ - a₂*b₁.
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).
then the determinant of
|B| = a₁*b₂*c₃ + a₂*b₃*c₁ + a₃*b₁*c₂ - a₃*b₂*c₁ - a₁*b₃*c₂ - a₂*b₁*c₃.
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:
Now, as in the 2x2 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,
a₁*b₂*c₃. 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,
a₂*b₃*c₁. We do this one more time to get
a₃*b₁*c₂ 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,
a₃*b₂*c₁. We do the same thing as before - moving the diagonal down. The expanded form above let's us easily see that this gives the other two negative summands,
then the determinant of such a 4x4 matrix is
|C| = a₁*b₂*c₃*d₄ - a₂*b₁*c₃*d₄ + a₃*b₁*c₂*d₄ - a₁*b₃*c₂*d₄ + a₂*b₃*c₁*d₄ - a₃*b₂*c₁*d₄ + a₃*b₂*c₄*d₁ - a₂*b₃*c₄*d₁ + a₄*b₃*c₂*d₁ - a₃*b₄*c₂*d₁ + a₂*b₄*c₃*d₁ - a₄*b₂*c₃*d₁ + a₄*b₁*c₃*d₂ - a₁*b₄*c₃*d₂ + a₃*b₄*c₁*d₂ - a₄*b₃*c₁*d₂ + a₁*b₃*c₄*d₂ - a₃*b₁*c₄*d₂ + a₂*b₁*c₄*d₃ - a₁*b₂*c₄*d₃ + a₄*b₂*c₁*d₃ - a₂*b₄*c₁*d₃ + a₁*b₄*c₂*d₃ - a₄*b₁*c₂*d₃.
Whew, that was a long one, wasn't it? You can see now that it's super easy to find the determinant of a 2x2 matrix, and we can learn how to find the determinant of a 3x3 matrix in an hour or so. But the determinant of a 4x4 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
a₁ instead of
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 4x4 determinant? Or 5x5?" Well, how convenient of you to ask! We'll show you that in.
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.
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.
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:
- 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 3x3 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).
- 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). This property 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:
- (Laplace expansion) Remember the "What is a determinant of a 5x5 matrix?" question from ? Finally, we can touch upon this topic and introduce a powerful tool to help us with the determinant formula.
A be a square matrix of size
n. Say that the
j-th row (or column) of
A has elements
aₙ. Denote by
Aᵢ the matrix obtained from
A by removing the whole row and column in which we had
Aᵢ is then a square matrix of size
|A| = (-1)j+1 * a₁ * |A₁| + (-1)j+2 * a₂ * |A₂| + ... + (-1)j+n * aₙ * |Aₙ|.
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 3x3 matrix, we can grab a piece of paper, pick, say, the third row of the matrix, and write enthusiastically:
Example: using the matrix determinant calculator
Say that you want to calculate the determinant of the following matrix:
The determinant of a 4x4 matrix, huh? We saw the determinant formula for one in the section, so we know it's not going to be very entertaining, is it? But we've learnt 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 4x4 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,
d₁ 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:
a₁ = 2,
b₁ = 5,
c₁ = 1,
d₁ = 3.
Similarly, for the other rows, we have:
a₂ = 4,
b₂ = 1,
c₂ = 7,
d₂ = 9,
a₃ = 6,
b₃ = 8,
c₃ = 3,
d₃ = 2,
a₄ = 7,
b₄ = 8,
c₄ = 1,
d₄ = 4.
The moment we write the last number, the matrix determinant calculator will do its magic and spit out the answer:
|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 3x3 determinants. Not terrible, but not great either. We can, however, do something first - use elementary column operations.
We've seen in
(-2)-multiple of the third column to the first one?
And why have we done that? Recall that in the Laplace expansion, the summands were like this:
(-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| with respect to the first row, the summand corresponding to the first cell in the first row will be
(-1) to some power times
0 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
5 and the
0-s. As we did before, we add to those columns the right multiple of the third column (the one with
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
0 times something, which is
0. To be precise, we get
And we know quite well how to find the determinant of a 3x3 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 2x2 matrix. Otherwise, we can just use the determinant formula and based on the above get:
|A| = (-1)⁴ * (-10*(-7)*1 + (-34)*(-7)*5 + (-12)*0*5 - (-12)*(-7)*5 - (-10)*(-7)*3 - (-34)*0*1) = 630.
Yay, it agrees with what we had above! See how much time the matrix determinant calculator can save us? Do you know how many pages of our favorite book we could have read in that time?