Determinant for small matrices
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_good_matrix
In this section we explore some basic properties of the determinant of a $2\times 2$ or a $3\times 3$ matrix.
Let
be a $2\times 2$ matrix.
Then its determinant is defined as
When
$$ A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} $$is a $3\times 3$ matrix, the determinant is
$$ \begin{aligned} \det(A) &= aei - afh - bdi + bfg + cdh - ceg \\ &= a(ei - fh) - b(di -fg) + c(dh - eg). \end{aligned} $$Let $n = 2,3$ and $A$ an $n\times n$ matrix.
Then the determinant functions have the following basic properties.
(See Section 108 for the notations of row operations.)
When $A$ is a $2\times 2$ matrix, one may construct a parallelogram spanned by its row vectors.
It is known that $\det(A)$ is the signed area of this parallelogram.
When $A$ is a $3\times 3$ matrix, one may construct a parallelepiped spanned by its row vectors.
It is known that $\det(A)$ is the signed volume of this parallelepiped.
The same statement holds when the row vectors are replaced with the column vectors.
As a consequence, $\det(A) \neq 0$ if and only if $A$ is invertible.
For any sqaure matrices $A$ and $B$ of the same size,
the determinant function also has the following properties.
### code
set_random_seed(0)
print_ans = False
n = 2
k1 = 2
k2 = 3
A1 = random_good_matrix(n,n,n) * choice([-2,-1,1,2])
A2 = copy(A1)
A2.swap_rows(0,1)
A3 = copy(A2)
A3.rescale_row(1,k1)
A4 = copy(A3)
A4.add_multiple_of_row(1,0,k2)
print("A1")
pretty_print(A1)
print("A2")
pretty_print(A2)
print("A3")
pretty_print(A3)
print("A4")
pretty_print(A4)
if print_ans:
print("det(A1) =", A1.det())
print("A2 is obtained from A1 by swapping rows, so ")
print("det(A2) = - det(A1) =", A2.det())
print("A3 is obtained from A2 by rescaling a row, so ")
print("det(A3) = %s * det(A2) ="%k1, A3.det())
print("A4 is obtained from A3 by adding a multiple of a row to the other, so ")
print("det(A4) = det(A3) =", A4.det())
用定義計算 $\det(A_2)$。
已知 $A_2$ 可以由 $A_1$ 經過列運算得出,
利用 $\det(A_1)$ 再次計算 $\det(A_2)$ 來驗證答案。
Find $\det(A_2)$ by definition. Suppose we know that $A_2$ can be obtained from $A_1$ by some row operation. Use $\det(A_1)$ to find $\det(A_2)$ again to verify your previous answer.
用定義計算 $\det(A_3)$。
已知 $A_3$ 可以由 $A_2$ 經過列運算得出,
利用 $\det(A_2)$ 再次計算 $\det(A_3)$ 來驗證答案。
Find $\det(A_3)$ by definition. Suppose we know that $A_3$ can be obtained from $A_2$ by some row operation. Use $\det(A_2)$ to find $\det(A_3)$ again to verify your previous answer.
用定義計算 $\det(A_4)$。
已知 $A_4$ 可以由 $A_3$ 經過列運算得出,
利用 $\det(A_3)$ 再次計算 $\det(A_4)$ 來驗證答案。
Find $\det(A_4)$ by definition. Suppose we know that $A_4$ can be obtained from $A_3$ by some row operation. Use $\det(A_3)$ to find $\det(A_4)$ again to verify your previous answer.
以下練習驗證行列式值和矩陣是否可逆的關係。
Through the following exercises, explore the relation between the determinant and the invertibility of a matrix.
寫出一個行列式值為 $0$
且矩陣中每項皆不為 $0$
的 $3\times 3$ 矩陣。
用列運算判斷其是否可逆。
Find a $3\times 3$ matrix with zero determinant such that all its entries are nonzero. Determine if it is invertible by row operations.
寫出一個行列式值不為 $0$
且矩陣中每項皆不為 $0$
的 $3\times 3$ 矩陣。
用列運算判斷其是否可逆。
Find a $3\times 3$ matrix with nonzero determinant such that all its entries are nonzero. Determine if it is invertible by row operations.
令
$$ A_x = \begin{bmatrix} 2 - x & 3 \\ 3 & 2 - x \end{bmatrix}. $$找出所有會讓 $A_x$ 奇異(不可逆)的 $x$。
對每個這樣的 $x$,求出一個非零向量 $\bv_x$ 使得 $A_x\bv_x = \bzero$。
Let
$$ A_x = \begin{bmatrix} 2 - x & 3 \\ 3 & 2 - x \end{bmatrix}. $$Find all possible $x$ such that $A_x$ is singular (not invertible). For each of such $x$, find a nonzero vector $\bx_v$ such that $A_x\bv_x = \bzero$.
令
$$ A_x = \begin{bmatrix} 0 - x & 1 & 1 \\ 1 & 0 - x & 0 \\ 1 & 0 & 0 - x \\ \end{bmatrix}. $$找出所有會讓 $A_x$ 奇異(不可逆)的 $x$。
對每個這樣的 $x$,求出一個非零向量 $\bv_x$ 使得 $A_x\bv_x = \bzero$。
Let
$$ A_x = \begin{bmatrix} 0 - x & 1 & 1 \\ 1 & 0 - x & 0 \\ 1 & 0 & 0 - x \\ \end{bmatrix}. $$Find all possible $x$ such that $A_x$ is singular (not invertible). For each of such $x$, find a nonzero vector $\bx_v$ such that $A_x\bv_x = \bzero$.
令 $n = 2,3$、且 $A$ 為一 $n\times n$ 的矩陣。
利用定義證明以下性質:
Let $n = 2,3$ and $A$ an $n\times n$ matrix. Prove the following properties by definition:
令 $n = 2,3$、且 $A$ 為一 $n\times n$ 的矩陣。
利用定義證明以下性質:
Let $n = 2,3$ and $A$ an $n\times n$ matrix. Prove the following properties by definition: