changed 4 years ago
Linked with GitHub

向量空間

Creative Commons License
This work by Jephian Lin is licensed under a Creative Commons Attribution 4.0 International License.

\(\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}}\)

from lingeo import random_int_list, random_good_matrix

Main idea

The vectors in \(\mathbb{R}^n\) enjoy some nice properties, such as \({\bf u} + {\bf v} = {\bf v} + {\bf u}\).
Although one can always expand a vector \({\bf x}\) in \(\mathbb{R}^n\) as \((x_1,\ldots, x_n)\), this seemingly natural setting is not always required.
For example, linear combinations \(c_1{\bf u}_1 + \cdots + c_d{\bf u}_d\) are defined without really examing the entries.

Similarly, we may say apple and banana are vectors.
We can make a linear combination like 1 apple + 2 banana
and say { apple, banana } is a linearly independent set
since intuitively there is no way to replace apples with bananas such as 1 apple + 2 banana = 0 .

Definition (Vector space)

A vector space over \(\mathbb{R}\) consists of three parts:

  1. a set \(V\) (considered as the set of vectors),
  2. an addition \(+\) for two vectors, and
  3. a scalar multiplication \(\cdot\) for a scalar and a vector.

The addition has to have the following basic properties:

  1. For any \({\bf u}, {\bf v}\in W\), \({\bf u} + {\bf v}\in W\). (closed under vector addition)
  2. For any \({\bf u}, {\bf v}\in W\), \({\bf u} + {\bf v} = {\bf u} + {\bf v}\). (commutative)
  3. For any \({\bf u}, {\bf v}, {\bf w}\in W\), \(({\bf u} + {\bf v}) + {\bf w} = {\bf u} + ({\bf v} + {\bf w})\in W\). (associative)
  4. There is a zero vector \({\bf 0}\in V\) such that \({\bf v} + {\bf 0} = {\bf v}\) for any \({\bf v}\in V\). (additive identity)
  5. Every vector \({\bf v}\) has an additive inverse \({\bf w}\) such that \({\bf v} + {\bf w} = {\bf 0}\). (additive inverse)

The scalar multiplication has to cooperate with the addition in a good mannar:
6. For any \(k\in\mathbb{R}\) and \({\bf v}\in V\), \(k\cdot {\bf v}\in V\). (closed under scalar multiplication)
7. For any \(k,\ell\in\mathbb{R}\) and \({\bf v}\in V\), \((k + \ell)\cdot {\bf v} = k\cdot{\bf v} + \ell\cdot{\bf v}\). (distributive over scalar addition)
8. For any \(k\in\mathbb{R}\) and \({\bf u}, {\bf v}\in V\), \(k\cdot({\bf u} + {\bf v}) = k\cdot {\bf u} + k\cdot{\bf v}\). (distributive over vector addition)
9. For any \(k,\ell\in\mathbb{R}\) and \({\bf v}\in V\), \((rs)\cdot {\bf v} = r\cdot(s\cdot{\bf v})\). (associative over field multiplication and scalar multiplication)
10. For \(1\in\mathbb{R}\) and \({\bf v}\in V\), \(1\cdot {\bf v} = {\bf v}\). (\(1\) is the identity operation)

Obviously, one may check \(\mathbb{R}^n\) along with the classical vector addition \(+\) and the scalar multiplication \(\cdot\) is a vector space.
In addition, the following can be viewed as vector spaces with the standard vector addition and scalar multiplication:

  1. All polynomial of degree at most \(d\).
  2. All \(m\times n\) matrices over \(\mathbb{R}^n\).
  3. All functions on the interval \([0,1]\).
  4. All continuous functions on the interval \([0,1]\).

There are still many instances of vector spaces.
And the nice thing about them is all the things we have learnt so far also apply to them, including span, linearly independence, dimension, ans so on.

We usually consider \(\mathbb{R}\) as the scalar, but any other number system with a field structure also works.
A field is, roughly speaking, a set of elements equipped with customized \(+\), \(-\), \(\times\), and \(\div\).
Common examples are \(\mathbb{R}\), \(\mathbb{C}\), and \(\mathbb{Q}\).
In contrast, \(\mathbb{Z}\) is not a field since it does not allow division.

Side stories

  • field
  • polynomial space
  • matrix space

Experiments

Exercise 1

執行以下程式碼。
\(S = \{ p_1, p_2, p_3 \}\)

### code
set_random_seed(0)
print_ans = False
m,n,r = 3,3,choice([2,3])
A = random_good_matrix(m,n,r)
v = vector(random_int_list(m))
b = v * A

xp = vector([x**p for p in range(n)])
ps = A * xp
for i in range(m):
    pretty_print("p%s ="%(i+1), ps[i])
pretty_print("b =", b * xp)

