01 – 矩阵的 行 化简(Row Reduction)

Row Reduction在解vector和matrix的方程时非常有用。首先我们了解什么是Row Reduced Matrix:

我们做行化简的最终目标是把matrix变成一个Row Reduced Echelon Form(RREF)。首先我们解释什么是Echelon Form。矩阵 Echelon form 的要求是所有数值不为0的entry在矩阵中的位置呈倒三角形/倒梯形排列。每一行的第一个不为0的entry正下方与正左侧都为0。具体形式如下,*表示任意数字:

\[\begin{bmatrix}* & … & * & … & * \\ 0 & 0 & * & … & * \\ 0 & 0 & * & … & * \\ … & … & 任意数量的行 & … & … \\ 0 & 0 & 0 & 0 & *\end{bmatrix}\]

而Reduced Echelon Form(和RREF/REF指代同一个东西),就是在Echelon form的基础上,每行的行首为1,且这些行首所在的列中,他们是唯一不为0的entry。以下是一部分例子:

\[\begin{bmatrix}1 & 0 & 0 \\ 0 & 1& 0 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}1 & 0 & 0 & a\\ 0 & 1 & 0 & b \\ 0 & 0 & 1 & c\end{bmatrix}\begin{bmatrix}1 & 0 & a & 0\\ 0 & 1 & b & 0 \\ 0 & 0 & 0 & 1\end{bmatrix}\begin{bmatrix}1 & 0 & 0 \\ 0 & 1 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0\end{bmatrix}\]

这里的每一个行首的 “ 1 ” 都是一个Pivit,这个Pivit的特征体现在:这个矩阵(Matrix)中,所有它正下方和正左方 entry 的值都为0。至于他的一些用法,我们在下文Row Reduction的过程中会讲到。而我们看到上图中有包含[ a, b, c ] 的列,这些 a,b,c 属于常数,而这一列则叫做自由变量(Free Variable)列。在这里理解这个Free Variable则需要线代的一些基础知识。以上图由左到右第二个图举例,这个matrix四列的四个向量(Vector)都属于\(R^3\),因此这四个Vector必然会Linearly dependent。所以,第四列的常数Vector就可以被前三列的Vector所组合出来,第四列进行multiplication的值,永远可以被前三个Vector的组合抵消。所以我们叫它Free Variable column。

行简化(Row Reduction)的做法以及它的具体应用:

假设我们想通过linear combination 的公式 Ax=y 求一个位置的向量,举个栗子(Matrix的值是我瞎编的,但row reduction的方法是通用的):

\[\begin{bmatrix}1 & 4 & 5 \\ 2 & 5& 1 \\ 0 & 1 & 2\end{bmatrix}\begin{bmatrix}x \\ y\\ z\end{bmatrix}=\begin{bmatrix}5\\2\\9\end{bmatrix}\]

首先我们把两边已知的部分整合成一个大的矩阵(Augmented Matrix),然后对这个综合矩阵进行Row Reduce:

\[\begin{bmatrix}1 & 4 & 5 & | & 5 \\ 2 & 5& 1 & | & 2 \\ 0 & 1 & 2 & | & 9\end{bmatrix}\]

在Row Reduce 中,对于矩阵A,B,C,已知AB=C时,当B不变的情况下,A和C可以同步进行行(Row)的变换;在A不变的情况下,B和C可以同步进行列(Column)的变换。Row Reduction是利用了行A,C可以同步进行行(Row)变换的特性。可以进行的变换有:行相加(Row Adding),行交换(Row Exchanging)以及行加倍(Row Multiplication)。我们现在对这个例子进行Row Reduction。为了方便,我们去掉了Augmented Matrix中用来分界的竖线:

Step1:交换2,3行,

\[\begin{bmatrix}1 & 4 & 5 & 5\\ 0 & 1 & 2 & 9\\2 & 5 & 1 & 2\end{bmatrix}\]

Step2:第3行 – 2 * 第1行,

\[\begin{bmatrix}1 & 4 & 5 & 5\\ 0 & 1 & 2 & 9\\0 & -3 & -9 & -8\end{bmatrix}\]

Step3:第3行 + 3 * 第2行,

\[\begin{bmatrix}1 & 4 & 5 & 5\\ 0 & 1 & 2 & 9\\0 & 0 & -3 & 19\end{bmatrix}\]

Step4:第3行 * (-1/3) ,

\[\begin{bmatrix}\underline{1} & 4 & 5 & 5\\ 0 & \underline{1} & 2 & 9\\0 & 0 & \underline{1} & -19/3\end{bmatrix}\]

