owned this note
owned this note
Published
Linked with GitHub
# 慣性
Inertia

This work by Jephian Lin is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
$\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}}$
```python
from lingeo import random_int_list
from sym import sym_from_list, inertia
```
## Main idea
Let $A$ be an $n\times n$ symmetric matrix.
According to the spectral theorem, all eigenvalues of $A$ are real, so they can be arranged from small to large on the real line.
Let $n_+(A)$, $n_-(A)$, and $n_0(A)$ be the number of positive, negative, and zero eigenvalues of $A$, respectively.
Then the **inertia** of $A$ is defined as
$$
\iner(A) = (n_+(A), n_-(A), n_0(A)).
$$
Two symmetric matrices $A$ and $B$ are **congruent** if there is an invertible matrix $Q$ such that
$$
Q\trans AQ = B.
$$
Notice that $Q$ _has to_ be invertible, yet it is $Q\trans$ in the relation.
##### Sylvester's law of inertia
If two symmetric matrices are congruent, then they have the same inertia.
Moreover, every real symmetric matrix $A$ is congruent to a matrix of the form
$$
\begin{bmatrix}
I_p & ~ & ~ \\
~ & -I_q & ~ \\
~ & ~ & O_r
\end{bmatrix},
$$
where $p = n_+(A)$, $q = n_-(A)$, and $r = n_0(A)$.
Since every invertible matrix can be decomposed into the product of some elementary matrix.
Two symmetric matrices $A$ and $B$ are congruent means there are elementary matrices $E_1,\ldots, E_k$ such that
$$
E_k\trans\cdots E_1\trans AE_1\cdots E_k = B.
$$
That is, applying some symmetric row/column operations simultaneously to $A$ will result in $B$.
## Side stories
- quadratic form
- local optimum by derivatives
## Experiments
##### Exercise 1
執行以下程式碼。
<!-- eng start -->
Run the code below.
<!-- eng end -->
```python
### code
set_random_seed(0)
print_ans = False
n = 3
entries = [1,1] + random_int_list(binomial(n+1,2) - 2, 3)
A = sym_from_list(n, entries)
pretty_print(LatexExpr("A ="), A)
if print_ans:
B = copy(A)
B.add_multiple_of_row(1,0,-1)
B.add_multiple_of_column(1,0,-1)
print("A after row/column operation:")
show(B)
print("(n+, n-, n0) =", inertia(A))
```
##### Exercise 1(a)
對 $A$ 進行列運算 $\rho_2:-\rho_1$、再進行行運算 $\kappa_2:-\kappa_1$ 的結果為何?
<!-- eng start -->
Apply the row operation $\rho_2:-\rho_1$ and the column operation $\kappa_2:-\kappa_1$ to $A$. What is the result?
<!-- eng end -->
$Ans:$
After executing the above code with `seed = 1`, we know
$$
A = \begin{bmatrix}
1 & 1 & 3 \\
1 & -1 & 1 \\
3 & 1 & -2 \\
\end{bmatrix}.
$$
The result of appling the row operation $\rho_2:-\rho_1$ and the column operation $\kappa_2:-\kappa_1$ to $A$ is
$$
A_1 = \begin{bmatrix}
1 & 0 & 3 \\
0 & -2 & -2 \\
3 & -2 & -2 \\
\end{bmatrix}.
$$
##### Exercise 1(b)
將 $A$ 進行一系列對稱的行列運算,讓它變成對角矩陣且對角線上只有 $1$、$0$、$-1$。
求 $\iner(A)$。
<!-- eng start -->
Apply some symmetric row/column operations simultaneously to $A$ so that it becomes a diagonal matrix with $1$, $0$, or $-1$ on the diagonal. Find $\iner(A)$.
<!-- eng end -->
$Ans:$
Apply the following symmetric row/column operations simultaneously to $A$.
$$
\begin{bmatrix}
1 & 0 & 0 \\
-1 & 1 & 0 \\
0 & 0 & 1 \\
\end{bmatrix}
\begin{bmatrix}
1 & 1 & 3 \\
1 & -1 & 1 \\
3 & 1 & -2 \\
\end{bmatrix}
\begin{bmatrix}
1 & -1 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{bmatrix} = A_1 =
\begin{bmatrix}
1 & 0 & 3 \\
0 & -2 & -2 \\
3 & -2 & -2 \\
\end{bmatrix}.
$$
$$
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
-3 & 0 & 1 \\
\end{bmatrix}
\begin{bmatrix}
1 & 0 & 3 \\
0 & -2 & -2 \\
3 & -2 & -2 \\
\end{bmatrix}
\begin{bmatrix}
1 & 0 & -3 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{bmatrix} = A_2 =
\begin{bmatrix}
1 & 0 & 0 \\
0 & -2 & -2 \\
0 & -2 & -11 \\
\end{bmatrix}.
$$
$$
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & -1 & 1 \\
\end{bmatrix}
\begin{bmatrix}
1 & 0 & 0 \\
0 & -2 & -2 \\
0 & -2 & -11 \\
\end{bmatrix}
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & -1 \\
0 & 0 & 1 \\
\end{bmatrix} = A_3 =
\begin{bmatrix}
1 & 0 & 0 \\
0 & -2 & 0 \\
0 & 0 & -9 \\
\end{bmatrix}.
$$
$$
\begin{bmatrix}
1 & 0 & 0 \\
0 & \frac{2}{\sqrt{2}} & 0 \\
0 & 0 & 1 \\
\end{bmatrix}
\begin{bmatrix}
1 & 0 & 0 \\
0 & -2 & 0 \\
0 & 0 & -9 \\
\end{bmatrix}
\begin{bmatrix}
1 & 0 & 0 \\
0 & \frac{2}{\sqrt{2}} & 0 \\
0 & 0 & 1 \\
\end{bmatrix} = A_4 =
\begin{bmatrix}
1 & 0 & 0 \\
0 & -1 & 0 \\
0 & 0 & -9 \\
\end{bmatrix}.
$$
$$
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & \frac{1}{3} \\
\end{bmatrix}
\begin{bmatrix}
1 & 0 & 0 \\
0 & -1 & 0 \\
0 & 0 & -9 \\
\end{bmatrix}
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & \frac{1}{3} \\
\end{bmatrix} = A_5 =
\begin{bmatrix}
1 & 0 & 0 \\
0 & -1 & 0 \\
0 & 0 & -1 \\
\end{bmatrix}.
$$
we can find $\iner(A) = (1,2,0)$ .
:::info
What do the experiments try to tell you? (open answer)
...
:::
## Exercises
##### Exercise 2
求以下矩陣 $A$ 的 $\iner(A)$。
<!-- eng start -->
Find $\iner(A)$ for the following matrices.
<!-- eng end -->
##### Exercise 2(a)
$$
A = \begin{bmatrix}
1 & 1 \\
1 & 1
\end{bmatrix}.
$$
$Ans:$
$$
\begin{aligned}
p_A(x) &= \det(A-xI)\\
&= x^2 - 2x\\
&= x (x - 2),\\
\end{aligned}
$$
When $p_A(x)=0$, we get $\spec(A) = \{0,2\}$.
Hence, we can know that $\iner(A) = (1,0,1)$.
##### Exercise 2(b)
$$
A = \begin{bmatrix}
0 & 1 \\
1 & 0
\end{bmatrix}.
$$
$Ans:$
$$
\begin{aligned}
p_A(x) &= \det(A-xI)\\
&= x^2 - 1\\
&= (x + 1)(x - 1),\\
\end{aligned}
$$
When $p_A(x)=0$, we get $\spec(A) = \{-1,1\}$.
Hence, we can know that $\iner(A) = (1,1,0)$.
##### Exercise 2(c)
$$
A = \begin{bmatrix}
1 & 1 & 1 \\
1 & 1 & 1 \\
1 & 1 & 1 \\
\end{bmatrix}.
$$
$Ans:$
$$
\begin{aligned}
p_A(x) &= s_0(-x)^3 + s_1(-x)^2 + s_2(-x) + s_3\\
&= (-1)x^3 + 3x^2 \\
&= -x^2(x - 3),
\end{aligned}
$$
When $p_A(x)=0$, we get $\spec(A) = \{0,0,3\}$.
Hence, we can know that $\iner(A) = (1,0,2)$.
##### Exercise 2(d)
$$
A = \begin{bmatrix}
0 & 1 & 1 \\
1 & 0 & 1 \\
1 & 1 & 0 \\
\end{bmatrix}.
$$
$Ans:$
$$
\begin{aligned}
p_A(x) &= s_0(-x)^3 + s_1(-x)^2 + s_2(-x) + s_3\\
&= (-1)x^3 + 3x + 2 \\
&=-(x + 1)(x^2 - x - 2 ) \\
&=-(x + 1)^2(x - 2),
\end{aligned}
$$
When $p_A(x)=0$, we get $\spec(A) = \{-1,-1,2\}$.
Hence, we can know that $\iner(A) = (1,2,0)$.
##### Exercise 3
一個矩陣 $A$ 的 **二次型(quadratic form)** 指的是長得像 $\bx\trans A\bx$ 的式子。
證明以下關於二次型的性質。
<!-- eng start -->
The **quadratic form** of a matrix $A$ is any expression of the form $\bx\trans A\bx$. Prove the following properties about the quadratic form.
<!-- eng end -->
##### Exercise 3(a)
令
$$
A = \begin{bmatrix}
2 & -1 \\
-1 & 2
\end{bmatrix}, \quad
\bx = \begin{bmatrix} x \\ y \end{bmatrix}.
$$
證明 $\bx\trans A\bx \geq 0$。
提示:展開後並將其寫成 $1(ax + by)^2 + 3(cx+dy)^2$。
<!-- eng start -->
Let
$$
A = \begin{bmatrix}
2 & -1 \\
-1 & 2
\end{bmatrix}, \quad
\bx = \begin{bmatrix} x \\ y \end{bmatrix}.
$$
Prove that $\bx\trans A\bx \geq 0$.
Hint: Expand it and try to write it into the form of $1(ax + by)^2 + 3(cx+dy)^2$.
<!-- eng end -->
$Ans:$
$$\bx\trans A\bx=
\begin{bmatrix}
x & y
\end{bmatrix}
\begin{bmatrix}
2 & -1 \\
-1 &2 \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}
=
\begin{bmatrix}
2x^2 - 2xy + 2y^2
\end{bmatrix}.
$$
And $2x^2 - 2xy + 2y^2$ can be written as
$1( \frac{1}{\sqrt{2}} x + \frac{1}{\sqrt{2}}y )^2 + 3( \frac{1}{\sqrt{2}}x + (\frac{-1}{\sqrt{2}})y )^2$.
$( \frac{1}{\sqrt{2}} x + \frac{1}{\sqrt{2}}y )^2$ and $( \frac{1}{\sqrt{2}}x + (\frac{-1}{\sqrt{2}})y )^2$ are either positive or zero.
So $\bx\trans A\bx \geq 0$.
##### Exercise 3(b)
令 $A$ 為一 $2\times 2$ 實對稱矩陣,且其特徵值為 $\lambda_1,\lambda_2$。
令
$$
\bx = \begin{bmatrix} x \\ y \end{bmatrix}.
$$
證明 $\bx\trans A\bx$ 可寫成 $\lambda_1(ax + by)^2 + \lambda_2(cx + dy)^2$ 的形式。
<!-- eng start -->
Let $A$ be a $2\times 2$ real symmetric matrix with eigenvalues $\lambda_1,\lambda_2$. Let
$$
\bx = \begin{bmatrix} x \\ y \end{bmatrix}.
$$
Show that $\bx\trans A\bx$ can be written as $\lambda_1(ax + bx)^2 + \lambda_2(cx + dy)^2$.
$Ans:$
Because $A$ is an $2\times 2$ real symmetric matrix.
From spectral theorem: There exists an orthogonal matrix
$$
Q=\begin{bmatrix}
a & c \\
b & d \\
\end{bmatrix}
$$ such that $Q\trans AQ=D$ is diagonal and
$$
D=\begin{bmatrix}
\lambda_1 & 0 \\
0 & \lambda_2 \\
\end{bmatrix}.
$$
Then,
$$
\bx\trans A\bx=\bx\trans QDQ\trans\bx
=
\begin{bmatrix}
x & y
\end{bmatrix}
\begin{bmatrix}
a & c \\
b & d \\
\end{bmatrix}
\begin{bmatrix}
\lambda_1 & 0 \\
0 & \lambda_2 \\
\end{bmatrix}
\begin{bmatrix}
a & b \\
c & d \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
\end{bmatrix}=
$$
$$
\begin{bmatrix}
ax+by & cx+dy
\end{bmatrix}
\begin{bmatrix}
\lambda_1 & 0 \\
0 & \lambda_2 \\
\end{bmatrix}
\begin{bmatrix}
ax+by \\
cx+dy \\
\end{bmatrix}
=
\lambda_1(ax + by)^2 + \lambda_2(cx + dy)^2
$$
<!-- eng end -->
##### Exercise 3(c)
令 $A$ 為一 $2\times 2$ 實對稱矩陣,且其特徵值為 $\lambda_1,\lambda_2$。
證明:
1. 若 $\lambda_1, \lambda_2 \geq 0$ 時,$\bx\trans A\bx \geq 0$。
2. 若 $\lambda_1, \lambda_2 \leq 0$ 時,$\bx\trans A\bx \leq 0$。
3. 若 $\lambda_1, \lambda_2 > 0$ 且 $\bx\neq\bzero$ 時,$\bx\trans A\bx > 0$。
4. 若 $\lambda_1, \lambda_2 < 0$ 且 $\bx\neq\bzero$ 時,$\bx\trans A\bx < 0$。
<!-- eng start -->
Let $A$ be a $2\times 2$ real symmetric matrix with eigenvalues $\lambda_1,\lambda_2$. Show the following:
1. If $\lambda_1, \lambda_2 \geq 0$, then $\bx\trans A\bx \geq 0$.
2. If $\lambda_1, \lambda_2 \leq 0$, then $\bx\trans A\bx \leq 0$.
3. If $\lambda_1, \lambda_2 > 0$ and $\bx\neq\bzero$, then $\bx\trans A\bx > 0$.
4. If $\lambda_1, \lambda_2 < 0$ and $\bx\neq\bzero$, then $\bx\trans A\bx < 0$.
<!-- eng end -->
##### Exercise 4
令 $A$ 為一 $2\times 2$ 實對稱矩陣。
證明:
1. 若 $\det(A) > 0$ 且 $\tr(A) > 0$,則 $\iner(A) = (2,0,0)$。
2. 若 $\det(A) > 0$ 且 $\tr(A) < 0$,則 $\iner(A) = (0,2,0)$。
3. 若 $\det(A) < 0$,則 $\iner(A) = (1,1,0)$。
<!-- eng start -->
Let $A$ be a $2\times 2$ real symmetric matrix. Show the following:
1. If $\det(A) > 0$ and $\tr(A) > 0$, then $\iner(A) = (2,0,0)$.
2. If $\det(A) > 0$ and $\tr(A) < 0$, then $\iner(A) = (0,2,0)$.
3. If $\det(A) < 0$, then $\iner(A) = (1,1,0)$.
<!-- eng end -->
##### Exercise 5
令 $f: \mathbb{R}^2 \rightarrow \mathbb{R}$ 為一二次可微函數且其微分連續。
令 $(x_0,y_0)\in\mathbb{R}^2$ 為一點、
而 $f_{xx}, f_{xy} = f_{yx}, f_{yy}$ 分別為 $f$ 對 $x$ 或 $y$ 的二次微分。
令
$$
A = \begin{bmatrix}
f_{xx} & f_{yx} \\
f_{xy} & f_{yy}
\end{bmatrix}, \quad
\bx = \begin{bmatrix} x \\ y_0 + y \end{bmatrix}.
$$
已知 $f$ 的函數值可以用
$$
f(x_0 + x, y_0 + y) \sim f(x_0, y_0) + \bx\trans A \bx
$$
逼近。
說明為什麼:
1. 若 $\det(A) > 0$ 且 $\tr(A) > 0$,則 $f$ 在 $(x_0,y_0)$ 有局部最小值。
2. 若 $\det(A) > 0$ 且 $\tr(A) < 0$,則 $f$ 在 $(x_0,y_0)$ 有局部最大值。
3. 若 $\det(A) < 0$,則 $f$ 在 $(x_0,y_0)$ 為𩣑點。
<!-- eng start -->
Let $f: \mathbb{R}^2 \rightarrow \mathbb{R}$ be a function whose second derivatives exist and are continuous. Let $(x_0,y_0)\in\mathbb{R}^2$ be a point and $f_{xx}, f_{xy} = f_{yx}, f_{yy}$ the second partial derivatives of $f$ with respect to $x$ and $y$.
Let
$$
A = \begin{bmatrix}
f_{xx} & f_{yx} \\
f_{xy} & f_{yy}
\end{bmatrix}, \quad
\bx = \begin{bmatrix} x \\ y_0 + y \end{bmatrix}.
$$
It is known that the approximation
$$
f(x_0 + x, y_0 + y) \sim f(x_0, y_0) + \bx\trans A \bx
$$
holds.
Give some intuitive reasons to the following facts.
1. If $\det(A) > 0$ and $\tr(A) > 0$, then $f$ has a local minimum at $(x_0,y_0)$.
2. If $\det(A) > 0$ and $\tr(A) < 0$, then $f$ has a local maximum at $(x_0,y_0)$.
3. If $\det(A) < 0$, then $f$ has a saddle point at $(x_0,y_0)$.
<!-- eng end -->
##### Exercise 6
利用以下步驟證明西爾維斯特慣性定理。
<!-- eng start -->
Use the given instructions to prove Sylvester's law of inertia.
##### Sylvester's law of inertia
If two symmetric matrices are congruent, then they have the same inertia.
<!-- eng end -->
##### Exercise 6(a)
定義
$$
E(t) = \begin{bmatrix}
1 & t \\
0 & 1
\end{bmatrix}.
$$
說明 $E(t)\trans AE(t)$ 在任何 $t\in\mathbb{R}$ 時都有相同的零維數。
<!-- eng start -->
Define
$$
E(t) = \begin{bmatrix}
1 & t \\
0 & 1
\end{bmatrix}.
$$
Show that $E(t)\trans AE(t)$ has the same nullity for any $t\in\mathbb{R}$.
<!-- eng end -->
##### Exercise 6(b)
定義
$$
E(t) = \begin{bmatrix}
t & 0 \\
0 & 1
\end{bmatrix}.
$$
說明 $E(t)\trans AE(t)$ 在任何 $t > 0$ 時都有相同的零維數。
<!-- eng start -->
Define
$$
E(t) = \begin{bmatrix}
t & 0 \\
0 & 1
\end{bmatrix}.
$$
Show that $E(t)\trans AE(t)$ has the same nullity for any $t > 0$.
<!-- eng end -->
##### Exercise 6(c)
定義
$$
E = \begin{bmatrix}
-1 & 0 \\
0 & 1
\end{bmatrix}.
$$
說明 $\iner(E\trans AE) = \iner(A)$。
<!-- eng start -->
Define
$$
E = \begin{bmatrix}
-1 & 0 \\
0 & 1
\end{bmatrix}.
$$
Show that $\iner(E\trans AE) = \iner(A)$.
<!-- eng end -->
##### Exercise 6(d)
已知矩陣的特徵值會隨矩陣的數值連續變動。
利用這個性質證明西爾維斯特慣性定理。
<!-- eng start -->
It is known that the eigenvalues is a continuous function of the entries of the matrix. Use this fact to prove Sylvester's law of inertia.
<!-- eng end -->
:::info
collaboration: 2
3 problems: 3
- 2abc
extra: 1.5
- 2d, 3ab
moderator: 1
qc: 1
:::