线性代数的本质 · 精研复习站

第 07 集:点积与对偶性

Dot products and duality
一句话直觉:点积的表面意义是向量投影与长度的乘积,而其更深层的本质在于“对偶性”——每一个高维到一维数轴的线性变换,都等价于与空间中唯一对应的向量做点积。

本讲将看似孤立的“对应坐标相乘再相加”公式放到线性变换的聚光灯下重新审视。我们先回顾点积的标准投影解释与对称性来源(为何 $\vec{v}\cdot\vec{w}=\vec{w}\cdot\vec{v}$),随后研究从二维空间映射到一维数轴的 $1\times 2$ 线性变换矩阵;通过将数轴斜放入平面并利用 $\hat{\imath}$ 与单位向量 $\hat{u}$ 之间的镜像对称性,直接证明了投影变换的矩阵恰好就是 $\hat{u}$ 的坐标转置,从而揭开“数值点积为何等于几何投影”的深层对偶原理。

▶ YouTube 原片 📺 B站官方双语 P10 🎙 B站中文配音 P10

前置依赖

← 第 03 集 · 矩阵与线性变换:理解基向量 $\hat{\imath},\hat{\jmath}$ 变换后的落点直接决定矩阵的列向量,以及线性变换保持网格等距的核心性质。
← 第 06·附注 集 · 非方阵:不同维度间的线性变换:理解不同维度之间的映射对应非方阵,尤其是将二维空间压缩到一维数轴的 $1\times 2$ 矩阵。

后续延伸

→ 第 08-1 集 · 叉积的标准介绍:引入三维向量叉积的面积、法向与右手定则几何含义,以及令人费解的“伪行列式”计算技巧。
→ 第 08-2 集 · 以线性变换的眼光看叉积:直接运用本讲建立的对偶性原理,把 $3\times 3$ 行列式视作 $\mathbb{R}^3\to\mathbb{R}$ 线性变换,证明叉积正是其对偶向量。
→ 第 08·拓展 集 · 克莱姆法则的几何解释:讨论点积提取坐标在一般线性变换下为何失效,对比正交变换与有向面积/体积的缩放不变关系。
代数点积定义
$$\vec{v}\cdot\vec{w}=\sum_{k=1}^{n} v_k w_k = v_1 w_1 + v_2 w_2 + \cdots + v_n w_n$$
几何投影公式
$$\vec{v}\cdot\vec{w}=\|\vec{v}\|\cdot \operatorname{proj}_{\vec{v}}(\vec{w}) = \|\vec{v}\|\|\vec{w}\|\cos\theta$$
数轴投影的线性变换与对偶向量
$$L(\vec{x}) = \begin{bmatrix} u_x & u_y \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix} = u_x x + u_y y = \hat{u}\cdot\vec{x}$$
缩放对偶向量
$$\vec{v}=c\hat{u}\;\Longrightarrow\; \vec{v}\cdot\vec{x} = c(\hat{u}\cdot\vec{x}) = \begin{bmatrix} c u_x & c u_y \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix}$$

点积的代数计算与几何投影解释

⏱ 00:17 – 02:10

大多数线性代数教材一开篇就引入点积,但在本系列中我们故意把它放到线性变换之后,因为只有站在线性变换的高度,才能看清点积在数学中的真正角色。先回顾标准引入法:给定两个同维向量,代数上只需将对应坐标逐一配对相乘后再相加。

📐 二维与四维点积算例
$$\begin{bmatrix}1\\2\end{bmatrix}\cdot\begin{bmatrix}3\\4\end{bmatrix}=1\times 3+2\times 4=11,\qquad \begin{bmatrix}6\\2\\8\\3\end{bmatrix}\cdot\begin{bmatrix}1\\8\\5\\3\end{bmatrix}=6\times 1+2\times 8+8\times 5+3\times 3=71$$
两个等长坐标列表的对应分量乘积之和,输出是一个纯标量。

几何上,要理解 $\vec{v}$ 与 $\vec{w}$ 的点积,想象把 $\vec{w}$ 正交投影到穿过原点与 $\vec{v}$ 终点的直线上,然后将这条有向投影的长度乘以 $\|\vec{v}\|$。

  • 两向量夹角小于 $90^\circ$(大致同向):投影与 $\vec{v}$ 同向,点积为正。
  • 两向量相互垂直(夹角 $90^\circ$):一个在另一个上的投影退化为零向量,点积恒为 $0$。
  • 两向量夹角大于 $90^\circ$(大致反向):投影方向与 $\vec{v}$ 相反,点积为负。
