owned this note
owned this note
Published
Linked with GitHub
# 體驗喬丹標準型

This work by Jephian Lin is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
{%hackmd 5xqeIJ7VRCGBfLtfMi0_IQ %}
```python
from lingeo import random_int_list, random_good_matrix
```
## Main idea
Let $\lambda\in\mathbb{C}$ and $n$ an integer.
A **Jordan block** of $\lambda$ of order $n$ is the $n\times n$ matrix
$$J_{\lambda,n} = \begin{bmatrix}
\lambda & 1 & & \\
& \ddots & \ddots & \\
& & & 1 \\
& & & \lambda \\
\end{bmatrix}.
$$
According to the spectrum theorem, for every symmetric matrix $A$, there is an orthonormal basis $\beta$ such that $[f_A]_\beta^\beta$ is orthogonal.
This is not necessarily true for not necessarily symmetric matrices, even we give up the condition of being orthonormal.
Any Jordan block of order at least $2$ is such an example.
Fortunately, we have the folloing canonical form.
##### Jordan canonical form
Let $A$ be an $n\times n$ matrix.
Then there is a basis $\beta$ of $\mathbb{R}^n$ such that
$$[f_A]_\beta^\beta = J_{\lambda_1,n_1}\oplus \cdots \oplus J_{\lambda_d,n_d},
$$
where $\oplus$ is the direct sum of two matrices.
That is, there is an invertible matrix $Q$ such that $Q^{-1}AQ = J_{\lambda_1,n_1}\oplus \cdots \oplus J_{\lambda_d,n_d}$.
We say two $n\times n$ matrices $A$ and $B$ are **similar** if there is an invertible matrix $Q$ such that $Q^{-1}AQ = B$.
Equivalently, $A$ and $B$ are similar if there is a basis $\beta$ of $\mathbb{R}^n$ such that $[f_A]_\beta^\beta = B$.
It is not trivial how to determine whether two given matrices are similar.
It turns out that two matrices are similar if and only if they have the same Jordan canonical form.
## Side stories
- matrix algebra
## Experiments
##### Exercise 1
執行以下程式碼。
已知 $A$ 和 $B$ 相似﹐且 $Q^{-1}AQ = B$。
```python
### code
set_random_seed(0)
print_ans = False
n = 2
A = matrix(2, random_int_list(n*n))
Q = random_good_matrix(n,n,n)
B = Q.inverse() * A * Q
print("Qinv * A * Q = B")
pretty_print(Q.inverse(), A, Q, "=", B)
if print_ans:
print("rank =", A.rank())
print("nullity =", A.nullity())
print("determinant =", A.determinant())
print("B (Qinv v) = (Qinv b)")
```
##### Exercise 1(a)
驗證 $A$ 和 $B$ 有相同的秩、核數、行列式值。
##### Exercise 1(b)
若已知 $A{\bf v} = {\bf b}$。
求 $B(Q^{-1}{\bf v})$。
## Exercises
##### Exercise 2
令 $A$ 和 $B$ 為兩 $n\times n$ 矩陣。
證明以下敘述等價:
1. $A$ 和 $B$ 相似。
2. 存在 $\mathbb{R}^n$ 的一組基底 $\beta$ 使得 $[f_A]_\beta^\beta = B$。
##### Exercise 3
令
$$J = J_{2,3} =
\begin{bmatrix}
2 & 1 & 0 \\
0 & 2 & 1 \\
0 & 0 & 2 \\
\end{bmatrix}.
$$
##### Exercise 3(a)
說明若存在一組基底 $\beta = \{ {\bf v}_1,\ldots,{\bf v}_3 \}$ 使得 $[f_J]_\beta^\beta$ 是對角矩陣 $\operatorname{diag}(\lambda_1,\lambda_2,\lambda_3)$﹐
則對每個 $i = 1,\ldots, 3$ 都有 $J{\bf v}_i = \lambda_i {\bf v}_i$。
##### Exercise 3(b)
說明若這樣的基底存在﹐必定是 $\lambda_1 = \cdots = \lambda_3 = 2$﹐
然而 $J$ 不可能和 $2I$ 相似。
##### Exercise 4
令 $A$ 為一 $n\times n$ 矩陣。
已知 $\beta$ 為 $\mathbb{R}^n$ 的一組基底使得 $[f_A]_\beta^\beta = J = J_{\lambda,n}$。
將每個 $A{\bf v}_i$ 寫成 $\beta$ 的線性組合。
##### Exercise 5
令
$$A = \begin{bmatrix}
5 & 1 & 0 \\
-7 & -1 & 1 \\
-6 & -2 & 2
\end{bmatrix}.
$$
令
${\bf v}_1 = (1, -3, -2)$、
${\bf v}_2 = (1, -2, -2)$、
${\bf v}_3 = (2, -5, -3)$、
$\beta = \{ {\bf v}_1, \ldots, {\bf v}_3 \}$。
求 $[f_A]_\beta^\beta$。
##### Exercise 6
證明兩矩陣相似是等價關係。