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/).
{%hackmd 5xqeIJ7VRCGBfLtfMi0_IQ %}
```python
from lingeo import random_int_list
```
## Main idea
##### Matrix-matrix multiplication (by entry)
Let
$$ A = \begin{bmatrix}
a_{11} & \cdots & a_{1n} \\
\vdots & ~ & \vdots \\
a_{m1} & \cdots & a_{mn} \\
\end{bmatrix} \text{ and }
B = \begin{bmatrix}
b_{11} & \cdots & b_{1\ell} \\
\vdots & ~ & \vdots \\
b_{n1} & \cdots & b_{n\ell} \\
\end{bmatrix}$$
be $m\times n$ and $n\times \ell$ matrices, respectively.
Then the $ij$-entry of $AB$ is
$$(AB)_{ij} = \sum_{k = 1}^n a_{ik}b_{k\ell}.$$
Let $A$ be an $m\times n$ matrix.
The **transpose** of $A$ is the $n\times m$ matrix $A^\top$ whose $ij$-entry is the $ji$-entry of $A$.
The $n\times n$ **identity matrix** is the matrix whose diagonal entries are one and other entries are zero, usually denoted as $I_n$.
The $m\times n$ **zero matrix** is the matrix whose entries are zero, usually denoted as $O_{m,n}$.
If $A$ is an $n\times n$ matrix and there is a matrix $B$ such that $AB = BA = I_n$,
then $B$ is called the **inverse** of $A$, denoted as $A^{-1} = B$.
A matrix with an inverse is **invertible**.
Suppose $A$ is an $n\times k$ matrix with $\operatorname{ker}(A) = \{{\bf 0}\}$.
Then every vector ${\bf b}\in\mathbb{R}^n$ can be written as
$${\bf b} = {\bf w} + {\bf h}$$
where ${\bf w}\in\operatorname{Col}(A)$ and ${\bf h}\in\operatorname{Col}(A)^\perp$.
Moreover,
$$\begin{aligned}
{\bf w} &= A(A^\top A)^{-1}A^\top {\bf b}, \\
{\bf h} &= {\bf b} - {\bf w}.
\end{aligned}$$
We say ${\bf w}$ is the **projection** of ${\bf b}$ onto the subspace $\operatorname{Col}(A)$, and
${\bf w} - {\bf h}$ the **reflection** of ${\bf b}$ along the subspace $\operatorname{Col}(A)$.
Both action can be done by matrices.
That is,
$$\begin{aligned}
{\bf w} &= A(A^\top A)^{-1}A^\top {\bf b}, \\
{\bf w} - {\bf h} &= 2{\bf w} - {\bf b} = (2A(A^\top A)^{-1}A^\top - I_n){\bf b}.
\end{aligned}
$$
## Side stories
- $\langle{\bf x},{\bf y}\rangle = {\bf y}^\top{\bf x}$
- matrix algbra
## Experiments
##### Exercise 1
執行下方程式碼。
依照步驟求出 ${\bf b}$ 在 $\operatorname{Col}(A)$ 上的投影。
```python
### code
set_random_seed(0)
print_ans = False
while True:
A = matrix(2, random_int_list(8)).transpose()
if (A.transpose() * A).is_invertible():
break
b = vector(random_int_list(4))
print("A =")
print(A)
print("b =", b)
if print_ans:
AT = A.transpose()
ATA = AT * A
w = A * ATA.inverse() * AT * b
print("The projection is %s."%w)
```
##### Exercise 1(a)
假設 ${\bb} = {\bw} + {\bh}$ 使得
${\bf w}\in\operatorname{Col}(A)$(也就是有某一個 ${\bv}$ 使得 ${\bf w} = A{\bv}$)、
${\bf h}\in\operatorname{Col}(A)^\perp = \operatorname{Row}(A^\top)^\perp = \operatorname{ker}(A^\top)$(也就是 $A^\top{\bf h} = {\bf 0}$)。
將 ${\bb} = {\bw} + {\bh}$ 兩邊前乘 $A^\top$﹐
並用 $A$、${\bb}$、和 ${\bv}$ 表示出來。
:::warning
- [ ] 不要把所有數學式變粗體,粗體是為了區別向量(粗)和純量;題目裡的 ${\bf A}\trans$ 是我打錯,己經改掉了
- [x] ${\bf b} = {\bf w} + {\bf h}$ 兩邊同乘 ${\bf A\trans}$ --> 在 ${\bf b} = {\bf w} + {\bf h}$ 兩邊的前面同乘 ${\bf A\trans}$(不要用數學式當句子開頭,矩陣乘法前乘後乘不一樣)
:::
在 ${\bf b} = {\bf w} + {\bf h}$ 兩邊前方同乘 ${A\trans}$ 得到
$A\trans \bb = A\trans \bw + A\trans\bh$ 。
而 ${\bf w}\in\operatorname{Col}(A)$,
換句話說必定會有一個向量 ${\bf v}$ 使得 ${\bf w} = A{\bf v}$ 。
因此 $A\trans\bb = A\trans\bw + A\trans \bh$
又可以寫成
$A\trans\bb = A\trans A \bv + A\trans \bh$。
而由於 ${\bf h}\in\operatorname{Col}(A)^\perp = \operatorname{Row}(A^\top)^\perp = \operatorname{ker}(A^\top)$,
則 $A\trans \bh = {\bf 0}$ 。
因此 $A\trans \bb = A\trans A \bv + A\trans \bh$
又可寫成
$A\trans\bb = A\trans A \bv$。
##### Exercise 1(b)
將 $A$ 和 ${\bf b}$ 的數字代入並解方程式求出 ${\bf v}$ 。
(如果 $A^\top A$ 可逆﹐
則可以把上一題的式子寫成 ${\bf v} = (A^\top A)^{-1} A^\top {\bf b}$ 。)
:::warning
- [x] 經過計算 ${\bf dot(A)}$ 的值不為 ${\bf 0}$ 。--> 經過計算,發現 $\det(A)$ 的值不為 $0$。
- [x] ${\bf dot}$ --> $\det$
- [x] 因此可以代入公式-若以代入公式:若今有一矩陣 $A$ 且 $\det(A)$ 的值不為 $0$,則矩陣 ... 的反矩陣為 ... .
:::
執行程式碼後得到
$$
A = \begin{bmatrix}
0 & 0 \\
-1 & 0 \\
0 & 0 \\
-3 & -1
\end{bmatrix}
$$
及
$$
\bb = (-1,-2,-3,2).
$$
有了 $A$ 便可以得出 $A\trans$
$$ {A\trans} = \begin{bmatrix}
0 & -1 & 0 & -3 \\
0 & 0 & 0 & -1
\end{bmatrix} 。
$$
而計算 $A\trans A$ 得到
$$ {A\trans A} = \begin{bmatrix}
10 & 3 \\
3 & 1
\end{bmatrix} 。
$$
經過計算,發現 $\det(A)$ 的值不為 $0$。
因此可以代入公式:若今有一矩陣 $A$ 且 $\det(A)$ 的值不為 $0$,則矩陣
$$ A = \begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
$$
的反矩陣為
$$ A^{-1} = \frac{{\bf 1}}{{\det(A)}} \begin{bmatrix}
d & -b \\
-c & a
\end{bmatrix}.
$$
代入公式後得到
$$ {(A\trans A) ^{-1}} = \begin{bmatrix}
1 & -3 \\
-3 & 10
\end{bmatrix} 。$$
此時回到之前的式子,
${A\trans \bb} = { A\trans A \bv}$ 。
因 ${ (A\trans A)^{-1}}$ 有意義,則可兩邊同乘於 ${(A\trans A)^{-1}}$ ,
得到${(A\trans A)^{-1}A\trans \bb} = {(A\trans A)^{-1}(A\trans A) \bv}$ 。
因為任何矩陣與其反矩陣相乘皆得到 ${I_n}$ 。
因此上述式子又可寫成 ${(A\trans A)^{-1}A\trans \bb} = {\bf v}$ 。
將 ${\bb}$ 寫成矩陣的形式,得到
$$
{\bb} = \begin{bmatrix}
-1 \\
-2 \\
-3 \\
2
\end{bmatrix} 。
$$
將 ${\bf (A\trans A)^{-1} 、 A\trans 、 b}$ 的值代入,
得到
$$
{\bf v} =
\begin{bmatrix}
{\bf 1} & {\bf -3} \\
{\bf -3} & {\bf 10}
\end{bmatrix}
\begin{bmatrix}
{\bf 0} & {\bf -1} & {\bf 0} & {\bf -3} \\
{\bf 0} & {\bf 0} & {\bf 0} & {\bf -1}
\end{bmatrix}
\begin{bmatrix}
{\bf -1} \\
{\bf -2} \\
{\bf -3} \\
{\bf 2}
\end{bmatrix} 。
$$
將算式的結果寫成向量的形式便會得到
${\bf v} = {\bf (2,-8)} 。$
##### Exercise 1(c)
因此我們知道
$$\begin{aligned}
{\bf w} &= A{\bf v}, \\
{\bf h} &= {\bf b} - {\bf w}.
\end{aligned}
$$
以題目給的 $A$ 和 ${\bf b}$ 將 ${\bf w}$ 和 ${\bf h}$ 求出來﹐
並確認 $A^\top{\bf h} = {\bf 0}$。
:::warning
- [x] 目前已知 ${\bf w = Av}$ --> 後面加逗點
- [x] ${\bf A\trans h = 0}$ 成立 --> 因此 ${\bf A\trans h = 0}$ 確實成立(不要用數學當開頭)
:::
目前已知 ${\bf w = Av}$,
將先前得到的 ${\bf v}$ 寫成矩陣的形式,
並將 ${\bf A 、 v}$ 的值代入算式中。
得到
$$
{\bf w =} \begin{bmatrix}
{\bf 0} & {\bf 0} \\
{\bf -1} & {\bf 0} \\
{\bf 0} & {\bf 0} \\
{\bf -3} & {\bf -1}
\end{bmatrix}
\begin{bmatrix}
{\bf 2} \\
{\bf -8}
\end{bmatrix}
{\bf =}
\begin{bmatrix}
{\bf 0} \\
{\bf -2} \\
{\bf 0} \\
{\bf 2}
\end{bmatrix} 。
$$
若將 ${\bf w}$ 寫成向量的形式,則
$$
{\bf w = (0, -2, 0, 2)} 。
$$
目前也知道 ${\bf h = b - w}$ 。
將 ${\bf b}$ 和 ${\bf w}$ 的值代入後得
$$
{\bf h = (-1,-2,-3,2) - (0,-2,0,2) = (-1,0,-3,0)} 。
$$
驗證 ${\bf A\trans h = 0}$ 。
將 ${\bf h}$ 寫成矩陣的形式,並將 ${\bf A\trans}$ 和 ${\bf h}$ 的值代入,
得到
$$
{\bf A\trans h = } \begin{bmatrix}
{\bf 0} & {\bf -1} & {\bf 0} & {\bf -3} \\
{\bf 0} & {\bf 0} & {\bf 0} & {\bf -1}
\end{bmatrix}
\begin{bmatrix}
{\bf -1} \\
{\bf 0} \\
{\bf -3} \\
{\bf 0}
\end{bmatrix}
{\bf =}
\begin{bmatrix}
{\bf 0} \\
{\bf 0}
\end{bmatrix} 。
$$
因此 ${\bf A\trans h = 0}$ 成立。
## Exercises
##### Exercise 2
以下小題說明為何 $A^\top A$ 可逆。
##### Exercise 2(a)
若 ${\bf x}$ 和 ${\bf y}$ 為 $\mathbb{R}^n$ 中的兩向量。
驗證 $\langle{\bf x},{\bf y}\rangle = {\bf y}^\top{\bf x}$。
(這裡的右式把 ${\bf x}$ 和 ${\bf y}$ 都當成 $n\times 1$ 的矩陣
而算出來的 $1\times 1$ 的矩陣 ${\bf y}^\top{\bf x}$ 被當成一個數字。)
:::warning
- [x] $n\times 1$ 前面留空
:::
假設 ${\bf x}$ 與 ${\bf y}$ 都為 $n\times 1$ 的矩陣,則 ${\by\trans}$ 會為$1\times n$ 的矩陣。
將 ${\bf x}$ 與 ${\bf y}$ 帶入 $\langle{\bf x},{\bf y}\rangle$,
$\langle{\bf x},{\bf y}\rangle$ = $({\bx_{1}\by_{1}+\bx_{2}\by_{2}+....+\bx_{n}\by_{n}})$。
將 ${\bf x}$ 與 ${\by\trans}$ 帶入 ${\bf y}^\top{\bf x}$,
${\bf y}^\top{\bf x}$ = $({\by_{1}\bx_{1} + \by_{2}\by_{2} +.... + \by_{n}\bx_{n}})$。
由上兩個式子的結果可以得證 $\langle{\bf x},{\bf y}\rangle = {\bf y}^\top{\bf x}$ 。
##### Exercise 2(b)
若 $A$ 和 $B$ 分別為 $m\times n$ 和 $n\times \ell$ 的兩矩陣。\
驗證 $(AB)^\top$ = $B^\top A^\top$ 。
:::warning
- [x] 這題是要驗證 $(AB)^\top$ 和 $B^\top A^\top$ 的每一項都相同。你可以令 $A = \begin{bmatrix} a_{ij} \end{bmatrix}$ 且 $B = \begin{bmatrix} b_{ij} \end{bmatrix}$。則 $(AB)\trans$ 的第 $i,j$-項為 ... 。而 $B\trans A\trans$ 的第 $i,j$-項為 ...。所以 ... 。
:::
若 $A$ 和 $B$ 分別為 $m\times n$ 和 $n\times \ell$ 的兩矩陣。\
則
$$ A = \begin{bmatrix}
a_{11} & \cdots & a_{1n} \\
\vdots & ~ & \vdots \\
a_{m1} & \cdots & a_{mn} \\
\end{bmatrix} \text{ and }
B = \begin{bmatrix}
b_{11} & \cdots & b_{1\ell} \\
\vdots & ~ & \vdots \\
b_{n1} & \cdots & b_{n\ell} \\
\end{bmatrix} 。
$$
而
$$
AB = C_{m \ell} = \begin{bmatrix}
c_{11} & \cdots & c_{1j} \\
\vdots & ~ & \vdots \\
c_{i1} & \cdots & c_{ij}
\end{bmatrix} i=1...m, j=1...\ell 。
$$
其中 $C_{ij} = \sum\limits_{k = 1}^n a_{ik}b_{kj}$ 。\
而 $C\trans$ 為一 $\ell\times m$ 的矩陣,且 $C\trans$ 可表示為
$$
(AB)\trans = C\trans = \begin{bmatrix}
c_{11} & \cdots & c_{i1} \\
\vdots & ~ & \vdots \\
c_{1j} & \cdots & c_{ij}
\end{bmatrix}, i=1...m, j=1...\ell 。
$$
且 $C\trans$ 滿足 $C\trans_{ij} = C_{ji} = \sum\limits_{k = 1}^n a_{jk}b_{ki}$ 。
因目前已知 $A$ 和 $B$ 分別為 $m\times n$ 和 $n\times \ell$ 的兩矩陣。\
則 $A\trans$ 和 $B\trans$ 分別為 $n\times m$ 和 $\ell\times n$ 的兩矩陣,且 $A\trans 、B\trans$ 可表示為
$$ A\trans = \begin{bmatrix}
a_{11} & \cdots & a_{m1} \\
\vdots & ~ & \vdots \\
a_{1n} & \cdots & a_{mn} \\
\end{bmatrix} \text{ and }
B\trans = \begin{bmatrix}
b_{11} & \cdots & b_{n1} \\
\vdots & ~ & \vdots \\
b_{1\ell} & \cdots & b_{n\ell} \\
\end{bmatrix} 。
$$
而 $B\trans A\trans$ 為一 $\ell\times m$ 的矩陣,且 $B\trans A\trans$可表示為
$$
B\trans A\trans = \begin{bmatrix}
b_{11} & \cdots & b_{n1} \\
\vdots & ~ & \vdots \\
b_{1\ell} & \cdots & b_{n\ell} \\
\end{bmatrix}
\begin{bmatrix}
a_{11} & \cdots & a_{m1} \\
\vdots & ~ & \vdots \\
a_{1n} & \cdots & a_{mn} \\
\end{bmatrix} =
\begin{bmatrix}
d_{11} & \cdots & d_{m1} \\
\vdots & ~ & \vdots \\
d_{1\ell} & \cdots & d_{m \ell} \\
\end{bmatrix} = D.
$$
而 $D_{ij} = \sum\limits_{k = 1}^n a_{j k}b_{ki}$ 。
因此,矩陣 $C$ 和矩陣 $D$ 相等。
等價於 $(AB)\trans = B\trans A\trans$。
##### Exercise 2(c)
驗證 $\langle A{\bf x}, {\bf y}\rangle = {\bf y}^\top A{\bf x} = \langle {\bf x}, A^\top{\bf y}\rangle$。
:::warning
- [x] 經過以下計算可以得到 ... ,以及 ...。故得證。(不要用數學式開頭)
:::
ANS:\
經過以下計算可得到
$\langle A{\bf x}, {\bf y}\rangle= (A\bf x)^\top \bf y =(\bf x^\top A^\top)\bf y=\langle {\bf x},A^\top{\bf y}\rangle$,\
以及 $\langle {\bf x},A^\top{\bf y}\rangle=(A^\top\bf y)^\top (\bf x)= {\bf y}^\top A{\bf x}$。\
故得證。
##### Exercise 2(d)
證明 $\operatorname{ker}(A) = \operatorname{ker}(A^\top A)$。
因為 $A^\top A$ 是一個方陣,
後面會證明一個方陣 $M$ 可逆的等價條件就是 $\ker(M) = \{{\bf 0}\}$。
因此 $\operatorname{ker}(A) = \{{\bf 0}\}$ 足以保證 $A^\top A$ 可逆。
另一方面,
如果 $\operatorname{ker}(A) \neq \{{\bf 0}\}$,
表示 $A$ 中的行向量有一些可以去掉並不會影響到行空間。
重覆這個步驟直到沒有任何多餘的行向量時
(這時行空間都還是同一個)
就保證有 $\operatorname{ker}(A)$。
(參考【矩陣的行向量】中的練習。)
:::warning
Nice work!
- [x] $\ker(A)$表示$A \bf x = 0$ , --> 若 $\bx\in\ker(A)$,則 $A \bx = \bzero$。
- [x] 第一句最後 + 因此 $\bx\in\ker(A\trans A)$。
- [x] 中和英數之間空格
- [x] 而$\ker(A^\top A)$表示$A^\top A \bf x = 0$, --> 而$\bx\in\ker(A^\top A)$ 表示 $A^\top A \bx = \bzero$。
- [x] 展式數學裡是 $y_i^2$(少平方、純量不要粗體)
:::
ANS:\
若 $\bx\in\ker(A)$, 則 $A \bx = \bzero$,
兩邊同乘 $A^\top$ 可得 $A^\top A \bf x = A^\top 0=0$。
因此 $\bx\in\ker(A\trans A)$。
而 $\bx\in\ker(A^\top A)$ 表示 $A^\top A \bx = \bzero$,
兩邊同乘 $\bf x^\top$ 可得 $\bf x^\top A^\top A\bf x = (Ax)^\top Ax=0$,
經整理後可得 $\|{A\bf x}\|^2 = 0$。
另一方面,令 $\bf y=A \bf x$ 可得
$$\|\by\|^2 = \sum_{i = 1}^{n} y_i^2=0
$$
及 $\by = A\bx = \bzero$。
由此可知 $\operatorname{ker}(A) = \operatorname{ker}(A^\top A)$。
##### Exercise 3(a)
想像矩陣乘法就是一個動作(像是投影、或是鏡射)。
若 $A$ 是一個投影矩陣、
${\bf b}$ 是一個向量。
猜看看 $A^2{\bf b}$會是什麼?
猜看看 $A^2$ 會是什麼?
(下方程式碼中的矩陣是一個投影矩陣。可以試試看。)
:::warning
- [x] 標點
- [x] 中和英數之間空格
- [x] 結論應該是 $A^2 = A$。"而$A^2$為${\bf b}$的反矩陣" 不合邏輯,矩陣 $A^2$ 不會是向量 $\bb$ 的反矩陣。
:::
將 $A^2{\bf b}$ 可以先拆解成 $AA{\bf b},$
再透過矩陣乘法的性質,結合律得 $A(A{\bf b})$。
因此一共進行了兩次投影的矩陣乘法。
而不管投影幾次都會跟投影一次落在同一個向量,
因此 $A^2{\bf b}=A{\bf b}$,
又得 $A^2=A$。
```python
### code
set_random_seed(0)
a = vector(random_int_list(3))
A = a.outer_product(a) / a.norm()**2
b = vector(random_int_list(3))
print("A =")
show(A)
print("b =", b)
```
##### Exercise 3(b)
想像矩陣乘法就是一個動作(像是投影、或是鏡射)
若 $A$ 是一個鏡射矩陣、
${\bf b}$ 是一個向量。
猜看看 $A^2{\bf b}$ 會是什麼?
猜看看 $A^2$ 會是什麼?
(下方程式碼中的矩陣是一個投影矩陣。
可以試試看。)
:::warning
- [x] 標點、空格
- [x] $A^2 = I$
:::
$A^2{\bf b}$ 可以先拆解成成 $AA{\bf b}$,
再透過矩陣乘法的性質,結合律得 : $A(A{\bf b})$。
因此一共進行了兩次鏡射的矩陣乘法,
而鏡射兩次則會回到原本的向量。
因此 $A^2{\bf b}={\bf b}$,
得 $A^2=I$,所以 $A^2$ 是一個單位矩陣。
```python
### code
set_random_seed(0)
a = vector(random_int_list(3))
A = 2*a.outer_product(a) / a.norm()**2 - identity_matrix(3)
b = vector(random_int_list(3))
print("A =")
show(A)
print("b =", b)
```
##### Exercise 4
令 $A$、$B$、$C$ 為矩陣
${\bf x}$ 和 ${\bf y}$ 為向量、$k$ 為純量。
驗證以下的矩陣運算等式。
##### Exercise 4(a)
1. $(AB)C = A(BC)$.
2. $A(B + C) = AB + AC$.
3. $A(kB) = k(AB)$.
4. $A({\bf x} + {\bf y}) = A{\bf x} + A{\bf y}$.
5. $A(k{\bf x}) = k(A{\bf x})$.
:::warning
- [x] 第 4 有少刮號
:::
答:
1.$((AB)C)_{ij}=[\sum\limits_{s = 1}^n{A_{is}}{B_{st}}]\sum\limits_{t = 1}^p{C_{tj}}=\sum\limits_{s = 1}^n{A_{is}}[\sum\limits_{t = 1}^p{B_{st}}{C_{tj}}]=(A(BC))_{ij}.$
2.$(A(B + C))_{ij} = \sum\limits_{s = 1}^n{A_{is}}(B_{sj}+C_{sj})=\sum\limits_{s = 1}^n{A_{is}}B_{sj}+\sum\limits_{s = 1}^n{A_{is}}C_{sj}=(AB)_{ij}+(AC)_{ij}.$
3.$(A(kB))_{ij}=\sum\limits_{s = 1}^n{A_{is}}(kB_{sj})=k\sum\limits_{s = 1}^n{A_{is}}B_{sj}=k(AB)_{ij}.$
${\bf x} , {\bf y}$向量可視為$s\times 1$之矩陣,
4.$(A({\bf x} + {\bf y}))_{i1} = \sum\limits_{s = 1}^n{A_{is}}({\bf x}_{s1}+{\bf y}_{s1})=\sum\limits_{s = 1}^n{A_{is}}{\bf x}_{s1}+\sum\limits_{s = 1}^n{A_{is}}{\bf y}_{s1}=(A{\bf x})_{i1}+(A{\bf y})_{i1}.$
5.$(A(k{\bf x}))_{i1}=\sum\limits_{s = 1}^n{A_{is}}(k{\bf x}_{s1})=k\sum\limits_{s = 1}^n{A_{is}}{\bf x}_{s1}=k(A{\bf x})_{i1}.$
##### Exercise 4(b)
給一組例子使得 $AB \neq BA$。
:::warning
- [x] 中與英數空格
- [ ] 粗體位置不對
- [ ] 以下幾題都有空格或粗體的問題
- [x] 設 --> 令
:::
答:
令 $A$ 為 ${\ 2\times 2}$ 方陣, $B$ 為 ${\ 2\times 3}$ 矩陣, $AB$ 為 ${\ 2\times 3}$ 矩陣,而 $BA$ 無法相乘。
故 $AB \neq BA$;
令 $A$ , $B$ 皆為 ${\ 2\times 2}$ 方陣,
$${\bf A }= \begin{bmatrix}
1 & 1 \\
0 & 1 \\
\end{bmatrix}\text{ and }
{\bf B} = \begin{bmatrix}
0 & 1 \\
1 & 0 \\
\end{bmatrix}.
$$
$$ {\bf AB} = \begin{bmatrix}
1 & 1 \\
1 & 0 \\
\end{bmatrix}\text{ and }
{\bf BA} = \begin{bmatrix}
0 & 1 \\
1 & 1 \\
\end{bmatrix},
$$
$AB \neq BA$,得證。
##### Exercise 4(c)
若 $A$、$B$、$C$ 皆為可逆矩陣。
則 $(AB)^{-1} = B^{-1}A^{-1}$。
:::warning
- [x] c ...。(不要用數學開頭)
- [x] AB 要放在數學式,而且應該是 "因 $A$ 和 $B$ 都可逆"
- [x] 最長那個式子改成
:::
答:
已知 $(AB)(AB)^{-1}= I_n$。
因 $AB$ 可逆,
$$B^{-1}A^{-1} = B^{-1}A^{-1}I_n = B^{-1}A^{-1}(AB)(AB)^{-1} = (AB)^{-1}.
$$
則$(AB)^{-1} = B^{-1}A^{-1}$,得證。
##### Exercise 4(d)
定義一個方陣 $M$ 的**跡數**(trace)為其對角線上的所有元素相加,記作 $\operatorname{tr}(M)$。
則 $\operatorname{tr}(A +B) = \operatorname{tr}(A) + \operatorname{tr}(B)$。
:::warning
- [x] 等號要進數學模式
:::
答:
設方陣$A$與$B$可相加。
依定義,$\operatorname{tr}(A)= \sum\limits_{i = 1}^n{A_{ii}}$且$\operatorname{tr}(B)= \sum\limits_{i = 1}^n{B_{ii}}$,
則
$$\begin{aligned}
\tr(A+B) &= \sum_{i = 1}^n{({A_{ii}}+{B_{ii}})} \\
&= \sum_{i = 1}^n{A_{ii}}+\sum_{i = 1}^n{B_{ii}} \\
&= \tr(A) + \tr(B),
\end{aligned}
$$
得證。
##### Exercise 4(e)
若 $A$ 是一個 $2\times 2$ 的方陣。
則 $\operatorname{det}(AB) = \operatorname{det}(A) \cdot \operatorname{det}(B)$。
答:
設$B$亦為$2\times 2$ 的方陣。$$A = \begin{bmatrix}
a & b \\
c & d \\
\end{bmatrix}\text{ and }
{\bf B} = \begin{bmatrix}
q & w \\
e & r \\
\end{bmatrix},AB = \begin{bmatrix}
aq+eb & aw+br \\
cq+de & cw+dr \\
\end{bmatrix}$$
則
$$\begin{aligned}
\det(AB) &= -bcqr+adqr+bcwe-adwe \\
&=(ad-bc)\times(qr-we) \\
&=\det(A) \cdot \det(B),
\end{aligned}
$$
得證。
(實際上 $n\times n$ 都對,但我們還沒學到 $n\times n$ 方陣的行列式值怎麼算。)
:::success
Good!
一些格式我幫你們改好了。
不過其實這個證明還要講清楚為什麼當 $E_i$ 是基本矩陣時會有 $\det(\prod_i E_i) = \prod_i \det(E_i)$。
:::
補:
如 $\det(B)=0$,$B$不可逆,則 $\operatorname{ker}(B)$ 不為 $\{\bzero\}$,存在非零向量 $\bx$ 使$B\bx=\bzero$。
又 $A(B\bx)=0=(AB)\bx$,存在非零解使$(AB)\bx=\bzero$,
故 $\det(AB)=0=\det(A) \cdot \det(B)$。
如 $B$ 可逆,則 $B$ 可表示為 $n$ 個基本矩陣之積$B=\prod_{i=1}^{n}E_{i}$。
因此
$$\begin{aligned}
\det(AB) = \det(A\prod_{i=1}^{n}E_{i}) &= \det(A)\det(E_1)\det(E_2)\cdots\det(E_n) \\
&= \det(A)\det(\prod_{i=1}^{n}E_{i})=\det(A) \cdot \det(B),
\end{aligned}
$$
得證。
:::info
只有一題半是數學錯
其它格式還算不錯(句子都很完整!)
目前分數 5/5
:::