The definition of the determinant of a square matrix could look overwhelming at first sight. One reason is that the intuition behind it is not entirely clear just by looking at the definition. That many books introduce determinants using the cofactor formula further muddies the water. If you are interested in knowing one motivation for determinants, you could watch a 3-part video series on the subject starting here.

## Definition of the determinant of a square matrix

Given an $$n\times n$$ matrix $$A$$, the determinant of $$A$$, denoted by $$\det(A)$$, is defined to be $\sum_{\sigma \in S_n} (-1)^{\text{#inv}(\sigma)} A_{1,\sigma(1)}\cdots A_{n,\sigma(n)}$ where $$A_{i,j}$$ denote the entry in row $$i$$ and column $$j$$ of $$A$$.

So computing the determinant as defined requires taking the sum of $$n!$$ terms, each of which depends on a permutation of $$S_n$$ and is a product of $$n$$ entries from $$A$$ with a sign that depends on the parity of the number of inversions of the permutation. (The parity of an integer tells whether it is even or odd.)

Note that even for a relatively small $$n$$, the number of terms is already quite large for manual calculations. For example, $$n = 5$$ already gives $$5\times 4 \times 3 \times 2\times 1=120$$ terms. Fortunately, there are efficient ways to compute the determinant that does not require computing $$n!$$ terms.

## Convention

Instead of writing $$\det\left(\begin{bmatrix} a & b &c \\ d & e & f\\ p & q & r\end{bmatrix}\right)$$, one can simply write $$\left|\begin{matrix} a & b &c \\ d & e & f\\ p & q & r\end{matrix}\right|$$.

### Determinant of a $$2\times 2$$ matrix

Let $$A = \begin{bmatrix} a & b \\ c & d\end{bmatrix}$$. Let $$\sigma_1$$ and $$\sigma_2$$ be the two permutations in $$S_2$$ where $$\sigma_1$$ denotes the identity permutation. Since $$\text{#inv}(\sigma_1) = 0$$ and $$\text{#inv}(\sigma_2) = 1$$, we have $\det(A) = (-1)^{\text{#inv}(\sigma_1)} A_{1,\sigma_1(1)} A_{2, \sigma_1(2)} + (-1)^{\text{#inv}(\sigma_2)} A_{1,\sigma_2(1)} A_{2, \sigma_2(2)} = ad - bc.$

### Determinant of a $$3\times 3$$ matrix

Let $$A = \begin{bmatrix} p_1 & p_2 & p_3 \\ q_1 & q_2 & q_3 \\ r_1 & r_2 & r_3 \end{bmatrix}$$. Let $$\sigma_1,\ldots,\sigma_6$$ denote the permutations in $$S_3$$ as follows:

 $$i$$ $$\sigma_i$$ $$\text{#inv}(\sigma_i)$$ $$(-1)^{\text{#inv}(\sigma_i)}$$ 1 2 3 4 5 6 $$\left(\begin{matrix} 1 & 2 & 3\\1 & 2 & 3\end{matrix}\right)$$ $$\left(\begin{matrix} 1 & 2 & 3\\1 & 3 & 2\end{matrix}\right)$$ $$\left(\begin{matrix} 1 & 2 & 3\\2 & 1 & 3\end{matrix}\right)$$ $$\left(\begin{matrix} 1 & 2 & 3\\2 & 3 & 1\end{matrix}\right)$$ $$\left(\begin{matrix} 1 & 2 & 3\\3 & 1 & 2\end{matrix}\right)$$ $$\left(\begin{matrix} 1 & 2 & 3\\3 & 2 & 1\end{matrix}\right)$$ 0 1 1 2 2 3 1 -1 -1 1 1 -1

Then \begin{eqnarray} \det(A) & = & \sum_{i = 1}^6 (-1)^{\text{#inv}(\sigma_i)} A_{1,\sigma_i(1)} A_{2, \sigma_i(2)} A_{3,\sigma_i(3)} \\ & = & p_1q_2r_3 - p_1q_3r_2 - p_2q_1r_3 + p_2q_3r_1 + p_3q_1r_2 - p_3q_2r_1. \end{eqnarray}

There is a simple way to remember the above formulas for the determinants of $$2\times 2$$ and $$3\times 3$$ matrices. The positive terms are formed from starting with an element in the top row and going down diagonally to the right and wrapping around when one attempts to go off the matrix. The negative terms are formed from starting with an element in the bottom row and then going up diagonally to the right and wrapping around when one attempts to go off the matrix.

Note that this memory trick does not work for $$n\times n$$ matrices with $$n \geq 4$$.

Let's look at the formula for $$3\times 3$$ matrices above.

If we start with $$p_1$$, going down diagonally to the right will pick up $$q_2$$ and $$r_3$$, giving $$p_1q_2r_3$$.

If we start with $$p_2$$, going down diagonally to the right will pick up $$q_3$$ and then $$r_1$$ after wrapping around, giving $$p_2q_3r_1$$.

If we start with $$p_3$$, going down diagonally to the right will force us to wrap around and pick up $$q_1$$ and then $$r_2$$, giving $$p_3q_1r_2$$.

Hence, if we start with $$r_1$$, going diagonally to the right will pick up $$q_2$$ and $$p_3$$, giving $$-p_3q_2r_1$$.

If we start with $$r_2$$, going down diagonally to the right will pick up $$q_3$$ and then $$p_1$$ after wrapping around, giving $$-p_1q_3r_2$$.

If we start with $$r_3$$, going down diagonally to the right will force us to wrap around and pick up $$q_1$$ and then $$p_2$$, giving $$-p_2q_1r_3$$.

## Exercises

1. Compute the determinants of each of the following matrices:

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

2. $$\begin{bmatrix} 1 & 0 & 0 \\ 0 & a & b \\ 0 & c & d\end{bmatrix}$$

3. $$\begin{bmatrix} 0 & 0 & p \\ q & 0 & 0 \\ 0 & r & 0\end{bmatrix}$$

2. In this question, you will work out an explicit formula for the determinant of a $$4\times 4$$ matrix.

1. List all the elements of $$S_4$$.

2. Let $$A = \begin{bmatrix} a_1 & a_2 & a_3 & a_4\\ b_1 & b_2 & b_3 & b_4\\ c_1 & c_2 & c_3 & c_4\\ d_1 & d_2 & d_3 & d_4 \end{bmatrix}$$. Write out $$\det(A)$$ explicitly.

3. Let $$A$$ and $$B$$ be $$n \times n$$ matrices such that $$B$$ is obtained from $$A$$ by multiplying a row of $$A$$ by the scalar $$\alpha$$. Prove that $$\det(B) = \alpha \det(A)$$.