$\mathbb{R}^n$ 中的子空間¶

Subspaces in $\mathbb{R}^n$

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}}$

In [ ]:
from lingeo import random_int_list, draw_span

Main idea¶

Let $S$ be a set of (possibily infinitely many) vectors in $\mathbb{R}^n$.
A linear combination of $S$ is a vector of the form $$c_1\bu_1 + \cdots + c_k\bu_k,$$ for some vectors $\bu_1,\ldots, \bu_k\in S$ and
some scalars $c_1,\ldots,c_k\in\mathbb{R}$.

Although $S$ can have infinitely many vectors, a linear combination only uses finitely many vectors in $S$.

The span of $S$ is the set of all linear combination of $S$,
denoted by $\vspan(S)$.
(We vacuously define $\vspan(\emptyset) = \{\bzero\}$.)

Let $V$ be a subset of $\mathbb{R}^n$. Then the following two conditions are equivalent.

  1. $V = \vspan(S)$ for some vectors $S$.
  2. $V$ is a nonempty subset that is closed under scalar multiplication and vector addition. That is,
    1. $V \neq \emptyset$.
    2. For any scalar $k$ and vector $\bv\in V$, $k\bv\in V$. (closed under scalr multiplication)
    3. For any two vectors $\bu,\bv\in V$, $\bu + \bv\in V$. (closed under vector addition)

If either one of the two conditions holds, then $V$ is called a subspace of $\mathbb{R}^n$.

