owned this note
owned this note
Published
Linked with GitHub
# 基本矩陣與行超平行體

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}}$
```python
from lingeo import random_int_list, row_operation_process
```
## Main idea
Each $n\times n$ matrix can be viewed as a list of column vectors $\{\bu_1,\ldots, \bu_n\}$.
We define the **column parallelotope** of $A$ as the polytope
$$
\{c_1\bu_1 + \cdots + c_n\bu_n : c_i\in [0,1] \text{ for all }i = 1,\ldots, n\}
$$
spanned by the columns $\{\bu_1,\ldots, \bu_n\}$ of $A$.
Let $\Vol_C(A)$ be the **signed volume** of the column parallelotope.
Then $\Vol_C(A)$ can be defined through the following rules.
- $\Vol_C(I_n) = 1$.
- If $E$ is the elementary matrix of $\rho_i\leftrightarrow\rho_j$, then $E$ **swaps** the $i$-th and $j$-th coordinates of columns of $A$.
Thus, $\Vol_C(EA) = -\Vol_C(A)$ and we define $\Vol_C(E) = -1$.
- If $E$ is the elementary matrix of $\rho_i:\times k$, then $E$ **rescales** the $i$-th coordinates of columns of $A$.
Thus, $\Vol_C(EA) = k\Vol_C(A)$ and we define $\Vol_C(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 $E$ **slants** the $i$-th coordinates of columns of $A$ to the direction of $j$-th coordinates.
Thus, $\Vol_C(EA) = \Vol_C(A)$ and we define $\Vol_C(E) = 1$.
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 $\Vol_C(A) = \Vol_C(F_1)\cdots\Vol_C(F_k)\Vol_C(I_n) = \Vol_C(F_1)\cdots\Vol_C(F_k)$.
In contrast, if $A$ is not invertible,
then column parallelotope collapses and is flat $\Vol_C(A) = 0$.
From this point of view,
the value of $\Vol_C(A)$ can be both
the signed volume and
the **scaling factor** changing $\Vol_C(B)$ to $\Vol_C(AB)$ for any $B$.
## Side stories
- Jacobian
## Experiments
##### Exercise 1
執行以下程式碼。
已知 $A = F_1\cdots F_k$ 是一群單位矩陣的乘積。
```python
### code
set_random_seed(0)
print_ans = False
n = 2
while True:
A = matrix(n, random_int_list(n^2, 3))
if A.det() != 0:
break
elems = row_operation_process(A, inv=True)
pretty_print(A, LatexExpr("="), *elems)
R = identity_matrix(n)
k = 1
vols = [1]
for elem in elems[::-1]:
R = elem * R
vols.append(R.det())
vecs = R.columns()
P = polytopes.parallelotope(vecs).plot(
xmin=-3,
xmax=3,
ymin=-3,
ymax=3,
wireframe="black",
fill="lightgreen"
)
for v in vecs:
P += text("%s"%v, v + vector([0,0.5]), fontweight=1000).plot()
show(P, title="$V_{%s}$"%k)
k += 1
if print_ans:
for k,vol in enumerate(vols):
print("The signed volumn (area) of V%s is"%k, vol)
```
$\begin{bmatrix}-3&3\\1&2\end{bmatrix}=\begin{bmatrix}-3&0\\0&1\end{bmatrix}\begin{bmatrix}1&0\\1&1\end{bmatrix}\begin{bmatrix}1&0\\0&3\end{bmatrix}\begin{bmatrix}1&-1\\0&1\end{bmatrix}$
##### Exercise 1(a)
令 $V_0$ 為單位矩陣的行超平行體。
說明如何從 $V_0$ 得到 $V_1$ 並求出 $V_1$ 的面積。
:::warning
- [x] 因為 $V_1$ 為 $\begin{bmatrix}1&-1\\0&1\end{bmatrix}=\begin{bmatrix}1&-1\\0&1\end{bmatrix}\begin{bmatrix}1&0\\0&1\end{bmatrix}$ 的行超平行體,其由 $V_0$ 經過傾斜得來,因此面積不變。
- [x] 數學式放進句子裡,加標點
:::
解:
因為 $V_1$ 為 $\begin{bmatrix}1&-1\\0&1\end{bmatrix}=\begin{bmatrix}1&-1\\0&1\end{bmatrix}\begin{bmatrix}1&0\\0&1\end{bmatrix}$
的行超平行體,其由 $V_0$ 經過傾斜得來,因此面積不變。
所以 $\Vol_C(V_1) =1$。
##### Exercise 1(b)
依序說明如何從 $V_i$ 得到 $V_{i+1}$,
並求出 $V_2,\ldots, V_k$ 的面積。
:::warning
- [x] 依上一題建議修改
- [x] 標點
- [x] $V_4$ 是由 $V_3$ 把沿 $x$ 方向伸縮 $3$ 倍並對 $y$ 軸鏡射
:::
解:
因為 $V_2$ 為 $\begin{bmatrix}1&-1\\0&3\end{bmatrix}=\begin{bmatrix}1&0\\0&3\end{bmatrix}\begin{bmatrix}1&-1\\0&1\end{bmatrix}$ 的行超平行體,其由 $V_1$ 把沿 $y$ 方向伸縮 $3$ 倍得來,因此面積變為 $3$ 倍。
所以 $\Vol_C(V_2) = 3$。
因為 $V_3$ 為 $\begin{bmatrix}1&-1\\1&2\end{bmatrix}=\begin{bmatrix}1&0\\1&1\end{bmatrix}\begin{bmatrix}1&-1\\0&3\end{bmatrix}$ 的行超平行體,其由 $V_2$ 經過傾斜得來,因此面積不變。
所以$\Vol_C(V_3) = 3$。
因為 $V_4$ 為 $\begin{bmatrix}-3&3\\1&2\end{bmatrix}=\begin{bmatrix}-3&0\\0&1\end{bmatrix}\begin{bmatrix}1&-1\\1&2\end{bmatrix}$ 的行超平行體,其為 $V_3$ 把沿 $x$ 方向伸縮 $3$ 倍並對 $y$ 軸鏡射,因此面積變為$-3$倍。
所以 $\Vol_C(V_3) = -9。$
## Exercises
##### Exercise 2
對以下矩陣 $A$,
用文字描述它的行平行體,並用求出它的有向體積。
##### Exercise 2(a)
$$
A = \begin{bmatrix}
1 & 0 & 0 \\
0 & 2 & 0 \\
0 & 0 & 3
\end{bmatrix}.
$$
:::warning
- [x] 三個向量所組成的立體平行體,其為一長方體且三邊長長度為 ...,因此 ...
- [x] 這整個題組都還沒扯到行列式值
:::
解:
此平形體是由 $(1,0,0),(0,2,0),(0,0,3)$ 三個向量所組成的立體平行體,其為一長方體且三邊長長度為 $1,2,3$ , 因此 $\Vol_C(A)=6$。
##### Exercise 2(b)
$$
A = \begin{bmatrix}
0 & 1 & 0 \\
2 & 0 & 0 \\
0 & 0 & 3
\end{bmatrix}.
$$
:::warning
- [x] 依上一題修改
- [x] 沒有解釋到負號
:::
解:
此平行體是由 $(0,2,0),(1,0,0),(0,0,3)$ 三個向量所組成的立體平行體,其為一長方體且三邊長長度為 $1,2,3$ ,且把沿 $x$ 方向對 $y$ 軸鏡射,因此 $\Vol_C(A)=-6$。
##### Exercise 2(c)
$$
A = \begin{bmatrix}
1 & 1 & 1 \\
1 & 2 & 3 \\
0 & 0 & 0
\end{bmatrix}.
$$
:::warning
- [x] 目前與行列式值無關
:::
解:
此平行體是由 $(1,1,0),(1,2,0),(1,3,0)$ 所組成的平行體,
但此平行體扁平的落在 $z=0$ 的平面上,
因此 $\Vol_C(A)=0$。
##### Exercise 2(d)
$$
A = \begin{bmatrix}
1 & 1 & 0 \\
1 & 2 & 0 \\
1 & 3 & 0
\end{bmatrix}.
$$
:::warning
- [x] 目前與行列式值無關
:::
解:
此平行體是由 $(1,1,1),(1,2,3),(0,0,0)$ 所組成的平行體,
但此平行體扁平的落在 $x - 2y + z = 0$ 的平面上,
因此 $\Vol_C(A)=0$。
##### Exercise 2(e)
$$
A = \begin{bmatrix}
1 & 2 & 0 \\
3 & 4 & 0 \\
0 & 0 & 5
\end{bmatrix}.
$$
:::warning
- [x] 目前與行列式值無關
- [x] 原因是這個超平行體的底面由 $\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}$、而高是 $5$
- [ ] 文字可以再改進
:::
解:
這個超平行體的底面由 $(1,3),(2,4)$ 兩個矩陣組成,而高是 $5$,
因此 $\Vol_C(A)=-10$。
##### Exercise 3
在 $\Vol_C$ 的定義中,假設我們已經接受了 02.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
- If $E$ is the elementary matrix of $\rho_i:\times k$, then $E$ **rescales** the $i$-th coordinates of columns of $A$.
Thus, $\Vol_C(EA) = k\Vol_C(A)$ and we define $\Vol_C(E) = k$.
- If $E$ is the elementary matrix of $\rho_i:+k\rho_j\times$, then $E$ **slants** the $i$-th coordinates of columns of $A$ to the direction of $j$-th coordinates.
Thus, $\Vol_C(EA) = \Vol_C(A)$ and we define $\Vol_C(E) = 1$.
說明為什麼
- If $E$ is the elementary matrix of $\rho_i\leftrightarrow\rho_j$, then $E$ **swaps** the $i$-th and $j$-th coordinates of columns of $A$.
Thus, $\Vol_C(EA) = -\Vol_C(A)$ and we define $\Vol_C(E) = -1$.
中的 $-1$ 是合理的。
:::warning
- [x] 用文字敘述清楚
- [x] 數學放數學式
- [x] 與行列式值無關
- [x] 中英數間空格
- [x] 不要中英混雜
- [x] 標點
:::
解:
$E$ 代表把目標矩陣中兩列互換的矩陣,如果要用題目給的兩個條件做出 $\rho_i\leftrightarrow\rho_j$ ,可以照著以下步驟:
- $E_1$ 代表 $\rho_j:+1\rho_i$ 這個列運算的基本矩陣。
- $E_2$ 代表 $\rho_i:-1\rho_j$ 這個列運算的基本矩陣。
- $E_3$ 代表 $\rho_j:+1\rho_i$ 這個列運算的基本矩陣。
- $E_4$ 代表 $\rho_i:\times (-1)$ 這個列運算的基本矩陣。
可得:
$$
EA=E_4E_3E_2E_1A.
$$
$A$ 為 $n$ 階方陣。
再利用題目給的性質, $E_1$ 到 $E_3$ 不會使 $\Vol_C$ 改變, $E_4$ 會使其變成 $-1$ 倍,就能說明此題。
$$
\Vol_C(E) = -1.
$$
##### Exercise 4
利用 $\Vol_C$ 定義中的四條準則,說明以下性質。
##### Exercise 4(a)
若 $A$ 中有一列為零向量,說明 $\Vol_C(A) = 0$。
:::success
Nice!
:::
解:
因為 $A$ 中有一列零向量,我們可以使用列運算 $\rho_i:\times k$ 讓這一個零列每項的值乘 $k$ 倍,並令這一個新矩陣為 $B$。然而由於 $0$ 乘上任何數字還是 $0$,故 $A = B$。
另外,從 $\Vol_C$ 的定義中得知
$$\Vol_C(B) = k\Vol_C(A).
$$
然而我們也知道 $A=B$,故 $\Vol_C(B) = \Vol_C(A)$。因此我們得到
$$
\Vol_C(B) = \Vol_C(A) = k\Vol_C(A),
$$
所以 $\Vol_C(A) = 0$。
##### Exercise 4(b)
若 $A$ 中有兩列向量相等,說明 $\Vol_C(A) = 0$。
解:
因為 $A$ 中有兩列相等,我們可以使用列運算 $\rho_i\leftrightarrow\rho_j$ 讓這兩列交換,並令這一個新矩陣為 $B$。然而由於兩列相等,交換後並不會有所差別,故 $A = B$。
另外,從 $\Vol_C$ 的定義中得知
$$\Vol_C(B) = -\Vol_C(A).
$$
然而我們也知道 $A=B$,故 $\Vol_C(B) = \Vol_C(A)$。因此我們得到
$$
\Vol_C(B) = \Vol_C(A) = -\Vol_C(A),
$$
所以 $\Vol_C(A) = 0$。
##### Exercise 4(c)
若 $A$ 中的列向量集合線性相依,說明 $\Vol_C(A) = 0$。
**[由汪駿佑同學提供]**
假設 $A$ 為 $n \times n$ 矩陣 ,其列向量為 ${\{\ba_1,\ba_2,\cdots,\ba_n}\}$。
則其中一個向量可以寫成其它向量的線性組合,不失一般性,我們假設 $\ba_i$ 可以寫成
$$
\ba_i = c_1\ba_1 + c_2\ba_2 + \cdots + c_n\ba_n,c_1,c_2,\ldots,c_n \in \mathbb R.
$$
那麼我們可以利用列運算 $\rho_i:+(-c_1)\rho_1$、$\rho_i:+(-c_2)\rho_2$ $\cdots$ 等等運算使得第 $i$ 列成為零列,從而得到與上面相同的結論。
所以 $\Vol_C(A) = 0$。
##### Exercise 5
令
$$
A = \begin{bmatrix}
\frac{1}{\sqrt{3}} & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{6}}\\
\frac{1}{\sqrt{3}} & -\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{6}}\\
\frac{1}{\sqrt{3}} & 0 & -\frac{2}{\sqrt{6}}\\
\end{bmatrix}.
$$
##### Exercise 5(a)
已知 $A$ 的行向量彼此互相垂直
且長度皆為 $1$。
以直觀的方式猜測 $\Vol_C(A)$。
真的計算看看你的猜測是否正確。
:::warning
- [x] 說明直觀猜測的原因
- [x] 可以的話還是把 $E_1$ 到 $E_8$ 寫出來,或是拍照上傳也行
:::
解:
因為三個行向量彼此垂直且長度為 $1$,猜測他是在三維空間中的正立方體, $\Vol_C(A)=1$。
以高斯消去法可知 $A$ 為可逆矩陣且 $A=E_1^{-1}E_2^{-1}E_3^{-1}E_4^{-1}E_5^{-1}E_6^{-1}E_7^{-1}E_8^{-1}I_3$,
其中 $E_1 = \begin{bmatrix}
1 & 0 & 0 \\
-1 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}$, $E_2 = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
-1 & 0 & 1
\end{bmatrix}$, $E_3 = \begin{bmatrix}
1 & 0 & 0 \\
0 & -\frac{{\sqrt{2}}}2 & 0 \\
0 & 0 & 1
\end{bmatrix}$, $E_4 = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & \frac{1}{\sqrt{2}} & 1
\end{bmatrix}$, $E_5 = \begin{bmatrix}
1 & -\frac{1}{\sqrt{2}} & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}$, $E_6 = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & -\frac{{\sqrt{6}}}3
\end{bmatrix}$, $E_7 = \begin{bmatrix}
1 & 0 & -\frac{1}{\sqrt{6}} \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}$, $E_8= \begin{bmatrix}
{\sqrt{3}} & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}$。
$E_1,E_2,E_4,E_5,E_7$ 為一列乘以 $k$ 倍加到別列的基本矩陣,所以$\Vol_C(E_1)=\Vol_C(E_2)=\Vol_C(E_4)=\Vol_C(E_5)=\Vol_C(E_7)=1$,$E_3,E_6,E_8$ 為一列乘 $k$ 倍的基本矩陣,
所以 $\Vol_C(E_3)=(-\frac{{\sqrt{2}}}2)$,$\Vol_C(E_6)=(-\frac{{\sqrt{6}}}3)$,$\Vol_C(E_8)=\sqrt{3}$,
$\Vol_C(A)=(-\frac{{\sqrt{2}}}2)(-\frac{{\sqrt{6}}}3){\sqrt{3}}=1$。
##### Exercise 5(b)
將 $A$ 矩陣的
第一個行向量伸縮為原來的 $3$ 倍,
第二個行向量伸縮為原來的 $4$ 倍,
第三個行向量伸縮為原來的 $5$ 倍,
並得到 $B$ 矩陣。
以直觀的方式猜測 $\Vol_C(B)$。
真的計算看看你的猜測是否正確。
:::warning
- [x] 前乘基本矩陣無法將行向量伸縮,因為你第一題已經寫很完整了,你可以寫:同樣用高斯消去法可得 $\Vol_C$ ... 沒關係
:::
解:
因為三個行向量彼此垂直且長度為 $3,4,5$,猜測他是三維空間中的長方形, $\Vol_C(B)=60$。
同樣用高斯消去法可得
$\Vol_C(B)=3\times4\times5=60$。
##### Exercise 6
積分的概念在於
把許多小方塊(或是其它幾何形狀)的體積累積起來。
當這些小方塊的體積會隨著座標變動的時候則須要乘上一些調整量來確保體積正確。
我們知道笛卡爾座標和極座標轉換時有以下公式
$$
\int f\,dxdy = \int f rdrd\theta.
$$
當 $x = r\cos\theta$ 且 $y = r\sin\theta$ 時,
計算
$$
J = \begin{bmatrix}
\frac{\partial x}{\partial r} & \frac{\partial y}{\partial r} \\
\frac{\partial x}{\partial \theta} & \frac{\partial y}{\partial \theta} \\
\end{bmatrix}
$$
的 $\Vol_C(J)$。
而這個值告訴我們極座標上的一個小方塊
和笛卡爾座標上的一個小方塊
它們的體積的比率為何。
解:
$$
\Vol_C(J) = \det(J)=\left | \begin{matrix}
\frac{\partial x}{\partial r} & \frac{\partial y}{\partial r} \\
\frac{\partial x}{\partial \theta} & \frac{\partial y}{\partial\theta}\\
\end{matrix} \right |.
$$
展開 $\det(J)$ 得下式:
$\frac{\partial x}{\partial r}\cdot\frac{\partial y}{\partial\theta} -
\frac{\partial x}{\partial \theta}\cdot\frac{\partial y}{\partial r} =
\cos\theta\cdot r\cos\theta + \sin\theta\cdot r\sin\theta = r(\sin^2\theta + \cos^2\theta) = r.$
故 $\Vol_C(J) = r。$
:::info
目前分數 = 5 ± 檢討 = 6.5
:::