## SectionA.6Determinant

Note: 1 lecture

For square matrices we define a useful quantity called the determinant. Define the determinant of a $$1 \times 1$$ matrix as the value of its only entry

\begin{equation*} \det \left( \begin{bmatrix} a \end{bmatrix} \right) \overset{\text{def}}{=} a . \end{equation*}

For a $$2 \times 2$$ matrix, define

\begin{equation*} \det \left( \begin{bmatrix} a & b \\ c & d \end{bmatrix} \right) \overset{\text{def}}{=} ad-bc . \end{equation*}

Before defining the determinant for larger matrices, we note the meaning of the determinant. An $$n \times n$$ matrix gives a mapping of the $$n$$-dimensional euclidean space $${\mathbb{R}}^n$$ to itself. So a $$2 \times 2$$ matrix $$A$$ is a mapping of the plane to itself. The determinant of $$A$$ is the factor by which the area of objects changes. If we take the unit square (square of side 1) in the plane, then $$A$$ takes the square to a parallelogram of area $$\lvert\det(A)\rvert\text{.}$$ The sign of $$\det(A)$$ denotes a change of orientation (negative if the axes get flipped). For example, let

\begin{equation*} A = \begin{bmatrix} 1 & 1 \\ -1 & 1 \end{bmatrix} . \end{equation*}

Then $$\det(A) = 1+1 = 2\text{.}$$ Let us see where $$A$$ sends the unit square—the square with vertices $$(0,0)\text{,}$$ $$(1,0)\text{,}$$ $$(0,1)\text{,}$$ and $$(1,1)\text{.}$$ The point $$(0,0)$$ gets sent to $$(0,0)\text{.}$$

\begin{equation*} \begin{bmatrix} 1 & 1 \\ -1 & 1 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ -1 \end{bmatrix} , \qquad \begin{bmatrix} 1 & 1 \\ -1 & 1 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \end{bmatrix} , \qquad \begin{bmatrix} 1 & 1 \\ -1 & 1 \end{bmatrix} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 2 \\ 0 \end{bmatrix} . \end{equation*}

The image of the square is another square with vertices $$(0,0)\text{,}$$ $$(1,-1)\text{,}$$ $$(1,1)\text{,}$$ and $$(2,0)\text{.}$$ The image square has a side of length $$\sqrt{2}\text{,}$$ and it is therefore of area 2. See Figure A.7.

In general, the image of a square is going to be a parallelogram. In high school geometry, you may have seen a formula for computing the area of a parallelogram with vertices $$(0,0)\text{,}$$ $$(a,c)\text{,}$$ $$(b,d)$$ and $$(a+b,c+d)\text{.}$$ The area is

\begin{equation*} \left\lvert \, \det \left( \begin{bmatrix} a & b \\ c & d \end{bmatrix} \right) \, \right\lvert = \lvert a d - b c \rvert . \end{equation*}

The vertical lines above mean absolute value. The matrix $$\left[ \begin{smallmatrix} a & b \\ c & d \end{smallmatrix} \right]$$ carries the unit square to the given parallelogram.

There are a number of ways to define the determinant for an $$n \times n$$ matrix. Let us use the so-called cofactor expansion. We define $$A_{ij}$$ as the matrix $$A$$ with the $$i^{\text{th}}$$ row and the $$j^{\text{th}}$$ column deleted. For example, if

\begin{equation*} \text{If} \qquad A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} , \qquad \text{then} \qquad A_{12} = \begin{bmatrix} 4 & 6 \\ 7 & 9 \end{bmatrix} \qquad \text{and} \qquad A_{23} = \begin{bmatrix} 1 & 2 \\ 7 & 8 \end{bmatrix} . \end{equation*}

We now define the determinant recursively

\begin{equation*} \det (A) \overset{\text{def}}{=} \sum_{j=1}^n {(-1)}^{1+j} a_{1j} \det (A_{1j}) , \end{equation*}

or in other words

\begin{equation*} \det (A) = a_{11} \det (A_{11}) - a_{12} \det (A_{12}) + a_{13} \det (A_{13}) - \cdots \begin{cases} + a_{1n} \det (A_{1n}) & \text{if } n \text{ is odd,} \\ - a_{1n} \det (A_{1n}) & \text{if } n \text{ even.} \end{cases} \end{equation*}

For a $$3 \times 3$$ matrix, we get $$\det (A) = a_{11} \det (A_{11}) - a_{12} \det (A_{12}) + a_{13} \det (A_{13})\text{.}$$ For example,

