\(A{\bf x} = {\bf b}\) 的解集合

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_ref

Main idea

Let \(A\) be an \(m\times n\) matrix and \({\bf b}\) a vector in \(\mathbb{R}^n\).
Recall that \(A{\bf x} = {\bf b}\) is equivalent to a system of linear equation.
When \({\bf b} = {\bf 0}\), the system is said to be homogeneous, and
\[\operatorname{ker}(A) = \{{\bf x}\in\mathbb{R}^n : A{\bf x} = {\bf 0}\}. \]

Let \(U = \{{\bf x}\in\mathbb{R}^n : A{\bf x} = {\bf b}\}\) be the set of all solutions.
Then \(U\) is an affine subspace in \(\mathbb{R}^n\).
In fact, \(U\) can be written as \({\bf p} + \operatorname{ker}(A)\), where \({\bf p}\) can be any vector in \(U\).

We call \(U\) the set of general solutions.
When one element is chosen from \(U\), it is called a particular solution.
And \(\operatorname{ker}(A)\) is called the set of homogeneous solutions.

Equivalently, the solutions set of \(A{\bf x} = {\bf b}\) is of the form:

​​​​general solutions = particular solution + homogeneous solutions
​​​​(a shifted space)      (a vector)              (a space)

Side stories

  • A.nullspace()

Experiments

Exercise 1

執行下方程式碼。

### code
set_random_seed(0)
print_ans = False
A = random_ref(3,5,2)
p = vector(random_int_list(5))
b = A * p

h = A.right_kernel().basis()[0]
p1 = p + h

print("A =")
show(A)
print("b =", b)
print("p =", p)
print("h =", h)
print("p1 =", p1)
Exercise 1(a)

利用題目給的 \({\bf h}\).
確認它在 \(\operatorname{ker}(A)\) 中。
計算 \({\bf p} + {\bf h}\) 並驗證它符合 \(A({\bf p} + {\bf h}) = {\bf b}\)

  • 0 > \(\bzero\),要丟要數學式裡,後兩題都是

答:
題目給的 \(A = \begin{bmatrix} 1 & 0 & 3 & 5 & -5\\ 0 & 1 & -5 & 0 & 3\\ 0 & 0 & 0 & 0& 0\\ \end{bmatrix}\) \({\bf p} = (-3,3,4,-4,-3)\) \({\bf h} = (1,0,0,\frac{-1}{5},0)\) \({\bf b} = (4,-26,0)\)
因為 \(A{\bf h} = \begin{bmatrix} 1 & 0 & 3 & 5 & -5\\ 0 & 1 & -5 & 0 & 3\\ 0 & 0 & 0 & 0& 0\\ \end{bmatrix}\) \(\begin{bmatrix} 1\\0\\0\\\frac{-1}{5}\\0\\ \end{bmatrix} = \begin{bmatrix} 0\\0\\0 \end{bmatrix} = \bzero\) 所以 \({\bf h}\)\(\operatorname{ker}(A)\) 中。

\({\bf p} + {\bf h} = (-2,3,4,\frac{-21}{5},-3)\)
\(A({\bf p} + {\bf h}) = \begin{bmatrix} 1 & 0 & 3 & 5 & -5\\ 0 & 1 & -5 & 0 & 3\\ 0 & 0 & 0 & 0 & 0\\ \end{bmatrix} \begin{bmatrix} -2\\3\\4\\\frac{-21}{5}\\-3\\ \end{bmatrix} = \begin{bmatrix} 4\\-26\\10\\ \end{bmatrix} = \bb\)
驗證符合 \(A({\bf p} + {\bf h}) = {\bf b}\)

Exercise 1(b)

如果已知 \(A{\bf p} = {\bf b}\)
證明對任意 \(\operatorname{ker}(A)\) 中的向量 \({\bf h}\)
都有 \(A({\bf p} + {\bf h}) = {\bf b}\)

  • 全型標點旁不用再空格

