4.2 Computing determinants

We know already how to compute the determinants of general \(2\times 2\) matrices, and for \(3\times 3\) one can use formula (4.4) which is just the Leibniz formula with \(6\) terms, corresponding to the \(3!=6\) elements of \(S_3\). Let us look at determinants of larger matrices. There is a convention to denote the determinant of a matrix by replacing the brackets by vertical bars, for example \[\begin{vmatrix} a_{11} & a_{12}\\ a_{21} & a_{22}\end{vmatrix} :=\det \begin{pmatrix}a_{11} & a_{12}\\ a_{21} & a_{22}\end{pmatrix} =a_{11}a_{22}-a_{12}a_{21} .\]

We will now discuss some systematic methods to compute determinants. The first is Laplace expansion. As a preparation we need some definitions.

Definition 4.17: (Minors of a matrix)

Let \(A\in M_{n}(\mathbb{R})\), then we define the following:

  • \(\hat A_{ij}\in M_{n-1}(\mathbb{R})\) is the matrix obtained from \(A\) by removing row \(i\) and column \(j\).

  • \(\det \hat A_{ij}\) is called the minor associated with \(a_{ij}\).

  • \(A_{ij}:=(-1)^{i+j}\det \hat A_{ij}\) is called the signed minor associated with \(a_{ij}\).

Example 4.18:
Let \(A=\begin{pmatrix}1 & 0 & -1 \\ 2 & 1 & 3\\ 0 & 1 & 0\end{pmatrix}\). Then \(\hat A_{11}=\begin{pmatrix}1 & 3\\ 1 & 0\end{pmatrix}\), and \(A_{11}=-3\).
Exercise 4.19:
Find \(\hat A_{12},\hat A_{13}\), and \(\hat A_{32}\), and the corresponding signed minors.
Click for solution

We have\(\hat A_{12}=\begin{pmatrix}2 & 3\\ 0 & 0\end{pmatrix}\), \(\hat A_{13}=\begin{pmatrix}2 & 1\\ 0 & 1\end{pmatrix}\), \(\hat A_{32}=\begin{pmatrix}1 &-1 \\ 2 & 3\end{pmatrix}\) and so on. For the signed minors we find that \(A_{12}=0\), \(A_{13}=2\), \(A_{32}=-5\).

 

Example 4.20:
Let \(A=\begin{pmatrix}1 & 2 \\ 3 & 4\end{pmatrix}\). Then \(\hat A_{11}=4\), \(\hat A_{12}=3\), \(\hat A_{21}=2\), \(\hat A_{22}=1\) (where these \(1\times1\) matrices are identified with the corresponding real number as usual) and \(A_{11}=4\), \(A_{12}=-3\), \(A_{21}=-2\), \(A_{22}=1\).

Practically, determinants are usually calculated recursively, using the so-called Laplace (or cofactor) expansion.

Theorem 4.21: (Laplace expansion)

Let \(A\in M_{n}(\mathbb{R})\), then we can rewrite the determinant of \(A\) in the following ways:

  • For any row \((a_{i1}, a_{i2}, \cdots ,a_{in})\) we have \[\det A=a_{i1} A_{i1}+a_{i2} A_{i2}+\cdots +a_{in} A_{in}=\sum_{j=1}^n a_{ij} A_{ij} = \sum_{j=1}^n (-1)^{i+j} a_{ij} \det \hat A_{ij}.\] This is known as expanding by row \(i\).

  • For any column \(\begin{pmatrix}a_{1j}\\ a_{2j}\\ \vdots \\a_{nj}\end{pmatrix}\) we have \[\det A=a_{1j} A_{1j}+a_{2j} A_{2j}+\cdots +a_{nj} A_{nj}=\sum_{i=1}^n a_{ij} A_{ij}=\sum_{i=1}^n (-1)^{i+j} a_{ij} \det \hat A_{ij} .\] This is known as expanding by column \(j\).  

