第 26 章
复矩阵与快速傅里叶变换:从 Hermitian 到 FFT
复数内积要共轭,对称推广为 Hermitian,正交推广为酉;傅里叶矩阵的列正交,且能递归分解,把 n² 次乘法降到 (n/2)log₂n。
Complex Matrices and the Fast Fourier Transform: From Hermitian to FFT
Complex inner products require conjugation; symmetry becomes Hermitian and orthogonality becomes unitary. The Fourier matrix has orthogonal columns and factors recursively, reducing n² multiplications to (n/2)log₂n.
篇内目录
- Why complex numbers enter
- Timeline
- Length and inner product of complex vectors
- Length
- The Hermitian transpose
- Orthogonality
- Symmetric becomes Hermitian, orthogonal becomes unitary
- The Fourier matrix
- Definition
- The case
- Why the columns are orthogonal
- The fast Fourier transform
- The problem
- The factorization
- Recursion
- The scale
- Core review
- Common misconceptions
- Check your understanding
- How this connects
为什么必须引入复数
实矩阵也可能有复特征值,例如旋转 的矩阵特征值是 。因此必须弄清:当向量、矩阵与内积都变成复数时,哪些定义要改。
核心原则只有一条:转置时要同时取共轭。
时间轴
| 时间 | 内容 |
|---|---|
| 0:08 | 复数进入线性代数:傅里叶矩阵与 FFT |
| 1:20 | FFT 把 次运算降到 |
| 4:01 | 复向量空间 |
| 5:16 | 复向量的长度必须用共轭, |
| 8:40 | 复内积的定义 |
| 11:27 | 共轭转置与 Hermitian 矩阵 |
| 13:56 | 酉矩阵: |
| 17:11 | 傅里叶矩阵 :元素为 , |
| 21:28 | 的幂是 次单位根 |
| 24:53 | 的具体形式与列的相互正交 |
| 28:55 | 不同列的内积为零:逐一验算 |
| 31:56 | 逆矩阵: 只需对元素取共轭 |
| 33:09 | FFT 的分治思路:偶数列与奇数列分开 |
| 36:42 | 修正因子对角矩阵 |
| 41:28 | 递归拆分与运算量 |
| 44:33 | 与 的对比 |
复向量的长度与内积
长度
对复向量 , 不再适用。以 为例:
但向量显然不是零向量。正确做法是
对 :
所以长度是 。
Hermitian 转置
把「转置 + 共轭」合成一个符号:
于是长度平方写成 。两个复向量的内积是
它通常是复数;当 时得到非负实数,正是长度平方。
正交
两个复向量正交,指向量内积为零:
单位化后 。
从对称到 Hermitian,从正交到酉
| 实数情形 | 复数情形 |
|---|---|
| 对称 | Hermitian |
| 正交 | 酉 |
| 实特征值、正交特征向量 | 实特征值、正交特征向量 |
Hermitian 矩阵的对角元必须是实数:转置后位置不变,再取共轭仍要等于自身,只有实数满足。非对角元成共轭对:若 ,则 。
傅里叶矩阵
定义
设
它是 次单位根,位于单位圆上,角度为 。 阶傅里叶矩阵的第 项( 从 0 到 )是
也就是说,行号乘列号作为 的指数。
四阶例子
时
于是
指数表:
再用 、、 化简。
列为什么正交
取第 2 列与第 4 列(下标 1 与 3):
如果直接点乘(不取共轭),得到
看起来不为零。但复内积必须先对第一个向量取共轭:
所以它们确实正交。忘记共轭是这一节最常见的错误。
每列的长度平方为 。把 除以 ,就得到酉矩阵:
于是
快速傅里叶变换
问题
直接用 乘一个向量需要 次乘法,因为矩阵是满的。FFT 把它降到约 。
分解思路
以 为例。关键观察:
因为角度翻倍, 的两倍就是 。于是 可以写成
三个因子分别是:
- :奇偶置换矩阵,把向量的偶数下标分量排在前面、奇数下标排在后面。它不需要乘法,只是重排。
- 两个 :分别作用在偶数分量与奇数分量上。
- 修正矩阵: 与 几乎不花代价,真正的代价是乘以对角矩阵 共 32 次乘法。
因此 次乘法变成
递归
对每个 继续同样的分解,得到四个 ,再接上 32 大小的置换与修正。一直分解到 1 点变换。
共 层。每一层的修正总共花 次乘法,于是总代价
数量级
:
- 直接乘法:;
- FFT:。
约 200 倍的加速。这正是 FFT 能改变整个行业的原因。
核心回顾
- 复向量长度用 ,内积用 ,必须取共轭。
- 对称推广为 Hermitian(),正交推广为酉()。
- 傅里叶矩阵 ,。
- 的列正交,长度为 ;。
- FFT 利用 递归分解,代价从 降到 。
常见误区
- 复内积忘记共轭,导致正交性判断错误。
- 把 Hermitian 矩阵的对角元写成复数。对角元必须为实。
- 把 写成 。正确形式是 。
- 认为 FFT 是近似算法。它是精确的矩阵分解,只是改变了乘法顺序。
- 把 写成 与 的直角坐标形式再求高次幂。用指数形式才看得清规律。
理解检验
1. 计算 的长度平方。
参考答案:长度平方是 。逐项计算:,,。所以 ,长度为 。若误用 ,会得到 ,既不是实数也不正确——复内积必须取共轭。
2. 写出 ,并验证第 2 列与第 3 列正交(记得取共轭)。
参考答案:,
第 2 列(下标 1)是 ,取共轭得 ;第 3 列(下标 2)是 。内积
所以两列正交。若不取共轭直接点乘,得到 只是巧合;换第 2、4 列就会失败,那正是正文展示的例子。
3. 为什么 Hermitian 矩阵的对角元必须是实数?
参考答案:Hermitian 要求 ,即 。取 得 。一个复数等于其共轭,当且仅当它的虚部为零,所以对角元必须是实数。非对角元则成共轭对:,例如 时 。
4. 的分解中,哪个因子承担主要计算量?
参考答案:对角修正矩阵 承担主要计算量,共 次乘法。置换矩阵 只重排下标,不需要乘法; 与 中的加减法代价很低;两个 的代价递归计算。每一层修正花 次乘法,共 层,所以总量是 。
5. 时,FFT 比直接乘法快多少倍?
参考答案:直接乘法需要 次;FFT 需要 次。倍数约为 ,即约 200 倍。注意 FFT 不是近似算法,它是精确的矩阵分解,只是把同一组乘法按递归顺序重排,减少了重复计算。
与前后课程的关系
这一讲完成了复数情形,并用傅里叶矩阵展示了矩阵分解的计算价值。下一讲回到实对称矩阵,系统讨论正定性:特征值、主元与顺序主子式三种判据如何等价。
Why complex numbers enter
A real matrix can have complex eigenvalues: the rotation has . So we must settle what changes when vectors, matrices, and inner products become complex.
There is one governing rule: conjugate whenever you transpose.
Timeline
| Time | Topic |
|---|---|
| 0:08 | Complex numbers enter: the Fourier matrix and the FFT |
| 1:20 | The FFT cuts operations down to |
| 4:01 | Complex vector space |
| 5:16 | Length in the complex case needs conjugation |
| 8:40 | The complex inner product |
| 11:27 | Conjugate transpose and Hermitian matrices |
| 13:56 | Unitary matrices: |
| 17:11 | The Fourier matrix with entries |
| 21:28 | Powers of are the -th roots of unity |
| 24:53 | The concrete and orthogonality of its columns |
| 28:55 | Inner products of distinct columns vanish |
| 31:56 | The inverse: conjugates the entries |
| 33:09 | Divide and conquer: separating even and odd columns |
| 36:42 | The diagonal correction matrix |
| 41:28 | Recursion and the operation count |
| 44:33 | Comparing with |
Length and inner product of complex vectors
Length
For a complex vector , is no longer usable. Take :
Yet the vector is not zero. The correct definition is
For :
so the length is .
The Hermitian transpose
Combine transpose and conjugation into one symbol:
Then the length squared is , and the inner product of two complex vectors is
It is usually complex; when it is a nonnegative real number, namely the squared length.
Orthogonality
Two complex vectors are orthogonal when
and unit length means .
Symmetric becomes Hermitian, orthogonal becomes unitary
| Real case | Complex case |
|---|---|
| Symmetric | Hermitian |
| Orthogonal | Unitary |
| Real eigenvalues, orthogonal eigenvectors | Real eigenvalues, orthogonal eigenvectors |
The diagonal entries of a Hermitian matrix must be real: transposition leaves them in place, and conjugating must return the same value, which only real numbers satisfy. Off-diagonal entries come in conjugate pairs: if , then .
The Fourier matrix
Definition
Let
an -th root of unity on the unit circle at angle . The entry of the Fourier matrix, with from 0 to , is
The exponent is the row index times the column index.
The case
For ,
so
The exponent pattern:
and then , , simplify the entries.
Why the columns are orthogonal
Take columns 2 and 4 (indices 1 and 3):
A plain dot product without conjugation gives
which looks nonzero. But the complex inner product conjugates the first vector:
So they are orthogonal after all. Forgetting the conjugate is the classic error here.
Each column has squared length . Dividing by produces a unitary matrix:
and therefore
The fast Fourier transform
The problem
Multiplying by directly costs multiplications because the matrix is full. The FFT reduces this to about .
The factorization
Take . The key observation is
because doubling the angle gives . Hence factors as
The three factors are:
- , an even-odd permutation matrix: it puts even-indexed components first and odd-indexed ones second. No multiplications, only reordering.
- Two copies of , acting separately on the even and odd parts.
- Fix-up matrices: and are nearly free; the real cost is multiplying by the diagonal which is 32 multiplications.
So multiplications become
Recursion
Break each the same way, producing four plus a size-32 permutation and fix-up. Continue down to size 1.
There are levels. Each level costs multiplications in its fix-up, so the total is
The scale
For :
- direct multiplication: ;
- FFT: .
About a 200-fold speedup. That is why the FFT changed entire industries.
Core review
- Complex length uses ; the inner product is ; conjugation is mandatory.
- Symmetry generalizes to Hermitian (), orthogonality to unitary ().
- The Fourier matrix is with .
- Its columns are orthogonal with squared length , and .
- The FFT uses to recurse, cutting to .
Common misconceptions
- Dropping the conjugate in a complex inner product, which breaks orthogonality tests.
- Giving a Hermitian matrix complex diagonal entries. The diagonal must be real.
- Writing . The correct form is .
- Calling the FFT an approximation. It is an exact factorization; only the order of multiplications changes.
- Converting to sine and cosine before taking high powers. The exponential form is what reveals the pattern.
Check your understanding
1. Compute the squared length of .
Reference answer: The squared length is . Term by term: , , and . Hence and the length is . Using instead gives , which is neither real nor correct — the complex inner product must conjugate.
2. Write and verify that columns 2 and 3 are orthogonal, remembering the conjugate.
Reference answer: With ,
Column 2 (index 1) is with conjugate ; column 3 (index 2) is . Then
So the columns are orthogonal. Without the conjugate one gets only by coincidence; columns 2 and 4 fail, which is exactly the example in the text.
3. Why must the diagonal of a Hermitian matrix be real?
Reference answer: Hermitian means , i.e. . Setting gives . A complex number equals its conjugate exactly when its imaginary part is zero, so each diagonal entry is real. Off-diagonal entries come in conjugate pairs: , so forces .
4. In the factorization of , which factor carries most of the work?
Reference answer: The diagonal correction matrix , which costs multiplications. The permutation only reorders entries and costs no multiplications, and cost only cheap additions, and the two blocks are handled recursively. Each level spends multiplications and there are levels, giving overall.
5. For , how many times faster is the FFT than direct multiplication?
Reference answer: Direct multiplication costs multiplications; the FFT costs . The ratio is , about 200 times faster. The FFT is not an approximation — it is an exact factorization that reorders the same multiplications so that repeated work is eliminated.
How this connects
This lecture completes the complex case and uses the Fourier matrix to show the computational value of matrix factorization. The next lecture returns to real symmetric matrices and develops positive definiteness, where eigenvalues, pivots, and leading minors give three equivalent tests.