答:
因為向量 \({\bf h}\)\(\operatorname{ker}(A)\) 中,
所以 \(A{\bf h}\) = \(\bzero\)
因此 \(A({\bf p + \bf h})\) = \(A{\bf p} + A{\bf h}\) = \({\bf b}\) + 0 = \({\bf b}\)
可證明對任意 \(\operatorname{ker}(A)\) 中的向量 \({\bf h}\),都有 \(A({\bf p} + {\bf h}) = {\bf b}\)

Exercise 1©

利用題目給的 \({\bf p}_1\)
確認它符合 \(A{\bf p}_1 = {\bf b}\)
計算 \({\bf p}_1 - {\bf p}\) 並驗證它在 \(\operatorname{ker}(A)\) 中。

答:
題目給 \({\bf p}_1 = (-2,3,4,\frac{-21}{5},-3)\)
\(A{\bf p}_1 = \begin{bmatrix} 1 & 0 & 3 & 5 & -5\\ 0 & 1 & -5 & 0 & 3 & \\ 0 & 0 & 0 & 0 & 0\\ \end{bmatrix} \begin{bmatrix}-2\\3\\4\\\frac{-21}{5}\\-3\\\end{bmatrix} = \begin{bmatrix} 4\\-26\\10\\ \end{bmatrix} = {\bf b}\)
\({\bf p}_1 - {\bf p} = (1,0,0,\frac{-1}{5},0)\)

\(A({\bf p}_1 - {\bf p}) = \begin{bmatrix} 1 & 0 & 3 & 5 & -5\\ 0 & 1 & -5 & 0 & 3 & \\ 0 & 0 & 0 & 0 & 0\\ \end{bmatrix} \begin{bmatrix} 1\\0\\0\\\frac{-1}{5}\\0\\\end{bmatrix} = \begin{bmatrix} 0\\0\\0\\\end{bmatrix}\)
因為 \(A({\bf p}_1 - {\bf p})\) = \(\bzero\) 所以 \({\bf p}_1 - {\bf p}\)\(\operatorname{ker}(A)\) 中。

Exercise 1(d)

如果已知 \(A{\bf p} = {\bf b}\)
證明對任意符合 \(A{\bf p}_1 = {\bf b}\) 的向量 \({\bf p}_1\)
都有 \({\bf p}_1 - {\bf p}\in\operatorname{ker}(A)\)

  • 怎麼突然從 答 變 Ans 了。兩者皆可,但是 \(Ans:\) 不要放數學式,斜體可以用 Ans:

答:
已知 \(A{\bf p} = {\bf b}\),若存在 \({\bf p}_1\),使得 \(A{\bf p}_1 = {\bf b}\) ,則
\(A{\bf p}_1 - A{\bf p}\) = \({\bf b} - {\bf b}\),可得 \(A({\bf p}_1 - {\bf p})\) = \(0\)
由此可證 \({\bf p}_1 - {\bf p}\in\operatorname{ker}(A)\)

Exercises

Exercise 2

給定矩陣 \(A\) 和向量 \({\bf b}\)
假設 \(\bb \in \Col(A)\)
\(U = \{ {\bf x}: A{\bf x} = {\bf b} \}\)
證明 \(V = \{ {\bf p}_1 - {\bf p}_2 : {\bf p}_1 , {\bf p}_2 \in U \}\) 是一個子空間。
(因此 \(U\) 是一個仿射子空間。)

  • \({\bf x}\in\operatorname{ker}(A)\)> 令 \({\bf x}\in\operatorname{ker}(A)\)。因為 \(\bb\in\Col(A)\),所以 \(U\neq\emptyset\)
  • 兩邊同乘 \(A\) ,可得 \(A({\bf p}_1 - {\bf p}_2) = A{\bf x} = 0\)。 < 這句不用
  • 由此可知 \({\bf p}_1 \in U\)> 因為 \(A\bp_1 = A(\bp_2 + \bx) = \bb + \bzero = \bb\),由此可知 \({\bf p}_1 \in U\)

答:
\({\bf p}_1 , {\bf p}_2 \in U\)
則 : \(A{\bf p}_1 = {\bf b}\)\(A{\bf p}_2 = {\bf b}\)
因此可得 \(A{\bf p}_1 - A{\bf p}_2 = {\bf b} - {\bf b}\)
\(A({\bf p}_1 - {\bf p}_2) = \bzero\)

