矩阵特征值和特征向量详细计算过程
矩阵特征值和特征向量定义
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中计算特征值及特征向量
# -*- 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)
输出结果:
[[ 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对矩阵特征值和特征向量进行了归一化处理
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/04/01/detailed-calculation-process-of-matrix-eigenvalues-and-eigenvectors/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论