線性代數 : 矩陣乘法和矩陣的逆

矩陣乘法和求矩陣的逆

  1. 常規方法:行向量*列向量
  2. 矩陣*列向量
  3. 行向量*矩陣
  4. 列向量*行向量
  5. 分塊矩陣乘法
  6. 求矩陣的逆

列*行

A=[121321011],B=[123321211],AB=CA = \left[\begin{matrix} 1 & 2 & 1 \\ 3 & 2 & 1 \\ 0 & 1 & 1 \end{matrix}\right], B = \left[\begin{matrix} 1 & 2 & 3 \\ 3 & 2 & 1 \\ 2 & 1 & 1 \end{matrix}\right], AB = C

C(i,j)=k=13A(i,k)B(k,j)C_{(i,j)} = \sum_{k=1}^{3} A_{(i,k)}B_{(k,j)}
C(i,j)=ArowiBcoljC_{(i,j)} = A_{row_i}\cdot B_{col_j}

  • i=2,j=2i=2,j =2
  • C(2,2)=3×2+2×2+1×1=11C_{(2,2)} = 3\times 2+2\times 2+1\times 1 = 11

矩陣*列向量

A[123321211]=CA\left[\begin{matrix} 1 & 2 & 3 \\ 3 & 2 & 1 \\ 2 & 1 & 1 \end{matrix}\right] =C

C=[A[132]A[221]A[311]]C= \left[\begin{matrix}A\left[\begin{matrix} 1\\ 3\\ 2\end{matrix}\right] & A\left[\begin{matrix} 2\\ 2\\ 1\end{matrix}\right] & A\left[\begin{matrix} 3\\ 1\\ 1\end{matrix}\right]\end{matrix}\right]

矩陣AA列向量的線性組合
A=[121321011]A = \left[\begin{matrix} 1 & 2 & 1 \\ 3 & 2 & 1 \\ 0 & 1 & 1 \end{matrix}\right]

Ccol1=A[132]=1×[130]+3×[221]+2×[111]=[9115]C_{col_1} = A\left[\begin{matrix} 1\\ 3\\ 2\end{matrix}\right] = 1\times \left[\begin{matrix} 1\\ 3\\ 0\end{matrix}\right]+ 3\times \left[\begin{matrix}2\\ 2\\ 1\end{matrix}\right] + 2\times \left[\begin{matrix} 1\\ 1\\ 1\end{matrix}\right] = \left[\begin{matrix} 9\\ 11\\ 5\end{matrix}\right]

以此類推:

Ccol2=[7119]C_{col_2} = \left[\begin{matrix} 7\\ 11\\ 9\end{matrix}\right]
Ccol3=[6122]C_{col_3} = \left[\begin{matrix} 6\\ 12\\ 2\end{matrix}\right]

C=[976111112532]C = \left[\begin{matrix} 9 & 7 & 6 \\ 11 & 11 & 12 \\ 5 & 3 & 2 \end{matrix}\right]

行向量*矩陣

AB=CAB = C : 矩陣BB行向量的線性組合

C=[Arow1BArow2BArow3B]C = \left[\begin{matrix}A_{row_1}B\\ A_{row_2}B \\ A_{row_3}B\end{matrix}\right]

Crow1=[121][123321211]=1×[123]+2×[321]+1×[211]=[976]C_{row_1} = \left[\begin{matrix} 1 & 2 & 1\end{matrix}\right]\left[\begin{matrix} 1 & 2 & 3 \\ 3 & 2 & 1 \\ 2 & 1 & 1 \end{matrix}\right] = 1\times \left[\begin{matrix} 1 & 2 & 3\end{matrix}\right]+2\times \left[\begin{matrix}3 & 2 & 1\end{matrix}\right]+1\times \left[\begin{matrix}2 & 1 & 1 \end{matrix}\right] = \left[\begin{matrix}9 & 7 & 6\end{matrix}\right]

列*行

AB=Acol1Brow1+Acol2Brow2+Acol3Brow3AB = A_{col_1}B_{row_1} + A_{col_2}B_{row_2} + A_{col_3}B_{row_3}

C1=Acol1Brow1=[130][123]=[123369000]C_1 = A_{col_1}B_{row_1} = \left[\begin{matrix} 1\\ 3\\ 0\end{matrix}\right]\left[\begin{matrix}1 & 2 & 3\end{matrix}\right]=\left[\begin{matrix} 1 & 2 & 3 \\ 3 & 6 & 9 \\ 0 & 0 & 0 \end{matrix}\right]

C2=Acol2Brow2=[221][321]=[642642321]C_2 = A_{col_2}B_{row_2} = \left[\begin{matrix} 2\\ 2\\ 1\end{matrix}\right]\left[\begin{matrix}3 & 2 & 1\end{matrix}\right]=\left[\begin{matrix} 6 & 4 & 2 \\ 6 & 4 & 2 \\ 3 & 2 & 1 \end{matrix}\right]