开篇漫画引用:如果把代数公式仅当作把两个数变成一个新数的“奇迹”,就无法真正理解其来源 00:20
开篇漫画引用:如果把代数公式仅当作把两个数变成一个新数的“奇迹”,就无法真正理解其来源画面重点:《卡尔文与霍布斯》漫画片段与点积引入动机
同维向量的数值配对乘法:列出两个三维数表对应位置相乘准备求和 00:56
同维向量的数值配对乘法:列出两个三维数表对应位置相乘准备求和画面重点:两个三维向量对应坐标高亮配对
二维算例 $[1,2]^T\cdot[3,4]^T = 1\times 3 + 2\times 4$ 演示坐标配对相加过程 01:10
二维算例 $[1,2]^T\cdot[3,4]^T = 1\times 3 + 2\times 4$ 演示坐标配对相加过程画面重点:数字配对连线与 Dot product 标量结果
标准几何解释:将 $\vec{w}$ 正交投影到过原点与 $\vec{v}$ 的直线上 01:34
标准几何解释:将 $\vec{w}$ 正交投影到过原点与 $\vec{v}$ 的直线上画面重点:平面上的黄色向量 $\vec{v}$、粉色向量 $\vec{w}$ 与正交投影虚线
方向一致性检验:当 $\vec{v}$ 与 $\vec{w}$ 大致同向时,点积 $\vec{v}\cdot\vec{w}>0$ 01:55
方向一致性检验:当 $\vec{v}$ 与 $\vec{w}$ 大致同向时,点积 $\vec{v}\cdot\vec{w}>0$画面重点:同向夹角下的正值点积符号标注
[00:17] ↗
传统上,点积是线性代数课程中很靠前的内容 一般就在最开始
["Ode to Joy", by Beethoven, plays to the end of the piano.] Traditionally, dot products are something that's introduced really early on in a linear algebra course, typically right at the start.
[00:27] ↗
我把它放得如此靠后,看起来似乎很奇怪
So it might seem strange that I've pushed them back this far in the series.
[00:30] ↗
我这么做是有原因的,虽然引入点积的标准方法只需要向量的基础认识即可 但是要更进一步理解点积所发挥的作用 只能从线性变换的角度才能完成
I did this because there's a standard way to introduce the topic, which requires nothing more than a basic understanding of vectors, but a fuller understanding of the role that dot products play in math can only really be found under the light of linear transformations.
[00:43] ↗
不过在此之前,我先简单介绍引入点积的标准方法 我想对于部分观众来说,这算是复习了吧
Before that, though, let me just briefly cover the standard way that dot products are introduced, which I'm assuming is at least partially review for a number of viewers.
[00:51] ↗
如果你有两个维数相同的向量 或是两个长度相同的数组 求它们的点积,就是将相应坐标配对 求出每一对坐标的乘积 然后将结果相加
Numerically, if you have two vectors of the same dimension, two lists of numbers with the same lengths, taking their dot product means pairing up all of the coordinates, multiplying those pairs together, and adding the result.
[01:07] ↗
所以向量(1, 2)点乘向量(3, 4)的结果为1×3+2×4
So the vector 1, 2 dotted with 3, 4 would be 1 times 3 plus 2 times 4.
[01:15] ↗
向量(6, 2, 8, 3)点乘向量(1, 8, 5, 3)的结果为6×1+2×8+8×5+3×3
The vector 6, 2, 8, 3 dotted with 1, 8, 5, 3 would be 6 times 1 plus 2 times 8 plus 8 times 5 plus 3 times 3.
[01:25] ↗
幸运的是,这个计算有一个优美的几何解释
Luckily, this computation has a really nice geometric interpretation.
[01:29] ↗
要求两个向量v和w的点积 想象将向量w朝着过原点和向量v终点的直线上投影
To think about the dot product between two vectors, v and w, imagine projecting w onto the line that passes through the origin and the tip of v.
[01:39] ↗
将投影的长度与向量v的长度相乘 你就得到了它们的点积 - v点乘w
Multiplying the length of this projection by the length of v, you have the dot product v dot w.
[01:46] ↗
除非w的投影与v的方向相反 这种情况下点积为负值
Except when this projection of w is pointing in the opposite direction from v, that dot product will actually be negative.
[01:54] ↗
所以当两个向量的指向大致相同时 它们的点积为正
So when two vectors are generally pointing in the same direction, their dot product is positive.
[01:59] ↗
当它们相互垂直时,意味着一个向量在另一个向量上的投影为零向量 它们的点积为零
When they're perpendicular, meaning the projection of one onto the other is the zero vector, their dot product is zero.
[02:06] ↗
而当它们的指向基本相反时 它们的点积为负
And if they point in generally the opposite direction, their dot product is negative.

看似不对称的投影为何满足交换律?

⏱ 02:12 – 04:09

投影解释立刻带来一个令人困惑的问题:把 $\vec{w}$ 投影到 $\vec{v}$ 上并乘以 $\|\vec{v}\|$,与反过来把 $\vec{v}$ 投影到 $\vec{w}$ 上并乘以 $\|\vec{w}\|$,听起来像是两个截然不同的过程,为何结果却总是一样($\vec{v}\cdot\vec{w}=\vec{w}\cdot\vec{v}$)?

