矩阵相乘最重要的方法是一般矩阵乘积。它只有在第一个矩阵的列数(column,台湾作行数)和第二个矩阵的行数(row,台湾作列数)相同时才有定义。一般单指矩阵乘积时,指的便是一般矩阵乘积。若
A
{\displaystyle A}
为
m
×
n
{\displaystyle m\times n}
矩阵,
B
{\displaystyle B}
为
n
×
p
{\displaystyle n\times p}
矩阵,则他们的乘积
A
B
{\displaystyle AB}
(有时记做
A
⋅
B
{\displaystyle A\cdot B}
)会是一个
m
×
p
{\displaystyle m\times p}
矩阵。其乘积矩阵的元素如下面式子得出:
(
A
B
)
i
j
=
∑
r
=
1
n
a
i
r
b
r
j
=
a
i
1
b
1
j
+
a
i
2
b
2
j
+
⋯
+
a
i
n
b
n
j
{\displaystyle (AB)_{ij}=\sum _{r=1}^{n}a_{ir}b_{rj}=a_{i1}b_{1j}+a_{i2}b_{2j}+\cdots +a_{in}b_{nj}}
以上是用矩阵单元的代数系统来说明这类乘法的抽象性质。本节以下各种运算法都是这个公式的不同角度理解,运算结果相等:
由定义直接计算
编辑
左边的图表示出要如何计算
A
B
{\displaystyle AB}
的
(
1
,
2
)
{\displaystyle (1,2)}
和
(
3
,
3
)
{\displaystyle (3,3)}
元素,当
A
{\displaystyle A}
是个
4
×
2
{\displaystyle 4\times 2}
矩阵和B是个
2
×
3
{\displaystyle 2\times 3}
矩阵时。分别来自两个矩阵的元素都依箭头方向而两两配对,把每一对中的两个元素相乘,再把这些乘积加总起来,最后得到的值即为箭头相交位置的值。
(
A
B
)
1
,
2
=
∑
r
=
1
2
a
1
,
r
b
r
,
2
=
a
1
,
1
b
1
,
2
+
a
1
,
2
b
2
,
2
{\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}}
(
A
B
)
3
,
3
=
∑
r
=
1
2
a
3
,
r
b
r
,
3
=
a
3
,
1
b
1
,
3
+
a
3
,
2
b
2
,
3
{\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}}
向量方法
编辑
这种矩阵乘积亦可由稍微不同的观点来思考:把向量和各系数相乘后相加起来。设
A
{\displaystyle \mathbf {A} }
和
B
{\displaystyle \mathbf {B} }
是两个给定如下的矩阵:
A
=
[
a
1
,
1
a
1
,
2
…
a
2
,
1
a
2
,
2
…
⋮
⋮
⋱
]
=
[
A
1
A
2
…
]
,
{\displaystyle \mathbf {A} ={\begin{bmatrix}a_{1,1}&a_{1,2}&\dots \\a_{2,1}&a_{2,2}&\dots \\\vdots &\vdots &\ddots \end{bmatrix}}={\begin{bmatrix}A_{1}&A_{2}&\dots \end{bmatrix}},}
B
=
[
b
1
,
1
b
1
,
2
…
b
2
,
1
b
2
,
2
…
⋮
⋮
⋱
]
=
[
B
1
B
2
⋮
]
{\displaystyle \mathbf {B} ={\begin{bmatrix}b_{1,1}&b_{1,2}&\dots \\b_{2,1}&b_{2,2}&\dots \\\vdots &\vdots &\ddots \end{bmatrix}}={\begin{bmatrix}B_{1}\\B_{2}\\\vdots \end{bmatrix}}}
其中
A
1
{\displaystyle A_{1}}
是由所有
a
x
,
1
{\displaystyle a_{x,1}}
元素所组成的向量(column),
A
2
{\displaystyle A_{2}}
是由所有
a
x
,
2
{\displaystyle a_{x,2}}
元素所组成的向量,以此类推。
B
1
{\displaystyle B_{1}}
是由所有
b
1
,
x
{\displaystyle b_{1,x}}
元素所组成的向量(row),
B
2
{\displaystyle B_{2}}
是由所有
b
2
,
x
{\displaystyle b_{2,x}}
元素所组成的向量,以此类推。
则
A
B
=
[
a
1
,
1
[
b
1
,
1
b
1
,
2
…
]
+
a
1
,
2
[
b
2
,
1
b
2
,
2
…
]
+
⋯
a
2
,
1
[
b
1
,
1
b
1
,
2
…
]
+
a
2
,
2
[
b
2
,
1
b
2
,
2
…
]
+
⋯
⋮
]
=
A
1
B
1
+
A
2
B
2
+
…
{\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}}=A_{1}B_{1}+A_{2}B_{2}+\dots }
举个例子来说:
[
1
0
2
−
1
3
1
]
⋅
[
3
1
2
1
1
0
]
=
[
1
[
3
1
]
+
0
[
2
1
]
+
2
[
1
0
]
−
1
[
3
1
]
+
3
[
2
1
]
+
1
[
1
0
]
]
=
[
[
3
1
]
+
[
0
0
]
+
[
2
0
]
[
−
3
−
1
]
+
[
6
3
]
+
[
1
0
]
]
{\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}}}
=
[
5
1
4
2
]
{\displaystyle ={\begin{bmatrix}5&1\\4&2\end{bmatrix}}}
左面矩阵的列为为系数表,右边矩阵为向量表。例如,第一行是[1 0 2],因此将1乘上第一个向量,0乘上第二个向量,2则乘上第三个向量。
向量表方法
编辑
一般矩阵乘积也可以想为是行向量和列向量的内积。若
A
{\displaystyle \mathbf {A} }
和
B
{\displaystyle \mathbf {B} }
为给定如下的矩阵:
A
=
[
a
1
,
1
a
1
,
2
a
1
,
3
…
a
2
,
1
a
2
,
2
a
2
,
3
…
a
3
,
1
a
3
,
2
a
3
,
3
…
⋮
⋮
⋮
⋱
]
=
[
A
1
A
2
A
3
⋮
]
{\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}}}
且
B
=
[
b
1
,
1
b
1
,
2
b
1
,
3
…
b
2
,
1
b
2
,
2
b
2
,
3
…
b
3
,
1
b
3
,
2
b
3
,
3
…
⋮
⋮
⋮
⋱
]
=
[
B
1
B
2
B
3
…
]
{\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}}}
其中,这里
A
1
{\displaystyle A_{1}}
是由所有
a
1
,
x
{\displaystyle a_{1,x}}
元素所组成的向量,
A
2
{\displaystyle A_{2}}
是由所有
a
2
,
x
{\displaystyle a_{2,x}}
元素所组成的向量,以此类推。
B
1
{\displaystyle B_{1}}
是由所有
b
x
,
1
{\displaystyle b_{x,1}}
元素所组成的向量,
B
2
{\displaystyle B_{2}}
是由所有
b
x
,
2
{\displaystyle b_{x,2}}
元素所组成的向量,以此类推。
则
A
B
=
[
A
1
A
2
A
3
⋮
]
×
[
B
1
B
2
B
3
…
]
=
[
(
A
1
⋅
B
1
)
(
A
1
⋅
B
2
)
(
A
1
⋅
B
3
)
…
(
A
2
⋅
B
1
)
(
A
2
⋅
B
2
)
(
A
2
⋅
B
3
)
…
(
A
3
⋅
B
1
)
(
A
3
⋅
B
2
)
(
A
3
⋅
B
3
)
…
⋮
⋮
⋮
⋱
]
{\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}}}
即
(
A
B
)
i
j
=
A
i
B
j
{\displaystyle \left(\mathbf {AB} \right)_{ij}=A_{i}B_{j}}
性质
编辑
矩阵乘法是不可交换的(即
A
B
≠
B
A
{\displaystyle AB\neq BA}
),除了一些较特别的情况。很清楚可以知道,不可能预期说在改变向量的部分后还能得到相同的结果,而且第一个矩阵的列数必须要和第二个矩阵的行数相同,也可以看出为什么矩阵相乘的顺序会影响其结果。
虽然矩阵乘法是不可交换的,但
A
B
{\displaystyle AB}
和
B
A
{\displaystyle BA}
的行列式总会是一样的(当
A
{\displaystyle A}
、
B
{\displaystyle B}
是同样大小的方阵时)。
当
A
{\displaystyle A}
、
B
{\displaystyle B}
可以被解释为线性算子,其矩阵乘积
A
B
{\displaystyle AB}
会对应为两个线性算子的复合函数,其中B先作用。
在试算表中做矩阵乘法
编辑
[
1
0
2
−
1
3
1
]
⋅
[
3
1
2
1
1
0
]
=
[
5
1
4
2
]
{\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}}}
以 Google Sheet 为例,选取储存格范围或者使用阵列,在储存格输入
=MMULT({1,0,2;-1,3,1},{3,1;2,1;1,0})
在某些试算表软件中必须必须按Ctrl+⇧ Shift+↵ Enter 将储存格内的变量变换为阵列
PP手表是什么牌子?pp手表价格一般是多少
濛翔组合成立!王濛回顾北京冬奥会 与黄健翔解说卡塔尔世界杯