首先展示一个 n n n阶行列式:
D = ∣ a 11 a 12 … a 1 n a 21 a 22 … a 2 n … … … … a n 1 a n 2 … a n n ∣ = a 11 A 11 + a 12 A 12 + ⋯ + a 1 n A 1 n D=\left|\begin{array}{cccc} a_{11} & a_{12} & \ldots & a_{1 n} \\ a_{21} & a_{22} & \ldots & a_{2 n} \\ \ldots & \ldots & \ldots & \ldots \\ a_{n 1} & a_{n 2} & \ldots & a_{n n} \end{array}\right|=a_{11} A_{11}+a_{12} A_{12}+\cdots+a_{1 n} A_{1 n} D= a11a21…an1a12a22…an2…………a1na2n…ann =a11A11+a12A12+⋯+a1nA1n
其中, a i j ( i = 1 , 2 , … , n , j = 1 , 2 , … , n ) a_{\mathrm{ij}}(\mathrm{i}=1,2, \ldots, n, \mathrm{j}=1,2, \ldots, n) aij(i=1,2,…,n,j=1,2,…,n)称为行列式的第 i i i行, 第 j j j列元素; A 1 j = ( − 1 ) 1 + j M 1 j ( j = 1 , 2 , … , n ) A_{1 j}=(-1)^{1+j} M_{1 j}(j=1,2, \ldots, n) A1j=(−1)1+jM1j(j=1,2,…,n), M 1 j M_{1 j} M1j为 D D D中划掉第一行和第 j j j列的所有元素后, 按原顺序排成的 n − 1 n-1 n−1阶行列式:
M 1 j = ∣ a 21 ⋯ a 2 j − i a 2 j + 1 ⋯ a 2 n a 31 ⋯ a 3 j − 1 a 3 j + 1 ⋯ a 3 n ⋮ ⋯ ⋮ ⋮ ⋯ ⋮ a n 1 ⋯ a n j − 1 a n j + 1 ⋯ a n n ∣ M_{1 j}=\left|\begin{array}{cccccc} a_{21} & \cdots & a_{2 j-i} & a_{2 j+1} & \cdots & a_{2 n} \\ a_{31} & \cdots & a_{3 j-1} & a_{3 j+1} & \cdots & a_{3 n} \\ \vdots & \cdots & \vdots & \vdots & \cdots & \vdots \\ a_{n 1} & \cdots & a_{n j-1} & a_{n j+1} & \cdots & a_{n n} \end{array}\right| M1j= a21a31⋮an1⋯⋯⋯⋯a2j−ia3j−1⋮anj−1a2j+1a3j+1⋮anj+1⋯⋯⋯⋯a2na3n⋮ann
称 M 1 j M_{1 j} M1j是 D D D的元素 a 1 j a_{1 j} a1j的余子式, A 1 j A_{1 j} A1j是元素 a 1 j a_{1 j} a1j的代数余子式。
由方阵A的代数余子式组成的如下形式的矩阵:
A ∗ = ( A 11 A 21 … A n 1 A 12 A 22 … A n 2 … … … … A 1 n A 2 n … A n n ) \mathbf{A}^{*}=\left(\begin{array}{cccc} \mathbf{A}_{11} & \mathbf{A}_{21} & \ldots & \mathbf{A}_{\mathrm{n} 1} \\ \mathbf{A}_{12} & \mathbf{A}_{22} & \ldots & \mathbf{A}_{\mathrm{n} 2} \\ \ldots & \ldots & \ldots & \ldots \\ \mathbf{A}_{1 n} & \mathbf{A}_{2 n} & \ldots & \mathbf{A}_{\mathrm{nn}} \end{array}\right) A∗= A11A12…A1nA21A22…A2n…………An1An2…Ann
上述矩阵称为方阵 A A A的伴随矩阵。
对 n n n阶方阵 A A A,如果存在 n n n阶方阵 B B B,使 A B = B A = E AB=BA=E AB=BA=E,则称方阵 A A A是可逆的,且称 B B B是 A A A的逆矩阵,记为 B = A − 1 B=A^{-1} B=A−1。可逆矩阵又称为非异阵或非奇异阵。单位矩阵E是可逆的,且 E − 1 = E E^{-1}=E E−1=E,但零矩阵不可逆。
可逆矩阵满足以下运算规律(设 A A A与 B B B是 n n n阶可逆矩阵, k k k是非零常数)。
下面举一个例子来计算矩阵A的逆。矩阵A如式矩阵A,则 A − 1 = A ∗ ∥ A ∥ A^{-1}=\frac{A^{*}}{\|A\|} A−1=∥A∥A∗。
A = [ 2 7 6 9 5 1 4 3 8 ] A=\left[\begin{array}{lll} 2 & 7 & 6 \\ 9 & 5 & 1 \\ 4 & 3 & 8 \end{array}\right] A= 294753618
首先来求A的行列式:
det ( A ) = ∣ 2 7 6 9 5 1 4 3 8 ∣ \operatorname{det}(A)=\left|\begin{array}{ccc} 2 & 7 & 6 \\ 9 & 5 & 1 \\ 4 & 3 & 8 \end{array}\right| det(A)= 294753618
= ( − 1 ) 1 + 1 ∗ 2 ∗ ∣ 5 1 3 8 ∣ + ( − 1 ) 1 + 2 ∗ 7 ∗ ∣ 9 1 4 8 ∣ + ( − 1 ) 1 + 3 ∗ 6 ∗ ∣ 9 5 4 3 ∣ = (-1)^{1+1} * 2 *\left|\begin{array}{cc} 5 & 1 \\ 3 & 8 \end{array}\right|+(-1)^{1+2} * 7 *\left|\begin{array}{ll} 9 & 1 \\ 4 & 8 \end{array}\right|+(-1)^{1+3} * 6 *\left|\begin{array}{cc} 9 & 5 \\ 4 & 3 \end{array}\right| =(−1)1+1∗2∗ 5318 +(−1)1+2∗7∗ 9418 +(−1)1+3∗6∗ 9453
= − 360 = -360 =−360
从上述的计算过程,我们不难看出,求A的行列式的时间复杂度为 N ∗ O ( N ! ) \mathrm{N} * \mathrm{O}(\mathrm{N} !) N∗O(N!)。
接下来计算A的伴随矩阵:
C 11 = ( − 1 ) 1 + 1 ∗ ∣ 5 1 3 8 ∣ = 37 C 12 = ( − 1 ) 1 + 2 ∗ ∣ 9 1 4 8 ∣ = − 68 C 13 = ( − 1 ) 1 + 3 ∗ ∣ 9 5 4 3 ∣ = 7 C 21 = ( − 1 ) 2 + 1 ∗ ∣ 7 6 3 8 ∣ = − 38 C 22 = ( − 1 ) 2 + 2 ∗ ∣ 2 6 4 8 ∣ = − 8 C 23 = ( − 1 ) 2 + 3 ∗ ∣ 2 7 4 3 ∣ = 22 C 31 = ( − 1 ) 3 + 1 ∗ ∣ 7 6 5 1 ∣ = − 23 C 32 = ( − 1 ) 3 + 2 ∗ ∣ 2 6 9 1 ∣ = 52 C 33 = ( − 1 ) 3 + 3 ∗ ∣ 2 7 9 5 ∣ = − 53 \begin{array}{l} C_{11}=(-1)^{1+1} *\left|\begin{array}{ll} 5 & 1 \\ 3 & 8 \end{array}\right|=37 \\ C_{12}=(-1)^{1+2} *\left|\begin{array}{ll} 9 & 1 \\ 4 & 8 \end{array}\right|=-68 \\ C_{13}=(-1)^{1+3} *\left|\begin{array}{ll} 9 & 5 \\ 4 & 3 \end{array}\right|=7 \\ C_{21}=(-1)^{2+1} *\left|\begin{array}{ll} 7 & 6 \\ 3 & 8 \end{array}\right|=-38 \\ C_{22}=(-1)^{2+2} *\left|\begin{array}{ll} 2 & 6 \\ 4 & 8 \end{array}\right|=-8 \\ C_{23}=(-1)^{2+3} *\left|\begin{array}{ll} 2 & 7 \\ 4 & 3 \end{array}\right|=22 \\ C_{31}=(-1)^{3+1} *\left|\begin{array}{ll} 7 & 6 \\ 5 & 1 \end{array}\right|=-23 \\ C_{32}=(-1)^{3+2} *\left|\begin{array}{ll} 2 & 6 \\ 9 & 1 \end{array}\right|=52 \\ C_{33}=(-1)^{3+3} *\left|\begin{array}{ll} 2 & 7 \\ 9 & 5 \end{array}\right|=-53 \end{array} C11=(−1)1+1∗ 5318 =37C12=(−1)1+2∗ 9418 =−68C13=(−1)1+3∗ 9453 =7C21=(−1)2+1∗ 7368 =−38C22=(−1)2+2∗ 2468 =−8C23=(−1)2+3∗ 2473 =22C31=(−1)3+1∗ 7561 =−23C32=(−1)3+2∗ 2961 =52C33=(−1)3+3∗ 2975 =−53
从上述的计算过程,我们不难看出,求A的伴随矩阵的时间复杂度为 N ∗ O ( N ! ) \mathrm{N} * \mathrm{O}(\mathrm{N} !) N∗O(N!)。所以求逆的整个过程的时间复杂度为 2 ∗ N ∗ O ( N ! ) 2*\mathrm{N} * \mathrm{O}(\mathrm{N} !) 2∗N∗O(N!)。对应的伴随矩阵为:
A ∗ = [ 37 − 38 − 23 − 68 − 8 52 7 22 − 53 ] A^{*}=\left[\begin{array}{ccc} 37 & -38 & -23 \\ -68 & -8 & 52 \\ 7 & 22 & -53 \end{array}\right] A∗= 37−687−38−822−2352−53
A的逆矩阵为:
A − 1 = A ∗ det ( A ) = [ 37 − 360 − 38 − 360 − 23 − 360 − 68 − 360 − 8 − 360 52 − 360 − 6 − 360 22 − 360 − 53 − 360 ] = [ − 37 360 19 180 23 360 17 90 1 45 13 90 − 7 360 − 11 180 53 360 ] A^{-1}=\frac{A^{*}}{\operatorname{det}(A)}=\left[\begin{array}{ccc} \frac{37}{-360} & \frac{-38}{-360} & \frac{-23}{-360} \\ \frac{-68}{-360} & \frac{-8}{-360} & \frac{52}{-360} \\ \frac{-6}{-360} & \frac{22}{-360} & \frac{-53}{-360} \end{array}\right]=\left[\begin{array}{ccc} -\frac{37}{360} & \frac{19}{180} & \frac{23}{360} \\ \frac{17}{90} & \frac{1}{45} & \frac{13}{90} \\ -\frac{7}{360} & -\frac{11}{180} & \frac{53}{360} \end{array}\right] A−1=det(A)A∗= −36037−360−68−360−6−360−38−360−8−36022−360−23−36052−360−53 = −360379017−360718019451−1801136023901336053