💡 等长镜像与单边缩放的同步倍增
先假设 $\|\vec{v}\|=\|\vec{w}\|$:此时两种投影操作互为完全的几何镜像,结果自然相等。接着把 $\vec{v}$ 拉伸为 $2\vec{v}$ 打破等长对称性:若视为把 $\vec{w}$ 投向 $2\vec{v}$,投影长度不变而被投影目标长度翻倍;若视为把 $2\vec{v}$ 投向 $\vec{w}$,目标长度不变但投影长度翻倍。无论哪一种理解,乘积总效果都精确放大 $2$ 倍!
⚠️ 真正的深层谜题仍未解开
上述论证解释了“投影定义为何对称”,却还没有回答最本质的问题:为什么“对应坐标相乘再相加”这种代数运算,居然会恰好等于“正交投影再乘以模长”的几何操作?要给出令人信服的回答,必须引入对偶性(Duality)。
交换视角:改为将 $\vec{v}$ 投影到 $\vec{w}$ 所在直线上,再乘以 $\vec{w}$ 的长度 02:25
交换视角:改为将 $\vec{v}$ 投影到 $\vec{w}$ 所在直线上,再乘以 $\vec{w}$ 的长度画面重点:标注 Length of projected $\vec{v}$ 的反向投影几何图
等长对称性:当 $\|\vec{v}\|=\|\vec{w}\|$ 时,相互投影的直角三角形互为镜像 02:48
等长对称性:当 $\|\vec{v}\|=\|\vec{w}\|$ 时,相互投影的直角三角形互为镜像画面重点:两条等长向量之间的对称垂直投影线段
打破对称性(视角一):把 $\vec{v}$ 放大至 $2\vec{v}$,$\vec{w}$ 的投影不变但底边模长翻倍 03:16
打破对称性(视角一):把 $\vec{v}$ 放大至 $2\vec{v}$,$\vec{w}$ 的投影不变但底边模长翻倍画面重点:Symmetry is broken 标题与 $(2\vec{v})\cdot\vec{w}=2(\vec{v}\cdot\vec{w})$
打破对称性(视角二):把 $2\vec{v}$ 投向 $\vec{w}$,$\vec{w}$ 模长不变而投影长度翻倍,结果仍为 $2$ 倍 03:40
打破对称性(视角二):把 $2\vec{v}$ 投向 $\vec{w}$,$\vec{w}$ 模长不变而投影长度翻倍,结果仍为 $2$ 倍画面重点:$2\vec{v}$ 向 $\vec{w}$ 方向延伸线的垂直投影虚线
[02:12] ↗
现在看看,这种解释异常地不对称
Now, this interpretation is weirdly asymmetric.
[02:15] ↗
它对两个向量的处理方式完全不同
It treats the two vectors very differently.
[02:17] ↗
所以我初次学习时,点积与顺序无关让我感到很惊讶
So when I first learned this, I was surprised that order doesn't matter.
[02:21] ↗
你可以将v投影到w上,将v的投影长度与w的长度相乘 然后得到相同的结果
You could instead project v onto w, multiply the length of the projected v by the length of w, and get the same result.
[02:30] ↗
我说,你不觉得这是个完全不同的过程吗?
I mean, doesn't that feel like a really different process?
[02:35] ↗
下面从直观上说说为什么点积与顺序无关
Here's the intuition for why order doesn't matter.
[02:38] ↗
如果v和w的长度恰好相同,我们可以利用其中的对称性
If v and w happened to have the same length, we could leverage some symmetry.
[02:43] ↗
因为w向v上投影,并将w的投影长度与v的长度相乘 和v向w上投影,并将v的投影长度与w的长度相乘互为镜像
Since projecting w onto v, then multiplying the length of that projection by the length of v, is a complete mirror image of projecting v onto w, then multiplying the length of that projection by the length of w.
[02:57] ↗
现在如果你将其中一个缩放若干倍,比如将v变成两倍 使得它们的长度不同,对称性就被破坏了
Now, if you scale one of them, say v, by some constant like 2, so that they don't have equal length, the symmetry is broken.
[03:05] ↗
但是我们可以这样解读新向量2v和w的点积
But let's think through how to interpret the dot product between this new vector, 2 times v, and w.
[03:11] ↗
如果你认为w向v上投影 那么2v点乘w就应该恰好是v点乘w的两倍
If you think of w as getting projected onto v, then the dot product 2v dot w will be exactly twice the dot product v dot w.
[03:20] ↗
这是因为,将v放大为原来的两倍并不改变w的投影长度 但是被投影的向量长度变为原来的两倍
This is because when you scale v by 2, it doesn't change the length of the projection of w, but it doubles the length of the vector that you're projecting onto.
[03:30] ↗
另一方面,假设你想将v投影到w上
But on the other hand, let's say you were thinking about v getting projected onto w.
[03:35] ↗
我们将v变为原来的两倍,这次是投影的长度变为原来的两倍 但是被投影的向量长度保持不变
Well, in that case, the length of the projection is the thing that gets scaled when we multiply v by 2, but the length of the vector that you're projecting onto stays constant.
[03:43] ↗
所以总体效果仍然是点积变为两倍
So the overall effect is still to just double the dot product.
[03:47] ↗
所以说,即便这种情况下对称性被破坏了 在两种理解方式下,缩放向量对点积结果的影响是相同的
So even though symmetry is broken in this case, the effect that this scaling has on the value of the dot product is the same under both interpretations.
[03:57] ↗
初次学习的时候,我还遇到了另一个让我困惑的大问题
There's also one other big question that confused me when I first learned this stuff.
[04:01] ↗
究竟为什么点积的这一运算过程 也就是对应坐标相乘并将结果相加,和投影有所联系?
Why on earth does this numerical process of matching coordinates, multiplying pairs, and adding them together have anything to do with projection?

多维空间到一维数轴的线性变换($1\times 2$ 矩阵)

⏱ 04:11 – 07:12

考虑一类特殊的线性变换 $L:\mathbb{R}^2\to\mathbb{R}$,它吃进一个二维向量,吐出一个一维实数(落在数轴上)。在几何上判定此类变换是否线性的直观测试是:取任意一条直线上等距排列的点列,变换落到数轴上之后,这些点仍然保持等距分布。

与高维方阵变换一样,一个二维到一维的线性变换完全由两个基向量 $\hat{\imath}$ 和 $\hat{\jmath}$ 的落点所决定。因为每个基向量只落在一个实数上,把它们的落点排成列,就得到一个只有一行的 $1\times 2$ 矩阵。

