Positivity
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, random_good_matrix
from sym import inertia
A real symmetric matrix $A$ is said to be positive definite or positive semidefinite if
$$ \bx\trans A\bx > 0 \quad\text{ or }\quad \bx\trans A\bx \geq 0, $$respectively, for any nonzero vector $\bx$.
A matrix $A$ is negative definite or negative semidefinite if $-A$ is positive definite or positive semidefinite, respectively.
In general, only positivity of a matrix only focus on real symmetric matrices (or complex Hermitian matrices).
That is, when we say a matrix is positive (semi)definite, we automatically assume it is symmetric.
It is known that a matrix $A$ is positive definite if and only if all its eigenvalues are positive.
Similarly, $A$ is positive semidefinite if and only if all its eigenvalues are nonnegative.
Note that an $n\times n$ positive semidefinite matrix $A$ is positive definite if and only if $\rank(A) = n$.
Let $A$ be an $n\times n$ positive semidefinite matrix of $\rank(A) = k$.
One may diagonalize it as $A = QDQ\trans $ by some orthogonal matrix $Q$ and diagonal matrix $D$.
Let $\lambda_1,\ldots,\lambda_k$ be the nonzero eigenvalues of $A$.
Then we have
for some $k\times n$ matrix $M$.
If a matrix $A$ can be written as $A = MM\trans$ for some matrix $M$, then $A$ is called a Gram matrix.
If $\br_1,\ldots,\br_n$ are the rows of $M$, then this means $A$ is a matrix of inner products;
that is, $A = \begin{bmatrix} \inp{\br_i}{\br_j} \end{bmatrix}$.
Indeed, a matrix is a Gram matrix if and only if it is positive semidefinite.
執行以下程式碼。
Run the code below.### code
set_random_seed(0)
print_ans = False
n = 3
while True:
eigs = random_int_list(n, 1)
if not all(eig == 0 for eig in eigs):
break
Q = random_good_matrix(n,n,n,2)
A = Q * diagonal_matrix(eigs) * Q.transpose()
pretty_print(LatexExpr("A ="), A)
print("eigenvalues =", A.eigenvalues())
if print_ans:
iner = inertia(A)
if iner[0] > 0:
while True:
x = vector(random_int_list(n))
if x.inner_product(A * x) > 0:
break
if iner[1] > 0:
while True:
y = vector(random_int_list(n))
if y.inner_product(A * y) < 0:
break
if iner[1] == 0:
if iner[2] == 0:
print("positive definite")
if iner[2] > 0:
print("positive semidefinite")
print("x =", x)
if iner[0] == 0:
if iner[2] == 0:
print("negative definite")
if iner[2] > 0:
print("negative semidefinite")
print("y =", y)
if iner[0] > 0 and iner[1] > 0:
print("none above")
print("x =", x)
print("y =", y)
判斷 $A$ 是否為正定、半正定、負定、半負定、或是皆不是。
Determine whether $A$ is positive definite, positive semidefinite, negative definite, negative semidefinite, or none of above.若 $A$ 為正定或半正定,找一個非零向量 $\bx$ 使得 $\bx\trans A\bx > 0$。
若 $A$ 為負定或半負定,找一個非零向量 $\by$ 使得 $\by\trans A\by < 0$。
若以上皆不是,找兩個非零向量 $\bx$ 和 $\by$ 使得 $\bx\trans A\bx > 0$ 而 $\by\trans A\by < 0$。
判斷以下矩陣是否為正定、半正定、皆不是。
For each of the following matrices, determine whether it is positive definite, positive semidefinite, or none of above.令 $A = \begin{bmatrix} a_{ij} \end{bmatrix}$ 為 $n\times n$ 一正定矩陣。
Let $A = \begin{bmatrix} a_{ij} \end{bmatrix}$ be an $n\times n$ positive definite matrix.證明對於所有 $i$ 都有 $a_{ii} \geq 0$。
Show that $a_{ii} \geq 0$ for each $i$.證明
$$ \sum_{i=1}^n\sum_{j=1}^n a_{ij} \geq 0. $$ Show that $$ \sum_{i=1}^n\sum_{j=1}^n a_{ij} \geq 0. $$證明以下關於(半)正定矩陣的相關性質。
Prove the following properties of positive (semi)definite matrices.正定矩陣的主子矩陣也是正定矩陣。
The principal submatrix of a positive definite matrix is again a positive definite matrix.正定矩陣加半正定矩陣是正定矩陣、
而半正定矩陣加半正定矩陣是半正定矩陣。
依照以下步驟證明以下敘述等價:
證明若 $A$ 有一特徵值 $\lambda\leq 0$,則存在一個非零向量 $\bx$ 使得 $\bx\trans A\bx \leq 0$。
因此若 $A$ 正定,則 $A$ 的特徵值均為正。
證明若 $A$ 的特徵值均為正,則對於所有非零向量 $\bx$ 都有 $\bx\trans A\bx > 0$。
(參考 607-3。)
證明以下敘述等價:
以下練習探討矩陣根號的概念。
The following exercises explore the notion of the square root of a matrix.證明若 $A$ 是一正定矩陣,
則其可寫成 $A = M^2$,
其中 $M$ 是對稱矩陣。
若 $A$ 是一正定矩陣、$B$ 為一對稱矩陣,
證明 $AB$ 的特徵值均為實數。
提示:證明 $AB$ 和某對稱矩陣相似。
Suppose $A$ is a positive definite matrix and $B$ is a symmetric matrix. Show that every eigenvalue of $AB$ is real. Hint: Show that $AB$ is similar to some symmetric matrix.回顧 213-5 中提到的廣義內積的定義。
以下練習說明廣義內積完全是由正定矩陣做出來的。
Recall the definition of an inner product in 213-5. The following exercises show that any inner product is the quadratic form of some positive definite matrix.令 $A$ 為一正定矩陣。
定義 $\inp{\bx}{\by}_A:=\by\trans A\bx$。
證明 $\inp{\cdot}{\cdot}_A$ 為一內積。
Let $A$ be a positive definite matrix. Define $\inp{\bx}{\by}_A:=\by\trans A\bx$. Show that $\inp{\cdot}{\cdot}_A$ is an inner product.令 $\inp{\cdot}{\cdot}$ 為一內積,
找一個矩陣 $A$ 使得對所有向量 $\bx$ 和 $\by$ 都有 $\inp{\bx}{\by} = \by\trans A\bx$。
驗證這個矩陣必須是正定的。
提示:選一些特別的 $\bx$ 和 $\by$ 來找到 $A$ 的各項。
Let $\inp{\cdot}{\cdot}$ be an inner product. Find a matrix $A$ such that $\inp{\bx}{\by} = \by\trans A\bx$ for any vectors $\bx$ and $\by$. Verify that this matrix must be positive definite. Hint: Substitute some particular $\bx$ and $\by$ to find the entries of $A$.