找一組好基底¶

Find a good basis

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

Main idea¶

Let $A$ be an $n\times n$ matrix.
Recall that $f_A:\mathbb{R}^n \rightarrow \mathbb{R}^n$ is the function defined by $f_A(\bx) = A\bx$.
Using the standard basis $\mathcal{E}_n$, the matrix representation of $f_A$ is

$$ [f_A] = [f_A]_{\mathcal{E}_n}^{\mathcal{E}_n} = A. $$

In constrast, the matrix representation of $f_A$ with respect to another basis $\beta$ is

$$ [f_A]_\beta^\beta = [\idmap]_{\mathcal{E}_n}^\beta [f_A] [\idmap]_\beta^{\mathcal{E}_n}. $$

If we let $Q = [\idmap]_\beta^{\mathcal{E}_n}$, then the columns of $Q$ are the vectors in $\beta$.
Also, we can write, $[f_A]_\beta^\beta = Q^{-1}AQ$.

On a matrix level, we say $A$ and $B$ are similar if there is an invertible matrix $Q$ such that $B = Q^{-1}AQ$.
In other words, $A$ and $B$ are just the same linear function represented under different bases.

Suppose $\beta = \{\bv_1, \ldots, \bv_n\}$ has the nice property that

$$ A\bv_i = \lambda_i \bv_i $$

for some values $\lambda_i$ and for $i = 1,\ldots, n$.

Then we know

$$ [f_A]_\beta^\beta = \begin{bmatrix} | & ~ & | \\ [f_A(\bv_1)]_\beta & \cdots & [f_A(\bv_n)]_\beta \\ | & ~ & | \\ \end{bmatrix} = \begin{bmatrix} | & ~ & | \\ [\lambda_1\bv_1]_\beta & \cdots & [\lambda_n\bv_n]_\beta \\ | & ~ & | \\ \end{bmatrix} = \begin{bmatrix} \lambda_1 & ~ & ~ \\ ~ & \ddots & ~ \\ ~ & ~ & \lambda_n \end{bmatrix}, $$

which is a diagonal matrix.
In this case, we say $A$ is diagonalizable .
Whenever $A\bv = \lambda\bv$ for some value $\lambda$ and some nonzero vector $\bv$,
we say $\lambda$ is an eigenvalue of $A$ and
$\bv$ is an eigenvector of $A$ with respect to $\lambda$.

Similarly, if $f: V\rightarrow V$ is a linear function and
$f(\bv) = \lambda \bv$ for some value $\lambda$ and some nonzero vector $\bv$,
then we say $\lambda$ is an eigenvalue of $f$ and
$\bv$ is an eigenvector of $f$ with respect to $\lambda$.

Proposition¶

Let $A$ be an $n\times n$ matrix. Then the following are equivalent.

  • $A$ is diagonalizable.
  • There is a basis $\beta$ of $\mathbb{R}^n$ that is composed of eigenvectors.
  • There are an invertible matrix $Q$ and a diagonal matrix $D$ such that $D = Q^{-1}AQ$.

When $A$ is a real symmetric matrix (meaning $A\trans = A$), such a nice basis exists;
moreover, it can be chosen to be orthonormal, so the corresponding $Q$ has $Q\trans = Q^{-1}$.

Spectral theorem (vector version)¶

Let $A$ be an $n\times n$ symmetric matrix.
Then there is an orthonormal basis $\beta$ of $\mathbb{R}^n$ such that $[f_A]_\beta^\beta = D$ is a diagonal matrix.
That is, there is an orthogonal matrix $Q$ such that $Q^\top AQ = D$ is a diagonal matrix.

Side stories¶

  • Jordan canonical form
  • algebra of $Q^{-1}AQ$
  • matrix power
  • simultaneously diagonalizable

Experiments¶

Exercise 1¶

執行以下程式碼。
令 $\beta = \{\bv_1, \cdots, \bv_n\}$ 為 $Q$ 的各行向量。

Run the code below. Let $\beta = \{\bv_1, \cdots, \bv_n\}$ be the columns of $Q$.

In [ ]:
### code
set_random_seed(0)
print_ans = False

n = 3
D = diagonal_matrix(random_int_list(n, 3))
Q = random_good_matrix(n,n,n, 2)
A = Q * D * Q.inverse()

pretty_print(LatexExpr("A ="), A)
pretty_print(LatexExpr("Q ="), Q)