📐 $1\times 2$ 矩阵作用在二维向量上
$$\begin{bmatrix} 1 & -2 \end{bmatrix}\begin{bmatrix} 4 \\ 3 \end{bmatrix} = 4\cdot(1) + 3\cdot(-2) = -2$$
第一列记录 $\hat{\imath}\mapsto 1$,第二列记录 $\hat{\jmath}\mapsto -2$;矩阵乘法过程与计算点积在数值上别无二致。
💡 把向量“放倒”与把矩阵“立起来”
单看数值计算,将 $1\times 2$ 矩阵乘以二维向量,完全就像是把一个二维列向量“放倒”成行向量后与另一个向量做点积。这暗示了一条惊人的几何桥梁:把空间映射到数轴的线性变换,与空间中的向量本身之间存在某种一一对应的深层关联。
二维平面空间向一维数轴折叠坍缩的线性变换示意图 04:28
二维平面空间向一维数轴折叠坍缩的线性变换示意图画面重点:倾斜压缩中的二维网格与一维数轴
线性的视觉检验:一条直线上的等距彩色点列映射到数轴后依然等距排列 05:05
线性的视觉检验:一条直线上的等距彩色点列映射到数轴后依然等距排列画面重点:数轴上保持均匀间距的彩色点列
用 $1\times 2$ 矩阵记录变换:基向量落点依次构成矩阵的两列(图中演示 $\hat{\imath}$ 落在 $2$ 上) 05:35
用 $1\times 2$ 矩阵记录变换:基向量落点依次构成矩阵的两列(图中演示 $\hat{\imath}$ 落在 $2$ 上)画面重点:数轴上标注 $\hat{\imath}$ 落点及 $1\times 2$ Transformation matrix 第一列
实例演算:$[1,\,-2]$ 作用在 $\vec{v}=[4,3]^T$ 上,得到 $4(1)+3(-2)=-2$ 06:08
实例演算:$[1,\,-2]$ 作用在 $\vec{v}=[4,3]^T$ 上,得到 $4(1)+3(-2)=-2$画面重点:数轴上叠加 $4\times(1)$ 与 $3\times(-2)$ 箭头指向 $L(\vec{v})=-2$
代数形式关联:$1\times 2$ 矩阵与二维列向量之间通过转置“放倒/立起”互相对应 06:45
代数形式关联:$1\times 2$ 矩阵与二维列向量之间通过转置“放倒/立起”互相对应画面重点:$1\times 2$ matrices $\leftrightarrow$ 2d vectors 对照示意
[04:11] ↗
如果想要给出一个满意的答案,并且正视点积的重要性 我们需要挖掘更深层次的东西,它通常被称为“对偶性”
Well, to give a satisfactory answer, and also to do full justice to the significance of the dot product, we need to unearth something a little bit deeper going on here, which often goes by the name duality.
[04:22] ↗
不过在继续深入之前,我需要花点时间讨论 多维空间到一维空间(数轴)的线性变换
But before getting into that, I need to spend some time talking about linear transformations from multiple dimensions to one dimension, which is just the number line.
[04:32] ↗
有不少函数能够接收二维向量并输出一个数 同样是二维输入和一维输出,和一般的函数相比,线性变换的要求更加严格
These are functions that take in a 2D vector and spit out some number, but linear transformations are of course much more restricted than your run-of-the-mill function with a 2D input and a 1D output.
[04:43] ↗
就像我在第三章中讨论的,高维空间中的变换需要满足一些严格的性质才会具有线性 但是为了不偏离最终目标,我特意忽略这些内容 而是聚焦于一种与之等价的直观特性
As with transformations in higher dimensions, like the ones I talked about in chapter 3, there are some formal properties that make these functions linear, but I'm going to purposefully ignore those here so as to not distract from our end goal, and instead focus on a certain visual property that's equivalent to all the formal stuff.
[04:59] ↗
如果你有一系列等距分布于一条直线上的点,然后应用变换 线性变换会保持这些点等距分布在输出空间中,也就是数轴上
If you take a line of evenly spaced dots and apply a transformation, a linear transformation will keep those dots evenly spaced once they land in the output space, which is the number line.
[05:12] ↗
否则,如果这些点没有等距分布,那么这个变换就不是线性的
Otherwise, if there's some line of dots that gets unevenly spaced, then your transformation is not linear.
[05:19] ↗
如同我们之前看到的例子一样 这些线性变换完全由它对i帽和j帽的变换决定 但是这一次,这些基向量只落在一个数上 所以当我们将它们变换后的位置记录为矩阵的列时 矩阵的每列只是一个单独的数
As with the cases we've seen before, one of these linear transformations is completely determined by where it takes i-hat and j-hat, but this time each one of those basis vectors just lands on a number, so when we record where they land as the columns of a matrix, each of those columns just has a single number.
[05:38] ↗
这是一个1×2矩阵
This is a 1x2 matrix.
[05:42] ↗
我们来考察一个例子,了解它对向量作用的含义
Let's walk through an example of what it means to apply one of these transformations to a vector.
[05:46] ↗
假设你有一个线性变换,它将i帽和j帽分别变换至1和-2
Let's say you have a linear transformation that takes i-hat to 1 and j-hat to negative 2.
[05:52] ↗
要跟踪一个向量,比如向量(4, 3),在变换之后的去向 将这个向量分解为4乘以i帽加上3乘以j帽
To follow where a vector with coordinates, say, 4, 3 ends up, think of breaking up this vector as 4 times i-hat plus 3 times j-hat.
[06:02] ↗
由于线性性质,在变换后 这个向量的位置是4乘以变换后的i帽,也就是1 加上3乘以变换后的j帽,也就是-2 结果说明它落在-2上
A consequence of linearity is that after the transformation, the vector will be 4 times the place where i-hat lands, 1, plus 3 times the place where j-hat lands, negative 2, which in this case implies that it lands on negative 2.
[06:18] ↗
当你完全从数值角度进行计算时,它就是矩阵向量乘法
When you do this calculation purely numerically, it's matrix vector multiplication.
[06:26] ↗
1×2矩阵与向量相乘这一数值运算过程 感觉上就和两个向量的点积一样
Now, this numerical operation of multiplying a 1x2 matrix by a vector feels just like taking the dot product of two vectors.
[06:33] ↗
那个1×2矩阵不正像是一个倾倒的向量吗?
Doesn't that 1x2 matrix just look like a vector that we tipped on its side?
[06:38] ↗
实际上,我们现在可以说 1×2矩阵与二维向量之间有着微妙的联系 这种关系在于:将向量放倒,从而得到与之相关的矩阵 或者将矩阵立直,从而得到与之相关的向量
In fact, we could say right now that there's a nice association between 1x2 matrices and 2D vectors, defined by tilting the numerical representation of a vector on its side to get the associated matrix, or to tip the matrix back up to get the associated vector.
[06:54] ↗
因为我们现在只是从数值表达上来看这个联系 所以向量和1×2矩阵之间的来回转化看上去毫无意义
Since we're just looking at numerical expressions right now, going back and forth between vectors and 1x2 matrices might feel like a silly thing to do.
[07:01] ↗
但是这暗示了一点,从几何角度可以看到一些美妙的事情
But this suggests something that's truly awesome from the geometric view.
[07:05] ↗
将向量转化为数的线性变换和这个向量本身有着某种关系
There's some kind of connection between linear transformations that take vectors to numbers and vectors themselves.

