owned this note
owned this note
Published
Linked with GitHub
# 向量空間中的矩陣表示法
Matrix representation in a vector space

This work by Jephian Lin is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
$\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}}$
```python
from lingeo import random_int_list, random_good_matrix
from linspace import vtop
```
## Main idea
Let $f : V \rightarrow U$ be a linear function,
$\alpha = \{ \bv_1, \ldots, \bv_n \}$ be a basis of $V$, and
$\beta$ a basis of $U$.
Then the matrix
$$
[f]_\alpha^\beta = \begin{bmatrix}
| & ~ & | \\
[f(\bv_1)]_\beta & \cdots & [f(\bv_n)]_\beta \\
| & ~ & | \\
\end{bmatrix}
$$
has the property that $[f(\bb)]_\beta = [f]_\alpha^\beta [\bb]_\alpha$.
Therefore, we call $[f]_\alpha^\beta$ the **matrix representation** of $f$ with respect to $\alpha$ and $\beta$.
The equality can be visualized by the following diagram.
$$
\begin{array}{ccc}
\bb & \xrightarrow{f} & f(\bb) \\
\downarrow & ~ & \downarrow \\
[\bb]_\alpha & \xrightarrow{[f]_\alpha^\beta\cdot\square} & [f(\bb)]_\beta \\
\end{array}
$$
Let $A = [f]_\alpha^\beta$.
Lots of (if not all) information about $f$ can be found from the the matrix representation.
- $\range(f) = \{\bu\in U: [\bu]_\beta\in\range(A)\}$
- $\ker(f) = \{\bv\in V: [\bv]_\beta\in\ker(A)\}$
- $\rank(f) = \rank(A)$
- $\nul(f) = \nul(A)$
##### Dimension theorem (general)
Let $f$ be a linear function from $V$ to $U$.
Then $\rank(f) + \nul(f) = \dim(V)$.
## Side stories
- derivative
- transpose
## Experiments
##### Exercise 1
執行以下程式碼。
已知 $f$ 為 $\mathcal{P}^2$ 到 $\mathcal{P}^1$ 的線性函數﹐
而 $\alpha$ 和 $\beta$ 分別為 $\mathcal{P}^2$ 和 $\mathcal{P}^1$ 的一組基底。
<!-- eng start -->
Run the code below. Let $f: \mathcal{P}^2 \rightarrow \mathcal{P}^1$ be a linear function. Let $\alpha$ and $\beta$ be bases of $\mathcal{P}^2$ and $\mathcal{P}^1$, respectively.
<!-- eng end -->
```python
### code
set_random_seed(0)
print_ans = False
m,n = 2,3
alpha = random_good_matrix(n,n,n, bound=3)
beta = random_good_matrix(m,m,m, bound=3)
A = matrix(m, random_int_list(m*n))
v = vector(random_int_list(n, 3))
b = alpha * v
print("alpha contains %s polynomials:"%n)
for j in range(n):
print("v%s ="%(j+1), vtop(alpha.column(j)))
print("beta contains %s polynomials:"%m)
for i in range(m):
print("u%s ="%(i+1), vtop(beta.column(i)))
for j in range(n):
print( "f(v%s) = "%(j+1) + " + ".join("%s u%s"%(A[i,j],i+1) for i in range(m)) )
print("b =", vtop(b))
if print_ans:
print("[b]_alpha =", v)
print("[f(b)]_beta =", A*v)
print("f(b) =", vtop(beta * A * v))
print("[f]_alpha^beta =")
show(A)
```
##### Exercise 1(a)
求 $[\bb]_\alpha$、$[f(\bb)]_\beta$、及 $f(\bb)$。
<!-- eng start -->
Find $[\bb]_\alpha$, $[f(\bb)]_\beta$, and $f(\bb)$.
<!-- eng end -->
##### Exercise 1(b)
求 $[f]_\alpha^\beta$。
<!-- eng start -->
Find $[f]_\alpha^\beta$.
<!-- eng end -->
## Exercises
##### Exercise 2
令 $f : V \rightarrow \mathbb{R}^m$ 為一線性函數、
$\alpha = \{\bv_1, \ldots, \bv_n\}$ 為 $V$ 的一組基底、
$\beta = \{\bu_1, \ldots, \bu_m\}$ 為 $U$ 的一組基底。
<!-- eng start -->
Let $f : V \rightarrow \mathbb{R}^m$ be a linear function, $\alpha = \{\bv_1, \ldots, \bv_n\}$ a basis of $V$, and $\beta = \{\bu_1, \ldots, \bu_m\}$.
<!-- eng end -->
##### Exercise 2(a)
令 $V = \mathcal{P}^3$、$U = \mathcal{P}^2$ 且
$f(p) = p'$ 為 $p$ 的微分。
令 $\alpha$、$\beta$ 分別為 $V$ 和 $U$ 的標準基底。
求 $[f]_\alpha^\beta$、$\rank(f)$、及 $\nul(f)$。
<!-- eng start -->
Let $V = \mathcal{P}^3$, $U = \mathcal{P}^2$, and $f(p) = p'$ the derivative of $p$. Let $\alpha$ and $\beta$ be the standard bases of $V$ and $U$, respectively. Find $[f]_\alpha^\beta$, $\rank(f)$, and $\nul(f)$.
<!-- eng end -->
##### Exercise 2(b)
令 $V = \mathcal{P}^3$、$U = \mathcal{P}^3$ 且
$f(p) = p'$ 為 $p$ 的微分。
令 $\alpha$、$\beta$ 分別為 $V$ 和 $U$ 的標準基底。
求 $[f]_\alpha^\beta$、$\rank(f)$、及 $\nul(f)$。
<!-- eng start -->
Let $V = \mathcal{P}^3$, $U = \mathcal{P}^3$, and $f(p) = p'$ the derivative of $p$. Let $\alpha$ and $\beta$ be the standard bases of $V$ and $U$, respectively. Find $[f]_\alpha^\beta$, $\rank(f)$, and $\nul(f)$.
<!-- eng end -->
##### Exercise 2(c)
令 $V = \mathcal{P}^3$、$U = \mathcal{P}^4$ 且
$f(p) = (1-x)\cdot p$。
令 $\alpha$、$\beta$ 分別為 $V$ 和 $U$ 的標準基底。
求 $[f]_\alpha^\beta$、$\rank(f)$、及 $\nul(f)$。
<!-- eng start -->
Let $V = \mathcal{P}^3$, $U = \mathcal{P}^4$, and $f(p) = (1-x)\cdot p$. Let $\alpha$ and $\beta$ be the standard bases of $V$ and $U$, respectively. Find $[f]_\alpha^\beta$, $\rank(f)$, and $\nul(f)$.
<!-- eng end -->
##### Exercise 2(d)
令 $V = U = \mathcal{M}_{2,2}$ 且
$f(A) = A\trans$ 為 $A$ 的轉置。
令 $\alpha = \beta$ 為 $\mathcal{M}_{2,2}$ 的標準基底。
求 $[f]_\alpha^\beta$、$\rank(f)$、及 $\nul(f)$。
<!-- eng start -->
Let $V = U = \mathcal{M}_{2,2}$ and $f(A) = A\trans$ the transpose of $A$. Let $\alpha = \beta$ be the standard basis of $\mathcal{M}_{2,2}$. Find $[f]_\alpha^\beta$, $\rank(f)$, and $\nul(f)$.
<!-- eng end -->
##### Exercise 2(e)
令
$$
M = \begin{bmatrix}
1 & 2 \\
2 & 4 \\
\end{bmatrix}.
$$
令 $V = U = \mathcal{M}_{2,2}$ 且
$f(A) = MA$。
令 $\alpha = \beta$ 為 $\mathcal{M}_{2,2}$ 的標準基底。
求 $[f]_\alpha^\beta$、$\rank(f)$、及 $\nul(f)$。
<!-- eng start -->
Let
$$
M = \begin{bmatrix}
1 & 2 \\
2 & 4 \\
\end{bmatrix}.
$$
Let $V = U = \mathcal{M}_{2,2}$ and $f(A) = MA$. Let $\alpha = \beta$ be the standard basis of $\mathcal{M}_{2,2}$. Find $[f]_\alpha^\beta$, $\rank(f)$, and $\nul(f)$.
<!-- eng end -->