此时我们就得到了一个Row Reduction的半成品,此时我们找到了传说中的Pivot,就是上面用下划线标注的那些1。这些Pivot非常有用,因为我们可以发现,通过靠上方的行减去靠下行的multiplication(比如行1减去5个行3)我们就可以消除Pivot右侧每一列的数值。这里第四列我们化不出pivot,所以它没法被完全消除。但由于这个matrix 是一个Augmented Matrix,所以我们暂时不把它看作一个Free Variable Column,具体原因请继续看:

Step5:第1行 – 4 * 第2行,

\[\begin{bmatrix}1 & 0 & -3 & -31\\ 0 & 1 & 2 & 9\\0 & 0 & 1 & -19/3\end{bmatrix}\]

Step6:第1行 + 3 * 第3行,

\[\begin{bmatrix}1 & 0 & 0 & -50\\ 0 & 1 & 2 & 9\\0 & 0 & 1 & -19/3\end{bmatrix}\]

Step7:第2行 – 2 * 第3行,

\[\begin{bmatrix}1 & 0 & 0 & -50\\ 0 & 1 & 0 & \frac{65}{3}\\0 & 0 & 1 & -19/3\end{bmatrix}\]

此时,这个Augmented Matrix就已经被完全行化简了。它在保留原本Matrix所有特性(表示完全相同的Span)的同时,把自己化简成了左侧为Identical Matrix,右侧为一个Vector Column的形式。这种形式,也可以被称为 Row Reduced Echelon Form,简称RREF。

我们回到原始的解方程,拆开Augmented Matrix,将未知Vector [ x y z ] 加回到这个式子,现在的方程式就被化简成为:

\[\begin{bmatrix}1 & 0 & 0 \\ 0 & 1& 0 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}x \\ y\\ z\end{bmatrix}=\begin{bmatrix}-50\\ \frac{65}{3} \\ \frac{19}{3}\end{bmatrix}\]

展开左侧的 Linear Combination,我们可以得到:

\[x \begin{bmatrix}1 \\ 0 \\ 0\end{bmatrix} + y \begin{bmatrix}0\\1\\0\end{bmatrix} + z \begin{bmatrix}0\\0\\1\end{bmatrix}=\begin{bmatrix}-50\\ \frac{65}{3} \\ \frac{19}{3}\end{bmatrix}\]

从而解出最终结果 \(x=-50, y=\frac{65}{3}, z = \frac{19}{3} \)

一个特殊的情况 — Free Variable

假设我们行化简之后得出了这样一个等式:

\[\begin{bmatrix}1 & 0 & 1 & 0\\0 & 1 & 2 & 0\\ 0 & 0 & 0 & 1\end{bmatrix}\begin{bmatrix}w\\x \\ y\\ z\end{bmatrix}=\begin{bmatrix}4\\ 5 \\ 6\end{bmatrix}\]

此时的 [ 1 2 0 ]这个列就是一个Free Variable Column。对应的,展开后的式子会长这样:

\[w \begin{bmatrix}1 \\ 0 \\ 0\end{bmatrix} + x \begin{bmatrix}0 \\ 1 \\ 0\end{bmatrix} + y \begin{bmatrix}1\\2\\0\end{bmatrix} + z \begin{bmatrix}0\\0\\1\end{bmatrix}=\begin{bmatrix}4\\ 5 \\ 6\end{bmatrix}\]

由于 y 所对应的 [ 1 2 0 ]是Free Variable Column, 我们把y看作Free Variable,保留在解的vector中。这个时候,这个等式的解就是一个Span,而y所对应的Vector Column所标示的就是这个解集所构成的subspace的方向。

在这个情况下,要抵消掉 y,则需要

w = – y,x = – 2y,z = 0

当y=0,则

w = 4,x = 5,z = 6

这时,[ 4 5 0 6 ] 就成为了解集这个subset的定位点,而方向vector的计算则是通过将 w,x,z 通过y表示,此时 [ w x y z ] (这也是对所有\(R^4\)默认的方向vector,毕竟都是根据四个轴延伸嘛)便会成为 [-y -2y y 0]。因此,最终的解会是一个可以用公式(equation form)表示的集合 subspace:

\[\begin{bmatrix}w\\ x \\ y\\z\end{bmatrix}=\begin{bmatrix}4\\5\\0\\6\end{bmatrix} + y \begin{bmatrix}-1\\-2\\1\\0\end{bmatrix}\]

所以这就是全部 关于行化简(Row Reduction)的内容了,希望我写的有够清楚….

本文为JamesChenS原创,感谢发现了这些数学知识的科学家们,未经允许禁止转载。

Scroll to Top