投影作为线性变换与对称性推导

⏱ 07:15 – 10:31

现在暂时“忘掉”点积公式,做一次精妙的几何构造:复制一条数轴,让 $0$ 点对齐原点并斜放在二维平面中,记数轴上刻度 $1$ 对应的二维单位向量为 $\hat{u}$。然后定义函数 $P(\vec{x})$:把平面中任意向量正交投影到这条斜置数轴上,读取其落点刻度。

由于正交投影保持直线上等距点的等距性,$P$ 必然是一个二维到一维的线性变换,因此一定存在唯一的 $1\times 2$ 矩阵 $\begin{bmatrix} m_1 & m_2 \end{bmatrix}$ 来描述它——而 $m_1, m_2$ 正是 $\hat{\imath}$ 与 $\hat{\jmath}$ 投影到斜数轴后的刻度值。

💡 角平分线对称性直接读出矩阵元素
如何求 $\hat{\imath}$ 投影到 $\hat{u}$ 所在数轴上的数值?注意到 $\hat{\imath}$ 与 $\hat{u}$ 都是单位向量(模长均为 $1$),以二者夹角的角平分线作对称轴,“把 $\hat{\imath}$ 投影到 $\hat{u}$ 轴”与“把 $\hat{u}$ 投影到 $x$ 轴”完全互为镜像!而把 $\hat{u}$ 投影到 $x$ 轴正是 $\hat{u}$ 的横坐标 $u_x$。完全同理,$\hat{\jmath}$ 投影到斜数轴的结果正是 $\hat{u}$ 的纵坐标 $u_y$。
📐 单位向量点积等于投影的严格证明
$$\text{Proj}_{\hat{u}}\begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} u_x & u_y \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix} = u_x x + u_y y = \hat{u}\cdot\begin{bmatrix} x \\ y \end{bmatrix}$$
因为投影变换的 $1\times 2$ 矩阵就是 $[u_x\;\; u_y]$,所以与单位向量 $\hat{u}$ 做数值点积,必然等于把向量正交投影到 $\hat{u}$ 方向并读取长度。
几何设置:将数轴复制并斜放在二维空间中,原点对齐 $0$,定义斜数轴刻度 $1$ 处为单位向量 $\hat{u}$ 07:35
几何设置:将数轴复制并斜放在二维空间中,原点对齐 $0$,定义斜数轴刻度 $1$ 处为单位向量 $\hat{u}$画面重点:带刻度的斜置数轴嵌入二维坐标系
检验投影的线性性:直线上等距的粉色点列正交投影到斜数轴后依然保持等距 08:08
检验投影的线性性:直线上等距的粉色点列正交投影到斜数轴后依然保持等距画面重点:垂直投向斜数轴并保持等距的点列
关键对称轴登场:$\hat{\imath}$ 与 $\hat{u}$ 均为单位向量,过夹角平分线的镜像对称揭示 $\hat{\imath}$ 的落点等于 $u_x$ 09:10
关键对称轴登场:$\hat{\imath}$ 与 $\hat{u}$ 均为单位向量,过夹角平分线的镜像对称揭示 $\hat{\imath}$ 的落点等于 $u_x$画面重点:Line of symmetry 虚线、单位向量 $\hat{\imath}$ 与 $\hat{u}$ 的镜像投影
同理用 $\hat{\jmath}$ 与 $\hat{u}$ 的对称性求得矩阵第二列等于 $\hat{u}$ 的纵坐标 $u_y$ 09:54
同理用 $\hat{\jmath}$ 与 $\hat{u}$ 的对称性求得矩阵第二列等于 $\hat{u}$ 的纵坐标 $u_y$画面重点:矩阵 $[u_x,\; u_y]$ 推导与 $\hat{\jmath}$ 投影对称线
矩阵向量乘法 $[u_x,\; u_y][x,y]^T$ 与向量点积 $[u_x,u_y]^T\cdot[x,y]^T$ 在计算式上完全重合 10:26
矩阵向量乘法 $[u_x,\; u_y][x,y]^T$ 与向量点积 $[u_x,u_y]^T\cdot[x,y]^T$ 在计算式上完全重合画面重点:Matrix-vector product $\Updownarrow$ Dot product 等价式同屏对照
[07:15] ↗
我来举个例子说明这种关系的重要性 而它恰恰回答了之前提到的点积的问题
Let me show an example that clarifies the significance, and which just so happens to also answer the dot product puzzle from earlier.
[07:22] ↗
忘记你所学过的 假设你还不知道点积与投影有关
Unlearn what you have learned, and imagine that you don't already know that the dot product relates to projection.
[07:29] ↗
我现在将数轴复制一份 然后保持0在原点,将它斜向放置在空间中
What I'm going to do here is take a copy of the number line and place it diagonally in space somehow, with the number 0 sitting at the origin.
[07:37] ↗
现在考虑这样一个二维向量,它的终点落在这条数轴的1上
Now think of the two-dimensional unit vector whose tip sits where the number 1 on the number is.
[07:42] ↗
我给它起个名字,就叫“u帽”
I want to give that guy a name, u-hat.
[07:46] ↗
这个向量在接下来的讲解中扮演着重要的角色 所以请你牢记它
This little guy plays an important role in what's about to happen, so just keep him in the back of your mind.
[07:51] ↗
如果将二维向量直接投影到这条数轴上 实际上,我们就这样定义了一个从二维向量到数的函数
If we project 2d vectors straight onto this diagonal number line, in effect, we've just defined a function that takes 2d vectors to numbers.
[08:00] ↗
更重要的是,这个函数是线性的,因为它顺利通过了线性检验 即直线上等距分布的点在投影到数轴上后仍然等距分布
What's more, this function is actually linear, since it passes our visual test that any line of evenly spaced dots remains evenly spaced once it lands on the number line.
[08:12] ↗
这里说明一点,即便我把这条数轴放在二维空间中 上述函数的输出结果还是数,而不是二维向量
Just to be clear, even though I've embedded the number line in 2d space like this, the outputs of the function are numbers, not 2d vectors.
[08:20] ↗
你应该把它看作一个接收两个坐标并输出一个坐标的函数
You should think of a function that takes in two coordinates and outputs a single coordinate.
[08:25] ↗
不过,u帽是二维空间中的一个向量
But that vector u-hat is a two-dimensional vector, living in the input space.
[08:29] ↗
而它碰巧又落在这条数轴上
It's just situated in such a way that overlaps with the embedding of the number line.
[08:35] ↗
根据这个投影,我们定义了一个从二维向量到数的线性变换 所以我们就能够找到描述这个变换的1×2矩阵
With this projection, we just defined a linear transformation from 2d vectors to numbers, so we're going to be able to find some kind of 1x2 matrix that describes that transformation.
[08:46] ↗
为了找到这个矩阵,我们把这条斜着的数轴放大来看 并且需要考虑变换后i帽和j帽的位置,因为它们就是矩阵的列
To find that 1x2 matrix, let's zoom in on this diagonal number line setup and think about where i-hat and j-hat each land, since those landing spots are going to be the columns of the matrix.
[08:58] ↗
这一部分内容超级漂亮
This part's super cool.
[09:00] ↗
我们可以通过精妙的对称性进行推理
We can reason through it with a really elegant piece of symmetry.
[09:03] ↗
因为i帽和u帽都是单位向量 将i帽向u帽所在的直线投影与u帽向x轴投影看上去完全对称
Since i-hat and u-hat are both unit vectors, projecting i-hat onto the line passing through u-hat looks totally symmetric to projecting u-hat onto the x-axis.
[09:14] ↗
所以说,如果要问i帽在投影之后落在哪个数上 答案就应该是u帽向x轴投影所得到的数
So when we ask what number does i-hat land on when it gets projected, the answer is going to be the same as whatever u-hat lands on when it's projected onto the x-axis.
[09:23] ↗
而u帽向x轴投影得到的数就是u帽的横坐标
But projecting u-hat onto the x-axis just means taking the x-coordinate of u-hat.
[09:29] ↗
因此根据对称性,将i帽向斜着的数轴上投影所得到的数 就是u帽的横坐标
So by symmetry, the number where i-hat lands when it's projected onto that diagonal number line is going to be the x-coordinate of u-hat.
[09:37] ↗
是不是很酷?
Isn't that cool?
[09:39] ↗
以上推理过程对j帽几乎一致
The reasoning is almost identical for the j-hat case.
[09:42] ↗
花点时间思考一下
Think about it for a moment.
[09:49] ↗
与之前的原因相同 u帽的y坐标给出了j帽向斜着的数轴上投影所得到的数
For all the same reasons, the y-coordinate of u-hat gives us the number where j-hat lands when it's projected onto the number line copy.
[09:58] ↗
暂停思考一会儿,我觉得这部分非常漂亮
Pause and ponder that for a moment.
[09:59] ↗
暂停思考一会儿,我觉得这部分非常漂亮
I just think that's really cool.
[10:01] ↗
所以描述投影变换的1×2矩阵的两列 就分别是u帽的两个坐标
So the entries of the 1x2 matrix describing the projection transformation are going to be the coordinates of u-hat.
[10:08] ↗
而空间中任意向量经过投影变换的结果 也就是投影矩阵与这个向量相乘 和这个向量与u帽的点积在计算上完全相同
And computing this projection transformation for arbitrary vectors in space, which requires multiplying that matrix by those vectors, is computationally identical to taking a dot product with u-hat.
[10:21] ↗
这就是为什么与单位向量的点积可以解读为 将向量投影到单位向量所在的直线上所得到的投影长度
This is why taking the dot product with a unit vector can be interpreted as projecting a vector onto the span of that unit vector and taking the length.

