將矩陣視為線性函數¶

Matrix as a linear function

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, random_good_matrix, kernel_matrix, row_space_matrix, left_kernel_matrix

Main idea¶

Let $A$ be an $m\times n$ matrix.
Then $$\begin{aligned} f_A: \mathbb{R}^n &\rightarrow \mathbb{R}^m \\ \bu &\mapsto A\bu \end{aligned}$$
defines a linear function.
With this connection,

  • $\range(f_A) = \Col(A)$,
  • $\ker(f_A) = \ker(A)$,
  • $\rank(f_A) = \rank(A)$,
  • $\nul(f_A) = \nul(A)$.

By the dimension theorem, the following are equivalent:

  1. $f_A$ is injective.
  2. $\nul(A) = 0$.
  3. $\rank(A) = n$.

On the other hand, $f_A$ is surjective if and only if $\rank(A) = m$.

Therefore, the inverse of $f_A$ exists only when $\rank(A) = m = n$.
When the inverse function exists, $f_A^{-1} = f_{A^{-1}}$.

Let $I_n$ be the identity matrix.
Then $f_{I_n} = \idmap_{\mathbb{R}^n}$.

Let $\mathcal{E}_n = \{ \be_1, \ldots, \be_n \}$ be the standard basis of $\mathbb{R}^n$.
Let
$$D = \begin{bmatrix} d_1 & ~ & ~ \\ ~ & \ddots & ~ \\ ~ & ~ & d_n \\ \end{bmatrix}$$ be an $n\times n$ diagonal matrix.
Then $f_D$ is a scaling function that satisfying
$$\begin{array}{ccc} \be_1 &\mapsto & d_1\be_1, \\ &\vdots & \\ \be_n &\mapsto & d_n\be_n. \\ \end{array}$$

In particular, if $A$ is a diagonal matrix whose diagonal entries are $1$ or $0$, then $f_A$ is a projection.
If $A$ is a diagonal matrix whose diagonal entries are $1$ or $-1$, then $f_A$ is a reflection.

Let
$$R_\theta = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}.$$
Let $R(i,j,\theta)$ be the $n\times n$ matrix obtained $I_n$ by replacing the $2\times 2$ principal submatrix on the $i$-th and $j$-th rows/columns with $R_\theta$.
Then $R(i,j,\theta)$ is called the Givens rotation.
The function $f_{R(i,j,\theta)}$ is a rotation on the $i,j$-coordinates.

A permutation is a bijection between $\{1, \ldots, n\}$ to itself.
Let $\sigma$ be a permutation on $\{1,\ldots,n\}$.
Define the matrix $P$ such that the $\sigma(i),i$-entry is $1$ for $i = 1,\ldots, n$ while other entries are zero.
Then $f_P$ is a function sending $\be_i$ to $\be_{\sigma(i)}$.

Side stories¶

  • build $A$ from $A\be_i$

Experiments¶

Exercise 1¶

執行以下程式碼。
已知 $\left[\begin{array}{c|c} R & \br \end{array}\right]$ 為 $\left[\begin{array}{c|c} A & \bb \end{array}\right]$ 的最簡階梯形式矩陣。
令 $f_A$ 為對應到矩陣 $A$ 的線性函數。

Run the code below. Let $\left[\begin{array}{c|c} R & \br \end{array}\right]$ be the reduced echelon form of $\left[\begin{array}{c|c} A & \bb \end{array}\right]$. Let $f_A$ be the linear function representing $A$.

In [ ]:
### code
set_random_seed(0)
print_ans = False
ran = choice([True, False])
ker = choice([True, False])
m,n,r = 3,4,2
A = random_good_matrix(m,n,r)
v = vector(random_int_list(n))
b = A * v + ( zero_vector(m) if ran else left_kernel_matrix(A).row(0) )
u = kernel_matrix(A).column(0) + ( zero_vector(n) if ker else row_space_matrix(A).row(0) )
Ab = A.augment(b, subdivide=True)
Rr = Ab.rref()

print("[ A | b ] =")
show(Ab)
print("[ R | r ] =")
show(Rr)
print("u =", u)

if print_ans:
    print("b in range(f_A)?", ran)
    print("u in kernel(f_A)?", ker)
Exercise 1(a)¶

判斷 $\bb$ 是否落在 $\range(f_A)$ 中。

Is $\bb$ in $\range(f_A)$?

Exercise 1(b)¶

判斷 $\bu$ 是否落在 $\ker(f_A)$ 中。

Is $\bu$ in $\ker(f_A)$?

Exercises¶

Exercise 2¶

對以下各矩陣 $A$:

  1. 說明 $f_A$ 的作用。
  2. 寫出 $\range(f_A)$ 及 $\rank(f_A)$。
  3. 寫出 $\ker(f_A)$ 及 $\nul(f_A)$。
  4. 判斷 $f_A$ 是否可逆;若可逆﹐其反函數為何?

For each of the following matrices:

  1. Describe the effect of $f_A$.
  2. Find $\range(f_A)$ and $\rank(f_A)$.
  3. Find $\ker(f_A)$ and $\nul(f_A)$.
  4. Is $f_A$ invertible? If yes, what is the inverse function?
Exercise 2(a)¶
$$A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \\ \end{bmatrix}.$$
Exercise 2(b)¶
$$A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}.$$
Exercise 2(c)¶
$$A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1 \\ \end{bmatrix}.$$
Exercise 2(d)¶
$$A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ 0 & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \end{bmatrix}.$$
Exercise 2(e)¶
$$A = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \\ \end{bmatrix}.$$
Exercise 3¶

令 $A$ 為一 $m\times n$ 矩陣。

Let $A$ be an $m\times n$ matrix.

Exercise 3(a)¶

說明若 $m < n$ 則 $f_A$ 不可能是嵌射。

Explain why $f_A$ is not injective whenever $m < n$.

Exercise 3(b)¶

說明若 $m > n$ 則 $f_A$ 不可能是映射。

Explain why $f_A$ is not surjective whenever $m > n$.

Exercise 4¶

令 $A$ 為一可逆矩陣。
驗證 $f_A^{-1} = f_{A^{-1}}$。

Let $A$ be an invertible matrix. Show that $f_A^{-1} = f_{A^{-1}}$.

Exercise 5¶

令 $A$ 為一 $m\times n$ 矩陣。
令 $\mathcal{E}_n = \{ \be_1,\ldots, \be_n \}$ 為 $\mathbb{R}^n$ 的標準基底。

Let $A$ be an $m\times n$ matrix. Let $\mathcal{E}_n = \{ \be_1,\ldots, \be_n \}$ be the standard basis of $\mathbb{R}^n$.

Exercise 5(a)¶

若 $m = 4$、$n = 3$ 且已知

$$ \begin{aligned} f_A(\be_1) &= (1,1,1,1), \\ f_A(\be_2) &= (1,2,3,4), \\ f_A(\be_3) &= (4,3,2,1). \\ \end{aligned} $$

求 $A$。

Suppose $m = 4$, $n = 3$, and

$$ \begin{aligned} f_A(\be_1) &= (1,1,1,1), \\ f_A(\be_2) &= (1,2,3,4), \\ f_A(\be_3) &= (4,3,2,1). \\ \end{aligned} $$

Find $A$.

Exercise 5(b)¶

說明 $A$ 會是把 $f(\be_1), \ldots, f(\be_n)$ 依序當成行向量的矩陣。

Explain that $A$ is the matrix whose columns are $f(\be_1), \ldots, f(\be_n)$.