Matrix multiplication and transpose
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, row_operation_process
When $A$ and $B$ are both $n\times n$ matrices, then $\det(AB) = \det(A) \det(B)$.
Intuitively, this follows from the fact that
the determinants are the scaling factors!
A formal proof can be done by the elementary matrices.
If both $A$ and $B$ are invertible,
then they can be written as the products of elementary matrices
so $AB$ can be written as the product of elementary matrices
$$ AB = F_1\cdots F_k E_1\cdots E_h. $$Therefore,
$$ \begin{aligned} \det(AB) &= \det(F_1)\cdots\det(F_k)\det(E_1)\cdots\det(E_h) \\ &= \big(\det(F_1)\cdots\det(F_k)\big)\big(\det(E_1)\cdots\det(E_h)\big) \\ &= \det(A)\det(B). \end{aligned} $$On the other hand, it is known that $AB$ is invertible if and only if both $A$ and $B$ are invertible.
Thanks to this nice property, we may derive the following facts.
As a consequence, we may define the determinant of linear function $f: V\rightarrow V$ by
$$ \det(f) = \det([f]_\beta^\beta), $$where $\beta$ can be any basis of $V$.
For matrix transpose, $\det(A\trans) = \det(A)$.
Intuitively, this follows from the fact that
$$ \det(A\trans) = \Vol_C(A\trans) = \Vol_R(A) = \det(A), $$since we have shown that the column parallelotope and the row parallelotop (surprisingly) have the same signed volumn.
Again, formally we may prove by the elementary matrices.
Let's make some observations first.
If $A$ is invertible, then we may write $A$ as the product of elementary matrices
$$ A = F_1 \cdots F_k, $$so
$$ A\trans = F_k\trans \cdots F_1\trans $$and
$$ \begin{aligned} \det(A\trans) &= \det(F_k\trans)\cdots\det(F_1\trans) \\ &= \det(F_k) \cdots \det(F_1) \\ &= \det(F_1) \cdots \det(F_k) \\ &= \det(A). \end{aligned} $$執行以下程式碼。
已知 $A = F_1\cdots F_k$ 及 $B = E_1\cdots E_h$ 都是一群單位矩陣的乘積。
Run the code below. Suppose we know $A = F_1\cdots F_k$ and $B = E_1\cdots E_h$ are the product of some elementary matrices.
### code
set_random_seed(0)
print_ans = False
n = 2
while True:
A = matrix(n, random_int_list(n^2, 3))
B = matrix(n, random_int_list(n^2, 3))
if A.det() != 0 and B.det() != 0:
break
elems_A = row_operation_process(A, inv=True)
elems_B = row_operation_process(B, inv=True)
print("A = F1 ... Fk")
pretty_print(A, LatexExpr("="), *elems_A)
print("B = E1 ... Eh")
pretty_print(B, LatexExpr("="), *elems_B)
if print_ans:
print("AB = F1 ... Fk E1 ... Eh")
pretty_print(A * B, LatexExpr("="), *(elems_A + elems_B))
print("det(AB) =", (A*B).det())
elems_AT = [elems.transpose() for elems in elems_A[::-1]]
print("A trans = Fk trans ... F1 trans")
pretty_print(A.transpose(), LatexExpr("="), *elems_AT)
print("det(A trans) =", A.transpose().det())
將 $AB$ 寫成基本矩陣的乘積,並求出 $\det(AB)$。
Write $AB$ as the product of some elementary matrices and find $\det(AB)$.
將 $A\trans$ 寫成基本矩陣的乘積,並求出 $\det(A\trans)$。
Write $A\trans$ as the product of some elementary matrices and find $\det(A\trans)$.
在總列數為 $3$ 的情況下,
寫下以下列運算的基本矩陣 $E$,
並解釋 $E\trans$ 所對應的列運算是什麼。
Consider matrices with $3$ rows. Find the elementary matrix corresponding to each of the following properties. Then explain what is the corresponding row operation for $E\trans$.
若 $A$ 為一可逆矩陣。
證明 $\det(A^{-1}) = \det(A)^{-1}$。
Suppose $A$ is an invertible matrix. Show that $\det(A^{-1}) = \det(A)^{-1}$.
若 $A$ 為一垂直矩陣($A\trans A = AA\trans = I_n$)。
證明 $\det(A) = \pm 1$。
Suppose $A$ is an orthogonal matrix. Show that $\det(A) = \pm 1$.
令 $V$ 為 $\mathbb{R}^3$ 中的一個二維空間,
而 $f:\mathbb{R}^3 \rightarrow \mathbb{R}^3$ 將向量 $\bv\in\mathbb{R}^3$ 投影到 $V$ 上。
求 $\det(f)$。
Let $V$ be a $2$-dimensional subspace in $\mathbb{R}^3$ and $f:\mathbb{R}^3 \rightarrow \mathbb{R}^3$ is the projection sending any vector $\bv\in\mathbb{R}^3$ onto $V$. Find $\det(f)$.
令 $V$ 為 $\mathbb{R}^3$ 中的一個二維空間,
而 $f:\mathbb{R}^3 \rightarrow \mathbb{R}^3$ 將向量 $\bv\in\mathbb{R}^3$ 鏡射到 $V$ 的對面。
求 $\det(f)$。
Let $V$ be a $2$-dimensional subspace in $\mathbb{R}^3$ and $f:\mathbb{R}^3 \rightarrow \mathbb{R}^3$ is the reflection sending any vector $\bv\in\mathbb{R}^3$ to the other side of $V$. Find $\det(f)$.
令 $A$ 和 $B$ 皆為 $n\times n$ 矩陣。
依照以下步驟證明以下敘述等價。
(這題為證明 $\det(AB) = \det(A)\det(B)$ 的必要過程,
所以請不要用行列式值來證明。)
Let $A$ and $B$ be $n\times n$ matrix. Follow the given steps to show the two statements below are equivalent.
(This problem is a necessary step for proving $\det(AB) = \det(A)\det(B)$, so please do not use the previous equality to prove it.
證明:
若 $\ker(B) \neq \{\bzero\}$,則 $\ker(AB) \neq \{\bzero\}$。
Show that if $\ker(B) \neq \{\bzero\}$, then $\ker(AB) \neq \{\bzero\}$.
證明:
若 $\Col(A) \neq \mathbb{R}^n$,則 $\Col(AB) \neq \mathbb{R}^n$。
Show that if $\Col(A) \neq \mathbb{R}^n$, then $\Col(AB) \neq \mathbb{R}^n$.
證明:
若 $A$ 和 $B$ 皆可逆,則 $AB$ 可逆。
Show that if both $A$ and $B$ are invertible, then $AB$ is also invertible.