13  Determinants

library(tidyverse)
library(dasc2594)

Definition 13.1 The determinant \(\operatorname{det}(\mathbf{A})\) is a function of a square \(n \times n\) matrix \(\mathbf{A}\) whose output is a real number that satisfies the following properties based on elementary row operations

  1. The determinant of the \(n \times n\) identity matrix \(\mathbf{I}\) is equal to 1

  2. If a scalar multiple of one row of \(\mathbf{A}\) is added to another row of \(\mathbf{A}\), then the determinant \(\operatorname{det}(\mathbf{A})\) is unchanged.

  3. Scaling a row of \(\mathbf{A}\) by a constant \(c\) multiples the determinant by \(c\)

  4. Swapping two rows of a matrix \(\mathbf{A}\) multiplies the determinant by -1

The determinant is the unique function mapping square matrices to the real number line that satisfies the above definition.

Let \(\mathbf{A} = \begin{pmatrix} 5 & 3 \\ 1 & -3 \end{pmatrix}\). Find \(\operatorname{det}(\mathbf{A})\).

We can calculate the determinant \(\operatorname{det}(\mathbf{A})\) using row operations to get to reduced row echelon form.

\[ \begin{aligned} && \begin{pmatrix} 5 & 3 \\ 1 & -3 \end{pmatrix} && \operatorname{det} = x \\ \mbox{swap row 1 and row 2} && \begin{pmatrix} 1 & -3 \\ 5 & 3 \end{pmatrix} && \operatorname{det} = -x \\ \mbox{row 2 = -5 * row 1 + row 2} && \begin{pmatrix} 1 & -3 \\ 0 & 18 \end{pmatrix} && \operatorname{det} = -x \\ \mbox{row 2 } \div \mbox{ 18} && \begin{pmatrix} 1 & -3 \\ 0 & 1 \end{pmatrix} && \operatorname{det} = -\frac{x}{18} \\ \mbox{row 1 = row 1 + 3 * row 2} && \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} && \operatorname{det} = -\frac{x}{18} \end{aligned} \] where the last matrix is in reduced row echelon form and is the identity matrix which has determinant \(\operatorname{det}(\mathbf{I}) = 1\). Therefore \(-\frac{x}{18} = 1\) which implies that \(x = -18\) so that \(\operatorname{det}(\mathbf{A}) = -18\) Let’s check our answer in R

A <- matrix(c(5, 1, 3, -3), 2, 2)
det(A)
[1] -18

Let \(\mathbf{A} = \begin{pmatrix} 2 & 0 \\ -3 & 5 \end{pmatrix}\). Find \(\operatorname{det}(\mathbf{A})\).

We can calculate the determinant \(\operatorname{det}(\mathbf{A})\) using row operations to get to reduced row echelon form.

\[ \begin{aligned} && \begin{pmatrix} 2 & 0 \\ -3 & 5 \end{pmatrix} && \operatorname{det} = x \\ \mbox{multiply row 1 by }\frac{1}{2} && \begin{pmatrix} 1 & 0 \\ -3 & 5 \end{pmatrix} && \operatorname{det} = \frac{x}{2} \\ \mbox{multiply row 2 by }\frac{-1}{3} && \begin{pmatrix} 1 & 0 \\ 1 & -\frac{5}{3} \end{pmatrix} && \operatorname{det} = -\frac{x}{6} \\ \mbox{row 2 = row 2 - row 1} && \begin{pmatrix} 1 & 0 \\ 0 & -\frac{5}{3} \end{pmatrix} && \operatorname{det} = -\frac{x}{6} \\ \mbox{multiply row 2 by } - \frac{3}{5} && \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} && \operatorname{det} = \frac{x}{10} \end{aligned} \] where the last matrix is in reduced row echelon form and is the identity matrix which has determinant \(\operatorname{det}(\mathbf{I}) = 1\). Therefore \(\frac{x}{10} = 1\) which implies that \(x = 10\) so that \(\operatorname{det}(\mathbf{A}) = 10\) Let’s check our answer in R

A <- matrix(c(2, -3, 0, 5), 2, 2)
det(A)
[1] 10

13.1 Determinants of \(2 \times 2\) matrices

