# 矩陣乘法

（重定向自矩阵乘积

${\displaystyle \mathbf {A} ={\begin{bmatrix}1&2\\3&4\end{bmatrix}}}$

「横向的一条线（row）」的各地常用別名

「纵向的一条线（column）」的各地常用別名

## 一般矩陣乘積

${\displaystyle (AB)_{ij}=\sum _{r=1}^{n}a_{ir}b_{rj}=a_{i1}b_{1j}+a_{i2}b_{2j}+\cdots +a_{in}b_{nj}}$

### 由定義直接計算

${\displaystyle (AB)_{1,2}=\sum _{r=1}^{2}a_{1,r}b_{r,2}=a_{1,1}b_{1,2}+a_{1,2}b_{2,2}}$
${\displaystyle (AB)_{3,3}=\sum _{r=1}^{2}a_{3,r}b_{r,3}=a_{3,1}b_{1,3}+a_{3,2}b_{2,3}}$

### 向量方法

${\displaystyle \mathbf {A} ={\begin{bmatrix}a_{1,1}&a_{1,2}&\dots \\a_{2,1}&a_{2,2}&\dots \\\vdots &\vdots &\ddots \end{bmatrix}}}$  ${\displaystyle \mathbf {B} ={\begin{bmatrix}b_{1,1}&b_{1,2}&\dots \\b_{2,1}&b_{2,2}&\dots \\\vdots &\vdots &\ddots \end{bmatrix}}}$

${\displaystyle \mathbf {AB} ={\begin{bmatrix}a_{1,1}{\begin{bmatrix}b_{1,1}&b_{1,2}&\dots \end{bmatrix}}+a_{1,2}{\begin{bmatrix}b_{2,1}&b_{2,2}&\dots \end{bmatrix}}+\cdots \\\\a_{2,1}{\begin{bmatrix}b_{1,1}&b_{1,2}&\dots \end{bmatrix}}+a_{2,2}{\begin{bmatrix}b_{2,1}&b_{2,2}&\dots \end{bmatrix}}+\cdots \\\vdots \end{bmatrix}}}$

${\displaystyle {\begin{bmatrix}1&0&2\\-1&3&1\end{bmatrix}}\cdot {\begin{bmatrix}3&1\\2&1\\1&0\end{bmatrix}}={\begin{bmatrix}1{\begin{bmatrix}3&1\end{bmatrix}}+0{\begin{bmatrix}2&1\end{bmatrix}}+2{\begin{bmatrix}1&0\end{bmatrix}}\\-1{\begin{bmatrix}3&1\end{bmatrix}}+3{\begin{bmatrix}2&1\end{bmatrix}}+1{\begin{bmatrix}1&0\end{bmatrix}}\end{bmatrix}}={\begin{bmatrix}{\begin{bmatrix}3&1\end{bmatrix}}+{\begin{bmatrix}0&0\end{bmatrix}}+{\begin{bmatrix}2&0\end{bmatrix}}\\{\begin{bmatrix}-3&-1\end{bmatrix}}+{\begin{bmatrix}6&3\end{bmatrix}}+{\begin{bmatrix}1&0\end{bmatrix}}\end{bmatrix}}}$
${\displaystyle ={\begin{bmatrix}5&1\\4&2\end{bmatrix}}}$

### 向量表方法

${\displaystyle \mathbf {A} ={\begin{bmatrix}a_{1,1}&a_{1,2}&a_{1,3}&\dots \\a_{2,1}&a_{2,2}&a_{2,3}&\dots \\a_{3,1}&a_{3,2}&a_{3,3}&\dots \\\vdots &\vdots &\vdots &\ddots \end{bmatrix}}={\begin{bmatrix}A_{1}\\A_{2}\\A_{3}\\\vdots \end{bmatrix}}}$ ${\displaystyle \mathbf {B} ={\begin{bmatrix}b_{1,1}&b_{1,2}&b_{1,3}&\dots \\b_{2,1}&b_{2,2}&b_{2,3}&\dots \\b_{3,1}&b_{3,2}&b_{3,3}&\dots \\\vdots &\vdots &\vdots &\ddots \end{bmatrix}}={\begin{bmatrix}B_{1}&B_{2}&B_{3}&\dots \end{bmatrix}}}$

${\displaystyle A_{1}}$ 是由所有${\displaystyle a_{1,x}}$ 元素所組成的向量，${\displaystyle A_{2}}$ 是由所有${\displaystyle a_{2,x}}$ 元素所組成的向量，以此類推。
${\displaystyle B_{1}}$ 是由所有${\displaystyle b_{x,1}}$ 元素所組成的向量，${\displaystyle B_{2}}$ 是由所有${\displaystyle b_{x,2}}$ 元素所組成的向量，以此類推。