We will discuss the proof of this result later, but let us first see how we can use it. The main idea is that Laplace expansion gives an expression for a determinant of an \(n\times n\) matrix as a sum over \(n\) determinants of smaller \((n-1)\times (n-1)\) matrices, and so we can iterate this, the determinants of \((n-1)\times (n-1)\) matrices can then be expressed in terms of determinants of \((n-2)\times (n-2)\) matrices, and so on, until we arrive at, say \(2\times 2\) matrices whose determinants we can compute directly.

Now let us look at some examples to see how to use this result. It is useful to visualise the sign-factors \((-1)^{i+j}\) by looking at the corresponding matrix \[\begin{pmatrix}+ & - & + & - &\cdots \\ - & + & - & + &\cdots \\ + & - & + & - & \cdots \\ \vdots & \vdots & \vdots & \vdots & \ddots\end{pmatrix}\] which has a chess board pattern of alternating \(+\) and \(-\) signs. So if, for instance, we want to expand \(A\) into the second row we get \[\det A=-a_{21}\det \hat A_{21}+a_{22} \det \hat A_{22}-a_{23} \det \hat A_{23}+\cdots\] and the pattern of signs in front of the terms is the same as the second row of the above sign-matrix.

Example 4.22:

Let \(A=\begin{pmatrix}1 & 0 & -1 \\ 2 & 1 & 3\\ 0 & 1 & 0 \end{pmatrix}\). We can find the determinant using Laplace expansion in different ways, choosing a row or column to expand by.

  • Expansion in the first row gives: \[\begin{vmatrix}1 & 0 & -1 \\ 2 & 1 & 3\\ 0 & 1 & 0\end{vmatrix}=1 \begin{vmatrix}1 & 3\\ 1 & 0\end{vmatrix}- 0\begin{vmatrix}2 & 3\\ 0 & 0\end{vmatrix}+(-1)\begin{vmatrix}2 & 1\\ 0 & 1\end{vmatrix}=-3-2=-5.\]

  • Expansion in the last column gives: \[\begin{vmatrix}1 & 0 & -1 \\ 2 & 1 & 3\\ 0 & 1 & 0\end{vmatrix}=(-1) \begin{vmatrix}2 & 1\\ 0 & 1\end{vmatrix}- 3\begin{vmatrix}1 & 0\\ 0 & 1\end{vmatrix}+0\begin{vmatrix}1 & 0\\ 2 & 1\end{vmatrix}=-2-3=-5.\]

  • Expansion in the last row gives: \[\begin{vmatrix}1 & 0 & -1 \\ 2 & 1 & 3\\ 0 & 1 & 0\end{vmatrix}=-\begin{vmatrix}1 & -1 \\ 2 & 3\end{vmatrix}=-5\] (note that in the second step we omitted the terms where \(a_{3j}=0\)).

Note that regardless of which row or column we choose to expand we obtain the same result.
Example 4.23:
Let \(A=\begin{pmatrix}2 & 3 & 7 & 0 & 1\\ -2 & 0 & 3 & 0 & 0\\ 0 & 0 & 1 & 0 & 0\\ -10 & 1 & 0 & -1 & 3 \\0 & 2 & -2 & 0 & 0\end{pmatrix}\). We expand in the 3rd row, then the 2nd row, then 2nd column (omitting writing any terms which would be multiplied by a minor of 0), so \[%\begin{split} \det A=\begin{vmatrix}2 & 3 & 0 & 1\\ -2 & 0 & 0 & 0\\ -10 & 1 & -1 & 3\\ 0 & 2 & 0 & 0\end{vmatrix}=- (-2)\begin{vmatrix}3 & 0 & 1\\ 1 & -1 & 3\\ 2 & 0 &0 \end{vmatrix} = -2 \begin{vmatrix}3 & 1\\ 2 & 0 \end{vmatrix}=4.\]

This expansion works similarly for larger matrices, but it becomes rather long. As the example shows, one can use the freedom of choice of rows or columns for the expansion to chose one which contains as many \(0\)’s as possible; this reduces the computational work one has to do.