if print_ans:
    print("b = " + " + ".join("%s p%s"%(v[i], i+1) for i in range(n)) )
    print("Linearly independent?", r == 3)
    print("span = all polynomial of degree at most 2?", r == 3)

藉由 seed = 0 得到 \[𝚙_𝟷=−5𝑥^2+3𝑥+1\] \[𝚙_𝟸=15𝑥^2−8𝑥−3\] \[𝚙_𝟹=45𝑥^2−23𝑥−9\] \[𝚋=65𝑥^2−34𝑥−13 \]

第一題全

  • 過程
  • \(p1\) > \(p_1\) 其它依此類推
Exercise 1(a)

\(b\) 寫成 \(S\) 的線性組合。

\(Ans:\) \[\left[\begin{array}{ccc|c} p_1 & p_2 & p_3 &b \end{array}\right].\] \[\left[\begin{array}{ccc|c} 1 & -3 & -9 & -13\\ 3 & -8 & -23 & -34\\ -5 & 15 & 45 & 65 \end{array}\right].\] \[\left[\begin{array}{ccc|c} 1 & 0 & 3 & 2\\ 0 & 1 & 4 & 5\\ 0 & 0 & 0 & 0 \end{array}\right].\]

\[b = - p_1 + p_2 + p_3 \]

Exercise 1(b)

判斷 \(S\) 是否線性獨立?

\(Ans:\) \[\begin{bmatrix} p_1 & p_2 & p_3 \end{bmatrix} \]\begin{bmatrix} 1 & -3 & -9\\ 3 & -8 & -23\\ -5 & 15 & 45 \end{bmatrix} \[\begin{bmatrix} 1 & 0 & 3\\ 0 & 1 & 4\\ 0 & 0 & 0 \end{bmatrix}\] \[-3p_1-4p_2+p_3=0\] 係數非皆為零,因此 \(S\) 非線性獨立

Exercise 1©

判斷 \(\operatorname{span}(S)\) 是否等於所有二次以下的多項式?

  • 兩個基底 > 兩個元素的基底

\(Ans:\)

\(p_3=3p_1+4p_2\)

基底為 \(p_1\)\(p_2\),兩個元素的基底無法形成三維空間,因此 \(S\) 無法生出所有二次以下的多項式。

Exercises

Exercise 2


\[\begin{aligned} p_1 &= (x + 1)(x + 2), \\ p_2 &= (x + 1)(x + 3) \end{aligned} \]
\(S = \{p_1, p_2\}\)

Exercise 2(a)

寫出一個 \(S\) 的線性組合。
\(Ans:\) \[\begin{aligned} p_1 &= (x + 1)(x + 2)=x^2+3x+2 \\ p_2 &= (x + 1)(x + 3)=x^2+4x+3 \end{aligned} \] \(p_1 + p_2 = 2x^2+7x+5\)

Exercise 2(b)

判斷 \(S\) 是否線性獨立。

  • 最前面加:把 \(p_1\)\(p_2\) 的係數寫成矩陣可以得到
  • \(\vspan(S)\) 不會等於一個矩陣,把前面的 \(\vspan(S) =\) 拿掉
  • 中英數空格

\(Ans:\)

\(p_1\)\(p_2\) 的係數寫成矩陣可以得到\[ \begin{bmatrix} 1 & 3 & 2 \\ 1 & 4 & 3 \\ \end{bmatrix} \ \rightarrow\ \begin{bmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \\ \end{bmatrix} \] \(p_1, p_2\) 無法互相寫成彼此的線性組合,故 \(S\) 為線性獨立。

Exercise 2©

判斷 \(\operatorname{span}(S)\) 是否等於所有二次以下的多項式。

  • 中英數空格
  • 兩個基底 > 兩個元素的基底

\(Ans:\)

基底為 \(p_1\)\(p_2\),兩個元素的基底無法形成三維空間,因此 \(S\) 無法生出所有二次以下的多項式。

Exercise 3


\[\begin{aligned} A_1 &= \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}, \\ A_2 &= \begin{bmatrix} 1 & 2 \\ 2 & 1 \end{bmatrix}, \\ A_3 &= \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} \end{aligned} \]
\(S = \{A_1, A_2, A_3\}\)

Exercise 3(a)

寫出一個 \(S\) 的線性組合。

\(Ans:\)

\(A_1 + A_2 + A_3 = \begin{bmatrix} 4 & 4 \\ 4 & 4 \end{bmatrix}\)

Exercise 3(b)

判斷 \(S\) 是否線性獨立。

\(Ans:\)

\(A_1 + A_2 + A_3 = \begin{bmatrix} 4 & 4 \\ 4 & 4 \end{bmatrix} = 4A_1\)

可得出 \(A_3 = 3A_1 - A_2\)