${\displaystyle \mathbf {AB} ={\begin{bmatrix}A_{1}\\A_{2}\\A_{3}\\\vdots \end{bmatrix}}\times {\begin{bmatrix}B_{1}&B_{2}&B_{3}&\dots \end{bmatrix}}={\begin{bmatrix}(A_{1}\cdot B_{1})&(A_{1}\cdot B_{2})&(A_{1}\cdot B_{3})&\dots \\(A_{2}\cdot B_{1})&(A_{2}\cdot B_{2})&(A_{2}\cdot B_{3})&\dots \\(A_{3}\cdot B_{1})&(A_{3}\cdot B_{2})&(A_{3}\cdot B_{3})&\dots \\\vdots &\vdots &\vdots &\ddots \end{bmatrix}}}$

### 性質

${\displaystyle A}$ ${\displaystyle B}$ 可以被解釋為線性算子，其矩陣乘積${\displaystyle AB}$ 會對應為兩個線性算子的複合函數，其中B先作用。

### 在試算表中做矩陣乘法

${\displaystyle {\begin{bmatrix}1&0&2\\-1&3&1\end{bmatrix}}\cdot {\begin{bmatrix}3&1\\2&1\\1&0\end{bmatrix}}={\begin{bmatrix}5&1\\4&2\end{bmatrix}}}$

=MMULT({1,0,2;-1,3,1},{3,1;2,1;1,0})


## 純量乘積

${\displaystyle (rA)_{ij}=r\cdot a_{ij}\ }$

${\displaystyle (Ar)_{ij}=a_{ij}\cdot r\ }$

${\displaystyle i{\begin{bmatrix}i&0\\0&j\\\end{bmatrix}}={\begin{bmatrix}-1&0\\0&k\\\end{bmatrix}}\neq {\begin{bmatrix}-1&0\\0&-k\\\end{bmatrix}}={\begin{bmatrix}i&0\\0&j\\\end{bmatrix}}i}$

## 阿達馬乘積

${\displaystyle {\begin{bmatrix}1&3&2\\1&0&0\\1&2&2\end{bmatrix}}\circ {\begin{bmatrix}0&0&2\\7&5&0\\2&1&1\end{bmatrix}}={\begin{bmatrix}1\cdot 0&3\cdot 0&2\cdot 2\\1\cdot 7&0\cdot 5&0\cdot 0\\1\cdot 2&2\cdot 1&2\cdot 1\end{bmatrix}}={\begin{bmatrix}0&0&4\\7&0&0\\2&2&2\end{bmatrix}}}$

## 克羅內克乘積

${\displaystyle {\begin{bmatrix}a_{11}B&a_{12}B&\cdots &a_{1n}B\\\vdots &\vdots &\ddots &\vdots \\a_{m1}B&a_{m2}B&\cdots &a_{mn}B\end{bmatrix}}}$

${\displaystyle A}$ 是一${\displaystyle m\times n}$ 矩陣和${\displaystyle B}$ 是一${\displaystyle p\times r}$ 矩陣時，${\displaystyle A\otimes B}$ 會是一${\displaystyle mp\times nr}$ 矩陣，而且此一乘積也是不可交換的。

${\displaystyle {\begin{bmatrix}1&2\\3&1\\\end{bmatrix}}\otimes {\begin{bmatrix}0&3\\2&1\\\end{bmatrix}}={\begin{bmatrix}1\cdot 0&1\cdot 3&2\cdot 0&2\cdot 3\\1\cdot 2&1\cdot 1&2\cdot 2&2\cdot 1\\3\cdot 0&3\cdot 3&1\cdot 0&1\cdot 3\\3\cdot 2&3\cdot 1&1\cdot 2&1\cdot 1\\\end{bmatrix}}={\begin{bmatrix}0&3&0&6\\2&1&4&2\\0&9&0&3\\6&3&2&1\end{bmatrix}}}$

${\displaystyle A}$ ${\displaystyle B}$ 分別表示兩個線性算子${\displaystyle V_{1}\to W_{1}}$ ${\displaystyle V_{2}\to W_{2}}$ ${\displaystyle A\otimes B}$ 便為其映射的張量乘積${\displaystyle V_{1}\otimes V_{2}\to W_{1}\otimes W_{2}}$

## 共同性質

${\displaystyle A(BC)=(AB)C}$

${\displaystyle A(B+C)=AB+AC}$
${\displaystyle (A+B)C=AC+BC}$

${\displaystyle c(AB)=(cA)B}$
${\displaystyle (Ac)B=A(cB)}$
${\displaystyle (AB)c=A(Bc)}$

## 參考

1. ^ Lerner, R. G.; Trigg, G. L. Encyclopaedia of Physics 2nd. VHC publishers. 1991. ISBN 3-527-26954-1 （英语）.
2. ^ Parker, C. B. McGraw Hill Encyclopaedia of Physics 2nd. 1994. ISBN 0-07-051400-3 （英语）.

• 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.