Vector space
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
The vectors in $\mathbb{R}^n$ enjoy some nice properties, such as $\bu + \bv = \bv + \bu$.
Although one can always expand a vector $\bx$ in $\mathbb{R}^n$ as $(x_1,\ldots, x_n)$, this seemingly natural setting is not always required.
For example, linear combinations $c_1\bu_1 + \cdots + c_d\bu_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
.
A vector space over $\mathbb{R}$ consists of three parts:
The addition has to have the following basic properties:
The scalar multiplication has to cooperate with the addition in a good mannar:
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:
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.
### 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)
判斷 $\vspan(S)$ 是否等於所有二次以下的多項式?
Is $\vspan(S)$ the same as the set of all polynomials of degree at most $2$?
令
$$ \begin{aligned} p_1 &= (x + 1)(x + 2), \\ p_2 &= (x + 1)(x + 3) \end{aligned} $$且 $S = \{p_1, p_2\}$。
Let
$$ \begin{aligned} p_1 &= (x + 1)(x + 2), \\ p_2 &= (x + 1)(x + 3) \end{aligned} $$and $S = \{p_1, p_2\}$.
判斷 $\vspan(S)$ 是否等於所有二次以下的多項式。
Is $\vspan(S)$ the same as the set of all polynomials of degree at most $2$?
令
$$ \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\}$。
Let
$$ \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} $$and 且 $S = \{A_1, A_2, A_3\}$.
判斷 $\vspan(S)$ 是否等於所有 $2\times 2$ 的實係數矩陣。
Is $\vspan(S)$ the same as the set of all $2\times 2$ real matrices?
以下考慮一種奇怪的加法 $\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)$ 配合在一起是一個向量空間。
Consider a new addition $\oplus$ and a new multiplication $\otimes$. Let $\mathbb{R}_+$ be the set of all positive real numbers. Here $+$ and $\times$ are the ordinary addition and multiplication between two real numbers. For any $a, b\in\mathbb{R}_+$ and $k\in\mathbb{R}$, define $a \oplus b = a \times b$ and $k\otimes a = a^k$.
Show that $(\mathbb{R}_+, \oplus, \otimes)$ is a vector space.
對於任何 $\bv\in V$,都有 $0\cdot \bv = \bzero$。
(這個式子的口頭敘述是:
實數的 $0$ 乘上任何一個向量
都是零向量。)
Show that $0\cdot \bv = \bzero$ for any $\bv\in V$. (Verbally, this says the scalar multiplication of $0$ and any vector is the zero vector.)
對於任何 $\bv\in V$,$-1\cdot \bv + \bv = \bzero$。
(這個式子的口頭敘述是:
實數的 $-1$ 乘上任何一個向量
都是該向量的加法反元素。)
Show that $-1\cdot \bv + \bv = \bzero$ for any $\bv\in V$. (Verbally, this says the scalar multiplication of $-1$ and any vector is its additive inverse.)
一個 體 的指的是一個集合 $F$ 搭配一個加法一個乘法使得:
(想像實數集 $\mathbb{R}$、或是有理數集 $\mathbb{Q}$;但整數集 $\mathbb{Z}$ 則不是一個體。)
驗證 $\mathbb{Z}_2 = \{0,1\}$ 搭配
加法 $a + b = (a + b) \pmod{2}$ 和
乘法 $a \cdot b = a \cdot b$
是一個體。
(所以向量空間中的純量也可以代換成 $\mathbb{Z}_2$。)
A field is a set $F$ along with two operations named the addition and the multiplication with the following properties:
For example, the set of real numbers $\mathbb{R}$ and the set of rational numbers $\mathbb{Q}$ are fields. In contrast, the set of integers $\mathbb{Z}$ is not a field.
Verify that $\mathbb{Z}_2 = \{0,1\}$ along with the addition $a + b = (a + b) \pmod{2}$ and the multiplication $a \cdot b = a \cdot b$ is a field.
(Therefore, $\mathbb{Z}_2$ can also be used as the scalars of a vector space.)