因為 \(A_3\)\(A_1\)\(A_2\) 的線性組合,所以 \(S\) 不是線性獨立。

Exercise 3©

判斷 \(\operatorname{span}(S)\) 是否等於所有 \(2\times 2\) 的實係數矩陣。

  • \(\vspan(V)\) 不會等於矩陣,把矩陣前的 \(\vspan(V) =\) 拿掉;前面改成 "而把 \(A_1\), \(A_2\) 的係數重新寫成 \(4\times 2\) 矩陣可得"
  • 這題答案是「否」

\(Ans:\)

\[V = \{A_1, A_2\},\]

因為 \(A_3\)\(A_1\)\(A_2\) 的線性組合,所以 \(\operatorname{span}(V) = \operatorname{span}(S)\)

而把 \(A_1\) , \(A_2\)的係數重新寫成 \(4\times 2\) 矩陣可得

\[ \begin{bmatrix} 1 & 1 \\ 1 & 2 \\ 1 & 2 \\ 1 & 1 \end{bmatrix}\]

經過列運算可得

\[R = \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ 0 & 0 \\ 0 & 0 \end{bmatrix}, \]

代表 \(A_1\)\(A_2\)\(V\) 的基底且 \(V\) 線性獨立。

因此 \(V\)\(\operatorname{span}(S)\) 的基底,且 \(\operatorname{span}(S)\) 的維度為 \(2\)
然而 \(2\times 2\) 實係數矩陣的維度為 \(4\),
所以 \(\operatorname{span}(S)\) 無法做出所有的 \(2\times 2\) 實係數矩陣。

Exercise 4

以下考慮一種奇怪的加法 \(\oplus\) 和乘法 \(\otimes\)
考慮 \(\mathbb{R}_+\) 為所有正實數的集合、\(+\)\(\times\) 分別是實數的正常加法和乘法。
\(a,b\in\mathbb{R}_+\) 定義 \(a \oplus b = a \times b\)
\(k\in\mathbb{R}\)\(a\in\mathbb{R}_+\) 定義 \(k\otimes a = a^k\)

驗證 \((\mathbb{R}_+, \oplus, \otimes)\) 配合在一起是一個向量空間。

  • \(k, l \in \mathbb{R}_{+}\) > \(k, l \in \mathbb{R}\)
  • 第 10 點那個 \(l\) 應該是 \(1\)

Let \(a, b, c \in \mathbb{R}_{+}, k, l \in \mathbb{R}\)
(1) \(a\oplus b = ab \in \mathbb{R}_{+}\)
(2) \(a\oplus b = ab =ba = b\oplus a\)
(3) \((a\oplus b) \oplus c = ab \oplus c = abc = a\oplus bc = a \oplus (b \oplus c)\)
(4) \(1\in \mathbb{R}_{+}\), then we have \(a\oplus 1 = a.\)
(5) \(\frac{1}{a} \in \mathbb{R}_{+}\), then we have \(a\oplus \frac{1}{a} = 1.\)
(6) \(k \otimes a = a^{k} \in \mathbb{R}_{+}\)
(7) \((k+l)\otimes a = a^{k+l} = a^{k}a^{l} = (k \otimes a) \oplus (l \otimes a)\)
(8) \(k\otimes (a\oplus b) = k\times ab = (ab)^{k} = a^{k}b^{k} = k\otimes a \oplus k\otimes b\)
(9) \((kl)\otimes a = a^{kl} = (a^{l})^{k} = k\otimes (l\otimes a)\)
(10) For \(1 \in \mathbb{R}, 1\otimes a =a\)

By (1) to (10), we can say that \(\mathbb{R}_{+}\) is a vector space with \(\oplus\) and \(\otimes.\)

Exercise 5

\(V\) 為一向量空間。
證明以下性質。

Exercise 5(a)

對於任何 \({\bf v}\in V\)﹐都有 \(0\cdot {\bf v} = {\bf 0}\)
(這個式子的口頭敘述是:
實數的 \(0\) 乘上任何一個向量
都是零向量。)

  • 第一行和第四行可以刪掉
  • 第二行 > Consider the equality \(0\bv = (0 + 0)\bv = 0\bv + 0\bv\).
  • 第三行 > Thus, by adding the additive invertse of \(0\bv\) to both side, we have \(0 = 0\bv\).

Consider the equality \(0\bv = (0 + 0)\bv = 0\bv + 0\bv\).
Thus, by adding the additive invertse of \(0\bv\) to both side, we have \(0 = 0\bv\).

Exercise 5(b)

對於任何 \({\bf v}\in V\)\(-1\cdot {\bf v} + {\bf v} = {\bf 0}\)
(這個式子的口頭敘述是:
實數的 \(-1\) 乘上任何一個向量
都是該向量的加法反元素。)

  • 數學進數學模式
  • 純量不要粗體

