矩阵特征值和特征向量详细计算过程

矩阵特征值和特征向量定义

$A$为n阶矩阵,若数$\lambda$和n维非0列向量$x$满足$Ax=λx$,那么数$\lambda$称为$A$的特征值,$x$称为$A$的对应于特征值$\lambda$的特征向量。式$Ax=λx$也可写成$(A-λE)x=0$,并且$|λE-A|$叫做$A$的特征多项式。当特征多项式等于0的时候,称为$A$的特征方程,特征方程是一个齐次线性方程组,求解特征值的过程其实就是求解特征方程的解。

$$ Ax = \lambda x \implies Ax = \lambda Ex \implies (\lambda E - A)x = 0 $$

$$
|\lambda E - A| =
\begin {vmatrix}
\lambda - a_{11} & -a_{12} & \cdots & -a_{1n} \
-a_{21} & \lambda - a_{22} & \cdots & -a_{2n} \
\vdots & \vdots & \ddots & \vdots \
-a_{n1} & -a_{n2} & \cdots & \lambda - a_{nn}
\end {vmatrix}
= 0
$$

特征值及特征向量计算

若已知

$$
A =
\begin {pmatrix}
4 & 2 & -5 \
6 & 4 & -9 \
5 & 3 & -7
\end {pmatrix}
$$

计算:A的特征值和特征向量

$$
|\lambda E - A| =
\begin {vmatrix}
\lambda - 4 & -2 & 5 \
-6 & \lambda - 4 & 9 \
-5 & -3 & \lambda + 7
\end {vmatrix}
= 0
$$

计算行列式得:

$$
(\lambda-4)(\lambda-4)(\lambda+7) + (-2)\times9\times(-5) + 5\times(-6)\times(-3) - \
(5\times(\lambda-4)\times(-5) + (-2)\times(-6)\times(\lambda+7) + (\lambda-4)\times9\times(-3)) = 0
$$

化简得:

$$
\lambda^2 * (\lambda-1) = 0
$$

得到特征值:

$$
\lambda_1 = 1, \lambda_2 = \lambda_3 = 0
$$

当 $ \lambda_1 = 1 \implies (E - A)x = 0 $

$E = \bigl( \begin{smallmatrix} 1 & 0 & 0 \ 0 & 1 & 0 \ 0 & 0 & 1 \end{smallmatrix} \bigr)$ 从而 $E - A = \bigl( \begin{smallmatrix} -3 & -2 & 5 \ -6 & -3 & 9 \ -5 & -3 & 8 \end{smallmatrix} \bigr)$ 化简得:$\bigl( \begin{smallmatrix} 0 & 1 & -1 \ 1 & 0 & -1 \ 0 & 0 & 0 \end{smallmatrix} \bigr)$

$$
(E - A)x =
\begin {pmatrix}
0 & 1 & -1 \
1 & 0 & -1 \
0 & 0 & 0
\end {pmatrix}
\begin {pmatrix}
x_1 \
x_2 \
x_3
\end {pmatrix}
= 0
\implies
\left \{
\begin{array} {l}
x_1 - x_3 = 0 \
x_2 - x_3 = 0
\end{array}
\right.
$$

令$x_1 = 1$,得到特征矩阵:

$$
\xi_1 =
\begin {pmatrix}
1 \
1 \
1
\end {pmatrix}
$$

同理,当$ \lambda_2 = \lambda_3 = 0 $得:

$$
(E - A)x =
\begin {pmatrix}
-2 & 0 & 1 \
0 & -2 & 3 \
0 & 0 & 0
\end {pmatrix}
\begin {pmatrix}
x_1 \
x_2 \
x_3
\end {pmatrix}
= 0
\implies
\left \{
\begin{array} {l}
-2x_1 + x_3 = 0 \
-2x_2 + 3x_3 = 0
\end{array}
\right.
$$

令$x_1 = 1$,得到特征矩阵:

$$
\xi_2 = \xi_3 =
\begin {pmatrix}
1 \
3 \
2
\end {pmatrix}
$$

Python中计算特征值及特征向量

1
2
3
4
5
6
7
8
9
10
# -*- coding: utf-8 -*-
import numpy as np

a = np.array([[4, 2, -5], [6, 4, -9], [5, 3, -7]])
print(a)
# x = np.linalg.eigvals(a)
# print(x)
w, v = np.linalg.eig(a) # w是特征值, v为特征向量
print(w)
print(v)

输出结果:

1
2
3
4
5
6
7
[[ 4  2 -5]
[ 6 4 -9]
[ 5 3 -7]]
[ 1.00000000e+00 4.02000914e-08 -4.02000921e-08]
[[ 0.57735027 -0.26726123 0.26726125]
[ 0.57735027 -0.80178373 0.80178372]
[ 0.57735027 -0.53452248 0.53452249]]

注:np.linalg对矩阵特征值和特征向量进行了归一化处理

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :