or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
將線性函數化為矩陣
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}}\)
Main idea
Let \(A\) be an \(m\times n\) matrix, \(\mathcal{E}_n = \{ {\bf e}_1, \ldots, {\bf e}_n \}\) the standard basis of \(\mathbb{R}^n\), and \({\bf u}_1, \ldots, {\bf u}_n\) the columns of \(A\).
Recall that \(f_A\) is the unique linear function that satisfies the following conditions.
\[\begin{array}{rcl} f : \mathbb{R}^n & \rightarrow & \mathbb{R}^m \\ {\bf e}_1 & \mapsto & {\bf u}_1 \\ ~ & \cdots & ~ \\ {\bf e}_n & \mapsto & {\bf u}_n \\ \end{array} \]
In fact, every linear function \(f\) from \(\mathbb{R}^n\) to \(\mathbb{R}^m\) has an \(m\times n\) matrix \(A\) such that \(f({\bf v}) = A{\bf v}\) for all \({\bf v}\in\mathbb{R}^n\).
Let \(f\) be a linear function from \(\mathbb{R}^n\) to \(\mathbb{R}^m\) and
\(\mathcal{E}_n = \{ {\bf e}_1, \ldots, {\bf e}_n \}\) the standard basis of \(\mathbb{R}^n\).
Calculate \({\bf u}_1 = f({\bf e}_1)\), \(\ldots\), \({\bf u}_n = f({\bf e}_n)\) and
construct a matrix \(A\) whose columns are \({\bf u}_1, \ldots, {\bf u}_n\).
Thus, \(f({\bf v}) = A{\bf v}\) for all \({\bf v}\in\mathbb{R}^n\), and we call \(A\) the matrix representation of \(f\), denoted as \(A = [f]\).
Dimension theorem (\(\mathbb{R}^n\) to \(\mathbb{R}^m\))
Let \(f\) be a linear function from \(\mathbb{R}^n\) to \(\mathbb{R}^m\).
Then \(\operatorname{rank}(f) + \operatorname{null}(f) = n\).
As a consequence, for a linear function from \(\mathbb{R}^n\) to \(\mathbb{R}^m\), the following are equivalent.
Side stories
Experiments
Exercise 1
執行以下程式碼。
己知 \(f\) 是從 \(\mathbb{R}^4\) 到 \(\mathbb{R}^3\) 的一個函數。
Exercise 1(a)
驗證是否\(f({\bf 0}) =({\bf 0})\)。
注意這裡兩個零向量分別是定義域和對應域上的零向量。
由驗證得知
\(f({\bf 0})=(0,0,0)\)
得證。
Exercise 1(b)
輸入任意的 \({\bf v}_1, {\bf v}_2\in\mathbb{R}^4\)。
驗證明是否 \(f({\bf v}_1 + {\bf v}_2) = f({\bf v}_1) + f({\bf v}_2)\)。
由驗證得知
\(f({\bf v}_1)=(-3,-8,-13)\)
\(f({\bf v}_2)=(-1,-5,0)\)
\[f({\bf v}_1+{\bf v}_2)=(-4,-13,-13)=f({\bf v}_1)+f({\bf v}_2) \] 得證。
Exercise 1©
輸入任意的 \(k\in\mathbb{R}\) 及 \({\bf v}\in\mathbb{R}^4\)。
驗證明是否 \(f(k{\bf v}) = kf({\bf v})\)。
由驗證得知
\(f({\bf v}) = (-1,-5,0)\)
\(f(k{\bf v}) = (-3,-15,0) = 3(-1,-5,0) = kf({\bf v})\)
得證。
Exercise 1(d)
找到一個矩陣 \(A\) 使得對於所有 \({\bf v}\in\mathbb{R}^4\) 都有 \(f({\bf v}) = A{\bf v}\)。
假設
\({\bf e}_1 = (1,0,0,0)\)
\({\bf e}_2 = (0,1,0,0)\)
\({\bf e}_3 = (0,0,1,0)\)
\({\bf e}_4 = (0,0,0,1)\)
將 \({\bf e}_1、{\bf e}_2、{\bf e}_3、{\bf e}_4\) 帶入 \(f(x)\) 函數,得到
\(f({\bf e}_1) = (-4,-5,3)\)
\(f({\bf e}_2) = (3,0,4)\)
\(f({\bf e}_3) = (5,3,-4)\)
\(f({\bf e}_4) = (-5,-3,-3)\)
由上述得知 \[A = \begin{bmatrix} -4 & 3 & 5 & -5\\ -5 & 0 & 3 & -3\\ 3 & 4 & -4 & -3 \end{bmatrix}. \]
Exercises
Exercise 2
考慮以下函數 \(f\)﹐求出矩陣 \(A\) 使得 \(f = f_A\)。
Exercise 2(a)
\[f(x,y,z) = (x,y,0). \]
Ans:
\[\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0\\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} x\\ y\\ z\\ \end{bmatrix} = \begin{bmatrix} x \\ y \\ 0 \end{bmatrix} \] 因此, \(A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0\\ 0 & 0 & 0 \end{bmatrix}\)。
Exercise 2(b)
\[f(x,y,z) = (3x,4y,5z). \]
Ans:
\[\begin{bmatrix} 3 & 0 & 0 \\ 0 & 4 & 0\\ 0 & 0 & 5 \end{bmatrix} \begin{bmatrix} x\\ y\\ z\\ \end{bmatrix} = \begin{bmatrix} 3x \\ 4y \\ 5z \end{bmatrix} \] 因此, \(A = \begin{bmatrix} 3 & 0 & 0 \\ 0 & 4 & 0\\ 0 & 0 & 5 \end{bmatrix}\)。
Exercise 2©
\[f(x,y,z) = (x+2y+3z,4x+5y+6z,7x+8y+9z). \]
Ans:
\[\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6\\ 7 & 8 & 9 \end{bmatrix} \begin{bmatrix} x\\ y\\ z\\ \end{bmatrix} = \begin{bmatrix} x + 2y + 3z \\ 4x + 5y + 6z \\ 7x + 8y + 9z \end{bmatrix} \] 因此, \(A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6\\ 7 & 8 & 9 \end{bmatrix}\)。
Exercise 2(d)
\[f(x,y,z) = (y,z,x). \] Ans:
\[\begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} y \\ z \\ x \end{bmatrix} \] 因此, \(A = \begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ 1 & 0 & 0 \end{bmatrix}\)。
Exercise 2(e)
函數 \(f\) 把每個 \(\mathbb{R}^3\) 中的向量投影到 \((1,1,1)\) 的方向上。
Ans:
\[f(x,y,z) = \frac{1}{3} \begin{bmatrix}x+y+z \\ x+y+z \\x+y+z \end{bmatrix} = \begin{bmatrix}\frac{1}{3} & \frac{1}{3} & \frac{1}{3} \\ \frac{1}{3} & \frac{1}{3} & \frac{1}{3}\ \\ \frac{1}{3} & \frac{1}{3} & \frac{1}{3} \end{bmatrix}\begin{bmatrix}x \\ y \\ z \end{bmatrix}\] 因此,\[A = \begin{bmatrix}\frac{1}{3} & \frac{1}{3} & \frac{1}{3} \\ \frac{1}{3} & \frac{1}{3} & \frac{1}{3}\ \\ \frac{1}{3} & \frac{1}{3} & \frac{1}{3} \end{bmatrix}. \]
Exercise 2(f)
函數 \(f\) 把每個 \(\mathbb{R}^3\) 中的向量沿著 \(z\) 軸逆時鐘旋轉 \(45^\circ\)。
(這裡的旋轉是以北極往南看的逆時鐘。)
Ans:
\[f(x,y,z) = (\frac{\sqrt{2}}{2}x + \frac{\sqrt{2}}{2}y , \frac{\sqrt{2}}{2}x - \frac{\sqrt{2}}{2}y , z).\] \[\begin{bmatrix} \frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} & 0\\ \frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 0\\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} \frac{\sqrt{2}}{2}x - \frac{\sqrt{2}}{2}y \\ \frac{\sqrt{2}}{2}x + \frac{\sqrt{2}}{2}y \\ z \end{bmatrix} \] 因此,\[A = \begin{bmatrix} \frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} & 0\\ \frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 0\\ 0 & 0 & 1 \end{bmatrix}。\]
Exercise 3
令 \(f\) 是一個 \(\mathbb{R}^n\) 到 \(\mathbb{R}^m\) 的可微分函數(不一定線性)﹐
則 \(f\) 可以寫成 \[f(x_1,\ldots, x_n) = (f_1(x_1,\ldots, x_n), \ldots, f_m(x_1,\ldots, x_n)).\] 而 \(f\) 的全微分為
\[\begin{bmatrix} \frac{\partial f_1}{\partial x_1} & \cdots & \frac{\partial f_1}{\partial x_n} \\ \vdots & \cdots & \vdots \\ \frac{\partial f_m}{\partial x_1} & \cdots & \frac{\partial f_m}{\partial x_n} \\ \end{bmatrix}. \]
Exercise 3(a)
微分的用意是希望函數的區部性質非常接近線性函數。
說明為什麼全微分會被定為一個 \(m\times n\) 矩陣而不是一個 \(n\times m\) 矩陣。
Ans:
因為一個 \(m\times n\) 矩陣才能表示一個從 \(\mathbb{R}^n\) 到 \(\mathbb{R}^m\) 的函數,
所以, \(f\) 的全微分必為 \(m\times n\) 的矩陣。
Exercise 3(b)
令 \(A\) 為一 \(m\times n\) 矩陣而 \({\bf b}\in\mathbb{R}^m\)。
定義 \(f({\bf x}) = A{\bf x} + {\bf b}\)。
求 \(f\) 的全微分。
\[ \begin{bmatrix} {x_1}a_{11} + \cdots + {x_m}a_{1n} \\ \vdots \\ {x_m}a_{m1} + \cdots + {x_m}a_{mn} \end{bmatrix} \] –> 而 \[ A\bx = \begin{bmatrix} {x_1}a_{11} + \cdots + {x_m}a_{1n} \\ \vdots \\ {x_m}a_{m1} + \cdots + {x_m}a_{mn} \end{bmatrix} = \begin{bmatrix} f_1 \\ \vdots \\ f_m \end{bmatrix}. \]
由於 \(\frac{\partial f_i}{\partial x_j} = a_{ij}\),因此 \(f\) 的全微分為 \(A\)。
Ans:
令 \(A\) 為 \[\begin{bmatrix} a_{11} & \cdots & a_{1n} \\ \vdots & \cdots & \vdots \\ a_{m1} & \cdots & a_{mn} \end{bmatrix} \] \({\bf x}\) 為 \[\begin{bmatrix} {x_1} \\ \vdots \\ {x_m} \end{bmatrix}. \] 因為 \({\bf b}\) 為常數,所以,微分時無需考慮。
而 \[ A\bx = \begin{bmatrix} {x_1}a_{11} + \cdots + {x_m}a_{1n} \\ \vdots \\ {x_1}a_{m1} + \cdots + {x_m}a_{mn} \end{bmatrix} = \begin{bmatrix} f_1 \\ \vdots \\ f_m \end{bmatrix}. \] 由於 \(\frac{\partial f_i}{\partial x_j} = a_{ij}\),因此 \(f\) 的全微分為 \(A\)。
目前分數 6