A system of linear equations has the form
$$\left\{\begin{array}{ccccccc} a_{11}x_1 & + & \cdots & + & a_{1n}x_n & = & b_1 \\ \vdots & ~ & ~ & ~ & \vdots & = & \vdots \\ a_{m1}x_1 & + & \cdots & + & a_{mn}x_n & = & b_m \\ \end{array}\right.$$ for some variables $x_1,\ldots,x_n$, and some numbers $a_{ij}$'s and $b_1,\ldots,b_m$.
When $b_1 = \cdots = b_m = 0$, it is a homogeneous system of linear equations.

An $m\times n$ matrix $A$ over $\mathbb{R}$ is array
$$\begin{bmatrix} a_{11} & \cdots & a_{1n} \\ \vdots & ~ & \vdots \\ a_{m1} & \cdots & a_{mn} \\ \end{bmatrix}$$
for some numbers $a_{ij}$'s.

Matrix-vector multiplication (by entry)¶

Let $A = \begin{bmatrix} a_{ij}\end{bmatrix}$ be an $m\times n$ matrix and $\bv = (v_1,\ldots,v_n)$ a vector in $\mathbb{R}^n$.
Then $A\bv$ is a vector in $\mathbb{R}^m$ whose $i$-th entry is
$$\sum_{k=1}^n a_{ik}v_k.$$

Thus, every system of linear equation can be written as $A\bx = \bb$, while
it is homogeneous when $\bb = \bzero$.

The solution set of $A\bv = \bzero$ is called the kernel of $A$, denoted as $\ker(A)$.
That is, $\ker(A) = \{\bv\in\mathbb{R}^n : A\bv = \bzero\}$.
The kernel of an $m\times n$ matrix is a subspace in $\mathbb{R}^n$.

Side stories¶

  • set equal

Experiments¶

Exercise 1¶

執行下方程式碼。
原點為橘色點、 從原點延伸出去的紅色向量和淡藍色向量分別為 $\bu_1$ 和 $\bu_2$。
黑色向量為 $\bb$。
問 $\bb$ 是否是 $\{\bu_1, \bu_2\}$ 的線性組合?
若是,求 $c_1,c_2$ 使得 $\bb = c_1\bu_1 + c_2\bu_2$。

Run the code below. Let the origin be the orange point. Let $\bu_1$ and $\bu_2$ be the red and blue vectors with its tails at the origin. Let $\bb$ be the black vector. Is $\bb$ a linear combination of $\{\bu_1, \bu_2\}$? If yes, find $c_1$ and $c_2$ so that $\bb = c_1\bu_1 + c_2\bu_2$.

In [ ]:
### code
set_random_seed(0)
print_ans = False
while True:
    l = random_int_list(9)
    A = matrix(3, l)
    if A.det() != 0:
        break
u1 = vector(A[0])
u2 = vector(A[1])
u3 = vector(A[2])
        
inside = choice([0,1,1])
coefs = random_int_list(2, 2)
if inside:
    b = coefs[0]*u1 + coefs[1]*u2
else:
    b = coefs[0]*u1 + coefs[1]*u2 + 3*u3
    
print("u1 =", u1)
print("u2 =", u2)
print("b =", b)

pic = draw_span([u1,u2])
pic += arrow((0,0,0), b, width=5, color="black")
show(pic)

if print_ans:
    if inside:
        print("b is a linear combination of { u1, u2 } since b = %s u1 + %s u2."%(coefs[0], coefs[1]))
    else:
        print("b is not a linear combination of { u1, u2 }.")

Exercises¶

Exercise 2(a)¶

令

$$ \be_1 = \begin{bmatrix}1\\0\\0\end{bmatrix}, \be_2 = \begin{bmatrix}0\\1\\0\end{bmatrix}, \be_3 = \begin{bmatrix}0\\0\\1\end{bmatrix}. $$

說明 $\mathbb{R}^3 = \vspan(\{\be_1, \be_2, \be_3\})$,
因此它是一個子空間。
(要說明每一個 $\mathbb{R}^3$ 中的向量都可以寫成 $c_1\be_1 + c_2\be_2 + c_3\be_3$ 的形式。)

Let

$$ \be_1 = \begin{bmatrix}1\\0\\0\end{bmatrix}, \be_2 = \begin{bmatrix}0\\1\\0\end{bmatrix}, \be_3 = \begin{bmatrix}0\\0\\1\end{bmatrix}. $$

Explain why $\mathbb{R}^3 = \vspan(\{\be_1, \be_2, \be_3\})$. As a consequence, it is a subspace. (You have to show that every vector in $\mathbb{R}^3$ can be written as $c_1\be_1 + c_2\be_2 + c_3\be_3$.)

Exercise 2(b)¶

令

$$ \bb = \begin{bmatrix}1\\2\\-3\end{bmatrix}, \bu_1 = \begin{bmatrix}-1\\1\\0\end{bmatrix}, \bu_2 = \begin{bmatrix}0\\-1\\1\end{bmatrix}. $$

說明 $\bb\in\vspan(\{\bu_1, \bu_2\})$。

Let

$$ \bb = \begin{bmatrix}1\\2\\-3\end{bmatrix}, \bu_1 = \begin{bmatrix}-1\\1\\0\end{bmatrix}, \bu_2 = \begin{bmatrix}0\\-1\\1\end{bmatrix}. $$

Explain why $\bb\in\vspan(\{\bu_1, \bu_2\})$.

Exercise 2(c)¶

令

$$ \bb = \begin{bmatrix}1\\1\\1\end{bmatrix}, \bu_1 = \begin{bmatrix}-1\\1\\0\end{bmatrix}, \bu_2 = \begin{bmatrix}0\\-1\\1\end{bmatrix}. $$

說明 $\bb\notin\vspan(\{\bu_1, \bu_2\})$。

Let

$$ \bb = \begin{bmatrix}1\\1\\1\end{bmatrix}, \bu_1 = \begin{bmatrix}-1\\1\\0\end{bmatrix}, \bu_2 = \begin{bmatrix}0\\-1\\1\end{bmatrix}. $$

Explain why $\bb\notin\vspan(\{\bu_1, \bu_2\})$.

Exercise 2(d)¶

令

$$ \bb = \begin{bmatrix}1\\2\\-3\end{bmatrix}, \bu_1 = \begin{bmatrix}-1\\1\\0\end{bmatrix}, \bu_2 = \begin{bmatrix}0\\-1\\1\end{bmatrix}, \bu_3 = \begin{bmatrix}-1\\0\\1\end{bmatrix}. $$

找出至少兩組 $c_1, c_2, c_3$ 使得 $\bb = c_1\bu_1 + c_2\bu_2 + c_3\bu_3$。
這說明了線性組合的表示法不見得唯一。

Let

$$ \bb = \begin{bmatrix}1\\2\\-3\end{bmatrix}, \bu_1 = \begin{bmatrix}-1\\1\\0\end{bmatrix}, \bu_2 = \begin{bmatrix}0\\-1\\1\end{bmatrix}, \bu_3 = \begin{bmatrix}-1\\0\\1\end{bmatrix}. $$

Find at least two combinations of $c_1, c_2, c_3$ such that $\bb = c_1\bu_1 + c_2\bu_2 + c_3\bu_3$. This shows that the forms of linear combinations might not be unique.

Exercise 3¶

依照各小題的步驟來證明子空間的兩個條件等價。

  1. $V = \vspan(S)$ for some vectors $S$.
  2. $V$ is a nonempty subset that is closed under scalar multiplication and vector addition.

並用這些條件來判斷一個集合是否為子空間。

Use the given instructions to show the following statements are equivalent.

  1. $V = \vspan(S)$ for some vectors $S$.
  2. $V$ is a nonempty subset that is closed under scalar multiplication and vector addition.

Then you may use the equivalent conditions to check if a set is a subspace.

Exercise 3(a)¶

證明若條件 1 成立則條件 2 成立。

Show that Condition 1 implies Condition 2.

Sample:
Suppose $V = \vspan(S)$ for some $S\subseteq\mathbb{R}^n$.
We verify each of the requirements in condition 2.

nonempty
Since $\vspan(S)$ always contains ..., $V$ is nonempty.

closed under scalar multiplication
Suppose $\bv\in V$ and $k$ a scalar.
Then $\bv$ can be written as $c_1\bu_1 + \cdots + c_k\bu_k$ for some vectors $\bu_i\in S$ and scalars $c_i$.
Then ...
So $k\bv\in\vspan(S) = V$.

closed under vector addition
Suppose $\bv_1,\bv_2\in V$.
Then $\bv_1$ can be written as ...,
and $\bv_2$ can be written as ...
Then ...
So $\bv_1 + \bv_2 \in\vspan(S) = V$.

Exercise 3(b)¶

證明若條件 2 成立則條件 1 成立。

Show that Condition 2 implies Condition 1.

Sample:
Suppose $V$ is a nonempty subset of $\mathbb{R}^n$ and is closed under scalar multiplication and vector addition.
It is enough to show that $V = \vspan(V)$.

$V\subseteq\vspan(V)$
...

$\vspan(V)\subseteq V$
Let $\bu$ be an element of $\vspan(V)$.
Then $\bu$ can be written as ...
...
Therefore, $\bu\in V$.

Exercise 3(c)¶

判斷 $\emptyset$ 是否為一子空間。

Check if $\emptyset$ is a subspace.

Exercise 3(d)¶

判斷 $\{\bzero\}$ 是否為一子空間。

Check if $\{\bzero\}$ is a subspace.

Exercise 3(e)¶

判斷 $\left\{\begin{bmatrix}1\\1\\1\end{bmatrix}\right\}$ 是否為一子空間。

Check if $\left\{\begin{bmatrix}1\\1\\1\end{bmatrix}\right\}$ is a subspace.

Exercise 3(f)¶

判斷 $\left\{t\begin{bmatrix}1\\1\\1\end{bmatrix} : t\in\mathbb{R}\right\}$ 是否為一子空間。

Check if $\left\{t\begin{bmatrix}1\\1\\1\end{bmatrix} : t\in\mathbb{R}\right\}$ is a subspace.

Exercise 3(g)¶

判斷 $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x^2 + y^2 + z^2 = 1\right\}$ 是否為一子空間。

