线性代数
|

|
向量 · 向量空间 · 基底 · 行列式 · 矩阵
|
|
|
「横向的一条线(row)」的各地常用名稱 |
---|
中国大陸 | 行 |
---|
臺灣 | 列 |
---|
「纵向的一条线(column)」的各地常用名稱 |
---|
中国大陸 | 列 |
---|
臺灣 | 行 |
---|
数学中,矩阵乘法(英語:matrix multiplication)是一种根据两个矩阵得到第三个矩阵的二元运算,第三个矩阵即前两者的乘积,称为矩阵积(英語:matrix product)。设
是
的矩阵,
是
的矩阵,则它们的矩阵积
是
的矩阵。
中每一行的
个元素都与
中对应列的
个元素对应相乘,这些乘积的和就是
中的一个元素。
矩阵可以用来表示线性映射,矩阵积则可以用来表示线性映射的复合。因此,矩阵乘法是线性代数的基础工具,不仅在数学中有大量应用,在应用数学、物理学、工程学等领域也有广泛使用。[1][2]
矩陣相乘最重要的方法是一般矩陣乘積。它只有在第一個矩陣的列数(column,台湾作行數)和第二個矩陣的行数(row,台湾作列數)相同時才有定義。一般單指矩陣乘積時,指的便是一般矩陣乘積。若
為
矩陣,
為
矩陣,則他們的乘積
(有時記做
)會是一個
矩陣。其乘積矩陣的元素如下面式子得出:

以上是用矩陣單元的代數系統來說明這類乘法的抽象性質。本節以下各種運算法都是這個公式的不同角度理解,運算結果相等:
左邊的圖表示出要如何計算
的
和
元素,當
是個
矩陣和B是個
矩陣時。分別來自兩個矩陣的元素都依箭頭方向而兩兩配對,把每一對中的兩個元素相乘,再把這些乘積加總起來,最後得到的值即為箭頭相交位置的值。


這種矩陣乘積亦可由稍微不同的觀點來思考:把向量和各係數相乘後相加起來。設
和
是兩個給定如下的矩陣:

其中
是由所有
元素所组成的向量(column),
是由所有
元素所组成的向量,以此类推。
是由所有
元素所组成的向量(row),
是由所有
元素所组成的向量,以此类推。
則

舉個例子來說:


左面矩陣的列為為係數表,右邊矩陣為向量表。例如,第一行是[1 0 2],因此將1乘上第一個向量,0乘上第二個向量,2則乘上第三個向量。
一般矩陣乘積也可以想為是行向量和列向量的內積。若
和
為給定如下的矩陣:
且
其中,这里
是由所有
元素所組成的向量,
是由所有
元素所組成的向量,以此類推。
是由所有
元素所組成的向量,
是由所有
元素所組成的向量,以此類推。
则

即

矩陣乘法是不可交換的(即
),除了一些較特別的情況。很清楚可以知道,不可能預期說在改變向量的部份後還能得到相同的結果,而且第一個矩陣的列數必須要和第二個矩陣的行數相同,也可以看出為什麼矩陣相乘的順序會影響其結果。
雖然矩陣乘法是不可交換的,但
和
的行列式總會是一樣的(當
、
是同樣大小的方陣時)。
當
、
可以被解釋為線性算子,其矩陣乘積
會對應為兩個線性算子的複合函數,其中B先作用。
以 Google Sheet 為例,選取儲存格範圍或者使用陣列,在儲存格輸入
=MMULT({1,0,2;-1,3,1},{3,1;2,1;1,0})
在某些試算表軟體中必須必須按Ctrl+⇧ Shift+↵ Enter 將儲存格內的變數轉換為陣列
矩陣
和純量
的純量乘積
的矩陣大小和
一樣,
的各元素定義如下:

若我們考慮於一個環的矩陣時,上述的乘積有時會稱做左乘積,而右乘積的則定義為

當環是可交換時,例如實數體或複數體,這兩個乘積是相同的。但無論如何,若環是不可交換的話,如四元數,他們可能會是不同的。例如,

給定兩個相同維度的矩陣可計算有阿達馬乘積(Hadamard product),或稱做逐項乘積、分素乘積(element-wise product, entrywise product)。兩個
矩陣
、
的阿達馬乘積標記為
,定義為
的
矩陣。例如,

需注意的是,阿達馬乘積是克羅內克乘積的子矩陣。
給定任兩個矩陣
和
,可以得到兩個矩陣的直積,或稱為克羅內克乘積
,其定義如下

當
是一
矩陣和
是一
矩陣時,
會是一
矩陣,而且此一乘積也是不可交換的。
舉個例子,

若
和
分別表示兩個線性算子
和
,
便為其映射的張量乘積,
上述三種乘積都符合結合律:

以及分配律:


而且和純量乘積相容:



注意上述三個分開的表示式只有在純量體的乘法及加法是可交換(即純量體為一可交換環)時會相同。
其它参考文献包括:
- Strassen, Volker, Gaussian Elimination is not Optimal, Numer. Math. 13, p. 354-356, 1969.
- Coppersmith, D., Winograd S., Matrix multiplication via arithmetic progressions, J. Symbolic Comput. 9, p. 251-280, 1990.
- Horn, Roger; Johnson, Charles: "Topics in Matrix Analysis", Cambridge, 1994.
- Robinson, Sara, Toward an Optimal Algorithm for Matrix Multiplication, SIAM News 38(9), November 2005.