Matrix exponential
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
We know the exponential function can be written as
$$ e^x = \frac{1}{0!} + \frac{1}{1!}x + \frac{1}{2!}x^2 + \cdots. $$In a similar way, the matrix exponential of a square matrix $A$ is defined as
$$ e^A = \frac{1}{0!}I + \frac{1}{1!}A + \frac{1}{2!}A^2 + \cdots. $$The computation of the matrix exponential can be a tedious work, at least by hand.
However, when $D$ is a diagonal matrix, its matrix exponential can be easily obtained by
Moreover, suppose $A$ is diagonalizable as $D = Q^{-1}AQ$ and $A = QDQ^{-1}$.
Then the matrix exponential can be computed as
執行以下程式碼。
令 $s_k = \sum_{r = 0}^k \frac{1}{r!}A^r$ 為計算 $e^A$ 時的部份和。
定義 $\|B - C\|^2$ 為 $B - C$ 矩陣各項的平方和。
Run the code below. Let $s_k = \sum_{r = 0}^k \frac{1}{r!}A^r$ be the partial sum of $e^A$. Define $\|B - C\|^2$ as the square sum of entries of $B - C$.
### code
set_random_seed(0)
print_ans = False
n = 2
A = matrix(n, random_int_list(n^2, 3))
pretty_print(LatexExpr("A ="), A)
tk = [identity_matrix(n), A]
for k in range(2,16):
tk.append(tk[-1] * A / k)
sk = tk[:1]
for k in range(1,16):
sk.append(sk[-1] + tk[k])
pretty_print(LatexExpr("s_{5} ="), N(sk[5]))
pretty_print(LatexExpr("s_{10} ="), N(sk[10]))
pretty_print(LatexExpr("s_{15} ="), N(sk[15]))
if print_ans:
print("| s5 - s10 |^2 =", (sk[5] - sk[10]).norm("frob"))
print("| s10 - s15 |^2 =", (sk[10] - sk[15]).norm("frob"))
在高等微積分會學到,在一個完備的空間裡
(像是 $\mathbb{R}$ 或是 $\mathbb{R}^n$ 或是跟矩陣長很像的 $\mathbb{R}^{n^2}$),
如果一個數列有 $\| s_n - s_m \|$ 隨著 $n,m$ 變大而距離愈來愈小,
則 $\{s_n\}$ 數列會收斂。
In the future analysis courses, we will learn that in a complete space (such as $\mathbb{R}$, $\mathbb{R}^n$, or $\mathbb{R}^{n^2}$, which has a similar stucture as matrices), any sequence $\{s_n\}$ with $\| s_n - s_m \|$ going to zero as $n,m$ goes to infinity will converge.
令 $O_n$ 為 $n\times n$ 的零矩陣,用定義計算 $e^{O_n}$。
Let $O_n$ be the $n\times n$ zero matrix. Find $e^{O_n}$ by definition.
令
$$ A = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}. $$依照以下步驟求出 $e^{tA}$,其中 $t$ 是變數。
Let
$$ A = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}. $$Use the given instructions to find $e^{tA}$, where $t$ is a variable.
計算 $A, A^2, A^3, A^4$ 並找出 $A^n$ 的規律。
Find $A, A^2, A^3, A^4$. Then find a pattern of $A^n$.
利用定義求出 $e^{tA}$,並解釋 $t$ 在旋轉矩陣中扮演的角色。
Find $e^{tA}$ by definition. Then explain what is the geometric meaning of $t$.
已知
$$ \begin{bmatrix} 4 & 0 \\ 0 & 6 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}^{-1} \begin{bmatrix} 5 & -1 \\ -1 & 5 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}. $$令
$$ A = \begin{bmatrix} 5 & -1 \\ -1 & 5 \end{bmatrix}. $$It is known that
$$ \begin{bmatrix} 4 & 0 \\ 0 & 6 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}^{-1} \begin{bmatrix} 5 & -1 \\ -1 & 5 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}. $$Let
$$ A = \begin{bmatrix} 5 & -1 \\ -1 & 5 \end{bmatrix}. $$已知
$$ \begin{bmatrix} 4 & 0 \\ 0 & -6 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}^{-1} \begin{bmatrix} -1 & 5 \\ 5 & -1 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}. $$令
$$ A = \begin{bmatrix} -1 & 5 \\ 5 & -1 \end{bmatrix}. $$It is known that
$$ \begin{bmatrix} 4 & 0 \\ 0 & -6 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}^{-1} \begin{bmatrix} -1 & 5 \\ 5 & -1 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}. $$Let
$$ A = \begin{bmatrix} -1 & 5 \\ 5 & -1 \end{bmatrix}. $$已知
$$ \begin{bmatrix} 2 & 0 \\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}^{-1} \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}. $$令
$$ A = \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}. $$It is known that
$$ \begin{bmatrix} 2 & 0 \\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}^{-1} \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}. $$Let
$$ A = \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}. $$已知
$$ \begin{bmatrix} 3 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & 6 \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 \\ 1 & -1 & 1 \\ 1 & 0 & -2 \end{bmatrix}^{-1} \begin{bmatrix} 4 & 0 & -1 \\ 0 & 4 & -1 \\ -1 & -1 & 5 \end{bmatrix} \begin{bmatrix} 1 & 1 & 1 \\ 1 & -1 & 1 \\ 1 & 0 & -2 \end{bmatrix}. $$令
$$ A = \begin{bmatrix} 4 & 0 & -1 \\ 0 & 4 & -1 \\ -1 & -1 & 5 \end{bmatrix}. $$It is known that
$$ \begin{bmatrix} 3 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & 6 \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 \\ 1 & -1 & 1 \\ 1 & 0 & -2 \end{bmatrix}^{-1} \begin{bmatrix} 4 & 0 & -1 \\ 0 & 4 & -1 \\ -1 & -1 & 5 \end{bmatrix} \begin{bmatrix} 1 & 1 & 1 \\ 1 & -1 & 1 \\ 1 & 0 & -2 \end{bmatrix}. $$Let
$$ A = \begin{bmatrix} 4 & 0 & -1 \\ 0 & 4 & -1 \\ -1 & -1 & 5 \end{bmatrix}. $$已知
$$ \begin{bmatrix} 3 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & -6 \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 \\ 1 & -1 & 1 \\ 1 & 0 & -2 \end{bmatrix}^{-1} \begin{bmatrix} 2 & -2 & 3 \\ -2 & 2 & 3 \\ 3 & 3 & -3 \end{bmatrix} \begin{bmatrix} 1 & 1 & 1 \\ 1 & -1 & 1 \\ 1 & 0 & -2 \end{bmatrix}. $$令
$$ A = \begin{bmatrix} 2 & -2 & 3 \\ -2 & 2 & 3 \\ 3 & 3 & -3 \end{bmatrix}. $$It is known that
$$ \begin{bmatrix} 3 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & -6 \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 \\ 1 & -1 & 1 \\ 1 & 0 & -2 \end{bmatrix}^{-1} \begin{bmatrix} 2 & -2 & 3 \\ -2 & 2 & 3 \\ 3 & 3 & -3 \end{bmatrix} \begin{bmatrix} 1 & 1 & 1 \\ 1 & -1 & 1 \\ 1 & 0 & -2 \end{bmatrix}. $$Let
$$ A = \begin{bmatrix} 2 & -2 & 3 \\ -2 & 2 & 3 \\ 3 & 3 & -3 \end{bmatrix}. $$已知
$$ \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 3 & 2 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 \\ -6 & 5 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 3 & 2 \end{bmatrix}. $$令
$$ A = \begin{bmatrix} 0 & 1 \\ -6 & 5 \end{bmatrix}. $$It is known that
$$ \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 3 & 2 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 \\ -6 & 5 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 3 & 2 \end{bmatrix}. $$Let
$$ A = \begin{bmatrix} 0 & 1 \\ -6 & 5 \end{bmatrix}. $$已知
$$ \begin{bmatrix} 2 & 0 \\ 0 & -2 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 2 & -2 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 \\ -4 & 0 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 2 & -2 \end{bmatrix}. $$令
$$ A = \begin{bmatrix} 0 & 1 \\ -4 & 0 \end{bmatrix}. $$It is known that
$$ \begin{bmatrix} 2 & 0 \\ 0 & -2 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 2 & -2 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 \\ -4 & 0 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 2 & -2 \end{bmatrix}. $$Let
$$ A = \begin{bmatrix} 0 & 1 \\ -4 & 0 \end{bmatrix}. $$已知
$$ \begin{bmatrix} 2 & 1 \\ 0 & 2 \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ 4 & 0 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 \\ -4 & 4 \end{bmatrix} \begin{bmatrix} 2 & -1 \\ 4 & 0 \end{bmatrix}. $$令
$$ A = \begin{bmatrix} 0 & 1 \\ -4 & 4 \end{bmatrix}. $$It is known that
$$ \begin{bmatrix} 2 & 1 \\ 0 & 2 \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ 4 & 0 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 \\ -4 & 4 \end{bmatrix} \begin{bmatrix} 2 & -1 \\ 4 & 0 \end{bmatrix}. $$Let
$$ A = \begin{bmatrix} 0 & 1 \\ -4 & 4 \end{bmatrix}. $$已知
$$ \begin{bmatrix} 3 & 1 \\ 0 & 3 \end{bmatrix} = \begin{bmatrix} 3 & -1 \\ 9 & 0 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 \\ -9 & 6 \end{bmatrix} \begin{bmatrix} 3 & -1 \\ 9 & 0 \end{bmatrix}. $$令
$$ A = \begin{bmatrix} 0 & 1 \\ -9 & 6 \end{bmatrix}. $$It is known that
$$ \begin{bmatrix} 3 & 1 \\ 0 & 3 \end{bmatrix} = \begin{bmatrix} 3 & -1 \\ 9 & 0 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 \\ -9 & 6 \end{bmatrix} \begin{bmatrix} 3 & -1 \\ 9 & 0 \end{bmatrix}. $$Let
$$ A = \begin{bmatrix} 0 & 1 \\ -9 & 6 \end{bmatrix}. $$經由以下步驟說明 $\dot{\bx} = A\bx$ 的解就是 $e^{tA}\bc$,
其中 $\bc = (c_1,\ldots, c_n)$ 是一個控制常數的向量。
Use the given instructions to show that $e^{tA}\bc$ represents all the solutions of the equation $\dot{\bx} = A\bx$, where $\bc = (c_1,\ldots, c_n)$ is a vector of constant terms.
若 $A$ 可被對角化為 $D = Q^{-1}AQ$。
令 $Q\by = \bx$。
首先說明 $\dot{\by} = D\by$ 的解就是 $e^{Dt}\bd$,
其中 $\bd = (d_1,\ldots, d_n)$ 可以是任何常數。
Suppose $A$ is diagonalizable and has $D = Q^{-1}AQ$ for some diagonal matrix $D$. Let $Q\by = \bx$. First, show that $e^{Dt}\bd$ represents all the solutions of the equation $\dot{\by} = D\by$, where $\bd = (d_1,\ldots, d_n)$ is a vector of constant terms.
藉由 $\bx = Q^{-1}\by$ 來得到 $\bx = e^{tA}\bc$,
其中 $\bc = Q\bd$ 是一組獨立的常數(因為 $Q$ 可逆)。
Let $\bx = Q^{-1}\by$. Explain why $\bx = e^{tA}\bc$ represents all the solutions to the equation, where $\bc = Q\bd$ is composed of independent constants (since $Q$ is invertible).
如果 $A$ 不可對角化則必須仰賴喬丹標準型,但 $e^{tA}\bc$ 這個公式還是正確的。
If $A$ is not diagonalizable, then we need to find the Jordan canonical form of $A$, but the formula $e^{tA}\bc$ is still the general solution.