\begin{equation*} \begin{split} \det \left( \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} \right) & = 1 \cdot \det \left( \begin{bmatrix} 5 & 6 \\ 8 & 9 \end{bmatrix} \right) - 2 \cdot \det \left( \begin{bmatrix} 4 & 6 \\ 7 & 9 \end{bmatrix} \right) + 3 \cdot \det \left( \begin{bmatrix} 4 & 5 \\ 7 & 8 \end{bmatrix} \right) \\ & = 1 (5 \cdot 9 - 6 \cdot 8) - 2 (4 \cdot 9 - 6 \cdot 7) + 3 (4 \cdot 8 - 5 \cdot 7) = 0 . \end{split} \end{equation*}

It turns out that we did not have to necessarily use the first row. That is for any $$i\text{,}$$

\begin{equation*} \det (A) = \sum_{j=1}^n {(-1)}^{i+j} a_{ij} \det (A_{ij}) . \end{equation*}

It is sometimes useful to use a row other than the first. In the following example it is more convenient to expand along the second row. Notice that for the second row we are starting with a negative sign.

\begin{equation*} \begin{split} \det \left( \begin{bmatrix} 1 & 2 & 3 \\ 0 & 5 & 0 \\ 7 & 8 & 9 \end{bmatrix} \right) & = - 0 \cdot \det \left( \begin{bmatrix} 2 & 3 \\ 8 & 9 \end{bmatrix} \right) + 5 \cdot \det \left( \begin{bmatrix} 1 & 3 \\ 7 & 9 \end{bmatrix} \right) - 0 \cdot \det \left( \begin{bmatrix} 1 & 2 \\ 7 & 8 \end{bmatrix} \right) \\ & = 0 + 5 (1 \cdot 9 - 3 \cdot 7) + 0 = -60 . \end{split} \end{equation*}

Let us check if it is really the same as expanding along the first row,

\begin{equation*} \begin{split} \det \left( \begin{bmatrix} 1 & 2 & 3 \\ 0 & 5 & 0 \\ 7 & 8 & 9 \end{bmatrix} \right) & = 1 \cdot \det \left( \begin{bmatrix} 5 & 0 \\ 8 & 9 \end{bmatrix} \right) - 2 \cdot \det \left( \begin{bmatrix} 0 & 0 \\ 7 & 9 \end{bmatrix} \right) + 3 \cdot \det \left( \begin{bmatrix} 0 & 5 \\ 7 & 8 \end{bmatrix} \right) \\ & = 1 (5 \cdot 9 - 0 \cdot 8) - 2 (0 \cdot 9 - 0 \cdot 7) + 3 (0 \cdot 8 - 5 \cdot 7) = -60 . \end{split} \end{equation*}

In computing the determinant, we alternately add and subtract the determinants of the submatrices $$A_{ij}$$ multiplied by $$a_{ij}$$ for a fixed $$i$$ and all $$j\text{.}$$ The numbers $${(-1)}^{i+j}\det(A_{ij})$$ are called cofactors of the matrix. And that is why this method of computing the determinant is called the cofactor expansion.

Similarly we do not need to expand along a row, we can expand along a column. For any $$j\text{,}$$

\begin{equation*} \det (A) = \sum_{i=1}^n {(-1)}^{i+j} a_{ij} \det (A_{ij}) . \end{equation*}

A related fact is that

\begin{equation*} \det (A) = \det (A^T) . \end{equation*}

A matrix is upper triangular if all elements below the main diagonal are 0. For example,

\begin{equation*} \begin{bmatrix} 1 & 2 & 3 \\ 0 & 5 & 6 \\ 0 & 0 & 9 \end{bmatrix} \end{equation*}

is upper triangular. Similarly a lower triangular matrix is one where everything above the diagonal is zero. For example,

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 \\ 4 & 5 & 0 \\ 7 & 8 & 9 \end{bmatrix} . \end{equation*}

The determinant for triangular matrices is very simple to compute. Consider the lower triangular matrix. If we expand along the first row, we find that the determinant is 1 times the determinant of the lower triangular matrix $$\left[ \begin{smallmatrix} 5 & 0 \\ 8 & 9 \end{smallmatrix} \right]\text{.}$$ So the deteriminant is just the product of the diagonal entries:

\begin{equation*} \det \left( \begin{bmatrix} 1 & 0 & 0 \\ 4 & 5 & 0 \\ 7 & 8 & 9 \end{bmatrix} \right) = 1 \cdot 5 \cdot 9 = 45 . \end{equation*}

Similarly for upper triangular matrices

\begin{equation*} \det \left( \begin{bmatrix} 1 & 2 & 3 \\ 0 & 5 & 6 \\ 0 & 0 & 9 \end{bmatrix} \right) = 1 \cdot 5 \cdot 9 = 45 . \end{equation*}

In general, if $$A$$ is triangular, then

\begin{equation*} \det (A) = a_{11} a_{22} \cdots a_{nn} . \end{equation*}

If $$A$$ is diagonal, then it is also triangular (upper and lower), so same formula applies. For example,

