文章目录
- [1. 矩阵的逆矩阵](#1. 矩阵的逆矩阵)
-
- [1.1 AB的逆矩阵](#1.1 AB的逆矩阵)
- [1.2 转置矩阵](#1.2 转置矩阵)
- [2. 2X2矩阵A消元](#2. 2X2矩阵A消元)
- [3. 3X3矩阵A消元](#3. 3X3矩阵A消元)
- [4. 运算量](#4. 运算量)
- [5. 置换矩阵-左行右列](#5. 置换矩阵-左行右列)
本文主要目的是为了通过矩阵乘法实现矩阵A的分解。
1. 矩阵的逆矩阵
1.1 AB的逆矩阵
- 假设A,B矩阵都可逆
A ( B B − 1 ) A − 1 = I (1) A(BB^{-1})A^{-1}=I\tag{1} A(BB−1)A−1=I(1) - 可得如下
( A B ) ( B − 1 A − 1 ) = I (2) (AB)(B^{-1}A^{-1})=I\tag{2} (AB)(B−1A−1)=I(2) - 所以当AB矩阵单独可逆下:
( A B ) − 1 = B − 1 A − 1 (3) (AB)^{-1}=B^{-1}A^{-1}\tag{3} (AB)−1=B−1A−1(3)
1.2 转置矩阵
- 由于矩阵A满足如下条件
A A − 1 = I (4) AA^{-1}=I\tag{4} AA−1=I(4) - 对等式两边进行转置如下:
( A − 1 ) T A T = I T = I (5) (A^{-1})^TA^T=I^T=I\tag{5} (A−1)TAT=IT=I(5) - 由此可得如下:
( A T ) − 1 = ( A − 1 ) T (6) (A^T)^{-1}=(A^{-1})^{T}\tag{6} (AT)−1=(A−1)T(6)
2. 2X2矩阵A消元
假设矩阵A经过行与行之间的计算,可以得到上三角矩阵U ,可以简化成如下,
E 21 = [ 1 0 − 4 1 ] ; A = [ 2 1 8 7 ] ; U = [ 2 1 0 3 ] ; (7) E_{21}=\begin{bmatrix}1&0\\\\-4&1\end{bmatrix};A=\begin{bmatrix}2&1\\\\8&7\end{bmatrix};U=\begin{bmatrix}2&1\\\\0&3\end{bmatrix};\tag{7} E21= 1−401 ;A= 2817 ;U= 2013 ;(7)
E 21 A = U (8) E_{21}A=U\tag{8} E21A=U(8)
[ 1 0 − 4 1 ] [ 2 1 8 7 ] = [ 2 1 0 3 ] (9) \begin{bmatrix}1&0\\\\-4&1\end{bmatrix}\begin{bmatrix}2&1\\\\8&7\end{bmatrix}=\begin{bmatrix}2&1\\\\0&3\end{bmatrix}\tag{9} 1−401 2817 = 2013 (9)
- 可以将上式改成如下
A = ( E 21 ) − 1 U = L U (10) A=(E_{21})^{-1}U=LU\tag{10} A=(E21)−1U=LU(10) - ( E 21 ) − 1 (E_{21})^{-1} (E21)−1可得如下:
( E 21 ) − 1 = [ 1 0 4 1 ] (11) (E_{21})^{-1}=\begin{bmatrix}1&0\\\\4&1\end{bmatrix}\tag{11} (E21)−1= 1401 (11) - 将U进行分解可得
U = [ 2 1 0 3 ] = [ 2 0 0 3 ] [ 1 1 2 0 1 ] (12) U=\begin{bmatrix}2&1\\\\0&3\end{bmatrix}=\begin{bmatrix}2&0\\\\0&3\end{bmatrix}\begin{bmatrix}1&\frac{1}{2}\\\\0&1\end{bmatrix}\tag{12} U= 2013 = 2003 10211 (12) - 综上所述可得如下:
A = [ 2 1 8 7 ] ; L = [ 1 0 4 1 ] ; D = [ 2 0 0 3 ] ; U = [ 1 1 2 0 1 ] (13) A=\begin{bmatrix}2&1\\\\8&7\end{bmatrix};L=\begin{bmatrix}1&0\\\\4&1\end{bmatrix};D=\begin{bmatrix}2&0\\\\0&3\end{bmatrix};U=\begin{bmatrix}1&\frac{1}{2}\\\\0&1\end{bmatrix}\tag{13} A= 2817 ;L= 1401 ;D= 2003 ;U= 10211 (13) - A = L D U A=LDU A=LDU
[ 2 1 8 7 ] = [ 1 0 4 1 ] [ 2 0 0 3 ] [ 1 1 2 0 1 ] (14) \begin{bmatrix}2&1\\\\8&7\end{bmatrix}=\begin{bmatrix}1&0\\\\4&1\end{bmatrix}\begin{bmatrix}2&0\\\\0&3\end{bmatrix}\begin{bmatrix}1&\frac{1}{2}\\\\0&1\end{bmatrix}\tag{14} 2817 = 1401 2003 10211 (14)
3. 3X3矩阵A消元
- 同理假设有一个3X3矩阵,我们可以经过行变换来消元。
E 32 E 31 E 21 A = U (15) E_{32}E_{31}E_{21}A=U\tag{15} E32E31E21A=U(15) - 求逆矩阵如下:
L = ( E 21 ) − 1 ( E 31 ) − 1 ( E 32 ) − 1 (16) L=(E_{21})^{-1}(E_{31})^{-1}(E_{32})^{-1}\tag{16} L=(E21)−1(E31)−1(E32)−1(16)
A = ( E 21 ) − 1 ( E 31 ) − 1 ( E 32 ) − 1 U (17) A=(E_{21})^{-1}(E_{31})^{-1}(E_{32})^{-1}U\tag{17} A=(E21)−1(E31)−1(E32)−1U(17) - 假设如下矩阵:
E 21 = [ 1 0 0 − 2 1 0 0 0 1 ] ; E 31 = [ 1 0 0 0 1 0 0 0 1 ] ; E 32 = [ 1 0 0 0 1 0 0 − 5 1 ] ; (18) E_{21}=\begin{bmatrix}1&0&0\\\\-2&1&0\\\\0&0&1\end{bmatrix};E_{31}=\begin{bmatrix}1&0&0\\\\0&1&0\\\\0&0&1\end{bmatrix};E_{32}=\begin{bmatrix}1&0&0\\\\0&1&0\\\\0&-5&1\end{bmatrix};\tag{18} E21= 1−20010001 ;E31= 100010001 ;E32= 10001−5001 ;(18)
E 3221 = E 32 E 21 = [ 1 0 0 − 2 1 0 10 − 5 1 ] (19) E_{3221}=E_{32}E_{21}=\begin{bmatrix}1&0&0\\\\-2&1&0\\\\10&-5&1\end{bmatrix}\tag{19} E3221=E32E21= 1−21001−5001 (19)
E 21 = [ 1 0 0 − 2 1 0 0 0 1 ] ; ⇒ ( E 21 ) − 1 = [ 1 0 0 2 1 0 0 0 1 ] ; (20) E_{21}=\begin{bmatrix}1&0&0\\\\-2&1&0\\\\0&0&1\end{bmatrix};\Rightarrow(E_{21})^{-1}=\begin{bmatrix}1&0&0\\\\2&1&0\\\\0&0&1\end{bmatrix};\tag{20} E21= 1−20010001 ;⇒(E21)−1= 120010001 ;(20)
E 32 = [ 1 0 0 0 1 0 0 − 5 1 ] ; ⇒ ( E 32 ) − 1 = [ 1 0 0 0 1 0 0 5 1 ] ; (20) E_{32}=\begin{bmatrix}1&0&0\\\\0&1&0\\\\0&-5&1\end{bmatrix};\Rightarrow(E_{32})^{-1}=\begin{bmatrix}1&0&0\\\\0&1&0\\\\0&5&1\end{bmatrix};\tag{20} E32= 10001−5001 ;⇒(E32)−1= 100015001 ;(20)
L = ( E 3221 ) − 1 = ( E 21 ) − 1 ( E 32 ) − 1 = [ 1 0 0 2 1 0 0 5 1 ] ; (21) L=(E_{3221})^{-1}=(E_{21})^{-1}(E_{32})^{-1}=\begin{bmatrix}1&0&0\\\\2&1&0\\\\0&5&1\end{bmatrix};\tag{21} L=(E3221)−1=(E21)−1(E32)−1= 120015001 ;(21) - 综上所述:
A = L U (22) A=LU\tag{22} A=LU(22)
4. 运算量
- 假设我们矩阵A是100X100的矩阵,那么将矩阵A通过行变换分解成A=LU 一共要进行如下计算步骤:
C o u n t = n 2 + ( n − 1 ) 2 + ⋯ + 2 2 + 1 2 = 1 3 n 3 = 1000000 3 (23) Count=n^2+(n-1)^2+\dots+2^2+1^2=\frac{1}{3}n^3=\frac{1000000}{3}\tag{23} Count=n2+(n−1)2+⋯+22+12=31n3=31000000(23)
5. 置换矩阵-左行右列
- 左乘置换矩阵-进行行变换XA
- 右乘置换矩阵-进行列变换AX
- 置换矩阵指的是一列中只有一个位置为1,同一列其他位置均为0,用来对矩阵进行位置交换。
- 第一行和第二行位置交换
A = [ 1 2 3 4 5 6 7 8 9 ] (24) A=\begin{bmatrix}1&2&3\\\\4&5&6\\\\7&8&9\end{bmatrix}\tag{24} A= 147258369 (24)
B = [ 4 5 6 1 2 3 7 8 9 ] = [ 0 1 0 1 0 0 0 0 1 ] [ 1 2 3 4 5 6 7 8 9 ] (25) B=\begin{bmatrix}4&5&6\\\\1&2&3\\\\7&8&9\end{bmatrix}=\begin{bmatrix}0&1&0\\\\1&0&0\\\\0&0&1\end{bmatrix}\begin{bmatrix}1&2&3\\\\4&5&6\\\\7&8&9\end{bmatrix}\tag{25} B= 417528639 = 010100001 147258369 (25)