第 09 章

线性无关、基与维数

把「无关」「张成」「基」「维数」四个词一次定义清楚:无关看零组合是否唯一,张成看所有组合,基是二者兼具,维数是所有基共同的向量个数。

Independence, Basis, and Dimension

Four words get precise meanings: independence asks whether a zero combination is unique, spanning asks for all combinations, a basis does both, and dimension is the shared size of every basis.

首发于 2009.05.07中 / EN
系统课程linear-algebraindependencebasisdimension
语言
字号
目录
篇内目录

本讲要建立的四个词

这一讲是 18.06 的分水岭:此前一直在算(消元、解方程、找零空间),此后开始给结构命名。四个词各有明确分工:

词判断对象核心问题
线性无关一组向量除了全取零,还有没有组合能得到零向量?
张成一组向量与一个空间空间里每个向量是否都是这组向量的组合?
基一组向量与一个空间既无关又能张成,数量刚刚好
维数一个空间任意一组基里有多少个向量?

需要特别注意语法:是「一组向量」无关,不是「一个矩阵」无关;矩阵有秩,空间有维数。用词准确本身就是理解的一部分。

开场的关键事实:方程少于未知数

设 AA 是 m×nm\times n,且 n>mn>m。那么 Ax=0A\mathbf{x}=\mathbf{0} 一定有非零解。

理由是消元:nn 个变量最多只有 mm 个主元,因此至少有 n−mn-m 个自由变量。给自由变量赋非零值,再解出主元变量,就得到一个非零解。换句话说:

未知数多于方程时,零空间一定不止包含零向量。

这条事实会在本讲反复使用——它正是「nn 个向量挤在更低维空间里必然相关」的矩阵版本。

时间轴

时间内容
0:09开场:本讲要定义的四个词
1:52方程比未知数多,必然存在自由变量
3:55给自由变量赋非零值,得到零的非平凡组合
5:36两个向量 vv 与 2v2v 的组合
9:18三个共面向量必然线性相关
11:00线性无关的定义:只有零系数才给出零
14:33把列的组合写成矩阵乘法 AxA\mathbf{x}
16:14数主元判断列是否无关
17:54无关当且仅当零空间只有零向量
21:36张成:列空间覆盖整个空间
25:02标准基 e1,e2,e3e_1,e_2,e_3
26:45基不唯一:可以换掉其中一个向量
28:26加入一个平面外的向量得到新基
30:19R3R^3 中三个向量构成基的条件
33:57所有基含有相同个数的向量
37:27基 = 线性无关 + 张成
40:48从列中挑基:主元列
42:28维数:dim⁡C(A)=r\dim C(A)=r,dim⁡N(A)=n−r\dim N(A)=n-r
45:54另一组基:主元列与特殊解
49:17本讲公式收束

线性无关的定义

向量 v1,…,vn\mathbf{v}_1,\dots,\mathbf{v}_n 线性无关,当且仅当

c1v1+c2v2+⋯+cnvn=0c_1\mathbf{v}_1+c_2\mathbf{v}_2+\cdots+c_n\mathbf{v}_n=\mathbf{0}

只有唯一解 c1=c2=⋯=cn=0c_1=c_2=\cdots=c_n=0。如果存在不全为零的系数使上式成立,它们就线性相关。

三个直观例子

  1. v\mathbf{v} 与 2v2\mathbf{v}:取 2v1−v2=02\mathbf{v}_1-\mathbf{v}_2=\mathbf{0},系数 (2,−1)(2,-1) 不全为零,相关。
  2. v\mathbf{v} 与零向量:取 0⋅v+5⋅0=00\cdot\mathbf{v}+5\cdot\mathbf{0}=\mathbf{0},相关。只要一组向量里出现零向量,这组向量必然相关。
  3. 平面上的三个向量:把它们作为列放进一个 2×32\times3 矩阵,未知数 3 个、方程 2 个,必有非零零空间向量,所以三个平面向量必然相关。

第三个例子说明:「太多」本身就是相关的来源。在 nn 维空间里,任何超过 nn 个向量都必然相关。

用矩阵判断无关:零空间