if print_ans:
    v1, v2, v3 = Q.columns()
    u1, u2, u3 = D.columns()
    print("f_A(v1) =", A * v1)
    print("vector representation =", u1)
    print("f_A(v1) =", A * v2)
    print("vector representation =", u2)
    print("f_A(v1) =", A * v3)
    print("vector representation =", u3)
    print("matrix represesntation =")
    pretty_print(D)
Exercise 1(a)¶

求 $f_A(\bv_1)$ 及 $[f_A(\bv_1)]_\beta$。

Find $f_A(\bv_1)$ and $[f_A(\bv_1)]_\beta$.

Exercise 1(b)¶

求 $f_A(\bv_2)$ 及 $[f_A(\bv_2)]_\beta$。

Find $f_A(\bv_2)$ and $[f_A(\bv_2)]_\beta$.

Exercise 1(c)¶

求 $f_A(\bv_3)$ 及 $[f_A(\bv_3)]_\beta$。

Find $f_A(\bv_3)$ and $[f_A(\bv_3)]_\beta$.

Exercise 1(d)¶

求 $[f_A]_\beta^\beta$。

Find $[f_A]_\beta^\beta$.

Exercises¶

Exercise 2¶

對以下的矩陣 $A$ 及基底 $\beta$,
求出 $[f_A]_\beta^\beta$。

For each of the following matrices $A$ and bases $\beta$, find $[f_A]_\beta^\beta$.

Exercise 2(a)¶
$$ A = \begin{bmatrix} 5 & -1 \\ -1 & 5 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 1 \\ 1 \end{bmatrix}, \begin{bmatrix} 1 \\ -1 \end{bmatrix} \right\}. $$
Exercise 2(b)¶
$$ A = \begin{bmatrix} -1 & 5 \\ 5 & -1 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 1 \\ 1 \end{bmatrix}, \begin{bmatrix} 1 \\ -1 \end{bmatrix} \right\}. $$
Exercise 2(c)¶
$$ A = \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 1 \\ 1 \end{bmatrix}, \begin{bmatrix} 1 \\ -1 \end{bmatrix} \right\}. $$
Exercise 2(d)¶
$$ A = \begin{bmatrix} 0 & 1 \\ -6 & 5 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 1 \\ 3 \end{bmatrix}, \begin{bmatrix} 1 \\ 2 \end{bmatrix} \right\}. $$
Exercise 2(e)¶
$$ A = \begin{bmatrix} 0 & 1 \\ -4 & 0 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 1 \\ 2 \end{bmatrix}, \begin{bmatrix} 1 \\ -2 \end{bmatrix} \right\}. $$
Exercise 3¶

以下練習說明有些時候儘管矩陣無法對角化,
還是可以把 $[f_A]_\beta^\beta$ 化成一定簡單的形式。
未來會學到這些例子叫喬丹標準型。

對以下的矩陣 $A$ 及基底 $\beta$,
求出 $[f_A]_\beta^\beta$。

The following exercises demonstrate some examples where we can find a basis to simplify $[f_A]_\beta^\beta$ even if the matrix is not diagonalizable.

For each of the following matrices $A$ and bases $\beta$, find $[f_A]_\beta^\beta$.

Exercise 3(a)¶
$$ A = \begin{bmatrix} \frac{1}{2} & -\frac{1}{2} \\ \frac{1}{2} & -\frac{1}{2} \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 1 \\ 1 \end{bmatrix}, \begin{bmatrix} 1 \\ -1 \end{bmatrix} \right\}. $$
Exercise 3(b)¶
$$ A = \begin{bmatrix} 0 & 1 \\ -4 & 4 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 2 \\ 4 \end{bmatrix}, \begin{bmatrix} -1 \\ 0 \end{bmatrix} \right\}. $$
Exercise 3(c)¶
$$ A = \begin{bmatrix} 0 & 1 \\ -9 & 6 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 3 \\ 9 \end{bmatrix}, \begin{bmatrix} -1 \\ 0 \end{bmatrix} \right\}. $$
Exercise 4¶

對以下的矩陣 $A$ 及基底 $\beta$,
求出 $[f_A]_\beta^\beta$。

For each of the following matrices $A$ and bases $\beta$, find $[f_A]_\beta^\beta$.

