線性微分方程¶

Linear differential equation

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¶

In this section, every function, such as $x$ and $y$, are from $\mathbb{R}$ to $\mathbb{R}$ in variable $t$.
We will use the notation $\dot{x}$ and $x'$ interchangeably for $\frac{dx}{dt}$.
Note that the derivative is taken with respect to $t$ but not to $x$.

Some differential equations are easy to be solved.
For example, the solution to the equation

$$ \dot{x} = kx $$

is $x = C_1e^{kt}$ for any constant $C_1\in\mathbb{R}$.
And one may try that the solution to the equation

$$ \dot{x} = kx + C_1e^{kt} $$

is $x = (C_2 + C_1t)e^{kt}$ for any constant $C_2\in\mathbb{R}$.
(To see these are all the solutions relies on the Picard–Lindelöf theorem.)

Let $x_1$ and $x_2$ be functions in variable $t$.
The system

$$ \begin{aligned} \dot{x}_1 &= ax_1 + bx_2 \\ \dot{x}_2 &= cx_1 + dx_2 \end{aligned} $$

is called a homogeneous system of first-order linear differential equation.

One may write

$$ \bx = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}, \quad \dot{\bx} = \begin{bmatrix} \dot{x}_1 \\ \dot{x}_2 \end{bmatrix}, \text{ and}\quad A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}. $$

Then the system becomes

$$ \dot{\bx} = A\bx. $$

If $A$ is diagonalizable as $D = Q^{-1}AQ$, we may set $Q\by = \bx$ for some $\by = \begin{bmatrix} y_1 \\ y_2 \end{bmatrix}$.
Since $Q$ is a constant matrix, $\dot{\bx} = \dot{(Q\by)} = Q\dot{\by}$. Thus, the original system becomes

$$ \dot{\by} = Q^{-1}AQ \by = D\by, $$

which is much easier to be solved.
Once $\by$ is solved, $\bx$ can be found by $\bx = Q\by$.

Side stories¶

  • higher order differential equation

Experiments¶

Exercise 1¶

執行以下程式碼。

Run the code below.

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

lam1,lam2 = random_int_list(2, 3)
Q = random_good_matrix(2,2,2)
A = Q * diagonal_matrix([lam1, lam2]) * Q.inverse()

pretty_print(LatexExpr(r"\dot{x}_1 = (%s)x_1 + (%s)x_2"%(A[0,0],A[0,1])))
pretty_print(LatexExpr(r"\dot{x}_2 = (%s)x_1 + (%s)x_2"%(A[1,0],A[1,1])))

t = var("t")
y = vector([exp(lam1 * t), exp(lam2 * t)])
x = Q * y
pretty_print(LatexExpr("x_1 ="), x[0])
pretty_print(LatexExpr("x_2 ="), x[1])

if print_ans:
    pretty_print(LatexExpr(r"\dot{x}_1 ="), x[0].derivative(t))
    pretty_print(LatexExpr(r"\dot{x}_2 ="), x[1].derivative(t))
Exercise 1(a)¶

計算 $\dot{x}_1$ 及 $\dot{x}_2$。

Find $\dot{x}_1$ and $\dot{x}_2$.

Exercise 1(b)¶

驗證題目給的 $x_1$ 和 $x_2$ 是否滿足給定的微分方程組。

Verify that $x_1$ and $x_2$ are solutions to the system of differential equations.

Exercises¶

Exercise 2¶

解以下的微分方程組。
(請記得加上該有的常數。)

Solve the following differential equation. (Note that constant terms are important.)

Exercise 2(a)¶

已知

$$ \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}. $$

解微分方程組:

$$ \begin{aligned} \dot{x}_1 &= 5x_1 - x_2 \\ \dot{x}_2 &= -x_1 + 5x_2 \end{aligned} $$

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}. $$

Solve the system of differential equations:

$$ \begin{aligned} \dot{x}_1 &= 5x_1 - x_2 \\ \dot{x}_2 &= -x_1 + 5x_2 \end{aligned} $$
Exercise 2(b)¶

已知

$$ \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}. $$

解微分方程組:

$$ \begin{aligned} \dot{x}_1 &= -x_1 + 5x_2 \\ \dot{x}_2 &= 5x_1 - x_2 \end{aligned} $$

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}. $$

Solve the system of differential equations:

$$ \begin{aligned} \dot{x}_1 &= -x_1 + 5x_2 \\ \dot{x}_2 &= 5x_1 - x_2 \end{aligned} $$
Exercise 2(c)¶

已知

$$ \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}. $$

解微分方程組:

$$ \begin{aligned} \dot{x}_1 &= x_1 + x_2 \\ \dot{x}_2 &= x_1 + x_2 \end{aligned} $$

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}. $$