Definition 13.2 If \(\mathbf{A} = \begin{pmatrix} a & b \\ c & d \end{pmatrix}\) is a \(2 \times 2\) matrix, the determinant \(\operatorname{det}(\mathbf{A}) = ad - bc\)

Let \(\mathbf{A} = \begin{pmatrix} 5 & 3 \\ 1 & -3 \end{pmatrix}\). What is \(\det(\mathbf{A})\)?

Using Definition 13.2 , the determinant of \(\mathbf{A} = \begin{pmatrix} a & b \\ c & d \end{pmatrix}\) is \(\det(\mathbf{A}) = ad - bc= (5 * -3) - (3 * 1) = -18\)

13.2 Determinants of \(n \times n\) matrices

To better understand determinants of \(n \times n\) matrices, we need to define the two concepts of a matrix minor and cofactor.

Definition 13.3 For an \(n \times n\) matrix \(\mathbf{A}\),

  1. The (i, j) minor \(\mathbf{A}_{-i-j}\) is the \((n-1) \times (n-1)\) matrix obtained by deleting the \(i\)th row and the \(j\) column from \(\mathbf{A}\)

  2. The (i, j) cofactor \(c_{ij}\) is defined using the determinant of the minor where \[ \begin{aligned} c_{ij} = \mathbf(-1)^{i + j} \det{\mathbf{A}_{-i-j}} \end{aligned} \]

Note: The cofactor of a scalar \(a\) (a \(1 \times 1\) matrix) is defined as \(\mathbf{C}_{ij} = (-1)^{1 + 1} \det(a) = a\).

Note: The leading term in the cofactor definition \(\mathbf(-1)^{i + j}\) defines a checkerboard pattern shown below \[ \begin{aligned} \begin{pmatrix} + & - & + & - & \cdots \\ - & + & - & + & \cdots \\ + & - & + & - & \cdots \\ - & + & - & + & \cdots \\ \vdots & \vdots & \vdots & \vdots & \ddots \\ + & - & + & - & \cdots \\ \end{pmatrix} \end{aligned} \]

Example 13.1  

Let \(\mathbf{A} = \begin{pmatrix} 1 & -3 & 1 \\ 4 & 2 & -3 \\ 7 & 4 & 7 \end{pmatrix}\).

  1. Find the minor \(\mathbf{A}_{-2-3}\)

  2. Find the cofactor \(c_{23}\)

Using Definition 13.3, the minor \(\mathbf{A}_{-2-3}\) is the matrix \(\mathbf{A}\) with the second row and third column removed.

Thus, the minor \(\mathbf{A}_{-2-3} = \begin{pmatrix} 1 & -3 \\ 7 & 4 \end{pmatrix}\).

In R, this can be found by first defining the matrix A as

A <- matrix(c(1, 4,7, -3, 2, 4, 1, -3, 7), 3,3)

then finding the minor \(\mathbf{A}_{-2-3}\) as

A_minor_23 <- A[-2, -3]

The matrix cofactor \(c_{23} = (-1)^{2+3} \det \mathbf{A}_{-2-3} = (-1) * ((1)(4) - (-3) (7)) = -25\)

In R, given the minor A_minor_23, the cofactor is

(-1)^(2+3) * det(A_minor_23)
[1] -25

Note that in the cofactor definition of a \(n \times n\) matrix it is assumed that you can calculate the determinant of the \(n-1 \times n-1\) minor \(\mathbf{A}_{-i-j}\). From this we see that each of the \(n \times n\) cofactors of \(\mathbf{A}\) are themselves the (signed) determinants of \(n-1 \times n-1\) submatrices (the matrix minors). Thus, solving for all cofactors in general requires a recursive definition where smaller and smaller submatrices are evaluated.

Theorem 13.1 (Cofactor exapansion) Let \(\mathbf{A}\) be an \(n \times n\) matrix with \(ij\)th elements \(a_{ij}\). Then

  1. The cofactor expansion along the \(i\)th row (for any fixed row \(i\)) is \[ \begin{aligned} \det(\mathbf{A}) = \sum_{j=1}^n a_{ij} c_{ij} = a_{i1} c_{i1} + a_{i2} c_{i2} + \cdots + a_{in} c_{in} \end{aligned} \]

  2. The cofactor expansion along the \(j\)th column (for any fixed column \(j\)) is \[ \begin{aligned} \det(\mathbf{A}) = \sum_{i=1}^n a_{ij} c_{ij} = a_{1j} c_{1j} + a_{2j} c_{2j} + \cdots + a_{nj} c_{nj} \end{aligned} \]