We showed already in Theorem 4.11 that determinants of triangular matrices are easy to calculate. Let us derive this as well from using Laplace expansion.

Proposition 4.24:

Let \(A\in M_{n}(\mathbb{R})\).

  1. If \(A\) is upper triangular, i.e., \(a_{ij}=0\) if \(i>j\), then \[\det A=a_{11}a_{22}\cdots a_{nn} .\]

  2. If \(A\) is lower triangular, i.e., \(a_{ij}=0\) if \(i<j\), then \[\det A=a_{11}a_{22}\cdots a_{nn} .\]  

Proof.

We will only prove (i); part (ii) will be left as exercise. Since \(A\) is upper triangular its first column is \(\begin{pmatrix}a_{11}\\0\\\vdots \\0\end{pmatrix}\), hence expanding by that column gives \(\det A=a_{11} A_{11}\). But \(\hat A_{11}\) is again upper triangular with first column \(\begin{pmatrix}a_{22}\\0\\\vdots \\0\end{pmatrix}\) and so iterating this argument gives \(\det A=a_{11}a_{22}\cdots a_{nn}\).

This implies that a triangular matrix is invertible if, and only if, all its diagonal elements are non-zero.

This result will be the starting point for the second method we can use to compute determinants. Whenever we have a triangular matrix we can compute the determinant easily. In Section 7.1 we discussed how elementary row or column operations affected the determinant. So combining this with this result about determinants of triangular matrices gives us the following strategy: First use elementary row or column operations to bring a matrix to triangular form (which can always be done, as a consequence of Theorem 3.38 ), and then use the above result to compute the determinant of that triangular matrix.

When applying this strategy, we need to keep track of how each operation will change the determinant. Recall that:

  1. adding multiples of one column (or row) to another does not change the determinant.

  2. multiplying a column (or row) by a real number \(\lambda\) will multiply the determinant by \(\lambda\) also. Hence to find the determinant of the original matrix we need to multiply by a factor of \(\dfrac{1}{\lambda}.\)

  3. switching two columns (or two rows) changes the sign of the determinant, so we must multiply by a factor of \(-1\).

Example 4.25:

We have that:

  • \(\det \begin{pmatrix}2 & 0 & 3\\ -1 & 2 & 0 \\ 2 & 0 & 0\end{pmatrix}=-\det \begin{pmatrix}3 & 0 & 2\\ 0 & 2 & -1 \\ 0 & 0 & 2\end{pmatrix}=-12.\)

    Here we have switched columns 1 and 3, so must multiply the determinant by \(-1.\)

  • \(\det \begin{pmatrix}3 & 2 & 1\\ 2 & 2 & 1\\ 2 & 1 & 1\end{pmatrix}=\det \begin{pmatrix}1 & 1 & 1\\ 0 & 1 & 1\\ 0 & 0 & 1\end{pmatrix}=1\).

    Here we have subtracted column 3 from column 2 and 2 times column 3 from column 1, neither of which will change the determinant.

  • \(\begin{aligned}[t]\det \begin{pmatrix}1 & 0 & 3 & 4 \\ 0 & 2 & 1 & -1\\ 0 & 2 & -1 & 0\\ 2 & 1 & 1 & -1\end{pmatrix} &=\det \begin{pmatrix}9 & 4 & 7 & 4 \\ -2 & 1 & 0 & -1\\ 0 & 2 & -1 & 0\\ 0 & 0 & 0 & -1\end{pmatrix}=\det \begin{pmatrix}9 & 18 & 7 & 4 \\ -2 & 1 & 0 & -1\\ 0 & 0 & -1 & 0\\ 0 & 0 & 0 & -1\end{pmatrix}\\&=\det \begin{pmatrix}45 & 18 & 7 & 4 \\ 0 & 1 & 0 & -1\\ 0 & 0 & -1 & 0\\ 0 & 0 & 0 & -1\end{pmatrix}=45.\end{aligned}\)

    In the first step we used column 4 to remove all non-zero entries in row 4 except the last. Then we used column 3 to simplify column 2 and finally we used column 2 to simplify column 1. None of these operations change the determinant.

  • \(\begin{vmatrix}1/2 & 3/2 \\ 2 & 0\end{vmatrix}=\dfrac{1}{2}\begin{vmatrix}1 & 3 \\ 2 & 0\end{vmatrix}=-\dfrac{1}{2}\begin{vmatrix}2 & 0\\ 1 &3\end{vmatrix}=-\dfrac{1}{2}\times 2 \times 3=-3.\) Here we have multiplied row 1 by 2, so must balance this with a factor of \(\frac{1}{2}\), and then have switched rows 1 and 2, which introduces a factor of \(-1\).  