\begin{equation*} \det \left( \begin{bmatrix} 2 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 5 \end{bmatrix} \right) = 2 \cdot 3 \cdot 5 = 30 . \end{equation*}

In particular, the identity matrix $$I$$ is diagonal, and the diagonal entries are all 1. Thus,

\begin{equation*} \det(I) = 1 . \end{equation*}

The determinant is telling you how geometric objects scale. If $$B$$ doubles the sizes of geometric objects and $$A$$ triples them, then $$AB$$ (which applies $$B$$ to an object and then it applies $$A$$) should make size go up by a factor of $$6\text{.}$$ This is true in general:

This property is one of the most useful, and it is employed often to actually compute determinants. A particularly interesting consequence is to note what it means for the existence of inverses. Take $$A$$ and $$B$$ to be inverses, that is $$AB=I\text{.}$$ Then

\begin{equation*} \det(A)\det(B) = \det(AB) = \det(I) = 1 . \end{equation*}

Neither $$\det(A)$$ nor $$\det(B)$$ can be zero. This fact is an extremely useful property of the determinant, and one which is used often in this book:

In fact, $$\det(A^{-1}) \det(A) = 1$$ says that

\begin{equation*} \det(A^{-1}) = \frac{1}{\det(A)}. \end{equation*}

So we know what the determinant of $$A^{-1}$$ is without computing $$A^{-1}\text{.}$$

Let us return to the formula for the inverse of a $$2 \times 2$$ matrix:

\begin{equation*} \begin{bmatrix} a & b \\ c & d \end{bmatrix}^{-1} = \frac{1}{ad-bc} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix} . \end{equation*}

Notice the determinant of the matrix $$[\begin{smallmatrix}a&b\\c&d\end{smallmatrix}]$$ in the denominator of the fraction. The formula only works if the determinant is nonzero, otherwise we are dividing by zero.

A common notation for the determinant is a pair of vertical lines:

\begin{equation*} \begin{vmatrix} a & b \\ c & d \end{vmatrix} = \det \left( \begin{bmatrix} a & b \\ c & d \end{bmatrix} \right) . \end{equation*}

Personally, I find this notation confusing as vertical lines usually mean a positive quantity, while determinants can be negative. Also think about how to write the absolute value of a determinant. This notation is not used in this book.

### SubsectionA.6.1Exercises

#### ExerciseA.6.1.

Compute the determinant of the following matrices:

1. $$\displaystyle \begin{bmatrix} 3 \end{bmatrix}$$

2. $$\displaystyle \begin{bmatrix} 1 & 3 \\ 2 & 1 \end{bmatrix}$$

3. $$\displaystyle \begin{bmatrix} 2 & 1 \\ 4 & 2 \end{bmatrix}$$

4. $$\displaystyle \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix}$$

5. $$\displaystyle \begin{bmatrix} 2 & 1 & 0 \\ -2 & 7 & -3 \\ 0 & 2 & 0 \end{bmatrix}$$

6. $$\displaystyle \begin{bmatrix} 2 & 1 & 3 \\ 8 & 6 & 3 \\ 7 & 9 & 7 \end{bmatrix}$$

7. $$\displaystyle \begin{bmatrix} 0 & 2 & 5 & 7 \\ 0 & 0 & 2 & -3 \\ 3 & 4 & 5 & 7 \\ 0 & 0 & 2 & 4 \end{bmatrix}$$

8. $$\displaystyle \begin{bmatrix} 0 & 1 & 2 & 0 \\ 1 & 1 & -1 & 2 \\ 1 & 1 & 2 & 1 \\ 2 & -1 & -2 & 3 \end{bmatrix}$$

#### ExerciseA.6.2.

For which $$x$$ are the following matrices singular (not invertible).

1. $$\displaystyle \begin{bmatrix} 2 & 3 \\ 2 & x \end{bmatrix}$$

2. $$\displaystyle \begin{bmatrix} 2 & x \\ 1 & 2 \end{bmatrix}$$

3. $$\displaystyle \begin{bmatrix} x & 1 \\ 4 & x \end{bmatrix}$$

4. $$\displaystyle \begin{bmatrix} x & 0 & 1 \\ 1 & 4 & 2 \\ 1 & 6 & 2 \end{bmatrix}$$

#### ExerciseA.6.3.

Compute

\begin{equation*} \det \left( \begin{bmatrix} 2 & 1 & 2 & 3 \\ 0 & 8 & 6 & 5 \\ 0 & 0 & 3 & 9 \\ 0 & 0 & 0 & 1 \end{bmatrix}^{-1} \right) \end{equation*}

without computing the inverse.

#### ExerciseA.6.4.

Suppose

