定义#
一个 $m \times n$ 矩阵可表示为如下数表: $$ A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} = (a_{ij})_{m \times n} $$ $a_{i,j}$ 则表示第 $i$ 行第 $j$ 列的元素。
列向量视角#
这个视角比较重要。 $$ A = \begin{bmatrix} \mathbf{a_{1}} & \mathbf{a_{2}} & \cdots & \mathbf{a_{n}} \end{bmatrix} $$ 其中 $\mathbf{a_{j}}$ 表示矩阵中的第 $j$ 列向量。按行分块则同理可得。
矩阵和 $\mathbf{x}$ 向量的乘积#
$$ \mathbf{A}\mathbf{x} = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} \times \begin{bmatrix} x_{1} \\ x_{2} \\ \vdots \\ x_{n} \end{bmatrix} = \begin{bmatrix} \sum_{j = 1}^{n} a_{1j}x_{j} \\ \sum_{j = 1}^{n} a_{2j}x_{j} \\ \vdots \\ \sum_{j = 1}^{n} a_{mj}x_{j} \end{bmatrix} $$
从列向量的角度思考
$$ \mathbf{A}\mathbf{x} = \begin{bmatrix} \mathbf{a_{1}}x_{1} + \mathbf{a_{2}}x_{2} + \cdots + \mathbf{a_{n}}x_{n} \end{bmatrix} $$ 简洁而优雅。从这个角度我们可以知道 $\mathbf{A}\mathbf{x}$ 的计算结果是 $n$ 个列向量为基底,$\mathbf{x}$ 为系数的线性组合出来的一个新的向量。
矩阵的乘法#
定义 $A \times B$ :
$$ (AB)_{ij} = \sum_{k=1}^{n} a_{ik}b_{kj} $$ 这个式子精确的给出了答案矩阵的 $(i,j)$ 处的数的数值。由定义式我们也可以得出矩阵乘法的一个规则:$A$ 的列数一定要等于 $B$ 的行数。
但我们不妨换一种方式来理解:
我们知道,$A$ 可以看成由 $m$ 个列向量组成的,而 $B$ 则可以看成是由 $m$ 个行向量组成的。
$$ A \times B = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} \times \begin{bmatrix} b_{11} & b_{12} & \cdots & b_{1k} \\ b_{21} & b_{22} & \cdots & b_{2k} \\ \vdots & \vdots & \ddots & \vdots \\ b_{n1} & b_{n2} & \cdots & b_{nk} \end{bmatrix} $$ $$ = \begin{bmatrix} \mathbf{a_{1}} & \mathbf{a_{2}} & \cdots & \mathbf{a_{n}} \end{bmatrix} \times \begin{bmatrix} b_{11} & b_{12} & \cdots & b_{1k} \\ b_{21} & b_{22} & \cdots & b_{2k} \\ \vdots & \vdots & \ddots & \vdots \\ b_{n1} & b_{n2} & \cdots & b_{nk} \end{bmatrix} $$ $$ = \begin{bmatrix} \sum_{i = 1}^n\mathbf{a_{i}}\times b_{i1} & \sum_{i = 1}^n\mathbf{a_{i}}\times b_{i_{2}} & \cdots & \sum_{i = 1}^n\mathbf{a_{i}}\times b_{ik} \end{bmatrix} $$ 即答案矩阵 $(m \times k)$ 中第 $i$ 列数字所组成的向量即为以 $A$ 矩阵中 $n$ 个列向量为基底, $B$ 矩阵中第 $i$ 列为系数所组合出来的一个新的向量 $(m \times 1)$。
单位矩阵#
记号:$I$ $$ I = I_{n} = \begin{bmatrix} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{bmatrix}_{n} $$ 核心性质:
- $I_{n}\mathbf{x} = \mathbf{x}$ (对任意 $\mathbf{x}\in\mathbb{R}^n$)
- $AI = IA = A$
转置#
即将 $A$ 的行和列互换。
$$ A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}, \qquad A^{\mathrm{T}} = \begin{bmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{bmatrix} $$ 转置也使行空间和列空间互换。
- $(AB) ^ T = B ^ T A ^ T$
如何理解?从分块的角度看最清楚:$A$ 的列分组必须与 $B$ 的行分组匹配。转置之后,$A$ 的列变成了行、$B$ 的行变成了列,原来的「匹配」关系被翻转,所以要反过来乘才能重新匹配。设 $A$ 为 $m\times n$、$B$ 为 $n\times p$:
$$ \left[(AB)^{\mathrm{T}}\right]_{ji} = (AB)_{ij} = \sum_{k=1}^{n}a_{ik}b_{kj}, \qquad \left[B^{\mathrm{T}}A^{\mathrm{T}}\right]_{ji} = \sum_{k=1}^{n}(B^{\mathrm{T}})_{jk}(A^{\mathrm{T}})_{ki} = \sum_{k=1}^{n}b_{kj}a_{ik} $$
矩阵乘法的运算律#
- 结合律:$(AB)C = A(BC)$;
- 左分配律:$A(B+C) = AB + AC$;
- 右分配律:$(A+B)C = AC + BC$;
- 与标量交换:$c(AB) = (cA)B = A(cB)$;
- 单位元:$I_mA = A = AI_n$($A$ 为 $m\times n$);
- 转置反序:$(AB)^{\mathrm{T}} = B^{\mathrm{T}}A^{\mathrm{T}}$。
- 存在非零矩阵 $A,B$ 使得 $A \times B = O$。(所以无法通过 $AB = AC$ 推断出 $B = C$)
线性无关#
向量组 $\mathbf{v}_1, \dots, \mathbf{v}_k$ 线性无关,是指 $$ c_1\mathbf{v}_1 + c_2\mathbf{v}_2 + \cdots + c_k\mathbf{v}_k = \mathbf{0} $$ 只有零解 $c_1 = c_2 = \cdots = c_k = 0$。否则称线性相关。列无关的等价刻画:
- $A$ 的各列线性无关;
- $A\mathbf{x} = \mathbf{0}$ 只有零解;
- $\mathbf{N}(A) = \{\mathbf{0}\}$,即零空间维数为 $0$;
- 秩 $r = n$(所有列都是主元列);
- 若 $A\mathbf{x} = \mathbf{b}$ 有解,则解唯一。
线性方程组与矩阵#
像如下的方程组: $$ \begin{cases} a_{11}x_1 + a_{12}x_2 + \cdots + a_{1n}x_n = b_1 \\ a_{21}x_1 + a_{22}x_2 + \cdots + a_{2n}x_n = b_2 \\ \qquad \vdots \\ a_{m1}x_1 + a_{m2}x_2 + \cdots + a_{mn}x_n = b_m \end{cases} $$ 可以写为: $$ A\mathbf{x} = \mathbf{b} $$ 等价的关于该方程组的增广矩阵为 $\begin{bmatrix} A & \mathbf{b} \end{bmatrix}$。
现在我们回到刚开始 $A$ 的定义,可以看成每个列向量 $\mathbf{a_{j}}$ 的组合。
- 则对于所有 $\mathbf{x}$ ,$\mathbf{A}\mathbf{x}$ 所构成的向量集合就是这每个列向量组合所张成的空间。记做 $\mathbf{C}(A)$ ,称为列空间(column space)。
- $\mathbf{C}(A)$ 的维数 $dim\mathbf{C}(A)$ 即为矩阵 $\mathbf{A}$ 的秩 $rank$。
如此我们便将线性方程组这个概念和矩阵联系到一起了。