18.06 矩阵
方程组
\[ \left\{
\begin{array}{rl}
x + 2y + z = 2 \\
3x + 8y + z = 12
4y + z = 2
\end{array} \right.
\]
写成矩阵的形式可以改写为
\[ \begin{bmatrix}
1 & 2 & 1 \\
3 & 8 & 1\\
0 & 4 & 1 \\
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
z \\
\end{bmatrix}
=
\begin{bmatrix}
2 \\
12 \\
2 \\
\end{bmatrix}
\]
矩阵消元
模拟方程组的消元,矩阵的消元过程如下
\[ \begin{bmatrix}
1 & 2 & 1 & 2 \\
3 & 8 & 1 & 12\\
0 & 4 & 1 & 2 \\
\end{bmatrix}
\to
\begin{bmatrix}
1 & 2 & 1 & 2 \\
0 & 2 & -2 & 6\\
0 & 4 & 1 & 2 \\
\end{bmatrix}
\to
\begin{bmatrix}
1 & 2 & 1 & 2 \\
0 & 2 & -2 & 6\\
0 & 0 & 5 & -10 \\
\end{bmatrix}
\]
然后进行回代,就可以解除方程组的解了。
从行的角度:C 中的每一行是 A 中每一行的线性组合
\[ \begin{bmatrix}
a & b & c \\
\end{bmatrix}
\begin{bmatrix}
d & e & f \\
g & h & i\\
k & l & m \\
\end{bmatrix}
= a
\begin{bmatrix}
d & e & f \\
\end{bmatrix}
+ b
\begin{bmatrix}
g & h & i\\
\end{bmatrix}
+ c
\begin{bmatrix}
k & l & m \\
\end{bmatrix}
\]
从列的角度:C 中每一列是 B 中的每一列的线性组合
\[ \begin{bmatrix}
d & e & f \\
g & h & i\\
k & l & m \\
\end{bmatrix}
\begin{bmatrix}
a & b & c \\
\end{bmatrix}
= a
\begin{bmatrix}
d \\
e \\
f \\
\end{bmatrix}
+ b
\begin{bmatrix}
g \\
h \\
i\\
\end{bmatrix}
+ c
\begin{bmatrix}
k \\
l \\
m \\
\end{bmatrix}
\]
矩阵乘法
\[ \begin{bmatrix}
a_{11} & a_{12} & \ldots & a_{1n}\\
a_{21} & a_{22} & \ldots & a_{2n}\\
\vdots & \vdots & \vdots & \vdots\\
a_{m1} & a_{m2} & \ldots & a_{mn}\\
\end{bmatrix}
\begin{bmatrix}
b_{11} & b_{12} & \ldots & b_{1p}\\
b_{21} & b_{22} & \ldots & b_{2p}\\
\vdots & \vdots & \vdots & \vdots\\
x_{n1} & x_{n2} & \ldots & x_{np}\\
\end{bmatrix}
=
\begin{bmatrix}
c_{11} & c_{12} & \ldots & c_{1p}\\
c_{21} & c_{22} & \ldots & c_{2p}\\
\vdots & \vdots & \ddots & \vdots\\
c_{m1} & c_{m2} & \ldots & c_{mp}\\
\end{bmatrix}
\]
假设上面的矩阵分别为 A, B, C,即 \(AB=C\),则我们可以采用如下的方法计算矩阵 C
方法一:(row i of A) (column j of B),即
\begin{equation}
\notag C_{ij} = \sum_{k=1}^{n}a_{ik}b_{kj}
\end{equation}
方法二:C 中的每一列,是 B 中每一列的线性组合,即
\[ \begin{bmatrix}
a_{11} & a_{12} & \ldots & a_{1n}\\
a_{21} & a_{22} & \ldots & a_{2n}\\
\vdots & \vdots & \vdots & \vdots\\
a_{m1} & a_{m2} & \ldots & a_{mn}\\
\end{bmatrix}
\begin{bmatrix}
b_{11}\\
b_{21}\\
\vdots\\
x_{n1}\\
\end{bmatrix}
=
\begin{bmatrix}
c_{11}\\
c_{21}\\
\vdots\\
c_{m1}\\
\end{bmatrix}
\]
方法三:C 中的每一行,是 A 中每一行的线性组合
\[ \begin{bmatrix}
a_{11} & a_{12} & \ldots & a_{1n}\\
\end{bmatrix}
\begin{bmatrix}
b_{11} & b_{12} & \ldots & b_{1p}\\
b_{21} & b_{22} & \ldots & b_{2p}\\
\vdots & \vdots & \vdots & \vdots\\
x_{n1} & x_{n2} & \ldots & x_{np}\\
\end{bmatrix}
=
\begin{bmatrix}
c_{11} & c_{12} & \ldots & c_{1p}\\
\end{bmatrix}
\]
方法四:sum of (col of A)(row of B)
\[ \begin{bmatrix}
a_{11} & a_{12} & \ldots & a_{1n}\\
a_{21} & a_{22} & \ldots & a_{2n}\\
\vdots & \vdots & \vdots & \vdots\\
a_{m1} & a_{m2} & \ldots & a_{mn}\\
\end{bmatrix}
\begin{bmatrix}
b_{11} & b_{12} & \ldots & b_{1p}\\
b_{21} & b_{22} & \ldots & b_{2p}\\
\vdots & \vdots & \vdots & \vdots\\
x_{n1} & x_{n2} & \ldots & x_{np}\\
\end{bmatrix}
=
\begin{bmatrix}
a_{11}b_{11} & a_{11}b_{12} & \ldots & a_{11}b_{1p} \\
a_{21}b_{11} & a_{21}b_{12} & \ldots & a_{21}b_{1p} \\
a_{31}b_{11} & a_{31}b_{12} & \ldots & a_{31}b_{1p} \\
a_{41}b_{11} & a_{41}b_{12} & \ldots & a_{41}b_{1p} \\
\end{bmatrix}
+ \ldots +
\begin{bmatrix}
a_{1n}b_{11} & a_{1n}b_{12} & \ldots & a_{1n}b_{1p} \\
a_{2n}b_{11} & a_{2n}b_{12} & \ldots & a_{2n}b_{1p} \\
a_{3n}b_{11} & a_{3n}b_{12} & \ldots & a_{3n}b_{1p} \\
a_{4n}b_{11} & a_{4n}b_{12} & \ldots & a_{4n}b_{1p} \\
\end{bmatrix}
\]