\({\bf x}\in\operatorname{ker}(A)\)
因為 \({\bf b} \in\operatorname{Col}(A)\),所以 \(U\neq\emptyset\)
\({\bf p}_2 \in U\),令 \({\bf p}_1 = {\bf p}_2 + {\bf x}\),則 \({\bf p}_1 - {\bf p}_2 = {\bf x}\)
因為 \(A{\bf p}_1 = A({\bf p}_2 + {\bf x}) = {\bf b} + \bzero = {\bf b}\)
由此可知 \({\bf p}_1 \in U\)
因此可得 \(V = \{ {\bf p}_1 - {\bf p}_2 : {\bf p}_1 , {\bf p}_2 \in U \} = \{ {\bf x}:A{\bf x} = \bzero \}\) 是一個子空間。

Exercise 3

執行以下程式碼。

### code
set_random_seed(0)
A = random_ref(3,5,2)
b = vector(random_int_list(2) + [0])
b1 = b + vector([0,0,1])

print("A =")
show(A)
print("b =", b)
print("b1 =", b1)
Exercise 3(a)

湊出一個 \(A{\bf x} = {\bf b}\) 的解﹐稱之作 \({\bf p}\)

答:
題目給 \(A = \begin{bmatrix} 1 & 0 & 3 & 5 & -5\\ 0 & 1 & -5 & 0 & 3\\ 0 & 0 & 0 & 0& 0\\ \end{bmatrix}\) \({\bf b} = (-3,3,0)\)

\({\bf x} = (x_1,x_2,x_3,x_4,x_5)\),則 \(A{\bf x} = {\bf b}\) 為: \[\begin{cases} 1x_1 + 0x_2 + 3x_3 + 5x_4 - 5x_5 &= -3,\\ 0x_1 + 1x_2 - 5x_3 + 0x_4 + 3x_5 &= 3,\\ 0x_1 + 0x_2 + 0x_3 + 0x_4 + 0x_5 &= 0. \end{cases} \] \(x_3=x_4=x_5=0\),則 \(x_1=-3,x_2=3\)

所以 \({\bf p}={\bf x}=(x_1,x_2,x_3,x_4,x_5)=(-3,3,0,0,0)\)

Exercise 3(b)

利用參數式的方法找出 \({\bf h}_1\)\({\bf h}_2\)\({\bf h}_3\)
使得 \(\operatorname{ker}(A) = \operatorname{span}(\{{\bf h}_1, {\bf h}_2, {\bf h}_3\})\)

  • 啊你為什麼不要解 \(A\bx = \bzero\) 就好,這樣就不用一直 \(-\bp\)

答:
\({\bf x}=(x_1,x_2,1,0,0)\) 時解 \(A\bx = \bzero\),則 \(x_1=-3,x_2=5\)
所以 \({\bf h}_1=(-3,5,1,0,0)\)
\({\bf x}=(x_1,x_2,0,1,0)\) 時解 \(A\bx = \bzero\),則 \(x_1=-5,x_2=0\)
所以 \({\bf h}_2=(-5,0,0,1,0)\)
\({\bf x}=(x_1,x_2,0,0,1)\) 時解 \(A\bx = \bzero\),則 \(x_1=5,x_2=-3\)
\({\bf h}_3=(5,-3,0,0,1)\)
因此 \(\operatorname{ker}(A) = \{s{\bf h}_1 + t{\bf h}_2 + u{\bf h}_3:s,t,u \in \mathbb{R}\} = \operatorname{span}(\{{\bf h}_1, {\bf h}_2,{\bf h}_3\})\)

Exercise 3©

求出 \(A{\bf x} = {\bf b}\) 的所有解。

  • aligned 對齊
  • 加一下 \(\bh_3\),上一題我題目打錯了

答:
上述已求出 \({\bf p}\)\(\operatorname{ker}(A) = \operatorname{span}(\{{\bf h}_1, {\bf h}_2, \bh_3\})\)
因此 \(\{A{\bf x} = {\bf b}\}\) 的所有解
\[\begin{aligned} &= {\{\bf p} + s{\bf h}_1 + t{\bf h}_2 + u{\bf h}_3:s,t,u \in \mathbb{R}\} \\ &= {\bf p} + \{s{\bf h}_1 + t{\bf h}_2 + u{\bf h}_3:s,t,u \in \mathbb{R}\} \\ &= {\bf p} + \operatorname{span}(\{{\bf h}_1, {\bf h}_2,{\bf h}_3\}). \end{aligned} \]

