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}