Check if $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x^2 + y^2 + z^2 = 1\right\}$ is a subspace.

Exercise 3(h)¶

判斷 $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x^2 + y^2 + z^2 \geq 1\right\}$ 是否為一子空間。

Check if $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x^2 + y^2 + z^2 \geq 1\right\}$ is a subspace.

Exercise 3(i)¶

判斷 $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x \geq 0\right\}$ 是否為一子空間。

Check if $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x \geq 0\right\}$ is a subspace.

Exercise 3(j)¶

判斷 $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x + y + z = 0\right\}$ 是否為一子空間。

Check if $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x + y + z = 0\right\}$ is a subspace.

Exercise 3(k)¶

判斷 $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x + y + z = 1\right\}$ 是否為一子空間。

Check if $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : x + y + z = 1\right\}$ is a subspace.

Exercise 3(l)¶

判斷 $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : \begin{aligned} x + y + z &= 0 \\ x + 2y + 3z &= 0 \end{aligned} \right\}$ 是否為一子空間。

Check if $\left\{\begin{bmatrix}x\\y\\z\end{bmatrix} : \begin{aligned} x + y + z &= 0 \\ x + 2y + 3z &= 0 \end{aligned} \right\}$ is a subspace.

Exercise 4(a)¶

證明對任何 $S\subseteq\mathbb{R}^n$ 都有 $\vspan(\vspan(S)) = \vspan(S)$。

Show that $\vspan(\vspan(S)) = \vspan(S)$ for any subset $S\subseteq\mathbb{R}^n$.

Exercise 4(b)¶

令 $S\subseteq\mathbb{R}^n$。
證明以下敘述等價:

  1. $\bw\in\vspan(S)$.
  2. $\vspan(S\cup\{\bw\}) = \vspan(S)$.

Let $S\subseteq\mathbb{R}^n$. Show the following statements are equivalent.

  1. $\bw\in\vspan(S)$.
  2. $\vspan(S\cup\{\bw\}) = \vspan(S)$.