第 11 章
矩阵空间、秩一矩阵与小世界图
向量空间不限于 R^n:矩阵、函数都可以是向量。秩一矩阵是构造所有矩阵的积木,图则把线性代数带到网络与友谊链上。
Matrix Spaces, Rank-One Matrices, and Small-World Graphs
Vector spaces go beyond R^n: matrices and functions qualify too. Rank-one matrices are the building blocks of every matrix, and graphs bring linear algebra to networks and friendship chains.
篇内目录
- Vectors need not be arrows
- Timeline
- Three subspaces
- Symmetric matrices,
- Upper triangular matrices,
- Diagonal matrices,
- Intersection, union, and sum
- Functions are vectors too
- Rank-one matrices: the smallest blocks
- Example
- Every matrix is a sum of rank-one matrices
- Rank-one matrices are not a subspace
- A concrete subspace: components summing to zero
- Graphs: the next stage
- Takeaways
- Check your understanding
- How this connects to the course
向量不一定是箭头
上一讲末尾已经出现「矩阵作为向量」的想法,这一讲把它展开。判断标准只有一条:能相加、能乘标量,就构成向量空间。矩阵乘法在这里完全用不上。
全体 矩阵记作 。它的标准基是九个矩阵 ,每个只在第 行第 列有一个 1,其余为 0。因此
这九个矩阵相加、乘系数,可以拼出任意 矩阵,而且它们线性无关。
时间轴
| 时间 | 内容 |
|---|---|
| 0:10 | 矩阵空间与它的子空间 |
| 1:52 | 对称矩阵与上三角矩阵 |
| 6:58 | 对称矩阵的维数是 6 |
| 8:39 | 既对称又是上三角,只能是矩阵对角 |
| 10:21 | 子空间的交、并与和 |
| 13:48 | |
| 15:28 | 微分方程 的解空间 |
| 18:52 | 解空间维数为 2,基是 |
| 20:38 | 秩一矩阵是最小的积木 |
| 22:19 | 秩一矩阵 = 列乘行,维数 |
| 24:03 | 秩一矩阵的完整图景 |
| 27:30 | |
| 29:15 | 分量和为零的子空间 |
| 34:19 | 该子空间的零空间维数为 3 |
| 39:27 | 图与关联矩阵的预告 |
| 44:36 | 留给下一讲的问题 |
三个子空间
对称矩阵
对称要求 。独立选择的参数是:3 个对角元,加上对角线上方的 3 个元素;下方的 3 个由对称性决定。所以
注意: 的基不能只从标准基里挑。九个 中只有 3 个是对称的(),它们张不出全部对称矩阵。要得到完整的基,需要把 这样的组合加进来,例如
这是一个反复出现的教训:大空间的基不一定是子空间的基。
上三角矩阵
要求对角线下方全为 0。可自由选择的是对角元 3 个加上上方 3 个,共 6 个,所以
与对称情形不同, 的基恰好可以从标准基里挑出六个(,)。这只是巧合,不能当作通用方法。
对角矩阵
既对称又上三角,只能是对角矩阵。自由参数只有 3 个对角元:
交、并与和
- 交 ,维数 3。
- 并 不是子空间。取一个对称但非上三角的矩阵,再取一个上三角但非对称的矩阵,两者相加通常既不对称也不上三角,说明并集对加法不封闭。
- 和 定义为「一个 中元素加一个 中元素」的全体。它其实就是整个 。构造方法如下:给定任意 ,令
对称, 上三角,逐元素相加恰好得到 。因此
维数公式随之成立:
函数也是向量
考虑微分方程
它的解是
所有解构成一个向量空间:两个解相加仍是解,乘常数仍是解。 是一组基,维数是 2。
也可以选 作为基——基不唯一,维数唯一。Strang 的评论很精炼:一门线性微分方程课,本质上就是在给解空间找基。二阶方程的解空间维数是 2,这与方程阶数对应。
这类例子的意义在于:线性代数的语言(组合、无关、基、维数)并不依赖「向量是箭头」这一图像,只要对象能相加、能数乘即可。
秩一矩阵:最小的积木
秩为 1 的矩阵有一个非常干净的结构:
其中 是列向量, 是行向量。乘积是一个矩阵,每一列都是 的倍数。
例子
- 行空间由 张成,维数 1;
- 列空间由 张成,维数 1;
- 秩为 1,两个维数一致。
所有矩阵都是秩一矩阵之和
一个秩为 的矩阵可以写成 个秩一矩阵之和。例如一个 、秩为 4 的矩阵,可以拆成 4 个「列 × 行」的外积。
这解释了为什么秩一是「积木」:它是最简单的非零矩阵,而所有矩阵都由若干块拼成。后续讲行列式与特征值时,秩一矩阵还会反复出现,因为它的结构足够简单,计算可以化简。
秩一矩阵不构成子空间
一个自然的错误是把「所有秩一矩阵」当成子空间。取两个秩一矩阵相加:
结果是秩 2。更一般地,
所以两个秩一矩阵之和通常秩为 2,甚至可能更高。子空间必须对加法封闭,秩一集合不满足。
一个具体的子空间:分量和为零
在 中取所有满足
的向量。它构成子空间:相加、数乘都保持「和为零」。
它其实是矩阵
的零空间。 的秩为 1,列数 ,所以
一组自然基是三个特殊解:
四个基本子空间也随之清楚:
| 子空间 | 内容 | 维数 |
|---|---|---|
| 行空间 | 的所有倍数 | 1 |
| 零空间 | 分量和为零的向量 | 3 |
| 列空间 | 所有实数( 矩阵) | 1 |
| 左零空间 | 只有零向量 | 0 |
左零空间的基是空集——维数为 0 的空间只有零向量,不需要任何基向量。这个细节常被忽略,但它是维数定义的直接推论。
图:线性代数的下一个舞台
最后五分钟引入图。这里的「图」不是函数图像,而是节点与边的集合。
- 把教室里每个人看作节点,两人是朋友就连一条边,就得到一张友谊图。
- 把全美人口看作节点,就得到一张约 2.6 亿节点的图。
- 把网页看作节点、链接看作边,就得到万维网图。
核心问题是:任意两人之间最少要经过几步? 这就是「六度分隔」的来源。Strang 用自己的例子说明:他离某位政治家两步,学生离这位政治家最多三步。
数学上有趣的地方在于:少量捷径会让距离急剧下降。下一讲会用矩阵(关联矩阵)把图的性质翻译成线性代数问题,四个基本子空间会再次出现——这次是在网络里。
本讲结论
- 矩阵与函数都可以是向量,只要定义了加法与数乘。
- 矩阵空间维数 9;对称、上三角各 6;对角 3。
- 子空间的交与和满足维数加法公式。
- 秩一矩阵形如 ,是所有矩阵的积木;但秩一矩阵集合不是子空间。
- 分量和为零的 子空间是 的零空间,维数 3。
- 图把线性代数连接到网络与距离问题。
理解检验
1. 为什么对称矩阵空间的基不能直接从标准基 中挑?
参考答案:标准基里的 ()只有一个非零元,位于第 行第 列,它的转置是 ,因此不是对称矩阵。九个 中只有对角的那三个 是对称的,它们张成的只是对角矩阵空间,维数 3,远小于 。
要得到 的基,必须使用形如 的组合,例如
六个基向量可以取三个 加三个 (),共 6 个且线性无关。这说明:大空间的基不自动是子空间的基。
2. 上三角矩阵空间的基恰好是标准基的子集,这是必然还是巧合?
参考答案:是巧合,或者说,是上三角这个条件的特殊形式带来的便利。 的定义是「坐标满足 时 」,它是用逐坐标的等式刻画的,所以每个满足条件的 ()本身就在 里,把它们凑齐就得到一组基,共 6 个。
对称条件 则是坐标之间的等式,单个 不满足它,只有组合才满足。因此不能把「从标准基里挑」当作通用方法;判断依据始终是:这些向量是否都在子空间内、是否无关、个数是否等于维数。
3. 举两个秩一矩阵,使它们的和为秩二,并验证秩的次可加性。
参考答案:取
两者都是秩一矩阵(各只有一个非零列/行方向),而
的秩为 2。于是
次可加性成立,且此处取等号。注意和可以小于上界:若取 ,则 ,秩为 。无论如何,秩一矩阵之和不一定是秩一,所以「全体秩一矩阵」对加法不封闭,不构成子空间。
4. 零维空间的基是什么?为什么?
参考答案:零维空间只有零向量,其基是空集 。
理由要同时满足基的两个条件:空集的张成按定义是 (空组合等于零向量),所以它张成该空间;空集没有非平凡组合,因此线性无关。另一方面,任何包含零向量的非空集合都相关(取零向量的系数为 1),所以零维空间不可能有非空基。这正是本讲中 矩阵 的左零空间:维数为 ,基为空集。
5. 若把友谊图的每个人作为节点,邻接关系如何写成一个矩阵?
参考答案:用邻接矩阵 :行和列都对应人,若第 个人与第 个人是朋友,就令 ,否则 ;并约定 (不考虑自己与自己为友)。友谊是无向的,所以 , 是对称矩阵,对角线为 。
邻接矩阵的幂给出步数信息: 等于从 到 长度为 2 的路径条数, 对应长度 的路径条数——这就是「六度分隔」可以写成矩阵问题的原因。补充:下一讲使用的不是邻接矩阵,而是关联矩阵(行是节点、列是边),四个基本子空间在其中有直接的网络含义(如零空间对应环流)。
与前后课程的关系
上一讲建立了四个基本子空间;这一讲把「空间」推广到矩阵与函数,并引入秩一分解。下一讲正式用矩阵描述图:节点、边、关联矩阵,以及四个子空间在网络中的含义。
Vectors need not be arrows
The previous lecture already hinted that matrices can be vectors. This lecture develops the idea. The only requirement is structural: a set whose elements can be added and scaled is a vector space. Matrix multiplication plays no role.
The space of all matrices is called . Its standard basis is the nine matrices , each with a single 1 in row , column . Hence
Any matrix is a combination of these nine, and they are independent.
Timeline
| Time | Topic |
|---|---|
| 0:10 | Matrix spaces and their subspaces |
| 1:52 | Symmetric and upper triangular matrices |
| 6:58 | The symmetric matrices have dimension 6 |
| 8:39 | Symmetric and upper triangular means diagonal |
| 10:21 | Intersection, union, and sum of subspaces |
| 13:48 | The dimension formula for sums |
| 15:28 | The solution space of |
| 18:52 | The solution space is two-dimensional |
| 20:38 | Rank-one matrices as building blocks |
| 22:19 | Rank one: a column times a row |
| 24:03 | The complete rank-one picture |
| 27:30 | Rank is subadditive |
| 29:15 | The subspace of vectors whose entries sum to zero |
| 34:19 | Its null space has dimension three |
| 39:27 | A first look at graphs and incidence matrices |
| 44:36 | The question left for next lecture |
Three subspaces
Symmetric matrices,
Symmetry requires . The free choices are the 3 diagonal entries plus the 3 entries above the diagonal; the entries below are determined. Therefore
A warning: the basis of cannot simply be selected from the standard basis. Only three of the nine are symmetric (), and they cannot span all symmetric matrices. The full basis needs combinations such as
This is a recurring lesson: a basis of the big space is not automatically a basis of a subspace.
Upper triangular matrices,
Entries below the diagonal are zero. The free choices are the 3 diagonal entries plus the 3 above, so
Unlike the symmetric case, six of the standard with happen to form a basis. That is a coincidence of this example, not a general method.
Diagonal matrices,
Symmetric and upper triangular forces a diagonal matrix. Only the 3 diagonal entries are free:
Intersection, union, and sum
- Intersection , dimension 3.
- Union is not a subspace. A symmetric but non-triangular matrix plus an upper triangular but non-symmetric matrix typically produces something with neither property, so the union is not closed under addition.
- Sum is the set of all sums of one element from and one from . It is the whole space . Given any , set
is symmetric, is upper triangular, and entry by entry the sum is . Therefore
The dimension identity follows:
Functions are vectors too
Consider the differential equation
Its solutions are
The solution set is a vector space: sums of solutions are solutions, and scalar multiples are solutions. The pair is a basis, and the dimension is 2.
Another basis is — bases vary, dimension does not. Strang's remark is sharp: a course in linear differential equations is essentially the search for a basis of the solution space. A second-order equation has a two-dimensional solution space.
The point of the example is that linear algebra does not depend on vectors being arrows. Addition and scalar multiplication are enough.
Rank-one matrices: the smallest blocks
A rank-one matrix has a clean structure:
where is a column and is a row. Every column of the product is a multiple of .
Example
- The row space is spanned by , dimension 1.
- The column space is spanned by , dimension 1.
- The rank is 1, matching both dimensions.
Every matrix is a sum of rank-one matrices
A rank- matrix can be written as the sum of rank-one matrices. A matrix of rank 4, for instance, decomposes into four outer products.
This is why rank-one matrices are called building blocks: they are the simplest nonzero matrices, and every matrix is assembled from several of them. Determinants and eigenvalues of rank-one matrices are especially simple, which is why they reappear later.
Rank-one matrices are not a subspace
A natural mistake is to treat the set of all rank-one matrices as a subspace. Add two of them:
which has rank 2. More generally,
so a sum of two rank-one matrices is usually rank 2. A subspace must be closed under addition, and this set is not.
A concrete subspace: components summing to zero
In , take all vectors satisfying
This is a subspace: addition and scaling preserve the zero sum.
It is exactly the null space of
The rank is 1 and there are columns, so
A natural basis is the three special solutions:
The four fundamental subspaces follow:
| Subspace | Contents | Dimension |
|---|---|---|
| Row space | Multiples of | 1 |
| Null space | Vectors whose components sum to zero | 3 |
| Column space | All real numbers (a matrix) | 1 |
| Left null space | Only the zero vector | 0 |
The basis of the left null space is the empty set — a zero-dimensional space contains only the zero vector and needs no basis vectors. This detail is easy to skip but follows directly from the definition.
Graphs: the next stage
The last five minutes introduce graphs. Here a graph is not the plot of a function but a set of nodes and edges.
- Let every person in the room be a node, with an edge between friends. That is a friendship graph.
- Let every person in the country be a node. That is a graph with about 260 million nodes.
- Let every web page be a node and every link an edge. That is the web graph.
The central question: how many steps separate any two people? This is the origin of "six degrees of separation". Strang's own example: he is two steps from a certain politician, and his students are at most three.
The mathematical interest is that a few shortcuts collapse the distances dramatically. The next lecture uses a matrix — the incidence matrix — to translate graph properties into linear algebra, and the four subspaces reappear, this time inside a network.
Takeaways
- Matrices and functions are vectors whenever addition and scalar multiplication are defined.
- The space of matrices has dimension 9; symmetric and upper triangular spaces each have dimension 6; diagonal has dimension 3.
- Intersection and sum of subspaces satisfy the dimension identity.
- Rank-one matrices have the form and build all matrices; the set of rank-one matrices is not a subspace.
- The subspace of with component sum zero is the null space of , of dimension 3.
- Graphs connect linear algebra to networks and distance.
Check your understanding
1. Why can't a basis of the symmetric matrix space be chosen directly from the standard basis ?
Reference answer: A standard basis matrix with has a single nonzero entry in row , column ; its transpose is , so it is not symmetric. Among the nine only the three diagonal ones are symmetric, and they span only the diagonal matrices, of dimension 3, far below .
A basis of must use combinations such as , for example
Six basis vectors are the three plus the three with ; they are independent and span . The lesson: a basis of the big space is not automatically a basis of a subspace.
2. Is it a coincidence that the upper triangular space has a basis inside the standard basis?
Reference answer: It is a coincidence, or rather a consequence of the special form of the condition. is defined by coordinate-wise equations ( when ), so each with already lies in , and taking all six of them gives a basis.
Symmetry, by contrast, is an equation between coordinates, , which no single satisfies; only combinations do. So "pick from the standard basis" is never a general method. The real test is always: are the vectors inside the subspace, independent, and equal in number to the dimension?
3. Give two rank-one matrices whose sum has rank two, and verify subadditivity of rank.
Reference answer: Take
Both have rank one (each has a single nonzero column and row direction), while
has rank 2. Hence
so subadditivity holds, here with equality. The sum can also be smaller than the bound: with , has rank . Either way, a sum of rank-one matrices need not have rank one, so the set of rank-one matrices is not closed under addition and is not a subspace.
4. What is a basis of the zero-dimensional space, and why?
Reference answer: The zero-dimensional space contains only the zero vector, and its basis is the empty set .
It satisfies both requirements: the span of the empty set is by definition (the empty combination is the zero vector), and it has no nontrivial combination, so it is independent. Conversely, any nonempty set containing the zero vector is dependent (assign coefficient 1 to the zero vector), so no nonempty set can be a basis. This is exactly the left null space of the matrix : dimension , with the empty set as basis.
5. How would you encode a friendship graph as a matrix?
Reference answer: Use the adjacency matrix : rows and columns index people, with if person and person are friends and otherwise, and by convention. Friendship is undirected, so and is symmetric with zero diagonal.
Powers of the adjacency matrix record path counts: is the number of length-two paths from to , and counts paths of length — which is why "six degrees of separation" is a matrix question. Note: the next lecture uses the incidence matrix instead (rows are nodes, columns are edges), where the four subspaces have direct network meanings, such as the null space describing circulations.
How this connects to the course
The previous lecture established the four fundamental subspaces. This one extends "space" to matrices and functions and introduces rank-one decomposition. The next lecture uses matrices to describe graphs: nodes, edges, incidence matrices, and what the four subspaces mean on a network.