非单位向量缩放与对偶性的本质

⏱ 10:34 – 13:49

如果用来做点积的不是单位向量 $\hat{u}$,而是它的伸缩版,比如 $\vec{v} = 3\hat{u}$ 呢?数值上它的每个坐标都乘以 $3$,对应到线性变换矩阵 $\begin{bmatrix} 3u_x & 3u_y \end{bmatrix}$,这意味着把 $\hat{\imath}$ 和 $\hat{\jmath}$ 原本的投影位置分别放大 $3$ 倍。由线性性,新矩阵的作用就等于“先把任意向量投影到该数轴上,再把投影结果乘以 $3$(即乘以 $\|\vec{v}\|$)”——这就完整解释了一般非单位向量的点积几何意义!

💡 线性代数中的对偶性(Duality)
数学中的“对偶”指两种看似不同的数学对象之间存在自然却令人惊叹的对应关系。在这里:任何从多维空间到一维数轴的线性变换,无论最初是如何用几何语言定义的,空间中都必然存在唯一的“对偶向量” $\vec{v}$ 与之对应——施加这个变换,完全等价于与 $\vec{v}$ 做点积。反过来,空间中的一个向量也可以被看作某个多维到一维线性变换的“物质载体”或概念速记。
放大单位向量为 $3\hat{u}$:对应矩阵变成 $[3u_x,\; 3u_y]$,将投影长度统一放大 $3$ 倍 10:50
放大单位向量为 $3\hat{u}$:对应矩阵变成 $[3u_x,\; 3u_y]$,将投影长度统一放大 $3$ 倍画面重点:Associated transformation $[3u_x,\; 3u_y]$ 与缩放后的刻度投影
对偶性核心结论:任意二维到一维的线性变换,都唯一关联着空间中的某个对偶向量 12:00
对偶性核心结论:任意二维到一维的线性变换,都唯一关联着空间中的某个对偶向量画面重点:Any time you have a 2d-to-1d linear transform... 对应唯一向量图解
理解向量的“个性”:有时把向量看作多维到一维线性变换的实体化身,比单纯当成箭头更深刻 13:22
理解向量的“个性”:有时把向量看作多维到一维线性变换的实体化身,比单纯当成箭头更深刻画面重点:You should learn a vector's personality 概念总结
[10:34] ↗
那对于非单位向量呢?
So what about non-unit vectors?
[10:36] ↗
比如说,还是这个单位向量u帽,不过我们把它放大为原来的3倍
For example, let's say we take that unit vector u-hat, but we scale it up by a factor of 3.
[10:41] ↗
数值上说,它的每个坐标都被放大为原来的3倍
Numerically, each of its components gets multiplied by 3.
[10:45] ↗
所以要寻找与这个向量相关的投影矩阵 实际上就是之前i帽和j帽投影得到的值的3倍
So looking at the matrix associated with that vector, it takes i-hat and j-hat to three times the values where they landed before.
[10:55] ↗
更普遍地说,因为这个变换是线性的,意味着这个新矩阵可以看作 将任何向量朝斜着的数轴上投影,然后将结果乘以3
Since this is all linear, it implies more generally that the new matrix can be interpreted as projecting any vector onto the number line copy and multiplying where it lands by 3.
[11:05] ↗
这就是为什么向量与给定非单位向量的点积可以解读为 首先朝给定向量上投影 然后将投影的值与给定向量长度相乘
This is why the dot product with a non-unit vector can be interpreted as first projecting onto that vector, then scaling up the length of that projection by the length of the vector.
[11:18] ↗
思考一下这个过程
Take a moment to think about what happened here.
[11:20] ↗
我们有一个从二维空间到数轴的线性变换 它并不是由向量数值或点积运算定义得到的 而只是通过将空间投影到给定数轴上来定义
We had a linear transformation from 2D space to the number line, which was not defined in terms of numerical vectors or numerical dot products, it was just defined by projecting space onto a diagonal copy of the number line.
[11:32] ↗
但是因为这个变换是线性的,所以它必然可以用某个1×2矩阵描述
But because the transformation is linear, it was necessarily described by some 1x2 matrix.
[11:37] ↗
又因为1×2矩阵与二维向量相乘的计算过程 和转置矩阵并求点积的计算过程相同 所以这个投影变换必然会与某个二维向量相关
And since multiplying a 1x2 matrix by a 2D vector is the same as turning that matrix on its side and taking a dot product, this transformation was inescapably related to some 2D vector.
[11:49] ↗
这里给你的启发是,你在任何时候看到一个线性变换 它的输出空间是一维数轴 无论它是如何定义的 空间中会存在唯一的向量v与之相关 就这一意义而言,应用变换和与向量v做点积是一样的
The lesson here is that any time you have one of these linear transformations whose output space is the number line, no matter how it was defined, there's going to be some unique vector v corresponding to that transformation, in the sense that applying the transformation is the same thing as taking a dot product with that vector.
[12:10] ↗
对我来说,这个结果格外精彩
To me, this is utterly beautiful.
[12:13] ↗
它是数学中“对偶性”的一个实例
It's an example of something in math called duality.
[12:16] ↗
对偶性贯穿数学始终,在多个方面均有体现 而实际定义它却是比较棘手的
Duality shows up in many different ways and forms throughout math, and it's super tricky to actually define.
[12:23] ↗
粗略地说,它指的是 两种数学事物之间自然而又出乎意料的对应关系
Loosely speaking, it refers to situations where you have a natural but surprising correspondence between two types of mathematical thing.
[12:31] ↗
对于你刚学到的情况而言 你可以说一个向量的对偶是由它定义的线性变换 一个多维空间到一维空间的线性变换的对偶是多维空间中的某个特定向量
For the linear algebra case that you just learned about, you'd say that the dual of a vector is the linear transformation that it encodes, and the dual of a linear transformation from some space to one dimension is a certain vector in that space.
[12:47] ↗
总结一下,表面上看,点积是理解投影的有利几何工具 并且方便检验两个向量的指向是否相同
So to sum up, on the surface, the dot product is a very useful geometric tool for understanding projections and for testing whether or not vectors tend to point in the same direction.
[12:57] ↗
这大概也是你需要记住的点积中最重要的部分
And that's probably the most important thing for you to remember about the dot product.
[13:01] ↗
不过更进一步讲 两个向量点乘,就是将其中一个向量转化为线性变换
But at a deeper level, dotting two vectors together is a way to translate one of them into the world of transformations.
[13:09] ↗
同样,在数值上强调它可能显得没有意义
Again, numerically, this might feel like a silly point to emphasize.
[13:12] ↗
因为只是两种看上去恰好相似的计算过程而已
It's just two computations that happen to look similar.
[13:14] ↗
但是我认为这一过程非常重要 因为从始至终你都在和向量打交道 一旦你真正了解了向量的“个性” 有时你就会意识到,不把它看作空间中的箭头 而把它看作线性变换的物质载体,会更容易理解向量
But the reason I find this so important is that throughout math, when you're dealing with a vector, once you really get to know its personality, sometimes you realize that it's easier to understand it not as an arrow in space, but as the physical embodiment of a linear transformation.
[13:31] ↗
向量就仿佛是一个特定变换的概念性记号 因为对我们来说,想象空间中的向量比想象整个空间移动到数轴上更加容易
It's as if the vector is really just a conceptual shorthand for a certain transformation, since it's easier for us to think about arrows in space rather than moving all of that space to the number line.
[13:43] ↗
下期视频中 我将开始讨论叉积,你会在其中看到对偶性的另一个漂亮的体现
In the next video, you'll see another really cool example of this duality in action, as I talk about the cross product.