\begin{equation*} L = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 2 & 1 & 0 & 0 \\ 7 & \pi & 1 & 0 \\ 2^8 & 5 & -99 & 1 \end{bmatrix} \qquad \text{and} \qquad U = \begin{bmatrix} 5 & 9 & 1 & -\sin(1) \\ 0 & 1 & 88 & -1 \\ 0 & 0 & 1 & 3 \\ 0 & 0 & 0 & 1 \end{bmatrix} . \end{equation*}

Let $$A = LU\text{.}$$ Compute $$\det(A)$$ in a simple way, without computing what is $$A\text{.}$$ Hint: First read off $$\det(L)$$ and $$\det(U)\text{.}$$

#### ExerciseA.6.5.

Consider the linear mapping from $${\mathbb R}^2$$ to $${\mathbb R}^2$$ given by the matrix $$A = \left[ \begin{smallmatrix} 1 & x \\ 2 & 1 \end{smallmatrix} \right]$$ for some number $$x\text{.}$$ You wish to make $$A$$ such that it doubles the area of every geometric figure. What are the possibilities for $$x$$ (there are two answers).

#### ExerciseA.6.6.

Suppose $$A$$ and $$S$$ are $$n \times n$$ matrices, and $$S$$ is invertible. Suppose that $$\det(A) = 3\text{.}$$ Compute $$\det(S^{-1}AS)$$ and $$\det(SAS^{-1})\text{.}$$ Justify your answer using the theorems in this section.

#### ExerciseA.6.7.

Let $$A$$ be an $$n \times n$$ matrix such that $$\det(A)=1\text{.}$$ Compute $$\det(x A)$$ given a number $$x\text{.}$$ Hint: First try computing $$\det(xI)\text{,}$$ then note that $$xA = (xI)A\text{.}$$

#### ExerciseA.6.101.

Compute the determinant of the following matrices:

1. $$\displaystyle \begin{bmatrix} -2 \end{bmatrix}$$

2. $$\displaystyle \begin{bmatrix} 2 & -2 \\ 1 & 3 \end{bmatrix}$$

3. $$\displaystyle \begin{bmatrix} 2 & 2 \\ 2 & 2 \end{bmatrix}$$

4. $$\displaystyle \begin{bmatrix} 2 & 9 & -11 \\ 0 & -1 & 5 \\ 0 & 0 & 3 \end{bmatrix}$$

5. $$\displaystyle \begin{bmatrix} 2 & 1 & 0 \\ -2 & 7 & 3 \\ 1 & 1 & 0 \end{bmatrix}$$

6. $$\displaystyle \begin{bmatrix} 5 & 1 & 3 \\ 4 & 1 & 1 \\ 4 & 5 & 1 \end{bmatrix}$$

7. $$\displaystyle \begin{bmatrix} 3 & 2 & 5 & 7 \\ 0 & 0 & 2 & 0 \\ 0 & 4 & 5 & 0 \\ 2 & 1 & 2 & 4 \end{bmatrix}$$

8. $$\displaystyle \begin{bmatrix} 0 & 2 & 1 & 0 \\ 1 & 2 & -3 & 4 \\ 5 & 6 & -7 & 8 \\ 1 & 2 & 3 & -2 \end{bmatrix}$$

a) $$-2$$     b) $$8$$     c) $$0$$     d) $$-6$$     e) $$-3$$     f) $$28$$     g) $$16$$     h) $$-24$$

#### ExerciseA.6.102.

For which $$x$$ are the following matrices singular (not invertible).

1. $$\displaystyle \begin{bmatrix} 1 & 3 \\ 1 & x \end{bmatrix}$$

2. $$\displaystyle \begin{bmatrix} 3 & x \\ 1 & 3 \end{bmatrix}$$

3. $$\displaystyle \begin{bmatrix} x & 3 \\ 3 & x \end{bmatrix}$$

4. $$\displaystyle \begin{bmatrix} x & 1 & 0 \\ 1 & 4 & 0 \\ 1 & 6 & 2 \end{bmatrix}$$

a) $$3$$     b) $$9$$     c) $$3$$     d) $$\nicefrac{1}{4}$$

#### ExerciseA.6.103.

Compute

\begin{equation*} \det \left( \begin{bmatrix} 3 & 4 & 7 & 12 \\ 0 & -1 & 9 & -8 \\ 0 & 0 & -2 & 4 \\ 0 & 0 & 0 & 2 \end{bmatrix}^{-1} \right) \end{equation*}

without computing the inverse.

$$12$$

#### ExerciseA.6.104.

(challenging)   Find all the $$x$$ that make the matrix inverse

\begin{equation*} \begin{bmatrix} 1 & 2 \\ 1 & x \end{bmatrix}^{-1} \end{equation*}

have only integer entries (no fractions). Note that there are two answers.

$$1$$ and $$3$$