把 v1,…,vn\mathbf{v}_1,\dots,\mathbf{v}_n 作为矩阵 AA 的列:

Ac=c1v1+⋯+cnvn.A\mathbf{c}=c_1\mathbf{v}_1+\cdots+c_n\mathbf{v}_n.

于是:

  • 列向量无关   ⟺  \iff N(A)={0}N(A)=\{\mathbf{0}\};
  • 列向量相关   ⟺  \iff N(A)N(A) 中有非零向量;
  • 无关时秩 r=nr=n,所有列都是主元列,没有自由变量;
  • 相关时秩 r<nr<n,存在自由列。

这也给出一个常用判据:方阵的列构成基   ⟺  \iff 方阵可逆。

张成

一组向量张成一个空间,意思是:该空间恰好由这组向量的所有线性组合组成。

这个定义有一个等价说法:所有包含这组向量的子空间中,张成空间是最小的那个。因为任何包含这些向量的子空间,都必须包含它们的任意组合。

矩阵的列张成列空间,这是最常用的例子。注意「张成」只要求覆盖,不要求经济——多余向量可以存在,只是不必要。

基:不多不少

空间 VV 的一组基是同时满足两个条件的向量组:

  1. 线性无关(没有多余向量);
  2. 张成 VV(没有遗漏)。

基不是唯一的。R3\mathbb{R}^3 的标准基

e1=[100],e2=[010],e3=[001]\mathbf{e}_1=\begin{bmatrix}1\\0\\0\end{bmatrix},\quad \mathbf{e}_2=\begin{bmatrix}0\\1\\0\end{bmatrix},\quad \mathbf{e}_3=\begin{bmatrix}0\\0\\1\end{bmatrix}

是最方便的一组,但任意可逆 3×33\times3 矩阵的列都是 R3\mathbb{R}^3 的基。

例:什么时候两个向量不够,三个又太多

在 R3\mathbb{R}^3 中取

v1=[112],v2=[225].\mathbf{v}_1=\begin{bmatrix}1\\1\\2\end{bmatrix},\qquad \mathbf{v}_2=\begin{bmatrix}2\\2\\5\end{bmatrix}.

它们无关(不成比例),但只张成一个平面,不能张成整个 R3\mathbb{R}^3。

若加入 v3=(3,3,7)⊤\mathbf{v}_3=(3,3,7)^\top,它等于 v1+v2\mathbf{v}_1+\mathbf{v}_2,三个向量仍只张成那个平面,且变得相关——数量够了,方向没够。

若加入 v3=(3,3,8)⊤\mathbf{v}_3=(3,3,8)^\top,看起来「跳出平面」,但把三个向量作为列:

A=[123123258].A=\begin{bmatrix}1&2&3\\1&2&3\\2&5&8\end{bmatrix}.

第一行与第二行完全相同,所以 AA 不可逆,列必然相关。直接验证:

v1−2v2+v3=0.\mathbf{v}_1-2\mathbf{v}_2+\mathbf{v}_3=\mathbf{0}.

这个例子说明两件事:其一,凭直觉挑第三个向量并不可靠;其二,行之间的关系会限制列——这正是下一讲「行空间」的伏笔。

维数:所有基共享的数目

给定一个空间,它的任意两组基含有相同数量的向量。这个数量称为该空间的维数。

dim⁡(Rn)=n,dim⁡(列空间)=秩 r.\dim(\mathbb{R}^n)=n,\qquad \dim(\text{列空间})=\text{秩 }r.

维数的意义是「刚好够用的向量个数」:少一个就张不满,多一个就必相关。

列空间与零空间的维数

对本讲的矩阵 AA(m×nm\times n,秩 rr):

  • 列空间的基:原矩阵 AA 的 rr 个主元列。注意是 AA 的列,不是行简化形 RR 的列——行变换会改变列空间。
  • 零空间的基:对应 n−rn-r 个自由变量的特殊解。
  • 因此
dim⁡C(A)=r,dim⁡N(A)=n−r.\dim C(A)=r,\qquad \dim N(A)=n-r.

两者相加恰好是列数 nn,因为 nn 个变量被分成 rr 个主元变量与 n−rn-r 个自由变量。