This is quite complex. For those interested, an example is available here

Note: The above theorem states that there are actually \(2n\) ways to calculate the determinant–one for each row and column of \(\mathbf{A}\).

Use the minor/cofactor definition to calculate the determinant of the \(3 \times 3\) matrix \(\mathbf{A} = \begin{pmatrix} 5 & 0 & 2 \\ 1 & 3 & 3 \\ 2 & -4 & 1 \end{pmatrix}\)

The determinant of \(\mathbf{A}\) can be found by using Theorem 13.1 by expanding either down a row or a column. Because the first row contains a 0, we will use the cofactor expansion theorem. The cofactor expansion along the first row is \[ \begin{aligned} \det(\mathbf{A}) = a_{11} c_{11} + a_{12} c_{12} + a_{13} c_{13} \end{aligned} \] where \(a_{ij}\) is the \(ij\)th element of \(\mathbf{A}\). Thus, the cofactor expansion is \[ \begin{aligned} \det(\mathbf{A}) = 5 c_{11} + 0 c_{12} + 2 c_{13} \end{aligned} \] This implies that we only need to find the cofactors \(c_{11}\) and \(c_{13}\) (but not \(c_{12}\) because it gets multiplied by 0). Thus, the cofactor expansion along the first row only requires finding 2 cofactors \(c_{11}\) and \(c_{13}\).

The minor \(\mathbf{A}_{-1-1}\) is the matrix \(\mathbf{A}\) with the first row and first column removed and is \(\mathbf{A}_{-1-1} = \begin{pmatrix} 3 & 3 \\ -4 & 1 \end{pmatrix}\). The minor \(\mathbf{A}_{-1-3}\) is the matrix \(\mathbf{A}\) with the first row and third column removed and is \(\mathbf{A}_{-1-3} = \begin{pmatrix} 1 & 3 \\ 2 & -4 \end{pmatrix}\). The cofactor \(c_{11}\) is given by \[ \begin{aligned} c_{11} = (-1)^{1+1}((3)(1) - (3) (-4)) = 15 \end{aligned} \] and the cofactor \(c_{13}\) is given by \[ \begin{aligned} c_{13} = (-1)^{1+3}((1)(-4) - (3) (2)) = -10 \end{aligned} \]

Combining these, the determinant of \(\mathbf{A}\) using the cofactor expansion is \[ \begin{aligned} \det(\mathbf{A}) & = a_{11} c_{11} + a_{12} c_{12} + a_{13} c_{13} \\ & = (5) (15) + (0) (c_{12}) + (2) (-10) \\ & = 55 \end{aligned} \]

Use the minor/cofactor definition to calculate the determinant of the \(3 \times 3\) matrix \(\mathbf{A} = \begin{pmatrix} 2 & 4 & -1 \\ -3 & 0 & 2 \\ 2 & 0 & 4 \end{pmatrix}\)

The determinant of \(\mathbf{A}\) can be found by using Theorem 13.1 by expanding either down a row or a column. Because the second row contains multiple zeros, we will use the cofactor expansion theorem. The cofactor expansion along the second column is \[ \begin{aligned} \det(\mathbf{A}) & = a_{12} c_{12} + a_{22} c_{22} + a_{32} c_{32} \\ & = 4 c_{12} + 0 c_{22} + 0 c_{32} \end{aligned} \] This implies that we only need to find the cofactor \(c_{12}\) (but not \(c_{22}\) and \(c_{32}\) because these get multiplied by 0). Thus, the cofactor expansion along the second column only requires finding the single cofactor \(c_{12}\).

The minor \(\mathbf{A}_{-1-2}\) is the matrix \(\mathbf{A}\) with the first row and second column removed and is \(\mathbf{A}_{-1-2} = \begin{pmatrix} -3 & 2 \\ 2 & 4 \end{pmatrix}\). The cofactor \(c_{12}\) is given by \[ \begin{aligned} c_{12} = (-1)^{1+2}((-3)(4) - (2) (2)) = 16. \end{aligned} \]