C3=Acol3Brow3=[111][211]=[211211211]C_3 = A_{col_3}B_{row_3} = \left[\begin{matrix} 1\\ 1\\ 1\end{matrix}\right]\left[\begin{matrix}2 & 1 & 1\end{matrix}\right]=\left[\begin{matrix} 2 & 1 & 1 \\ 2 & 1 & 1 \\2 & 1 & 1 \end{matrix}\right]

C=C1+C2+C3=[976111112532]C = C_1 + C_2 + C_3 = \left[\begin{matrix} 9 & 7 & 6 \\ 11 & 11 & 12 \\ 5 & 3 & 2 \end{matrix}\right]

分塊矩陣乘法

A=[A1A2A3A4],B=[B1B2B3B4]A=\left[\begin{array}{c|c}A_1 & A_2 \\ \hline A_3 & A_4\end{array}\right], B=\left[\begin{array}{c|c}B_1 & B_2 \\ \hline B_3 & B_4\end{array}\right]

AB=A=[A1B1+A2B3A1B2+A2B4A3B1+A4B3A3B2+A4B4]AB = A=\left[\begin{array}{c|c}A_1B_1+A_2B_3 & A_1B_2+A_2B_4 \\ \hline A_3B_1+A_4B_3 & A_3B_2+A_4B_4\end{array}\right]

矩陣的逆

AA爲n階段方陣,存在XA=I,X=A1XA = I, 則 X= A^{-1}, 如果AA的逆存在,AA也稱作可逆矩陣或非奇異矩陣

例子: 判讀矩陣的逆是否存在?
AX=[1236]X=[1001]AX = \left[\begin{matrix}1 & 2\\ 3 & 6\end{matrix}\right]X = \left[\begin{matrix}1 & 0\\ 0 & 1\end{matrix}\right]

  1. 畫圖
    在這裏插入圖片描述
    由上圖可知,AA的兩個列向量共線,所以它們所有的線性組合都不能得到Icol1I_{col_1},同理也不能得到Icol2I_{col_2}

  2. 如果存在一個非0向量x\pmb x,使Ax=0A\pmb x=0,則AA的逆不存在
    證明:

  • 如果: 假設AA的逆存在
  • 那麼: A1Ax=0A^{-1}A \pmb x = 0
  • 所以: Ix=0I\pmb x = 0,即x=0\pmb x = 0
  • 因爲: x0\pmb x \neq 0
  • 所以: AA的逆不存在

計算AA的逆

列:A=[1327]A = \left[\begin{matrix}1 & 3\\ 2 & 7\end{matrix}\right],求AA的逆矩陣?

A1=[abcd]A^{-1} = \left[\begin{matrix} a & b \\ c & d\end{matrix}\right]

AA1=[1327][abcd]=[1001]AA^{-1} = \left[\begin{matrix}1 & 3\\ 2 & 7\end{matrix}\right]\left[\begin{matrix} a & b \\ c & d\end{matrix}\right] = \left[\begin{matrix} 1 & 0 \\ 0 & 1\end{matrix}\right]

計算矩陣的逆其實也是在求解方程組:
  1. a[12]+c[37]=[10]a\left[\begin{matrix}1 \\ 2\end{matrix}\right] + c\left[\begin{matrix}3 \\ 7\end{matrix}\right] = \left[\begin{matrix}1 \\ 0\end{matrix}\right]
  2. b[12]+d[37]=[01]b\left[\begin{matrix}1 \\ 2\end{matrix}\right] + d\left[\begin{matrix}3 \\ 7\end{matrix}\right] = \left[\begin{matrix}0 \\ 1\end{matrix}\right]
方程組
  1. {a+3c=12a+7c=0\left\{ \begin{array}{lr}a + 3c = 1\\ 2a + 7c= 0 \end{array}\right.

  2. {b+3d=02b+7d=1\left\{ \begin{array}{lr}b + 3d = 0\\ 2b + 7d= 1 \end{array}\right.

消元法解方程組
  1. 增廣矩陣[AI]=[13102701][A|I] = \left[\begin{matrix}1 & 3 & 1 & 0\\ 2 & 7 & 0 & 1\end{matrix}\right]

  2. AU,[13100121]A \to U, \to \left[\begin{matrix}1 & 3 & 1 & 0\\ 0 & 1 & -2 & 1\end{matrix}\right]

  3. AI,[10730121]A \to I, \to \left[\begin{matrix}1 & 0 & 7 & -3\\ 0 & 1 & -2 & 1\end{matrix}\right]

  4. A1=[7321]A^{-1} = \left[\begin{matrix} 7 & -3\\ -2 & 1\end{matrix}\right],a=7,b=3,c=2,d=1a = 7, b=-3,c=-2,d=1

Why ?[AI]AUI[IA1][A|I] \to A\to U \to I \to [I|A^{-1}]
  1. 矩陣消元&分塊乘法

(1).E[AI]=[IA1](1).E[A|I]=[I|A^{-1}]

(2).EA=I,EI=A1(2).EA = I, EI = A^{-1}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章