一个重要推论

如果已知一个空间的维数是 dd,那么只要拿到 dd 个无关向量,它们自动构成基——不需要再验证张成。理由:若它们张不满,就还需要第 d+1d+1 个向量,而那个向量必然与前 dd 个相关,矛盾。

这条推论在考试与工程里都很省事:维数已知时,只需验证无关。

本讲结论

  • 无关 = 零组合唯一;相关 = 存在非零零组合。
  • 张成 = 取遍所有线性组合;它是最小的包含该向量组的子空间。
  • 基 = 无关 + 张成;基不唯一,但向量个数唯一。
  • 维数 = 任一 basis 的向量数。
  • 列空间维数是秩 rr,零空间维数是 n−rn-r。

理解检验

1. 为什么「一组向量里有零向量」必然导致相关?

参考答案:设 vk=0\mathbf{v}_k=\mathbf{0}。取系数 ck=1c_k=1、其余 ci=0c_i=0,则

c1v1+⋯+cnvn=1⋅0=0,c_1\mathbf{v}_1+\cdots+c_n\mathbf{v}_n=1\cdot\mathbf{0}=\mathbf{0},

而系数不全为零。按定义,这组向量相关。零向量不提供任何新方向,所以它对张成没有贡献,只会破坏无关性。

2. R3\mathbb{R}^3 中三个向量相关,是否一定意味着其中一个是另外两个的组合?如果其中两个共线呢?

参考答案:一定意味着其中某一个可以写成其余的组合。由相关性,存在不全为零的 c1,c2,c3c_1,c_2,c_3 使 c1v1+c2v2+c3v3=0c_1\mathbf{v}_1+c_2\mathbf{v}_2+c_3\mathbf{v}_3=\mathbf{0}。取一个非零系数,例如 c3≠0c_3\ne0,则

v3=−c1c3v1−c2c3v2,\mathbf{v}_3=-\frac{c_1}{c_3}\mathbf{v}_1-\frac{c_2}{c_3}\mathbf{v}_2,

即 v3\mathbf{v}_3 是另外两个的组合。

若其中两个共线,比如 v1=λv2\mathbf{v}_1=\lambda\mathbf{v}_2,那么 v1−λv2=0\mathbf{v}_1-\lambda\mathbf{v}_2=\mathbf{0} 已经是不全为零的组合,三个向量必然相关;此时被表示出来的是共线的那一对中的某一个(v1=λv2\mathbf{v}_1=\lambda\mathbf{v}_2),而第三个向量完全可以是与它们无关的方向。也就是说相关性的「肇事者」是共线的那一对,不是第三个。

3. 为什么 dim⁡C(A)=r\dim C(A)=r 用的是 AA 的主元列,而不是 RR 的主元列?

参考答案:行变换保持零空间,却会改变列空间。RR 的列是行化简后的列,它们张成的空间一般不等于 C(A)C(A)——例如把 AA 化成 RR 时,某些列的数值被改写了。所以不能用 RR 的列来张成 C(A)C(A)。

AA 的主元列则同时满足两个条件:

  • 无关:它们在 RR 中对应的列是主元列,而 RR 的主元列线性无关,行变换不改变列之间的线性关系,所以 AA 的主元列也无关;
  • 张成 C(A)C(A):RR 的每一列都是其主元列的组合,且组合系数在行变换前后保持不变,所以 AA 的每一列都是 AA 的主元列的组合。

无关且张成,故 AA 的主元列构成 C(A)C(A) 的基,个数为 rr。

4. 已知某空间维数为 4,手上有 4 个无关向量,它们为什么自动是基?

参考答案:只需再验证它们张成该空间。若不满,就存在空间中的向量 w\mathbf{w} 不在这 4 个向量的张成里;把 w\mathbf{w} 加入后得到 5 个无关向量(否则 w\mathbf{w} 会落在原张成里,矛盾)。但 dd 维空间中任意多于 dd 个向量必相关——5 个无关向量与 dim⁡=4\dim=4 矛盾。所以这 4 个向量必然已经张成空间,构成基。等价说法:任一无关组都可以扩充为基,而基有 4 个向量,原组已经是 4 个,不能再扩充。