📝 几何直觉自测(点击题目展开解答)

Q1. 为什么点积定义中“先将 $\vec{w}$ 投影到 $\vec{v}$ 上再乘以 $\|\vec{v}\|$”与“先将 $\vec{v}$ 投影到 $\vec{w}$ 上再乘以 $\|\vec{w}\|$”一定会给出相同的结果?▼
当 $\|\vec{v}\|=\|\vec{w}\|$ 时,两个投影过程在几何上完全互为镜像,结果相等;当把其中一个向量(例如 $\vec{v}$)缩放 $k$ 倍时,在第一种视角下目标模长乘 $k$ 而投影不变,在第二种视角下投影长度乘 $k$ 而目标模长不变,两者总乘积均同步缩放 $k$ 倍,因此对称性始终成立。
Q2. 从线性变换角度,一个从 $\mathbb{R}^2$ 映射到一维数轴 $\mathbb{R}$ 的线性变换如何用矩阵表示?它的列向量有什么含义?▼
它由一个 $1\times 2$ 矩阵 $\begin{bmatrix} c_1 & c_2 \end{bmatrix}$ 表示,其中第一列 $c_1$ 是基向量 $\hat{\imath}$ 变换后落到数轴上的数值,第二列 $c_2$ 是基向量 $\hat{\jmath}$ 落到数轴上的数值。
Q3. 本讲如何不借助预设公式,仅通过几何对称性推导出“将向量投影到单位向量 $\hat{u}$ 所在数轴”的变换矩阵就是 $\begin{bmatrix} u_x & u_y \end{bmatrix}$?▼
因为 $\hat{\imath}$ 和 $\hat{u}$ 的长度都等于 $1$,过原点作两者夹角的角平分线作为对称轴时,“将 $\hat{\imath}$ 正交投影到 $\hat{u}$ 方向”与“将 $\hat{u}$ 正交投影到 $x$ 轴”完全对称,因此 $\hat{\imath}$ 的落点就是 $\hat{u}$ 的横坐标 $u_x$;同理 $\hat{\jmath}$ 的落点就是 $\hat{u}$ 的纵坐标 $u_y$。
Q4. 如何用一句话概括本讲所说的“对偶性”(Duality)?▼
任意一个从 $\mathbb{R}^n$ 到一维数轴 $\mathbb{R}$ 的线性变换,都与 $\mathbb{R}^n$ 中唯一的一个对偶向量 $\vec{v}$ 一一对应,使得对该线性变换求值完全等价于与 $\vec{v}$ 做点积。