Solve the system of differential equations:

$$ \begin{aligned} \dot{x}_1 &= x_1 + x_2 \\ \dot{x}_2 &= x_1 + x_2 \end{aligned} $$
Exercise 3¶

解以下的微分方程組。
(請記得加上該有的常數。)

Solve the following differential equation. (Note that constant terms are important.)

Exercise 3(a)¶

已知

$$ \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}. $$

解微分方程組:

$$ \begin{aligned} \dot{x}_1 &= 4x_1 + 0x_2 - x_3 \\ \dot{x}_2 &= 0x_1 + 4x_2 - x_3 \\ \dot{x}_3 &= -x_1 - x_2 + 5x_3 \end{aligned} $$

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}. $$

Solve the system of differential equations:

$$ \begin{aligned} \dot{x}_1 &= 4x_1 + 0x_2 - x_3 \\ \dot{x}_2 &= 0x_1 + 4x_2 - x_3 \\ \dot{x}_3 &= -x_1 - x_2 + 5x_3 \end{aligned} $$
Exercise 3(b)¶

已知

$$ \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}. $$

解微分方程組:

$$ \begin{aligned} \dot{x}_1 &= 2x_1 - 2x_2 + 3x_3 \\ \dot{x}_2 &= -2x_1 + 2x_2 + 3x_3 \\ \dot{x}_3 &= 3x_1 + 3x_2 - 3x_3 \end{aligned} $$

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}. $$

Solve the system of differential equations:

$$ \begin{aligned} \dot{x}_1 &= 2x_1 - 2x_2 + 3x_3 \\ \dot{x}_2 &= -2x_1 + 2x_2 + 3x_3 \\ \dot{x}_3 &= 3x_1 + 3x_2 - 3x_3 \end{aligned} $$
Exercise 4¶

對於高階的線性微分方程 $y'' + c_1 y' + c_2 y = 0$,
我們也可以寫成矩陣形式。
令

$$ \by = \begin{bmatrix} y \\ y' \end{bmatrix}, \quad \dot{\by} = \begin{bmatrix} y' \\ y'' \end{bmatrix},\text{ and}\quad A = \begin{bmatrix} 0 & 1 \\ -c_2 & -c_1 \end{bmatrix}. $$

則原方程式可以改寫為

$$ \dot{\by} = A\by. $$

解以下的微分方程。

For the higher-order differential equation $y'' + c_1 y' + c_2 y = 0$, we may let

$$ \by = \begin{bmatrix} y \\ y' \end{bmatrix}, \quad \dot{\by} = \begin{bmatrix} y' \\ y'' \end{bmatrix},\text{ and}\quad A = \begin{bmatrix} 0 & 1 \\ -c_2 & -c_1 \end{bmatrix}. $$

Then the differential equation can be written as

$$ \dot{\by} = A\by. $$

Solve the following differential equations.

Exercise 4(a)¶

已知

$$ \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}. $$

考慮微分方程 $y'' - 5y' + 6y = 0$。

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}. $$

Consider the differential equation $y'' - 5y' + 6y = 0$.

Exercise 4(b)¶

已知

$$ \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}. $$

考慮微分方程 $y'' + 0y' + 4y = 0$。

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}. $$

Consider the differential equation $y'' + 0y' + 4y = 0$.

Exercise 4(c)¶

已知

$$ \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}. $$

考慮微分方程 $y'' - 4y' + 4y = 0$。

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}. $$

Consider the differential equation $y'' - 4y' + 4y = 0$.

Exercise 4(d)¶

已知

$$ \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}. $$

考慮微分方程 $y'' - 6y' - 9y = 0$。

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}. $$

Consider the differential equation $y'' - 6y' - 9y = 0$.

Exercise 5¶

已知

$$ \begin{bmatrix} 3 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 \\ 3 & 2 & 1 \\ 9 & 4 & 1 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 6 & -11 & 6 \end{bmatrix} \begin{bmatrix} 1 & 1 & 1 \\ 3 & 2 & 1 \\ 9 & 4 & 1 \end{bmatrix}. $$

解微分方程 $y''' - 6y'' + 11y' - 6y = 0$。

It is known that

$$ \begin{bmatrix} 3 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 \\ 3 & 2 & 1 \\ 9 & 4 & 1 \end{bmatrix}^{-1} \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 6 & -11 & 6 \end{bmatrix} \begin{bmatrix} 1 & 1 & 1 \\ 3 & 2 & 1 \\ 9 & 4 & 1 \end{bmatrix}. $$

Consider the differential equation $y''' - 6y'' + 11y' - 6y = 0$.