5. 一个 5×75\times7 矩阵秩为 3,列空间与零空间的维数各是多少?

参考答案:m=5m=5、n=7n=7、r=3r=3。列空间维数等于秩:

dim⁡C(A)=r=3.\dim C(A)=r=3 .

零空间维数等于自由变量个数:

dim⁡N(A)=n−r=7−3=4.\dim N(A)=n-r=7-3=4 .

两者之和 3+4=7=n3+4=7=n,与「主元变量 + 自由变量 = 全部变量」一致。(顺带:行空间维数也是 3,左零空间维数是 m−r=2m-r=2。)

与前后课程的关系

上一讲用消元求零空间,这一讲为那些计算命名。下一讲把这套语言推广到四个基本子空间,并给出列空间与行空间维数相同的惊人事实。

Four words this lecture defines

This is the pivot of 18.06. Until now the work was computation: elimination, solving systems, finding null spaces. From here on, the course names structure.

TermApplies toQuestion it answers
Linear independenceA set of vectorsIs the all-zero combination the only one that gives 0\mathbf{0}?
SpanningA set of vectors and a spaceIs every vector in the space a combination of the set?
BasisA set of vectors and a spaceIndependent and spanning: exactly the right size
DimensionA spaceHow many vectors does any basis contain?

Grammar matters: a set of vectors is independent, not a matrix. A matrix has rank; a space has dimension. Getting the words right is part of getting the idea right.

The opening fact: more unknowns than equations

Let AA be m×nm\times n with n>mn>m. Then Ax=0A\mathbf{x}=\mathbf{0} has a nonzero solution.

Elimination explains it: with at most mm pivots among nn variables, at least n−mn-m variables are free. Assign a nonzero value to a free variable, solve for the pivots, and you have a nonzero solution. In one sentence:

More unknowns than equations forces a null space larger than {0}\{\mathbf{0}\}.

This fact drives the whole lecture. It is the matrix form of "too many vectors in a lower-dimensional space must be dependent".

Timeline

TimeTopic
0:09Opening: the four words this lecture defines
1:52More unknowns than equations forces free variables
3:55Nonzero choices of free variables give a combination equal to zero
5:36Combinations of vv and 2v2v
9:18Three coplanar vectors are always dependent
11:00Definition of independence: only zero coefficients give zero
14:33Column combinations written as AxA\mathbf{x}
16:14Counting pivots to test the columns
17:54Independent exactly when the null space is trivial
21:36Spanning: the columns reach every vector
25:02The standard basis e1,e2,e3e_1,e_2,e_3
26:45Bases are not unique
28:26Adding a vector off the plane gives another basis
30:19When three vectors in R3R^3 form a basis
33:57Every basis of a space has the same size
37:27Basis = independent and spanning
40:48Picking a basis: the pivot columns
42:28Dimensions: rr and n−rn-r
45:54Another basis: pivot columns and special solutions
49:17The lecture's closing formulas

Independence

Vectors v1,…,vn\mathbf{v}_1,\dots,\mathbf{v}_n are linearly independent exactly when

c1v1+c2v2+⋯+cnvn=0c_1\mathbf{v}_1+c_2\mathbf{v}_2+\cdots+c_n\mathbf{v}_n=\mathbf{0}

has only the solution c1=⋯=cn=0c_1=\cdots=c_n=0. If some nonzero choice of coefficients also produces 0\mathbf{0}, the vectors are dependent.

Three quick cases

  1. v\mathbf{v} and 2v2\mathbf{v}. Take 2v1−v2=02\mathbf{v}_1-\mathbf{v}_2=\mathbf{0}. The coefficients (2,−1)(2,-1) are not all zero, so the pair is dependent.
  2. v\mathbf{v} and the zero vector. Take 0⋅v+5⋅0=00\cdot\mathbf{v}+5\cdot\mathbf{0}=\mathbf{0}. Any set containing the zero vector is dependent.
  3. Three vectors in the plane. Put them as the columns of a 2×32\times3 matrix. Three unknowns, two equations, so a nonzero null-space vector exists. Three planar vectors are always dependent.