We haven’t yet given a proof of the Laplace expansion formulas. We will sketch one now.

Proof (Proof of Theorem 4.21, Non-examinable).

Since \(\det A=\det A^t\) it is enough to prove either the expansion formula for rows, or for columns. Let’s do it for the \(j\)th column \(a_j\) of \(A\). We have \[\det A=d_n(a_1,a_2, \cdots, a_{j},\cdots , a_n)=(-1)^{j-1}d_n(a_j, a_1,a_2,\cdots ,a_n) ,\] where we have exchanged column \(j\) with column \(j-1\), then with column \(j-2\), and so on until column \(j\) is the new column \(1\) and the other columns follow in the previous order. We need \(j-1\) switches of columns to do this so we picked up the factor \((-1)^{j-1}\). Now we use linearity applied to \(a_j=\sum_{i=1}^n a_{ij} e_i\), so \[d_n(a_j, a_1,a_2,\cdots ,a_n)=\sum_{i=1}^na_{ij}d_n(e_i, a_1,a_2,\cdots ,a_n)\] and we have to determine \(d_n(e_i, a_1,a_2,\cdots ,a_n)\). Now we observe that since \(\det A=\det A^t\) we can also exchange rows in a matrix and change the corresponding determinant by a sign. Switching the \(i\)th row upwards until it is the first row gives \[d_n(e_i, a_1,a_2,\cdots ,a_n)=(-1)^{i-1}d_n(e_1, a_1^{(i)},a_2^{(i)},\cdots ,a_n^{(i)})\] where \(a_1^{(i)}=(a_{i1}, a_{11}, a_{21}, \cdots ,a_{n1})^t\), and so on, are the original column vectors with the \(i\)th component moved to the first place. We now claim that \[d_n(e_1, a_1^{(i)},a_2^{(i)},\cdots ,a_n^{(i)})=\det \hat A_{ij} .\] This follows from two observations,

  • First, \(d_n(e_1, a_1^{(i)},a_2^{(i)},\cdots ,a_n^{(i)})\) does not depend on \(a_{i1}, a_{i2},\cdots , a_{in}\), since by Theorem 4.16, part (c), one can add arbitrary multiples of \(e_1\) to all other arguments without changing the value of \(d_n(e_1, a_1^{(i)},a_2^{(i)},\cdots ,a_n^{(i)})\). This means \(d_n(e_1, a_1^{(i)},a_2^{(i)},\cdots ,a_n^{(i)})\) depends only on \(\hat A_{ij}\) (recall that we removed column \(j\) already).

  • The function \(d_n(e_1, a_1^{(i)},a_2^{(i)},\cdots ,a_n^{(i)})\) is by construction a multilinear and alternating function of the columns of \(\hat A_{ij}\) and furthermore if \(\hat A_{ij}=I\), then \(d_n(e_1, a_1^{(i)},a_2^{(i)},\cdots ,a_n^{(i)})=1\), hence by Theorem 4.9 we have \(d_n(e_1, a_1^{(i)},a_2^{(i)},\cdots ,a_n^{(i)})=\det \hat A_{ij} .\)

So collecting all formulas we have found \[\det A=\sum_{j=1}^n (-1)^{i+j-2}a_{ij}\det \hat A_{ij}\] and since \((-1)^{i+j-2}=(-1)^{i+j}\) the proof is complete.