Thus, the determinant of \(\mathbf{A}\) using the cofactor expansion is \[ \begin{aligned} \det(\mathbf{A}) & = a_{12} c_{12} + a_{22} c_{22} + a_{32} c_{32} \\ & = (4) (16) + (0) (c_{22}) + (0) (c_{32}) \\ & = 64 \end{aligned} \]

Let \(\mathbf{A}\) be a \(n \times n\) matrix that has all zero entries for the \(j\)th row. Find \(\det(\mathbf{A})\)

Using the cofactor expansion theorem (Theorem 13.1), expand the determinant along the \(j\)th row. Then, because all entries of the \(j\)th row of \(\mathbf{A}\) are zero, this gives \[ \begin{aligned} \det(\mathbf{A}) & = a_{j1} c_{j1} + a_{j2} c_{j2} + \cdots + a_{jn} c_{jn} \\ & = 0 c_{j1} + 0 c_{j2} + \cdots + 0 c_{jn} \\ & = 0 \end{aligned} \]

Theorem 13.2 The determinant of a matrix \(\mathbf{A}\) is equal to the determinant of its transpose \(\mathbf{A}'\). In other words, \(\det(\mathbf{A}) = \det(\mathbf{A}')\)

Follows directly from cofactor expansion theorem. The expansion along a given row/column of \(\mathbf{A}\) is equivalent to expansion along the corresponding column/row of \(\mathbf{A}'\) (notice the row/column for \(\mathbf{A}\) got swapped to column/row for \(\mathbf{A}'\)).

13.3 Properties of determinants

Theorem 13.3 A \(n \times n\) square matrix \(\mathbf{A}\) is invertible if and only if \(\det(\mathbf{A}) \neq 0\)

From the invertible matrix theorem (Theorem 9.5), we know that the matrix \(\mathbf{A}\) is invertible if and only if every column of \(\mathbf{A}\) is a pivot column. Therefore, each column is linearly independent from the other columns. Based on the example above, if the rows were not linearly independent, the determinant would be equal to 0 (as row operations could create a row/column of all zeros). Thus, if the determinant is not 0, the columns of \(\mathbf{A}\) are linearly independent and the matrix is invertible.

Theorem 13.4 If \(\mathbf{A}\) and \(\mathbf{B}\) are \(n \times n\) matrices, \(\mathbf{I}\) is an \(n \times n\) identity matrix, and \(c\) is a scalar, we have

  1. \(\det(\mathbf{I}) = 1\)

  2. \(\det(\mathbf{A}) = \det(\mathbf{A}')\)

  3. \(\det(\mathbf{A}^{-1}) = 1 / \det(\mathbf{A})\) if \(\det(\mathbf{A}) \neq 0\) (\(\mathbf{A}\) is invertible)

  4. \(\det(\mathbf{A}\mathbf{B}) = \det(\mathbf{A})\det(\mathbf{B})\)

  5. \(\det(c\mathbf{A}) = c^n \det(\mathbf{A})\)

13.4 Cramer’s Rule and Determinants

While commonly used for theoretical results, Cramer’s rule is not commonly used in applied linear algebra. As such, we will mention Cramer’s rule but not focus on it.

Theorem 13.5 (Cramer’s Rule) Let \(\mathbf{A}\) be a \(n \times n\) invertible matrix. Define \(\mathbf{A}_i(\mathbf{b})\) as the matrix \(\mathbf{A}\) with the \(i\)th column replace by the vector \(\mathbf{b}\). For example, \(\mathbf{A}_i(\mathbf{b}) = \begin{pmatrix} \mathbf{a}_1 & \cdots & \mathbf{a}_{i-1} & \mathbf{b} & \mathbf{a}_{i+1} & \cdots & \mathbf{a}_n \end{pmatrix}\). Then, for any \(\mathbf{b} \in \mathcal{R}^n\), the unique solution to \(\mathbf{A} \mathbf{x} = \mathbf{b}\) has entries given by \[ \begin{aligned} x_i = \frac{\det(\mathbf{A}_i(\mathbf{b}))}{\det(\mathbf{A})} & \mbox{ for } i = 1, 2, \ldots, n \end{aligned} \]

Example 13.2 In Cramer’s rule, why do we know

  • the solution is unique for any \(\mathbf{b}\)?

  • the determinant \(\det(\mathbf{A}) \neq 0\)?