The third case makes the general principle visible: excess alone creates dependence. In an nn-dimensional space, any set of more than nn vectors is dependent.

Independence through the null space

Put v1,…,vn\mathbf{v}_1,\dots,\mathbf{v}_n into the columns of AA. Then

Ac=c1v1+⋯+cnvn.A\mathbf{c}=c_1\mathbf{v}_1+\cdots+c_n\mathbf{v}_n.

Therefore:

  • the columns are independent iff N(A)={0}N(A)=\{\mathbf{0}\};
  • they are dependent iff N(A)N(A) contains a nonzero vector;
  • independent means rank r=nr=n: every column is a pivot column, with no free variables;
  • dependent means r<nr<n: some free column exists.

For a square matrix this becomes: the columns form a basis of Rn\mathbb{R}^n iff the matrix is invertible.

Spanning

A set of vectors spans a space when the space consists of all linear combinations of those vectors.

There is an equivalent description: among all subspaces containing the vectors, the span is the smallest one. Any subspace that contains the vectors must contain every combination of them, so stopping at the combinations gives the minimum.

The columns of a matrix span its column space. Spanning does not require economy: redundant vectors may be present, they are simply unnecessary.

Basis: not too few, not too many

A basis of a space VV is a set of vectors that is

  1. linearly independent (nothing redundant), and
  2. spanning (nothing missing).

Bases are not unique. The standard basis of R3\mathbb{R}^3,

e1=[100],e2=[010],e3=[001],\mathbf{e}_1=\begin{bmatrix}1\\0\\0\end{bmatrix},\quad \mathbf{e}_2=\begin{bmatrix}0\\1\\0\end{bmatrix},\quad \mathbf{e}_3=\begin{bmatrix}0\\0\\1\end{bmatrix},

is the most convenient one, but the columns of any invertible 3×33\times3 matrix also form a basis.

Example: two are too few, three can be too many

In R3\mathbb{R}^3 take

v1=[112],v2=[225].\mathbf{v}_1=\begin{bmatrix}1\\1\\2\end{bmatrix},\qquad \mathbf{v}_2=\begin{bmatrix}2\\2\\5\end{bmatrix}.

They are independent (not multiples), but they span only a plane, not all of R3\mathbb{R}^3.

Adding v3=(3,3,7)⊤\mathbf{v}_3=(3,3,7)^\top does not help: it equals v1+v2\mathbf{v}_1+\mathbf{v}_2, so the three vectors still span the same plane and are now dependent.

Adding v3=(3,3,8)⊤\mathbf{v}_3=(3,3,8)^\top looks better, but form the matrix with these vectors as columns:

A=[123123258].A=\begin{bmatrix}1&2&3\\1&2&3\\2&5&8\end{bmatrix}.

Rows one and two are identical, so AA is singular and its columns must be dependent. Directly,

v1−2v2+v3=0.\mathbf{v}_1-2\mathbf{v}_2+\mathbf{v}_3=\mathbf{0}.

Two lessons follow. Picking the third vector by geometric intuition is unreliable. And relations among rows constrain the columns — the seed of the next lecture on row space.

Dimension

Any two bases of a given space contain the same number of vectors. That number is the dimension of the space.

dim⁡(Rn)=n,dim⁡(column space)=rank r.\dim(\mathbb{R}^n)=n,\qquad \dim(\text{column space})=\text{rank }r.

Dimension is "exactly enough": one vector fewer cannot span, one more must be dependent.

Dimensions of the column and null spaces

For AA of size m×nm\times n and rank rr:

  • Column space basis: the rr pivot columns of the original AA. They must come from AA, not from the reduced form RR, because row operations change the column space.
  • Null space basis: the special solutions associated with the n−rn-r free variables.
  • Hence
dim⁡C(A)=r,dim⁡N(A)=n−r.\dim C(A)=r,\qquad \dim N(A)=n-r.

The two add to the number of columns nn, because the nn variables split into rr pivot variables and n−rn-r free variables.

A useful corollary

If you already know a space has dimension dd, then any dd independent vectors in it automatically form a basis. If they failed to span, you would need a (d+1)(d+1)-st vector, which would have to be dependent on the first dd — a contradiction.