In \(\mathbb{R}\), \(0 = 1 + (-1)\)
Then, we have \(0\bv = [1 + (-1)] \cdot \bv\)
From (a), we know \(0\bv = {\bf 0}= 1 \cdot \bv+ (-1) \cdot\bv\)

Exercise 6

一個體的指的是一個集合 \(F\) 搭配一個加法一個乘法
(想像實數集 \(\mathbb{R}\)、或是有理數集\(\mathbb{Q}\);但整數集 \(\mathbb{Z}\) 則不是一個體。)
使得:

  1. 加法和乘法都有交換律和結合律。
  2. 乘法配合加法有分配律。
  3. 加法有單位元素 \(0\) 使得對任意 \(a\in F\) 都有 \(a + 0 = a\)
  4. 乘法有單位元素 \(1\) 使得對任意 \(a\in F\) 都有 \(a \cdot 1 = a\)
  5. 每個元素 \(a\in F\) 都有加法反元素 \(b\in F\) 使得 \(a + b = 0\)
  6. 每個非加法單位元素 \(0\) 的元素 \(a\in F\) 都有乘法反元素 \(b\in F\) 使得 \(a \cdot b = 1\)

驗證 \(\mathbb{Z}_2 = \{0,1\}\) 搭配
加法 \(a + b = (a + b) \pmod{2}\)
乘法 \(a \cdot b = a \cdot b\)
是一個體。

(所以向量空間中的純量也可以代換成 \(\mathbb{Z}_2\)。)

  • 缺結合律
  • 分配律少了 \(0+0\) 的 case
  1. 交換律、結合律
    \((a+b) \pmod{2} = (b+a) \pmod{2}\)
    \(a \cdot b = b \cdot a\)
    \(a \cdot( b \cdot c ) = (a \cdot b) \cdot c\)
    \((1+0+0) \pmod{2} = [(1+0) \pmod{2} + 0] \pmod{2} = [1 + (0+0) \pmod{2}] \pmod{2}\)
    \((1+1+0) \pmod{2} = [(1+1) \pmod{2} + 0] \pmod{2} = [1 + (1+0) \pmod{2}] \pmod{2}\)
    \((1+0+1) \pmod{2} = [(1+0) \pmod{2} + 1] \pmod{2} = [1 + (0+1) \pmod{2}] \pmod{2}\)
    \((0+0+0) \pmod{2} = [(0+0) \pmod{2} + 0] \pmod{2} = [0 + (0+0) \pmod{2}] \pmod{2}\)
    \((0+1+0) \pmod{2} = [(0+1) \pmod{2} + 0] \pmod{2} = [0 + (1+0) \pmod{2}] \pmod{2}\)
    \((0+0+1) \pmod{2} = [(0+0) \pmod{2} + 1] \pmod{2} = [0 + (0+1) \pmod{2}] \pmod{2}\)
    \((0+1+1) \pmod{2} = [(0+1) \pmod{2} + 1] \pmod{2} = [0 + (1+1) \pmod{2}] \pmod{2}\)
    \((1+1+1) \pmod{2} = [(1+1) \pmod{2} + 1] \pmod{2} = [1 + (1+1) \pmod{2}] \pmod{2}\)
  2. 分配律
    \(0 \cdot [(1 + 0) \pmod{2}]=( 0 \cdot 1 + 0 \cdot 0) \pmod{2}\)
    \(0 \cdot [(1 + 1) \pmod{2}]=( 0 \cdot 1 + 0 \cdot 1) \pmod{2}\)
    \(1 \cdot [(0 + 1) \pmod{2}]=( 1 \cdot 0 + 1 \cdot 1) \pmod{2}\)
    \(1 \cdot [(1 + 1) \pmod{2}]=( 1 \cdot 1 + 1 \cdot 1) \pmod{2}\)
    \(1 \cdot [(0 + 0) \pmod{2}]=( 1 \cdot 0 + 1 \cdot 0) \pmod{2}\)
    \(0 \cdot [(0 + 0) \pmod{2}]=( 0 \cdot 0 + 0 \cdot 0) \pmod{2}\)
  3. 加法有單位元素
    \((0+0) \pmod{2} = 0\)
    \((1+0) \pmod{2} = 1\)
  4. 乘法有單位元素
    \(0 \cdot 1 = 0\)
    \(1 \cdot 1 = 1\)
  5. 加法反元素
    \((0 + 0) \pmod{2} = 0\)
    \((1 + 1) \pmod{2} = 0\)
  6. 乘法反元素
    \(1 \cdot 1 = 1\)

\(\mathbb{Z}_2 = \{0,1\}\) 搭配
加法 \(a + b = (a + b) \pmod{2}\)
乘法 \(a \cdot b = a \cdot b\)
是一個體。

目前分數 6.5

Select a repo