# 行列式值的定義
Definition of the determinant

This work by Jephian Lin is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
$\newcommand{\trans}{^\top}
\newcommand{\adj}{^{\rm adj}}
\newcommand{\cof}{^{\rm cof}}
\newcommand{\inp}[2]{\left\langle#1,#2\right\rangle}
\newcommand{\dunion}{\mathbin{\dot\cup}}
\newcommand{\bzero}{\mathbf{0}}
\newcommand{\bone}{\mathbf{1}}
\newcommand{\ba}{\mathbf{a}}
\newcommand{\bb}{\mathbf{b}}
\newcommand{\bc}{\mathbf{c}}
\newcommand{\bd}{\mathbf{d}}
\newcommand{\be}{\mathbf{e}}
\newcommand{\bh}{\mathbf{h}}
\newcommand{\bp}{\mathbf{p}}
\newcommand{\bq}{\mathbf{q}}
\newcommand{\br}{\mathbf{r}}
\newcommand{\bx}{\mathbf{x}}
\newcommand{\by}{\mathbf{y}}
\newcommand{\bz}{\mathbf{z}}
\newcommand{\bu}{\mathbf{u}}
\newcommand{\bv}{\mathbf{v}}
\newcommand{\bw}{\mathbf{w}}
\newcommand{\tr}{\operatorname{tr}}
\newcommand{\nul}{\operatorname{null}}
\newcommand{\rank}{\operatorname{rank}}
%\newcommand{\ker}{\operatorname{ker}}
\newcommand{\range}{\operatorname{range}}
\newcommand{\Col}{\operatorname{Col}}
\newcommand{\Row}{\operatorname{Row}}
\newcommand{\spec}{\operatorname{spec}}
\newcommand{\vspan}{\operatorname{span}}
\newcommand{\Vol}{\operatorname{Vol}}
\newcommand{\sgn}{\operatorname{sgn}}
\newcommand{\idmap}{\operatorname{id}}
\newcommand{\am}{\operatorname{am}}
\newcommand{\gm}{\operatorname{gm}}
\newcommand{\mult}{\operatorname{mult}}
\newcommand{\iner}{\operatorname{iner}}$
```python
from lingeo import random_int_list
```
## Main idea
For $n\times n$ matrices $A$, the **determinant** $\det(A)$ is defined through the following rules.
- $\det(I_n) = 1$.
- If $E$ is the elementary matrix of $\rho_i\leftrightarrow\rho_j$, then $\det(EA) = -\det(A)$ and we define $\det(E) = -1$.
- If $E$ is the elementary matrix of $\rho_i:\times k$, then $\det(EA) = k\det(A)$ and we define $\det(E) = k$.
(Note that this statement still holds even when $k = 0$.)
- If $E$ is the elementary matrix of $\rho_i:+k\rho_j$, then $\det(EA) = \det(A)$ and we define $\det(E) = 1$.
Note that the determinants for $2\times 2$ and $3\times 3$ matrices agree with this definition.
As a consequence, if a matrix $A$ is invertible and
can be written as the product a sequence of elementary matrices $F_1\cdots F_k$,
then $\det(A) = \det(F_1)\cdots\det(F_k)\det(I_n) = \det(F_1)\cdots\det(F_k)$.
In contrast, if $A$ is not invertible,
then $\det(A) = 0$.
In particular, this happens when
- $A$ has a zero row, or
- $A$ has repeated rows.
By definitions, $\det(A) = \Vol_C(A) = \Vol_R(A)$ for any matrix $A$.
##### Remark
Thanks to row operations, the definition of $\det(A)$ assigns at least a value to $\det(A)$.
However, _maybe_ the rules assigns more than one values to it.
That is, the function might not be _well-defined_.
A matrix $A$ can be written as the product of different sequences of elementary matrices.
For example, one may write
$$
A = F_1 \cdots F_k = E_1 \cdots E_h
$$
for elementary matrices $F_1,\ldots, F_k$ and $E_1,\ldots, E_h$.
However, it is not yet clear by the definition
that $\det(F_1) \cdots \det(F_k) = \det(E_1) \cdots \det(E_h)$.
We will deal with this issue at the end of this chapter.
## Side stories
- well-defined
- permutation matrices
## Experiments
##### Exercise 1
執行以下程式碼。
<!-- eng start -->
Run the code below.
<!-- eng end -->
```python
### code
set_random_seed(0)
print_ans = False
n = 4
while True:
A = matrix(n, random_int_list(n^2, 3))
if A.det() != 0:
break
print("A =")
pretty_print(A)
if print_ans:
print("determinant of A =", A.det())
```
##### Exercise 1(a)
將 $A$ 消成最簡階梯形式、
並記錄下每一步的列運算。
<!-- eng start -->
Find the reduced echelon form of $A$ and record each step of the row operation.
<!-- eng end -->
##### Exercise 1(a) - answer here
Let `seed = 15`,
$$\begin{aligned} A = \left[\begin{array}{cccc}
2 & 2 & 2 & 0 \\
-2 & -1 & 2 & -2\\
2 & 0 & -2 & 1\\
2 & 0 & -2 & -2
\end{array}\right]
\xrightarrow[\rho_2:\rho_1+\rho_2]{\rho_3:\rho_3-\rho_1}\left[\begin{array}{cccc}
2 & 2 & 2 & 0\\
0 & 1 & 4 & -2\\
0 & -2 & -4 & 1\\
2 & 0 & -2 & -2
\end{array}\right]\\
\xrightarrow[\rho_3:\rho_3+2\rho_2]{\rho_4:\rho_4-\rho_1}\left[\begin{array}{cccc}
2 & 2 & 2 & 0\\
0 & 1 & 4 & -2\\
0 & 0 & 4 & -3\\
0 & -2 & -4 & -2
\end{array}\right]\\
\xrightarrow[\rho_1:\frac{1}{2}\rho_1]{\rho_4:\rho_4+2\rho_2}\left[\begin{array}{cccc}
1 & 1 & 1 & 0\\
0 & 1 & 4 & -2\\
0 & 0 & 4 & -3\\
0 & 0 & 4 & -6
\end{array}\right]\\
\xrightarrow[\rho_4:\rho_4-\rho_3]{\rho_2:\rho_2-\rho_3}\left[\begin{array}{cccc}
1 & 1 & 1 & 0\\
0 & 1 & 0 & 1\\
0 & 0 & 4 & -3\\
0 & 0 & 0 & -3
\end{array}\right]\\
\xrightarrow[\rho_1:\rho_1-\rho_2]{\rho_4:-\frac{1}{3}\rho_4}\left[\begin{array}{cccc}
1 & 0 & 1 & -1\\
0 & 1 & 0 & 1\\
0 & 0 & 4 & -3\\
0 & 0 & 0 & 1
\end{array}\right]\\
\xrightarrow[\rho_2:\rho_2-\rho_4]{\rho_3:\frac{1}{4}\rho_3}\left[\begin{array}{cccc}
1 & 0 & 1 & -1\\
0 & 1 & 0 & 0\\
0 & 0 & 1 & -\frac{3}{4}\\
0 & 0 & 0 & 1
\end{array}\right]\\
\xrightarrow[\rho_3:\rho_3+\frac{3}{4}\rho_4]{\rho_1:\rho_1+\rho_3}\left[\begin{array}{cccc}
1 & 0 & 1 & 0\\
0 & 1 & 0 & 0\\
0 & 0 & 1 & 0\\
0 & 0 & 0 & 1
\end{array}\right]\\
\xrightarrow[]{\rho_1:\rho_1-\rho_3}\left[\begin{array}{cccc}
1 & 0 & 0 & 0\\
0 & 1 & 0 & 0\\
0 & 0 & 1 & 0\\
0 & 0 & 0 & 1
\end{array}\right]\\
\end{aligned}
$$
:::success
Nice work!
:::
##### Exercise 1(b)
求出 $\det(A)$。
<!-- eng start -->
Find $\det(A)$.
<!-- eng end -->
##### Exercise 1(b) -- answer here
$\det(A)=1\cdot 4\cdot (-3)\cdot 2= -24.$
:::info
What do the experiments try to tell you? (open answer)
> We can know that after rref, we can find $\det(A)$ more easily .
:::
:::success
Good.
- [x] No space before a comma, put a space after a comma.
:::
## Exercises
##### Exercise 2
對以下矩陣 $A$,
求出 $\det(A)$。
<!-- eng start -->
For the following matrices $A$, find $\det(A)$.
<!-- eng end -->
##### Exercise 2(a)
$$
A = \begin{bmatrix}
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
1 & 0 & 0 & 0 \\
\end{bmatrix}.
$$
##### Exercise 2(a) - answer here
We have to turn the last row to the first row, so we times $-1$ three times. Because we swap the rows three times, then we can get the matrix after swapping.
$$
A = \begin{bmatrix}
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
1 & 0 & 0 & 0 \\
\end{bmatrix}\rightarrow
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
\end{bmatrix}.
$$
Then we can calculate $\det(A)=-1\cdot -1\cdot -1\cdot 1\cdot 1\cdot 1\cdot 1= -1.$
:::warning
The idea is correct. However,
$$
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
\end{bmatrix}\cdot(-1)\cdot(-1)\cdot(-1) =
\begin{bmatrix}
-1 & 0 & 0 & 0 \\
0 & -1 & 0 & 0 \\
0 & 0 & -1 & 0 \\
0 & 0 & 0 & -1 \\
\end{bmatrix}
$$
is not related to $A$.
:::
##### Exercise 2(b)
$$
A = \begin{bmatrix}
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
\end{bmatrix}.
$$
##### Exercise 2(b) - answer here
First swap the third row to the first row and last row to the second row. So we have to times -1 four times, then we can get the matrix after swapping.
$$
A = \begin{bmatrix}
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
\end{bmatrix}\rightarrow
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
\end{bmatrix}.
$$
Then we can calculate $\det(A)=-1\cdot -1\cdot -1\cdot -1\cdot 1\cdot 1\cdot 1\cdot 1 = 1.$
:::warning
Same as 2(b).
:::
##### Exercise 2(c)
$$
A = \begin{bmatrix}
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 \\
1 & 0 & 0 & 0 \\
\end{bmatrix}
$$
##### Exercise 2(c) - answer here
First swap the third row to the first row and last row to the second row. So we have to times -1 two times, then we can get the matrix after swapping.
$$
A = \begin{bmatrix}
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 \\
1 & 0 & 0 & 0 \\
\end{bmatrix}\rightarrow
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
\end{bmatrix}.
$$
$\det(A)= (-1)^2\cdot 1\cdot 1\cdot 1\cdot 1=1$.
:::warning
Same as 2(b).
:::
##### Exercise 2(d)
$$
A = \begin{bmatrix}
0 & 0 & 0 & 1 \\
0 & 0 & 2 & 0 \\
0 & 3 & 0 & 0 \\
4 & 0 & 0 & 0 \\
\end{bmatrix}.
$$
##### Exercise 2(d) - answer here
$$
A = \begin{bmatrix}
0 & 0 & 0 & 1 \\
0 & 0 & 2 & 0 \\
0 & 3 & 0 & 0 \\
4 & 0 & 0 & 0 \\
\end{bmatrix}\rightarrow
\begin{bmatrix}
4 & 0 & 0 & 0 \\
0 & 3 & 0 & 0 \\
0 & 0 & 2 & 0 \\
0 & 0 & 0 & 1 \\
\end{bmatrix}.
$$
By observing 2(c), we can know that $\det(A)=1\cdot 2\cdot 3\cdot 4 = 24.$
##### Exercise 2(e)
$$
A = \begin{bmatrix}
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 2 \\
3 & 0 & 0 & 0 \\
0 & 4 & 0 & 0 \\
\end{bmatrix}.
$$
##### Exercise 2(e) - answer here
First swap the third row to the first row and last row to the second row. So we have to times -1 four times, then we can get the matrix after swapping.
$$
A = \begin{bmatrix}
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 2 \\
3 & 0 & 0 & 0 \\
0 & 4 & 0 & 0 \\
\end{bmatrix}\rightarrow
\begin{bmatrix}
3 & 0 & 0 & 0 \\
0 & 4 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 2 \\
\end{bmatrix}.
$$
Then we can calculate $\det(A)$.
$\det(A)=-1\cdot -1\cdot -1\cdot -1\cdot 3\cdot 4\cdot 1\cdot 2 = 24.$
:::warning
Same as 2(b).
:::
##### Exercise 3
對以下矩陣 $A$,
求出 $\det(A)$。
<!-- eng start -->
For the following matrices $A$, find $\det(A)$.
<!-- eng end -->
##### Exercise 3(a)
$$
A = \begin{bmatrix}
1 & 1 & 1 & 1 \\
1 & 2 & 2 & 2 \\
1 & 2 & 3 & 3 \\
1 & 2 & 3 & 4
\end{bmatrix}.
$$
##### Exercise 3(a) -- answer here
Subtracting the other rows by first row to get,
$$
A = \begin{bmatrix}
1 & 1 & 1 & 1 \\
0 & 1 & 1 & 1 \\
0 & 1 & 2 & 2 \\
0 & 1 & 2 & 3
\end{bmatrix},
$$
and use second row to kill rows beneath it,
$$
A = \begin{bmatrix}
1 & 1 & 1 & 1 \\
0 & 1 & 1 & 1 \\
0 & 0 & 1 & 1 \\
0 & 0 & 1 & 2
\end{bmatrix},
$$
$$
A = \begin{bmatrix}
1 & 1 & 1 & 1 \\
0 & 1 & 1 & 1 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1
\end{bmatrix},
$$
$$
A = \begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}.
$$
Since row subtraction doesn't change determinant,
$\det(A)=1.$
:::success
Good.
:::
---
##### Exercise 3(b)
$$
A = \begin{bmatrix}
1 & 1 & \cdots & 1 \\
1 & 2 & \cdots & 2 \\
\vdots & \vdots & \ddots & \vdots \\
1 & 2 & \cdots & n
\end{bmatrix}.
$$
**[由 :cloud: 提供]**
##### Exercise 3(b) -- answer here
By applying the same way of **Exercise 3(a)**, we found that $\det(A)=1.$
##### Exercise 4
對以下矩陣 $A$,
求出 $\det(A)$。
<!-- eng start -->
For the following matrices $A$, find $\det(A)$.
<!-- eng end -->
##### Exercise 4(a)
$$
A = \begin{bmatrix}
1 & 1 & 1 & 1 \\
1 & 2 & 4 & 8 \\
1 & 3 & 9 & 27 \\
1 & 4 & 16 & 64
\end{bmatrix}.
$$
##### Exercise 4(a) - answer here
Subtracting the other rows by first row to get,
$$
A = \begin{bmatrix}
1 & 1 & 1 & 1 \\
0 & 1 & 3 & 7 \\
0 & 2 & 8 & 26 \\
0 & 3 & 15 & 63
\end{bmatrix},
$$
and do the row operation by second row to obtain
$$
A = \begin{bmatrix}
1 & 1 & 1 & 1 \\
0 & 1 & 3 & 7 \\
0 & 0 & 2 & 12 \\
0 & 0 & 6 & 42
\end{bmatrix}.
$$
Now we can do the matrix deflation to calculate the determinant of A.
$\det(A)=1\cdot 1\cdot (2\cdot 42 - 12\cdot 6) = 12.$
:::success
Good.
:::
##### Exercise 4(b)
$$
A = \begin{bmatrix}
1 & 1 & 1 & 1 & 1\\
1 & 2 & 4 & 8 & 16 \\
1 & 3 & 9 & 27 & 81 \\
1 & 4 & 16 & 64 & 256 \\
1 & 5 & 25 & 125 & 625
\end{bmatrix}.
$$
##### Exercise 4(b) - answer here
We do the row operation to matrix A to get
$$
A = \begin{bmatrix}
1 & 1 & 1 & 1 & 1\\
0 & 1 & 3 & 7 & 15 \\
0 & 0 & 2 & 12 & 50 \\
0 & 0 & 0 & 6 & 60 \\
0 & 0 & 0 & 0 & 24
\end{bmatrix},
$$
and we do the matrix deflation to calculate the determinant of A.
$\det(A)=1\cdot 1\cdot 2\cdot (6\cdot 24 - 60\cdot 0) = 288.$
:::success
Good.
:::
##### Exercise 5
對以下矩陣 $A$,
求出 $\det(A)$。
提示:把所有列加到第一列。
<!-- eng start -->
For the following matrices $A$, find $\det(A)$.
Hint: Add each row to the first row.
<!-- eng end -->
##### Exercise 5(a)
$$
A = \begin{bmatrix}
4 & -1 & -1 & -1 \\
-1 & 4 & -1 & -1 \\
-1 & -1 & 4 & -1 \\
-1 & -1 & -1 & 4
\end{bmatrix}.
$$
**[由 :cloud: 提供]**
After adding each row to the first row, the matrix $A$ becomes
$$
\begin{bmatrix}
1 & 1 & 1 & 1 \\
-1 & 4 & -1 & -1 \\
-1 & -1 & 4 & -1 \\
-1 & -1 & -1 & 4
\end{bmatrix}.
$$
Next, we subtract the the first row from other rows, eliminating the remaining $(-1)$'s. Then we divide these rows by $5$ to make an upper triangular matrix as follows.
$$
\begin{bmatrix}
1 & 1 & 1 & 1 \\
0 & 5 & 0 & 0 \\
0 & 0 & 5 & 0 \\
0 & 0 & 0 & 5
\end{bmatrix},
$$
$$
\begin{bmatrix}
1 & 1 & 1 & 1 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix},
$$
Thus, $\det(A)=1\cdot 5\cdot 5\cdot 5=125.$
##### Exercise 5(b)
令 $A$ 為一 $n\times n$ 矩陣
$$
\begin{bmatrix}
n & -1 & \cdots & -1 \\
-1 & n & \ddots & \vdots \\
\vdots & \ddots & \ddots & -1 \\
-1 & \cdots & -1 & n
\end{bmatrix}.
$$
<!-- eng start -->
Let $A$ be the $n\times n$ matrix
$$
\begin{bmatrix}
n & -1 & \cdots & -1 \\
-1 & n & \ddots & \vdots \\
\vdots & \ddots & \ddots & -1 \\
-1 & \cdots & -1 & n
\end{bmatrix}.
$$
<!-- eng end -->
**[由 :cloud: 提供]**
##### Exercise 5(b) -- answer here
By applying the same way of **Exercise 5(a)**, it will become something like
$$
\begin{bmatrix}
1 & 1 & \cdots & 1 \\
0 & (n+1) & \ddots & \vdots \\
\vdots & \ddots & \ddots & 0 \\
0 & \cdots & 0 & (n+1)
\end{bmatrix}.
$$
So $\det(A)=1\cdot (n+1)^{(n-1)}.$
##### Exercise 6
利用 $\det$ 定義中的四條準則,說明以下性質。
<!-- eng start -->
Use the four rules in the definition of the determinant to explain the following properties.
<!-- eng end -->
##### Exercise 6(a)
若 $A$ 中有一列為零向量,說明 $\det(A) = 0$。
<!-- eng start -->
If $A$ has a zero row, then $\det(A) = 0$.
<!-- eng end -->
**[由 :cloud: 提供]**
##### Exercise 6(a) -- answer here
Suppose the $i$th row of $A$ are zero, after applied row operation :
$$
A\xrightarrow{\rho_i:\times k}B.
$$
By the definition, $\det(B)=k\cdot \det(A),$ and since the $i$th row are all $0$ times any number is still $0$, so actually $B=A.$
We can know from $B=A$ that $\det(B)=\det(A),$ to achieve this equality (with any $k\neq 1$), the only possibility is $\det(A)=0.$
##### Exercise 6(b)
若 $A$ 中有兩列向量相等,說明 $\det(A) = 0$。
<!-- eng start -->
If $A$ has two rows in common, then $\det(A) = 0$.
<!-- eng end -->
**[由 :cloud: 提供]**
##### Exercise 6(b) -- answer here
Suppose $A$ has two rows in common, we can eliminate one of them by subtracting each other. There will be a zero row in $A$, applying the same way in **Exercise 6(a)**, we can find $\det(A) = 0.$
##### Exercise 6(c)
若 $A$ 中的列向量集合線性相依,說明 $\det(A) = 0$。
<!-- eng start -->
If some rows of $A$ form a linearly dependent set, then $\det(A) = 0$.
<!-- eng end -->
**[由 :cloud: 提供]**
##### Exercise 6(c) -- answer here
Since some rows of $A$ form a linearly dependent set, there are coefficients $c_1,\ldots, c_n$ that is not all zero such that
$$
c_1\br_1 + \cdots + c_n\br_n = \bzero,
$$
where $\br_1,\ldots,\br_n$ are the rows of $A$.
Without loss of generality, we may assume $c_1 \neq 0$.
$$
\br_1 = -\frac{1}{c_1}(c_2\br_2 + \cdots + c_n\br_n).
$$
Consequently, we may apply a sequence of row operations $\rho_1: +\frac{c_2}{c_1}\br_2$, $\ldots$, $\rho_1: +\frac{c_n}{c_1}\br_n$ to generate a zero row. Therefore, $\det(A)=0.$
:::info
collaboration: 2
3 problems: 3
* 2a~c
extra problems: 2.5
* 2d~e, 3a, 4a~b
moderator: 1
qc: 1
:::