This saves work in both exercises and engineering: when the dimension is known, independence alone suffices.

Takeaways

  • Independent means the zero combination is unique; dependent means a nonzero combination gives zero.
  • Spanning means taking every linear combination; it is the smallest subspace containing the set.
  • A basis is independent and spanning. Bases vary; their size does not.
  • Dimension is the number of vectors in any basis.
  • The column space has dimension rr; the null space has dimension n−rn-r.

Check your understanding

1. Why does a set containing the zero vector have to be dependent?

Reference answer: Suppose vk=0\mathbf{v}_k=\mathbf{0}. Choose ck=1c_k=1 and all other ci=0c_i=0. Then

c1v1+⋯+cnvn=1⋅0=0,c_1\mathbf{v}_1+\cdots+c_n\mathbf{v}_n=1\cdot\mathbf{0}=\mathbf{0},

with coefficients not all zero, so the set is dependent by definition. The zero vector supplies no new direction: it contributes nothing to the span while destroying independence.

2. If three vectors in R3\mathbb{R}^3 are dependent, must one be a combination of the other two? What if two of them are collinear?

Reference answer: Yes, some one of them is a combination of the rest. Dependence gives c1v1+c2v2+c3v3=0c_1\mathbf{v}_1+c_2\mathbf{v}_2+c_3\mathbf{v}_3=\mathbf{0} with some coefficient nonzero. If, say, c3≠0c_3\ne0, then

v3=−c1c3v1−c2c3v2,\mathbf{v}_3=-\frac{c_1}{c_3}\mathbf{v}_1-\frac{c_2}{c_3}\mathbf{v}_2,

so v3\mathbf{v}_3 is a combination of the other two.

If two are collinear, say v1=λv2\mathbf{v}_1=\lambda\mathbf{v}_2, then v1−λv2=0\mathbf{v}_1-\lambda\mathbf{v}_2=\mathbf{0} is already a nontrivial combination, so the triple is dependent regardless of the third vector. The vector being represented is one of the collinear pair, and the third may point in a completely independent direction — the collinear pair is what spoils independence, not the third vector.

3. Why does a column-space basis use the pivot columns of AA rather than those of RR?

Reference answer: Row operations preserve the null space but change the column space. The columns of RR have been rewritten, so they generally do not span C(A)C(A); using them would give the wrong space.

The pivot columns of AA satisfy both requirements:

  • Independence: their counterparts in RR are pivot columns and are independent, and row operations preserve all linear relations among columns, so the pivot columns of AA are independent too.
  • Spanning: every column of RR is a combination of its pivot columns, with coefficients unchanged by the row operations, so every column of AA is the same combination of the pivot columns of AA.

Independent and spanning, the pivot columns of AA form a basis of C(A)C(A), and there are rr of them.

4. Why do four independent vectors in a four-dimensional space automatically form a basis?

Reference answer: Only spanning remains to be checked. If they failed to span, some vector w\mathbf{w} of the space would lie outside their span; adjoining w\mathbf{w} would produce five independent vectors (otherwise w\mathbf{w} would lie in the span, a contradiction). But any set of more than dd vectors in a dd-dimensional space is dependent, which contradicts dim⁡=4\dim=4. So the four vectors already span the space. Equivalently, every independent set extends to a basis; a basis has four vectors, and the set already has four, so there is nothing to add.

5. For a 5×75\times7 matrix of rank 3, what are the dimensions of the column and null spaces?

Reference answer: Here m=5m=5, n=7n=7 and r=3r=3. The column-space dimension equals the rank:

dim⁡C(A)=r=3.\dim C(A)=r=3 .

The null-space dimension equals the number of free variables:

dim⁡N(A)=n−r=7−3=4.\dim N(A)=n-r=7-3=4 .

The two add to 3+4=7=n3+4=7=n, matching "pivot variables plus free variables equal all variables." (For reference, the row space also has dimension 3, and the left null space has dimension m−r=2m-r=2.)

How this connects to the course

The previous lecture computed null spaces; this one names what those computations produce. The next lecture extends the language to the four fundamental subspaces and proves the surprising fact that the row space and column space have the same dimension.

来源