Exercise 4(a)¶
$$ A = \begin{bmatrix} 4 & 0 & -1 \\ 0 & 4 & -1 \\ -1 & -1 & 5 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix}, \begin{bmatrix} 1 \\ -1 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ -2 \end{bmatrix} \right\}. $$
Exercise 4(b)¶
$$ A = \begin{bmatrix} 2 & -2 & 3 \\ -2 & 2 & 3 \\ 3 & 3 & -3 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix}, \begin{bmatrix} 1 \\ -1 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ -2 \end{bmatrix} \right\}. $$
Exercise 4(c)¶
$$ A = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 6 & -11 & 6 \end{bmatrix} \quad\text{and}\quad \beta = \left\{ \begin{bmatrix} 1 \\ 3 \\ 9 \end{bmatrix}, \begin{bmatrix} 1 \\ 2 \\ 4 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} \right\}. $$
Exercise 5¶

令 $A$ 及 $B$ 為兩 $n\times n$ 矩陣,而 $Q$ 為一 $n\times n$ 可逆矩陣。

Let $A$ and $B$ be $n\times n$ matrices and $Q$ an $n\times n$ invertible matrix.

Exercise 5(a)¶

以矩陣運算說明

$$ Q^{-1}AQ + Q^{-1}BQ = Q^{-1}(A + B)Q. $$

By matrix arithemic, show that

$$ Q^{-1}AQ + Q^{-1}BQ = Q^{-1}(A + B)Q. $$
Exercise 5(b)¶

利用 $f_A + f_B = f_{A + B}$ 的性質說明

$$ Q^{-1}AQ + Q^{-1}BQ = Q^{-1}(A + B)Q. $$

Use the fact $f_A + f_B = f_{A + B}$ to show that

$$ Q^{-1}AQ + Q^{-1}BQ = Q^{-1}(A + B)Q. $$
Exercise 5(c)¶

以矩陣運算說明

$$ (Q^{-1}AQ)^n = Q^{-1}A^nQ. $$

By matrix arithemic, show that

$$ (Q^{-1}AQ)^n = Q^{-1}A^nQ. $$
Exercise 5(d)¶

利用 $f_A \circ \cdots \circ f_A = f_{A^n}$ 的性質說明

$$ (Q^{-1}AQ)^n = Q^{-1}A^nQ, $$

其中 $f_A \circ \cdots \circ f_A$ 是指將 $f_A$ 函數和自己合成 $n$ 次。

Use the fact $f_A \circ \cdots \circ f_A = f_{A^n}$ to show that

$$ (Q^{-1}AQ)^n = Q^{-1}A^nQ, $$

where $f_A \circ \cdots \circ f_A$ is the composition of $f_A$ with itself $n$ times.

Exercise 5(e)¶

說明若 $A$ 可逆,則

$$ (Q^{-1}AQ)^{-1} = Q^{-1}A^{-1}Q. $$

Show that

$$ (Q^{-1}AQ)^{-1} = Q^{-1}A^{-1}Q $$

if $A$ is an invertible matrix.

Exercise 6¶

對以下矩陣 $A$,利用 5(c) 的結果計算 $A^n$。

For the following matrices $A$, use the result in 5(c) to find $A^n$.

Exercise 6(a)¶
$$ A = \begin{bmatrix} 0 & 1 \\ -6 & 5 \end{bmatrix}. $$

(參考 2(d)。)

$$ A = \begin{bmatrix} 0 & 1 \\ -6 & 5 \end{bmatrix}. $$

See 2(d).

Exercise 6(b)¶
$$ A = \begin{bmatrix} 0 & 1 \\ -4 & 4 \end{bmatrix}. $$

(參考 3(b)。)

$$ A = \begin{bmatrix} 0 & 1 \\ -4 & 4 \end{bmatrix}. $$

See 3(b).

Exercise 7¶

令 $A$ 及 $B$ 為兩 $n\times n$ 矩陣,而 $Q$ 為一 $n\times n$ 可逆矩陣。
若 $Q^{-1}AQ$ 和 $Q^{-1}BQ$ 都是對角矩陣,證明 $AB = BA$。

Let $A$ and $B$ be $n\times n$ matrices and $Q$ an $n\times n$ invertible matrix. Suppose both $Q^{-1}AQ$ and $Q^{-1}BQ$ are diagonal matrices. Show that $AB = BA$.