Dark Dwarf Blog background

线性代数基础

线性代数

1. 方程的几何意义

a.a. 行图像

在行图像中,每一个方程都代表一个几何图形。以二维空间为例,下面的方程:

2xy=0x+2y=3\begin{aligned} 2x - y &= 0\\ -x + 2y &= 3 \end{aligned}

在行图像的视角可以如下理解:

  • 第一个方程 2xy=02x - y = 0xx-yy 平面上代表一条直线。
  • 第二个方程 x+2y=3-x + 2y = 3 是平面上的另一条直线。
  • 方程组的解,就是这两条直线的交点。

三维空间亦然,下面的方程:

2xy=0x+2yz=13y+4z=4\begin{aligned} 2x - y &= 0\\ -x + 2y - z &= -1\\ -3y + 4z &= 4 \end{aligned}

这个方程组代表了三个平面。方程组的解,就是这三个平面的公共交点。

不过,在方程维度大于 3 之后,我们就无法继续上面的几何想像了,直观性下降了很多。

b.b. 列图像

列视角是线性代数中更核心、更强大的视角。在列图像中,我们将方程组看作是向量的线性合。前面二维空间的例子:

2xy=0x+2y=3\begin{aligned} 2x - y &= 0\\ -x + 2y &= 3 \end{aligned}

我们把它写成列向量的线性组合形式:

x[21]+y[12]=[03]\begin{aligned} x\begin{bmatrix}2\\-1\end{bmatrix} + y\begin{bmatrix}-1\\2\end{bmatrix} &= \begin{bmatrix}0\\3\end{bmatrix} \end{aligned}

它的解 x=1, y=2x=1,\ y=2 表示:

1[21]+2[12]=[21]+[24]=[03]\begin{aligned} 1\begin{bmatrix}2\\-1\end{bmatrix} + 2\begin{bmatrix}-1\\2\end{bmatrix} &= \begin{bmatrix}2\\-1\end{bmatrix} + \begin{bmatrix}-2\\4\end{bmatrix}\\ &= \begin{bmatrix}0\\3\end{bmatrix} \end{aligned}

因此 bb 可以由 col_1 \mathrm{col}\_1col_2 \mathrm{col}\_2 的线性组合得到。

同样,对前面的三维空间例子:

2xy+0z=0x+2yz=10x3y+4z=4\begin{aligned} 2x - y + 0z &= 0\\ -x + 2y - z &= -1\\ 0x - 3y + 4z &= 4 \end{aligned}

写成列向量线性组合的形式:

x[210]+y[123]+z[014]=[014]\begin{aligned} x\begin{bmatrix}2\\-1\\0\end{bmatrix} + y\begin{bmatrix}-1\\2\\-3\end{bmatrix} + z\begin{bmatrix}0\\-1\\4\end{bmatrix} &= \begin{bmatrix}0\\-1\\4\end{bmatrix} \end{aligned}

col_1=[210] \mathrm{col}\_1=\begin{bmatrix}2\\-1\\0\end{bmatrix}col_2=[123] \mathrm{col}\_2=\begin{bmatrix}-1\\2\\-3\end{bmatrix}col_3=[014] \mathrm{col}\_3=\begin{bmatrix}0\\-1\\4\end{bmatrix},目标向量 b=[014]b=\begin{bmatrix}0\\-1\\4\end{bmatrix}。几何上,这变成了:三个列向量能否通过合适的缩放与相加生成 bb

  • {col_1,col_2,col_3} \{\mathrm{col}\_1,\mathrm{col}\_2,\mathrm{col}\_3\} 张成整个 R3\mathbb{R}^3,则任意 bb 都有解。
  • 若这三向量退化(例如共面),则它们的线性组合只能落在那个平面上:
    • bb 在该平面内,则方程组有无穷多解;
    • bb 不在该平面上,则方程组无解。

在整个线性代数的学习中,列图像的重要性会越来越凸显。它将我们从解单个方程组的维提升到理解向量空间和矩阵变换的更高维度

2. 矩阵

a.a. 引入

我们引入一种新的线性组合表示方法。考虑下面三个向量

u=[110]v=[011]w=[001]u=\begin{bmatrix}1\\-1\\0\end{bmatrix}\quad v=\begin{bmatrix}0\\1\\-1\end{bmatrix}\quad w=\begin{bmatrix}0\\0\\1\end{bmatrix}

它们的线性组合为:

x1u+x2v+x3w=x1[110]+x2[011]+x3[001]=[x1x2x1x3x2].\begin{aligned} x_1 u + x_2 v + x_3 w &= x_1\begin{bmatrix}1\\-1\\0\end{bmatrix} + x_2\begin{bmatrix}0\\1\\-1\end{bmatrix} + x_3\begin{bmatrix}0\\0\\1\end{bmatrix}\\ &= \begin{bmatrix}x_1\\x_2 - x_1\\x_3 - x_2\end{bmatrix}. \end{aligned}

我们可以将列向量放入矩阵的列中,得到矩阵乘向量的形式:

A=[100110011],x=[x1x2x3],Ax=[100110011][x1x2x3]=[x1x2x1x3x2].\begin{aligned} A &= \begin{bmatrix} 1 & 0 & 0\\ -1 & 1 & 0\\ 0 & -1 & 1 \end{bmatrix},\qquad x = \begin{bmatrix}x_1\\x_2\\x_3\end{bmatrix},\\ Ax &= \begin{bmatrix} 1 & 0 & 0\\ -1 & 1 & 0\\ 0 & -1 & 1 \end{bmatrix} \begin{bmatrix}x_1\\x_2\\x_3\end{bmatrix} = \begin{bmatrix}x_1\\x_2 - x_1\\x_3 - x_2\end{bmatrix}. \end{aligned}

矩阵 AA 乘以向量 xx 的结果,与分别缩放并相加矩阵的列向量所得的组合完全相同。

从行的角度计算的话,方程就变为按行点积:

Ax=[(1,0,0)(x1,x2,x3)(1,1,0)(x1,x2,x3)(0,1,1)(x1,x2,x3)]=[x1x1+x2x2+x3].\begin{aligned} Ax &= \begin{bmatrix} (1,0,0)\cdot(x_1,x_2,x_3)\\[4pt] (-1,1,0)\cdot(x_1,x_2,x_3)\\[4pt] (0,-1,1)\cdot(x_1,x_2,x_3) \end{bmatrix} = \begin{bmatrix} x_1\\[4pt] -x_1 + x_2\\[4pt] -x_2 + x_3 \end{bmatrix}. \end{aligned}

这与行视角下的方程意义十分一致:矩阵每一行与列向量的点积,刚好对应一个线性方程组(也就是三维空间的平面):

1x1+0x2+0x3=b11x1+1x2+0x3=b20x11x2+1x3=b3\begin{aligned} 1x_1 + 0x_2 + 0x_3 &= b_1\\ -1x_1 + 1x_2 + 0x_3 &= b_2\\ 0x_1 - 1x_2 + 1x_3 &= b_3 \end{aligned}