矩阵的特征分解

实对称矩阵的谱分解

实对称矩阵的特征值分解成为谱分解。给定一个 的实对称矩阵 ,其特征值分解可以写成

其中 为正交矩阵,每一列对应一个特征向量, 为对角矩阵,对角元素为特征值。

将矩阵 作用于二维向量 ,对应运算

将其拆解为三个连续变换

参考资料 中的例子,

对两个标准正交基做几何变换

首先 先做旋转变换,

做缩放,

$$

$$

最后 做旋转变换,

$$

$$


矩阵 的特征向量为

变换 对特征向量 的作用为

$$

$$

可视化的 Python 程序见附录。

瑞利商

给定实数矩阵 ,定义其瑞利商为

当向量 为矩阵特征向量时, 为对应的特征值

对于实对称矩阵 ,瑞利商的最大值为最大特征值,最小值为最小特征值,驻点对应所有特征向量。

圆锥曲线——椭圆

设椭圆半长轴的长度为 ,半短轴的长度为 ,椭圆的解析式为

写成矩阵乘法的形式

设单位向量 ,满足

矩阵 作用与 后得到椭圆上的向量 ,则

,则

非对称方阵的特征分解

Gram 矩阵

设矩阵 的矩阵, 的 Gram 矩阵为

形状为 ,是实对称矩阵,并且 Gram 矩阵是半正定矩阵,对于任意 维非零列向量

非对称方阵的 EVD

设矩阵 ,分解为

下面考查非对称矩阵 对标准正交基的作用,与对称矩阵不同的是 的几何变换

拆成两个矩阵相乘的形式

分别对应了 缩放剪切 的几何变换,同理

因为 ,因此 对于面积的影响可以相互抵消。因此矩阵 对于面积的影响全来自于

总得来说,非对称矩阵 表示为

对应的几何变换为 剪切 → 缩放 → 缩放 → 缩放 → 剪切


矩阵 的特征向量为

矩阵 对特征向量 的作用为

参考资料

Visualize-ML/Linear-Algebra-Made-Easy---Learn-with-Python-and-Visualization

附录

  • 可视化:分别从标准正交基和特征向量的角度看谱分解(Python 代码由 GPT-5.1 参考正文内容生成,仅供参考)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import numpy as np
import matplotlib.pyplot as plt


# Standard basis
e1 = np.array([1, 0])
e2 = np.array([0, 1])
# Specify eigenvectors and eigenvalues
v1 = np.array([np.sqrt(2)/2, -np.sqrt(2)/2]) # eigenvector for eigenvalue 2
v2 = np.array([np.sqrt(2)/2, np.sqrt(2)/2]) # eigenvector for eigenvalue 1/2

V = np.column_stack([v1, v2])
Lambda = np.diag([2, 0.5])
VT = V.T

# Construct A = V Λ V^T
A = V @ Lambda @ VT

# A acting on standard basis
Ae1 = A.dot(e1)
Ae2 = A.dot(e2)

# Unit circle
theta = np.linspace(0, 2*np.pi, 400)
circle = np.vstack([np.cos(theta), np.sin(theta)])
ellipse = A.dot(circle) # image of unit circle → ellipse

# A acting on eigenvectors (pure scaling)
Av1 = A.dot(v1)
Av2 = A.dot(v2)

# ------------------------------------------------------
# Visualization
# ------------------------------------------------------
fig, axes = plt.subplots(1, 2, figsize=(12, 6))

# ------------------------------------------------------
# Figure 1: Standard basis view
# ------------------------------------------------------
ax = axes[0]
ax.set_title("Spectral Decomposition from Standard Basis")
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
ax.axhline(0, color='gray')
ax.axvline(0, color='gray')
ax.set_aspect('equal')

# Unit circle
ax.plot(circle[0], circle[1], 'k--', label="Unit Circle")

# Ellipse
ax.plot(ellipse[0], ellipse[1], 'r', label="Ellipse = A(Unit Circle)")

# Standard basis
ax.arrow(0, 0, e1[0], e1[1], width=0.01, color='black', label='e1')
ax.arrow(0, 0, e2[0], e2[1], width=0.01, color='black', label='e2')

# A acting on basis vectors
ax.arrow(0, 0, Ae1[0], Ae1[1], width=0.01, color='red', label='A e1')
ax.arrow(0, 0, Ae2[0], Ae2[1], width=0.01, color='blue', label='A e2')

ax.legend(loc="upper left")


# ------------------------------------------------------
# Figure 2: Eigenvector basis view
# ------------------------------------------------------
ax = axes[1]
ax.set_title("Spectral Decomposition from Eigenvector Basis")
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
ax.axhline(0, color='gray')
ax.axvline(0, color='gray')
ax.set_aspect('equal')

# Unit circle
ax.plot(circle[0], circle[1], 'k--', label="Unit Circle")

# Ellipse
ax.plot(ellipse[0], ellipse[1], 'r', label="Ellipse = A(Unit Circle)")

# Eigenvectors
ax.arrow(0, 0, v1[0], v1[1], width=0.01, color='purple', label='v1')
ax.arrow(0, 0, v2[0], v2[1], width=0.01, color='brown', label='v2')

# Eigenvalues scaling the eigenvectors → ellipse axes
ax.arrow(0, 0, Av1[0], Av1[1], width=0.01, color='purple', alpha=0.6, label='lambda1 * v1')
ax.arrow(0, 0, Av2[0], Av2[1], width=0.01, color='brown', alpha=0.6, label='lambda2 * v2')

ax.legend(loc="upper left")

plt.tight_layout()
plt.show()
  • 可视化:圆锥曲线——椭圆(Python 代码由 GPT-5.1 参考正文内容生成,仅供参考)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import numpy as np
import matplotlib.pyplot as plt

# Ellipse parameters: semi-major axis λ1, semi-minor axis λ2
lambda_1 = 3.0
lambda_2 = 1.5

# Construct the diagonal matrix Λ
Lambda = np.diag([lambda_1, lambda_2])

# A = V Λ V^T, with V taken as a rotation matrix (angle is arbitrary)
theta = np.deg2rad(30) # ellipse rotation angle: 30°
V = np.array([[np.cos(theta), -np.sin(theta)],
[np.sin(theta), np.cos(theta)]])

A = V @ Lambda @ V.T

# Parametric form of the ellipse (unit circle → ellipse)
t = np.linspace(0, 2*np.pi, 400)
z = np.vstack([np.cos(t), np.sin(t)]) # points on the unit circle

# Apply A to z to get the ellipse: x = A z
x = A @ z

# Coordinate transformation y = V^T x (ellipse → axis-aligned ellipse)
y = V.T @ x

# ==== ==== ==== ==== ==== ====
# Visualization
# ==== ==== ==== ==== ==== ====
plt.figure(figsize=(7,7))
plt.plot(x[0, :], x[1, :], label='Ellipse x = A z', linewidth=2)
plt.plot(y[0, :], y[1, :], label='y = V^T x (Axis-aligned ellipse)', linestyle='--')

# Unit circle
plt.plot(z[0, :], z[1, :], label='Unit Circle z', linestyle=':')

# Draw axes
plt.axhline(0, color='black', linewidth=0.5)
plt.axvline(0, color='black', linewidth=0.5)

plt.gca().set_aspect('equal', 'box')
plt.legend()
plt.title("Ellipse Visualization by Matrix Transformations")
plt.xlabel("x1 / y1")
plt.ylabel("x2 / y2")
plt.grid(True)

plt.show()