Exercise 3(d)

說明 \(A{\bf x} = {\bf b}_1\) 無解。
(儘管 \(\operatorname{ker}(A)\) 中有很多向量。)

答:
題目給 \({\bf b}_1 = (-3,3,1)\)

\({\bf x} = (x_1,x_2,x_3,x_4,x_5)\)

假設 \(A{\bf x} = {\bf b}_1\) 有解, 此時 \(A{\bf x} = {\bf b}_1\) 可寫成方程組 \[\begin{cases} 1x_1 + 0x_2 + 3x_3 + 5x_4 - 5x_5 &= -3,\\ 0x_1 + 1x_2 - 5x_3 + 0x_4 + 3x_5 &= 3,\\ 0x_1 + 0x_2 + 0x_3 + 0x_4 + 0x_5 &= 1, \end{cases} \] 其中 \(x_1,x_2,x_3,x_4,x_5 \in \mathbb{R}\)

因為 \(0x_1 + 0x_2 + 0x_3 + 0x_4 + 0x_5 = 0 \neq 1\)
所以 \(A{\bf x} = {\bf b}_1\) 有解的假設矛盾,
因此 \(A{\bf x} = {\bf b}_1\) 無解。

Exercise 4

我們現階段對解集合的理解
已經可以告訴我們一些有趣的性質。

Exercise 4(a)

\(V\) 為一子空間。
\(V\) 中至少有兩個向量﹐
\(V\) 中向量的個數是否有可能是有限個?

  • Let \(\vspan(V)=({\bf u}_1,{\bf u}_2 , \cdots ,{\bf u}_n)\) < 第一句我就看不懂,你是說 \(V\) 只有 \(n\) 個向量嗎?集合應該用 \(\{...\}\)。啊你沒事拿 \(V\)\(\vspan\) 幹麻 如果 \(V\) 是子空間,那麼 \(\vspan(V) = V\)
  • 句子不完整
  • 文法

大致上你要說的只有:

答:

因為有兩個點,我們令 \(\bu_1,\bu_2\in V\)\(\bu_1 \neq \bu_2\)
由於 \(V\) 是一個子空間,\(c_1\bu_1 + c_2\bu_2\in V\)
因為 \(\bu_1 \neq \bu_2\),我們可以假設 \(\bu_2\neq\bzero\)
同時,因為 \(c_2\) 可以是任何實數,
所以 \(c_1\bu_1 + c_2\bu_2\in V\) 有無窮多個可能性。
因此 \(V\) 不可能只有有限個元素。

Exercise 4(b)

\(A{\bf x} = {\bf b}\) 至少有兩個解﹐
全部解的個數是否有可能是有限個?

  • 跟前面一樣:若 \(\bx_1\)\(\bx_2\) 為兩相異解,則 。既然也不確定有幾個解,沒必要假設有 \(n\) 個,就拿兩個出來就好。
  • 純量不用粗體

答:

因為有兩個解,我們令 \(\bu_1,\bu_2\) 滿足 \(A\bu_1 = A\bu_2 = \bb\)\(\bu_1 \neq \bu_2\)
\(A(\bu_1 - \bu_2) = \bb - \bb = \bzero\)
我們可以發現,對於任何 \(k\in\mathbb{R}\) 都有
\[ A(\bu_1 + k(\bu_1 - \bu_2)) = A\bu_1 + kA(\bu_1 - \bu_2) = \bb + \bzero = \bb. \] 因此 \(\bu_1 + k(\bu_1 - \bu_2)\) 也是 \(A\bx = \bb\) 的解。
由於 \(k\) 有無窮多個可能性。
因此 \(A\bx = \bb\) 不可能只有有限個解。

乾淨漂亮!
3(b) 有不必要的步驟
第 5 題不知道在寫什麼,有待改進。

目前分數 5.5/5

Select a repo