How to calculate the determinant of a matrix

The determinant of a matrix is calculated recursively as follows. The determinant of a $1\times 1$ matrix is just the number itself. For, example, $\det([3]) = 3$ and $\det([-2.5]) = -2.5$. Here is what you do if you have a larger matrix: take the matrix, and write $+$ or $-1$ beside each entry, starting with $+$ for the first $1,1$-entry of the matrix and alternating from there. For example, a $2\times 2$ matrix will get the following arrangement of signs:
$$\begin{pmatrix} + & -\\ -& +\end{pmatrix}.$$ Now, select any row or column. It doesn’t matter which row or column you select as you will get the same answer in the end. For example, let’s take:
$$A = \begin{pmatrix} 1 & 2\\ 3& 4\end{pmatrix}.$$ Now, I select the first column. We now form a sum, one term for each entry. Start with the $1$, and cross out the row and column that contains it. Doing so will give you a smaller matrix. Multiply the entry $1$ by the determinant of that smaller matrix (this is the recursive part), taking into account the signs as in the first step of assigning $+$ and $-1$. This sum is the determinant. So,
$$\det(A) = 1\det(4)-3\det(2) = 1\cdot 4-3\cdot 2 = -2.$$ Now, this is quite easy for a $2\times 2$ matrix and in fact gives you the general formula
$$\det\left(\begin{pmatrix}a & b\\c & d\end{pmatrix}\right) = ad-bc.$$ Since this formula is so simple it really pays to memorize it. But basically your brain can’t help but memorize it after you do a few calculations anyway.

Now let’s take an example of a $3\times 3$ matrix
$$B = \begin{pmatrix} 1 & 2 & 3\\ 5 & 1 & 6\\ 1 & 0 & 2\end{pmatrix}.$$ The determinant of this matrix $B$ is calculated in the same way. Let’s again take the first column for our calculation, remembering the signs we need are alternating. Try it yourself before clicking on the answer:

Click for answer

$$\begin{align*}\det(B) &= 1\cdot\det\left(\begin{pmatrix}1 & 6\\0 & 2\end{pmatrix}\right) – 5\cdot\det\left(\begin{pmatrix}2 & 3\\0 & 2\end{pmatrix}\right) + 1\cdot\det\left(\begin{pmatrix}2 & 3\\1 &6\end{pmatrix}\right) \\
&=1(1\cdot 2 – 0\cdot 6) – 5(2\cdot 2 – 0\cdot 3) + 1(2\cdot 6 – 1\cdot 3)\\
&=2-20 + 9 = – 9

Now, it is very important to know that you can use any row or column in the determinant calculation. Therefore, it actually would have been easier to use the bottom or third row of this matrix, because there is a zero in it. Multiplying by zero gives zero, so that term in the sum will just be zero. That is very useful especially if your matrix is large and will save you many calculations.

Let’s try using the third row in matrix $B$. I will skip writing down the $2\times 2$ matrices now because you have already seen that part. Try it yourself before clicking on the answer:

Click for the answer

$$\begin{align*}\det(B) &= 1(2\cdot 6-1\cdot 3) + 2(1\cdot 1-5\cdot 2)\\
&= 9 + 2(-9) = -9\end{align*}.$$ Very good, we get the same answer, but with one less calculation.

Adding multiples of other rows or columns

Another very useful trick for calculating determinants is the following fact: if you add a multiple of one row to another row, then the determinant remains unchanged! The same thing works for columns. That’s right: you can use this technique to simplify the matrix before calculating its determinant. Let’s recall our matrix $B$:
$$B = \begin{pmatrix} 1 & 2 & 3\\ 5 & 1 & 6\\ 1 & 0 & 2\end{pmatrix}.$$ But instead of calculating the determinant right away, let’s add $-5$ times the first row to the second row, and $-1$ times the first row to the third row. Try it yourself to see what new matrix you get:

Click for the answer

$$B’ = \begin{pmatrix} 1 & 2 & 3\\ 0 & -9 & -9\\ 0 & -2 & -1\end{pmatrix}.$$

Now, try calculating the determinant by choosing the first column:

Click for the answer

$$\det(B’) = (-9)(-1)-(-2)(-9) = 9-18 = -9.$$ The reason I bring this up is that sometimes, adding multiples of one row to another is less mentally intensive than keeping track of many different matrices, as often finding the smaller matrices by crossing out rows and columns are where mistakes are made. Also, for large matrices, eliminating one determinant calculation for each zero entry you make will save a lot of future calculations due to the recursive nature of calculating the determinant.

Leave a comment

Fields marked with * are required. LaTeX snippets may be entered by surrounding them with single dollar signs. Use double dollar signs for display equations.