Matrix as a linear function
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_good_matrix, kernel_matrix, row_space_matrix, left_kernel_matrix
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,
By the dimension theorem, the following are equivalent:
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)}$.
執行以下程式碼。
已知 $\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$.
### 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)
對以下各矩陣 $A$:
For each of the following matrices:
令 $A$ 為一可逆矩陣。
驗證 $f_A^{-1} = f_{A^{-1}}$。
Let $A$ be an invertible matrix. Show that $f_A^{-1} = f_{A^{-1}}$.
令 $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$.
若 $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$.
說明 $A$ 會是把 $f(\be_1), \ldots, f(\be_n)$ 依序當成行向量的矩陣。
Explain that $A$ is the matrix whose columns are $f(\be_1), \ldots, f(\be_n)$.