第 29 章

奇异值分解:给四个子空间同时选对基

任意矩阵都能分解为 A = UΣVᵀ;右奇异向量来自 AᵀA,左奇异向量来自 AAᵀ,奇异值是特征值的平方根,本质是同时为正交的输入基与输出基。

Singular Value Decomposition: The Right Bases for All Four Subspaces

Every matrix factors as A = UΣVᵀ; right singular vectors come from AᵀA, left ones from AAᵀ, singular values are square roots of eigenvalues, and the point is an orthonormal input basis mapped to an orthonormal output basis.

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

SVD 想解决什么问题

特征分解 A=SΛS−1A=S\Lambda S^{-1} 有两个限制:矩阵必须是方阵,而且要有足够多的特征向量。更麻烦的是,即使能对角化,SS 通常也不是正交矩阵,换基之后角度和长度都被扭曲。

SVD 放弃「同一个基进、同一个基出」的要求,允许输入和输出各用一组正交基:

A=UΣVT.A=U\Sigma V^{\mathsf T}.
  • UU 是 m×mm\times m 正交矩阵,列是左奇异向量;
  • VV 是 n×nn\times n 正交矩阵,列是右奇异向量;
  • Σ\Sigma 是 m×nm\times n 对角矩阵,对角元 σ1≥σ2≥⋯≥σr>0\sigma_1\ge\sigma_2\ge\cdots\ge\sigma_r>0。

对任意 m×nm\times n 矩阵都成立,不管它是否方、是否对称、是否可对角化。

一句话总结: SVD 找到一组正交输入基,使得 AA 把每个基向量送到一组正交输出基的方向上,只做拉伸,不做旋转耦合。

时间轴

时间内容
0:14SVD:把好矩阵的思想推广到任意矩阵
1:29四个基本子空间与正交基
3:05任意线性变换的几何图像
5:48选择 v1,…,vrv_1,\dots,v_r 使 Avi=σiuiAv_i=\sigma_i u_i
8:31矩阵形式 AV=UΣAV=U\Sigma
11:02行空间与零空间的维数分工
13:48ATAA^{\mathsf T}A 对称且正定
15:17σi2\sigma_i^2 是 ATAA^{\mathsf T}A 的特征值
17:12先求 ATAA^{\mathsf T}A 的特征向量得到 VV
21:22再用 AATAA^{\mathsf T} 求 UU
28:15奇异矩阵的例子:秩为一的矩阵
31:05零空间与左零空间的对应
32:57由 vv 计算 uu 与奇异值 σ\sigma
37:39一般情形的基与维数
40:14SVD 的总结与四个子空间

几何目标

把 AA 看成从 Rn\mathbb R^n 到 Rm\mathbb R^m 的线性变换。行空间是 Rn\mathbb R^n 中的 rr 维子空间,列空间是 Rm\mathbb R^m 中的 rr 维子空间。

我们希望找到:

  • 行空间的一组标准正交基 v1,…,vrv_1,\dots,v_r;
  • 列空间的一组标准正交基 u1,…,uru_1,\dots,u_r;

使得

Av1=σ1u1,Av2=σ2u2,…,Avr=σrur.Av_1=\sigma_1u_1,\quad Av_2=\sigma_2u_2,\quad\dots,\quad Av_r=\sigma_ru_r.

σi\sigma_i 是拉伸倍数。写成矩阵就是

A[v1⋯vr]=[u1⋯ur][σ1⋱σr].A\begin{bmatrix}v_1&\cdots&v_r\end{bmatrix} =\begin{bmatrix}u_1&\cdots&u_r\end{bmatrix} \begin{bmatrix}\sigma_1&&\\&\ddots&\\&&\sigma_r\end{bmatrix}.

再把零空间与左零空间补齐,就得到完整的 A=UΣVTA=U\Sigma V^{\mathsf T}。

为什么零空间不构成困难

行空间之外的 n−rn-r 维是零空间,AA 把它们映到零;列空间之外的 m−rm-r 维是左零空间(ATA^{\mathsf T} 的零空间)。这两组基只需任意选取标准正交基,对应的奇异值就是 00。

所以真正的任务只有一个:在行空间和列空间里找到彼此配对的、被 AA 拉伸的正交方向。

如何计算:消去 U

从

A=UΣVTA=U\Sigma V^{\mathsf T}

出发,右乘 VV 的转置不方便,因为 UU 和 VV 都不知。技巧是构造一个只含 VV 的方程:

ATA=(UΣVT)T(UΣVT)=VΣTUTUΣVT.A^{\mathsf T}A =(U\Sigma V^{\mathsf T})^{\mathsf T}(U\Sigma V^{\mathsf T}) =V\Sigma^{\mathsf T}U^{\mathsf T}U\Sigma V^{\mathsf T}.

中间 UTU=IU^{\mathsf T}U=I,于是

ATA=VΣTΣVT=V[σ12⋱σn2]VT.A^{\mathsf T}A=V\Sigma^{\mathsf T}\Sigma V^{\mathsf T} =V\begin{bmatrix}\sigma_1^2&&\\&\ddots&\\&&\sigma_n^2\end{bmatrix}V^{\mathsf T}.

这正是 ATAA^{\mathsf T}A 的特征分解:

  • VV 的列是 ATAA^{\mathsf T}A 的特征向量;
  • σi2\sigma_i^2 是 ATAA^{\mathsf T}A 的特征值;
  • σi=λi\sigma_i=\sqrt{\lambda_i} 取正平方根。

同理,从 AATAA^{\mathsf T} 出发会消去 VV:

AAT=UΣΣTUT,AA^{\mathsf T}=U\Sigma\Sigma^{\mathsf T}U^{\mathsf T},

所以 UU 的列是 AATAA^{\mathsf T} 的特征向量。

ATAA^{\mathsf T}A 与 AATAA^{\mathsf T} 都是对称半正定矩阵,特征值非负,因此平方根有意义。两者非零特征值相同(这是 ABAB 与 BABA 特征值相同这一事实的特例)。

例一:可逆的 2×22\times2 矩阵

取

A=[44−33].A=\begin{bmatrix}4&4\\-3&3\end{bmatrix}.

第一步:算 ATAA^{\mathsf T}A

ATA=[4−343][44−33]=[257725].A^{\mathsf T}A= \begin{bmatrix}4&-3\\4&3\end{bmatrix} \begin{bmatrix}4&4\\-3&3\end{bmatrix} =\begin{bmatrix}25&7\\7&25\end{bmatrix}.

第二步:求特征值与特征向量

对 [257725]\begin{bmatrix}25&7\\7&25\end{bmatrix},两个特征向量是 [11]\begin{bmatrix}1\\1\end{bmatrix} 与 [1−1]\begin{bmatrix}1\\-1\end{bmatrix}:

ATA[11]=[3232]=32[11],A^{\mathsf T}A\begin{bmatrix}1\\1\end{bmatrix} =\begin{bmatrix}32\\32\end{bmatrix}=32\begin{bmatrix}1\\1\end{bmatrix}, ATA[1−1]=[18−18]=18[1−1].A^{\mathsf T}A\begin{bmatrix}1\\-1\end{bmatrix} =\begin{bmatrix}18\\-18\end{bmatrix}=18\begin{bmatrix}1\\-1\end{bmatrix}.

归一化后

v1=12[11],v2=12[1−1].v_1=\frac{1}{\sqrt2}\begin{bmatrix}1\\1\end{bmatrix},\qquad v_2=\frac{1}{\sqrt2}\begin{bmatrix}1\\-1\end{bmatrix}.

第三步:奇异值

σ1=32=42,σ2=18=32.\sigma_1=\sqrt{32}=4\sqrt2,\qquad \sigma_2=\sqrt{18}=3\sqrt2.

第四步:求 UU

AAT=[44−33][4−343]=[320018].AA^{\mathsf T}= \begin{bmatrix}4&4\\-3&3\end{bmatrix} \begin{bmatrix}4&-3\\4&3\end{bmatrix} =\begin{bmatrix}32&0\\0&18\end{bmatrix}.

它已经是对角矩阵,特征向量就是标准基,所以

u1=[10],u2=[01].u_1=\begin{bmatrix}1\\0\end{bmatrix},\qquad u_2=\begin{bmatrix}0\\1\end{bmatrix}.

第五步:检查符号

Av1=12[44−33][11]=12[80]=[420]=42[10],Av_1=\frac{1}{\sqrt2}\begin{bmatrix}4&4\\-3&3\end{bmatrix} \begin{bmatrix}1\\1\end{bmatrix} =\frac{1}{\sqrt2}\begin{bmatrix}8\\0\end{bmatrix} =\begin{bmatrix}4\sqrt2\\0\end{bmatrix} =4\sqrt2\begin{bmatrix}1\\0\end{bmatrix},

与 σ1u1\sigma_1u_1 一致。

但

Av2=12[44−33][1−1]=12[0−6]=[0−32]=−32[01].Av_2=\frac{1}{\sqrt2}\begin{bmatrix}4&4\\-3&3\end{bmatrix} \begin{bmatrix}1\\-1\end{bmatrix} =\frac{1}{\sqrt2}\begin{bmatrix}0\\-6\end{bmatrix} =\begin{bmatrix}0\\-3\sqrt2\end{bmatrix} =-3\sqrt2\begin{bmatrix}0\\1\end{bmatrix}.

出现了负号。正确的取法是 u2=[0−1]u_2=\begin{bmatrix}0\\-1\end{bmatrix},此时 Av2=32 u2Av_2=3\sqrt2\,u_2。

补充:特征向量乘以 −1-1 仍然是特征向量,所以 VV 的列有符号自由度。UU 必须与 VV 的符号选择配套,否则 UΣVTU\Sigma V^{\mathsf T} 会差一个符号。课堂在这里留下的「正弦符号」疑问,答案就是 u2u_2 应取 [0−1]\begin{bmatrix}0\\-1\end{bmatrix}。

最终

A=[100−1][420032]12[111−1].A= \begin{bmatrix}1&0\\0&-1\end{bmatrix} \begin{bmatrix}4\sqrt2&0\\0&3\sqrt2\end{bmatrix} \frac{1}{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix}.

例二:秩为 11 的矩阵

取

A=[4386].A=\begin{bmatrix}4&3\\8&6\end{bmatrix}.

两行成比例,秩为 11。

行空间与零空间

行向量都是 [43]\begin{bmatrix}4\\3\end{bmatrix} 的倍数,所以行空间是一维的:

v1=15[43]=[0.80.6].v_1=\frac{1}{5}\begin{bmatrix}4\\3\end{bmatrix} =\begin{bmatrix}0.8\\0.6\end{bmatrix}.

零空间与行空间正交,取

v2=[0.6−0.8].v_2=\begin{bmatrix}0.6\\-0.8\end{bmatrix}.

列空间与左零空间

列向量都是 [48]\begin{bmatrix}4\\8\end{bmatrix} 的倍数,方向为 [12]\begin{bmatrix}1\\2\end{bmatrix},归一化得

u1=15[12].u_1=\frac{1}{\sqrt5}\begin{bmatrix}1\\2\end{bmatrix}.

左零空间与列空间正交,取

u2=15[2−1].u_2=\frac{1}{\sqrt5}\begin{bmatrix}2\\-1\end{bmatrix}.

奇异值

ATA=[4836][4386]=[80606045].A^{\mathsf T}A= \begin{bmatrix}4&8\\3&6\end{bmatrix} \begin{bmatrix}4&3\\8&6\end{bmatrix} =\begin{bmatrix}80&60\\60&45\end{bmatrix}.

秩为 11,所以一个特征值为 00,另一个由迹得到:

125+0=125.125+0=125.

因此

σ1=125=55,σ2=0.\sigma_1=\sqrt{125}=5\sqrt5,\qquad \sigma_2=0.

检查:

Av1=[4386][0.80.6]=[510]=55⋅15[12]=σ1u1.Av_1=\begin{bmatrix}4&3\\8&6\end{bmatrix} \begin{bmatrix}0.8\\0.6\end{bmatrix} =\begin{bmatrix}5\\10\end{bmatrix} =5\sqrt5\cdot\frac{1}{\sqrt5}\begin{bmatrix}1\\2\end{bmatrix} =\sigma_1u_1.

四个子空间的完整图景

SVD 同时给出了四个基本子空间的标准正交基:

子空间所在空间维数基
行空间Rn\mathbb R^nrrv1,…,vrv_1,\dots,v_r
零空间Rn\mathbb R^nn−rn-rvr+1,…,vnv_{r+1},\dots,v_n
列空间Rm\mathbb R^mrru1,…,uru_1,\dots,u_r
左零空间Rm\mathbb R^mm−rm-rur+1,…,umu_{r+1},\dots,u_m

与 Gram-Schmidt 的区别在于:Gram-Schmidt 可以从任意基造出一组正交基,但它不会让 AA 在这组基下变成对角。SVD 额外要求 AA 把每个 viv_i 送到 uiu_i 的方向上,正是这个要求让它必须借助特征值。

常见误区

  1. 以为 UU 和 VV 可以独立选取。两者必须配对;viv_i 的符号改变时,uiu_i 也要相应改变。
  2. 把奇异值当成特征值。对非对称矩阵,两者一般不同;奇异值永远非负。
  3. 以为 ATAA^{\mathsf T}A 总是正定。秩亏时它有零特征值,只是半正定。
  4. 忘记排序。标准形式要求 σ1≥σ2≥⋯\sigma_1\ge\sigma_2\ge\cdots,UU 与 VV 的列要同步重排。

本讲结论

  • 任意矩阵都有 SVD:A=UΣVTA=U\Sigma V^{\mathsf T}。
  • VV 的列是 ATAA^{\mathsf T}A 的特征向量,UU 的列是 AATAA^{\mathsf T} 的特征向量,σi\sigma_i 是特征值的正平方根。
  • 当 AA 对称正定时,U=V=QU=V=Q,SVD 退化为 A=QΛQTA=Q\Lambda Q^{\mathsf T}。
  • SVD 的本质是同时为正输入基与输出基,使 AA 只沿各方向拉伸。
  • 它一次性给出四个基本子空间的标准正交基。

理解检验

1. 为什么 ATAA^{\mathsf T}A 的特征值一定是非负的?

参考答案:设 ATAv=λvA^{\mathsf T}Av=\lambda v,v≠0v\ne0。两边左乘 vTv^{\mathsf T}:

λ vTv=vTATAv=(Av)T(Av)=∥Av∥2≥0.\lambda\,v^{\mathsf T}v=v^{\mathsf T}A^{\mathsf T}Av=(Av)^{\mathsf T}(Av)=\lVert Av\rVert^2\ge0 .

而 vTv=∥v∥2>0v^{\mathsf T}v=\lVert v\rVert^2>0,所以 λ=∥Av∥2/∥v∥2≥0\lambda=\lVert Av\rVert^2/\lVert v\rVert^2\ge0。这同时说明 ATAA^{\mathsf T}A 半正定;当且仅当 N(A)={0}N(A)=\{\mathbf{0}\}(列无关)时为正定。奇异值取 σi=λi\sigma_i=\sqrt{\lambda_i} 正是因为它非负、平方根有实数意义。

2. 在例一中,为什么 u2u_2 必须取 [0−1]\begin{bmatrix}0\\-1\end{bmatrix} 而不是 [01]\begin{bmatrix}0\\1\end{bmatrix}?

参考答案:SVD 要求 Avi=σiuiAv_i=\sigma_i u_i 且 σi>0\sigma_i>0。例一中

Av2=12[44−33][1−1]=[0−32].Av_2=\frac1{\sqrt2}\begin{bmatrix}4&4\\-3&3\end{bmatrix}\begin{bmatrix}1\\-1\end{bmatrix}=\begin{bmatrix}0\\-3\sqrt2\end{bmatrix}.

若取 u2=(0,1)Tu_2=(0,1)^T,则 Av2=−32 u2Av_2=-3\sqrt2\,u_2,与 Av2=σ2u2=32 u2Av_2=\sigma_2u_2=3\sqrt2\,u_2 相差一个负号;取 u2=(0,−1)Tu_2=(0,-1)^T 才能写成 Av2=32 u2Av_2=3\sqrt2\,u_2。VV 的列可以任意乘 −1-1(仍是特征向量),但 UU 的列必须跟着配对,否则 UΣVTU\Sigma V^{\mathsf T} 会差符号。

3. 秩为 11 的矩阵,SVD 里有几个非零奇异值?为什么?

参考答案:恰好一个。非零奇异值的个数等于 rank⁡A\operatorname{rank}A,因为 AA 把行空间(rr 维)同构地送到列空间,每个方向对应一个正奇异值;零空间方向对应 σ=0\sigma=0。例二中 A=[4386]A=\begin{bmatrix}4&3\\8&6\end{bmatrix} 的 ATA=[80606045]A^{\mathsf T}A=\begin{bmatrix}80&60\\60&45\end{bmatrix},迹为 125125、秩 11,所以特征值是 125125 与 00,对应 σ1=55\sigma_1=5\sqrt5、σ2=0\sigma_2=0。

4. 对称正定矩阵的 SVD 与特征分解有什么关系?

参考答案:两者相同。对称正定矩阵有谱分解 A=QΛQTA=Q\Lambda Q^{\mathsf T},QQ 正交、Λ=diag⁡(λi)\Lambda=\operatorname{diag}(\lambda_i) 且 λi>0\lambda_i>0。把它与 A=UΣVTA=U\Sigma V^{\mathsf T} 对照,取 U=V=QU=V=Q、Σ=Λ\Sigma=\Lambda 即可,因为特征值全为正,奇异值 σi=λi2=λi\sigma_i=\sqrt{\lambda_i^2}=\lambda_i 就是特征值本身。也就是说,正定矩阵的左右奇异向量重合,SVD 退化为正交对角化;一般矩阵的奇异值与特征值不同,且奇异值永远非负。

5. 如果改变 v1v_1 的符号,UU、Σ\Sigma、VV 分别要怎么调整才能保持等式成立?

参考答案:把 VV 的第 1 列换成 −v1-v_1,同时把 UU 的第 1 列换成 −u1-u_1,Σ\Sigma 不变。理由是 A=∑iσiuiviTA=\sum_i\sigma_i u_iv_i^{\mathsf T},第 1 项为 σ1u1v1T\sigma_1u_1v_1^{\mathsf T};当 v1→−v1v_1\to-v_1 时,同时令 u1→−u1u_1\to-u_1,乘积 (−u1)(−v1)T=u1v1T(-u_1)(-v_1)^{\mathsf T}=u_1v_1^{\mathsf T} 不变。若只改 VV 不改 UU,整个和式会差一个符号。注意 σ1\sigma_1 必须保持正号——不能靠把 σ1\sigma_1 变为负数来吸收符号,因为 SVD 约定奇异值非负。

与前后课程的关系

上一讲用相似与 Jordan 形刻画了「同一变换换基」。这一讲进一步允许输入、输出使用不同的正交基,得到对所有矩阵都成立的分解。下一讲回到更基础的视角:线性变换本身是什么,矩阵如何由基的选择构造出来。

What SVD fixes

Eigen-decomposition A=SΛS−1A=S\Lambda S^{-1} has two limitations: the matrix must be square, and it must have enough eigenvectors. Worse, even when it diagonalizes, SS is usually not orthogonal, so changing basis distorts lengths and angles.

SVD drops the requirement that input and output share a basis. It allows a separate orthonormal basis on each side:

A=UΣVT.A=U\Sigma V^{\mathsf T}.
  • UU is m×mm\times m orthogonal; its columns are the left singular vectors.
  • VV is n×nn\times n orthogonal; its columns are the right singular vectors.
  • Σ\Sigma is m×nm\times n diagonal with σ1≥σ2≥⋯≥σr>0\sigma_1\ge\sigma_2\ge\cdots\ge\sigma_r>0.

This holds for every m×nm\times n matrix, square or not, symmetric or not, diagonalizable or not.

One-sentence summary: SVD finds an orthonormal input basis that AA maps to an orthonormal output basis, stretching each direction without coupling them.

Timeline

TimeTopic
0:14The SVD extends good-matrix ideas to any matrix
1:29The four subspaces and orthonormal bases
3:05The geometry of an arbitrary linear map
5:48Choosing v1,…,vrv_1,\dots,v_r with Avi=σiuiAv_i=\sigma_i u_i
8:31The matrix form AV=UΣAV=U\Sigma
11:02Splitting dimensions between row space and nullspace
13:48ATAA^{\mathsf T}A is symmetric and positive definite
15:17The σi2\sigma_i^2 are eigenvalues of ATAA^{\mathsf T}A
17:12Get VV from the eigenvectors of ATAA^{\mathsf T}A
21:22Then get UU from AATAA^{\mathsf T}
28:15A singular example: a rank-one matrix
31:05Matching nullspace with left nullspace
32:57Computing uu and σ\sigma from vv
37:39Bases and dimensions in general
40:14Summary of the SVD and the four subspaces

The geometric goal

View AA as a linear map from Rn\mathbb R^n to Rm\mathbb R^m. Its row space is an rr-dimensional subspace of Rn\mathbb R^n; its column space is an rr-dimensional subspace of Rm\mathbb R^m.

We want orthonormal bases

v1,…,vr in the row space,u1,…,ur in the column space,v_1,\dots,v_r \text{ in the row space},\qquad u_1,\dots,u_r \text{ in the column space},

such that

Av1=σ1u1,Av2=σ2u2,…,Avr=σrur.Av_1=\sigma_1u_1,\quad Av_2=\sigma_2u_2,\quad\dots,\quad Av_r=\sigma_ru_r.

In matrix form,

A[v1⋯vr]=[u1⋯ur][σ1⋱σr].A\begin{bmatrix}v_1&\cdots&v_r\end{bmatrix} =\begin{bmatrix}u_1&\cdots&u_r\end{bmatrix} \begin{bmatrix}\sigma_1&&\\&\ddots&\\&&\sigma_r\end{bmatrix}.

Completing both sides with the null spaces gives the full A=UΣVTA=U\Sigma V^{\mathsf T}.

Why null spaces are not the difficulty

The n−rn-r dimensions outside the row space form the null space, and AA sends them to zero. The m−rm-r dimensions outside the column space form the left null space, the null space of ATA^{\mathsf T}. Any orthonormal bases there will do; their singular values are zero.

So the real task is only this: find paired orthonormal directions in the row and column spaces that AA stretches into each other.

How to compute: eliminate U

Starting from

A=UΣVT,A=U\Sigma V^{\mathsf T},

multiply by the transpose to build an equation containing only VV:

ATA=(UΣVT)T(UΣVT)=VΣTUTUΣVT.A^{\mathsf T}A =(U\Sigma V^{\mathsf T})^{\mathsf T}(U\Sigma V^{\mathsf T}) =V\Sigma^{\mathsf T}U^{\mathsf T}U\Sigma V^{\mathsf T}.

Since UTU=IU^{\mathsf T}U=I,

ATA=VΣTΣVT=V[σ12⋱σn2]VT.A^{\mathsf T}A=V\Sigma^{\mathsf T}\Sigma V^{\mathsf T} =V\begin{bmatrix}\sigma_1^2&&\\&\ddots&\\&&\sigma_n^2\end{bmatrix}V^{\mathsf T}.

This is exactly the eigen-decomposition of ATAA^{\mathsf T}A:

  • the columns of VV are eigenvectors of ATAA^{\mathsf T}A;
  • σi2\sigma_i^2 are its eigenvalues;
  • σi=λi\sigma_i=\sqrt{\lambda_i}, the positive square root.

Similarly, AATAA^{\mathsf T} eliminates VV:

AAT=UΣΣTUT,AA^{\mathsf T}=U\Sigma\Sigma^{\mathsf T}U^{\mathsf T},

so the columns of UU are eigenvectors of AATAA^{\mathsf T}.

Both ATAA^{\mathsf T}A and AATAA^{\mathsf T} are symmetric positive semidefinite, so their eigenvalues are nonnegative and square roots exist. Their nonzero eigenvalues coincide, a special case of the fact that ABAB and BABA share eigenvalues.

Example one: an invertible 2×22\times2

A=[44−33].A=\begin{bmatrix}4&4\\-3&3\end{bmatrix}.

Compute ATAA^{\mathsf T}A

ATA=[4−343][44−33]=[257725].A^{\mathsf T}A= \begin{bmatrix}4&-3\\4&3\end{bmatrix} \begin{bmatrix}4&4\\-3&3\end{bmatrix} =\begin{bmatrix}25&7\\7&25\end{bmatrix}.

Eigenvalues and eigenvectors

For [257725]\begin{bmatrix}25&7\\7&25\end{bmatrix}, the eigenvectors are [11]\begin{bmatrix}1\\1\end{bmatrix} and [1−1]\begin{bmatrix}1\\-1\end{bmatrix}:

ATA[11]=[3232]=32[11],A^{\mathsf T}A\begin{bmatrix}1\\1\end{bmatrix} =\begin{bmatrix}32\\32\end{bmatrix}=32\begin{bmatrix}1\\1\end{bmatrix}, ATA[1−1]=[18−18]=18[1−1].A^{\mathsf T}A\begin{bmatrix}1\\-1\end{bmatrix} =\begin{bmatrix}18\\-18\end{bmatrix}=18\begin{bmatrix}1\\-1\end{bmatrix}.

Normalized:

v1=12[11],v2=12[1−1].v_1=\frac{1}{\sqrt2}\begin{bmatrix}1\\1\end{bmatrix},\qquad v_2=\frac{1}{\sqrt2}\begin{bmatrix}1\\-1\end{bmatrix}.

Singular values

σ1=32=42,σ2=18=32.\sigma_1=\sqrt{32}=4\sqrt2,\qquad \sigma_2=\sqrt{18}=3\sqrt2.

Find UU

AAT=[44−33][4−343]=[320018].AA^{\mathsf T}= \begin{bmatrix}4&4\\-3&3\end{bmatrix} \begin{bmatrix}4&-3\\4&3\end{bmatrix} =\begin{bmatrix}32&0\\0&18\end{bmatrix}.

This is already diagonal, so the eigenvectors are the standard basis:

u1=[10],u2=[01].u_1=\begin{bmatrix}1\\0\end{bmatrix},\qquad u_2=\begin{bmatrix}0\\1\end{bmatrix}.

Check the signs

Av1=12[44−33][11]=12[80]=[420]=42[10],Av_1=\frac{1}{\sqrt2}\begin{bmatrix}4&4\\-3&3\end{bmatrix} \begin{bmatrix}1\\1\end{bmatrix} =\frac{1}{\sqrt2}\begin{bmatrix}8\\0\end{bmatrix} =\begin{bmatrix}4\sqrt2\\0\end{bmatrix} =4\sqrt2\begin{bmatrix}1\\0\end{bmatrix},

which matches σ1u1\sigma_1u_1.

But

Av2=12[44−33][1−1]=12[0−6]=[0−32]=−32[01].Av_2=\frac{1}{\sqrt2}\begin{bmatrix}4&4\\-3&3\end{bmatrix} \begin{bmatrix}1\\-1\end{bmatrix} =\frac{1}{\sqrt2}\begin{bmatrix}0\\-6\end{bmatrix} =\begin{bmatrix}0\\-3\sqrt2\end{bmatrix} =-3\sqrt2\begin{bmatrix}0\\1\end{bmatrix}.

A minus sign appears. The correct choice is u2=[0−1]u_2=\begin{bmatrix}0\\-1\end{bmatrix}, giving Av2=32 u2Av_2=3\sqrt2\,u_2.

Background: an eigenvector times −1-1 is still an eigenvector, so the columns of VV have a sign freedom. UU must be chosen consistently with that sign, or UΣVTU\Sigma V^{\mathsf T} is off by a sign. The sign puzzle left open in the lecture is resolved by taking u2=[0−1]u_2=\begin{bmatrix}0\\-1\end{bmatrix}.

Finally,

A=[100−1][420032]12[111−1].A= \begin{bmatrix}1&0\\0&-1\end{bmatrix} \begin{bmatrix}4\sqrt2&0\\0&3\sqrt2\end{bmatrix} \frac{1}{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix}.

Example two: rank one

A=[4386].A=\begin{bmatrix}4&3\\8&6\end{bmatrix}.

The rows are proportional, so the rank is one.

Row space and null space

Every row is a multiple of [43]\begin{bmatrix}4\\3\end{bmatrix}, so the row space is one-dimensional:

v1=15[43]=[0.80.6].v_1=\frac{1}{5}\begin{bmatrix}4\\3\end{bmatrix} =\begin{bmatrix}0.8\\0.6\end{bmatrix}.

The null space is orthogonal to it:

v2=[0.6−0.8].v_2=\begin{bmatrix}0.6\\-0.8\end{bmatrix}.

Column space and left null space

Every column is a multiple of [48]\begin{bmatrix}4\\8\end{bmatrix}, whose direction is [12]\begin{bmatrix}1\\2\end{bmatrix}:

u1=15[12].u_1=\frac{1}{\sqrt5}\begin{bmatrix}1\\2\end{bmatrix}.

The left null space is orthogonal:

u2=15[2−1].u_2=\frac{1}{\sqrt5}\begin{bmatrix}2\\-1\end{bmatrix}.

Singular values

ATA=[4836][4386]=[80606045].A^{\mathsf T}A= \begin{bmatrix}4&8\\3&6\end{bmatrix} \begin{bmatrix}4&3\\8&6\end{bmatrix} =\begin{bmatrix}80&60\\60&45\end{bmatrix}.

The rank is one, so one eigenvalue is zero and the other follows from the trace:

125+0=125.125+0=125.

Hence

σ1=125=55,σ2=0.\sigma_1=\sqrt{125}=5\sqrt5,\qquad \sigma_2=0.

Check:

Av1=[4386][0.80.6]=[510]=55⋅15[12]=σ1u1.Av_1=\begin{bmatrix}4&3\\8&6\end{bmatrix} \begin{bmatrix}0.8\\0.6\end{bmatrix} =\begin{bmatrix}5\\10\end{bmatrix} =5\sqrt5\cdot\frac{1}{\sqrt5}\begin{bmatrix}1\\2\end{bmatrix} =\sigma_1u_1.

The complete picture of four subspaces

SVD hands you orthonormal bases for all four fundamental subspaces at once:

SubspaceLives inDimensionBasis
Row spaceRn\mathbb R^nrrv1,…,vrv_1,\dots,v_r
Null spaceRn\mathbb R^nn−rn-rvr+1,…,vnv_{r+1},\dots,v_n
Column spaceRm\mathbb R^mrru1,…,uru_1,\dots,u_r
Left null spaceRm\mathbb R^mm−rm-rur+1,…,umu_{r+1},\dots,u_m

The difference from Gram-Schmidt is that Gram-Schmidt can orthogonalize any basis, but it will not make AA diagonal in that basis. SVD adds the requirement that AA send each viv_i in the direction of uiu_i, and that is why eigenvalues are unavoidable.

Common mistakes

  1. Choosing UU and VV independently. They must be paired; flipping the sign of viv_i requires flipping uiu_i.
  2. Confusing singular values with eigenvalues. For non-symmetric matrices they differ, and singular values are never negative.
  3. Assuming ATAA^{\mathsf T}A is positive definite. With rank deficiency it has zero eigenvalues; it is only semidefinite.
  4. Forgetting the ordering. The standard form requires σ1≥σ2≥⋯\sigma_1\ge\sigma_2\ge\cdots, with the columns of UU and VV reordered in step.

Takeaways

  • Every matrix has an SVD: A=UΣVTA=U\Sigma V^{\mathsf T}.
  • The columns of VV are eigenvectors of ATAA^{\mathsf T}A; the columns of UU are eigenvectors of AATAA^{\mathsf T}; σi\sigma_i are positive square roots of the eigenvalues.
  • For symmetric positive definite AA, U=V=QU=V=Q and SVD reduces to A=QΛQTA=Q\Lambda Q^{\mathsf T}.
  • SVD's essence is choosing orthonormal input and output bases so that AA only stretches.
  • It produces orthonormal bases for all four fundamental subspaces in one step.

Check your understanding

1. Why must the eigenvalues of ATAA^{\mathsf T}A be nonnegative?

Reference answer: Let ATAv=λvA^{\mathsf T}Av=\lambda v with v≠0v\ne0. Left-multiplying by vTv^{\mathsf T},

λ vTv=vTATAv=(Av)T(Av)=∥Av∥2≥0.\lambda\,v^{\mathsf T}v=v^{\mathsf T}A^{\mathsf T}Av=(Av)^{\mathsf T}(Av)=\lVert Av\rVert^2\ge0 .

Since vTv=∥v∥2>0v^{\mathsf T}v=\lVert v\rVert^2>0, we get λ=∥Av∥2/∥v∥2≥0\lambda=\lVert Av\rVert^2/\lVert v\rVert^2\ge0. The same computation shows ATAA^{\mathsf T}A is positive semidefinite, and positive definite exactly when N(A)={0}N(A)=\{\mathbf{0}\} (independent columns). The singular values are σi=λi\sigma_i=\sqrt{\lambda_i} precisely because the eigenvalues are nonnegative and the real square root exists.

2. In example one, why must u2u_2 be [0−1]\begin{bmatrix}0\\-1\end{bmatrix} rather than [01]\begin{bmatrix}0\\1\end{bmatrix}?

Reference answer: SVD requires Avi=σiuiAv_i=\sigma_iu_i with σi>0\sigma_i>0. In example one,

Av2=12[44−33][1−1]=[0−32].Av_2=\frac1{\sqrt2}\begin{bmatrix}4&4\\-3&3\end{bmatrix}\begin{bmatrix}1\\-1\end{bmatrix}=\begin{bmatrix}0\\-3\sqrt2\end{bmatrix}.

With u2=(0,1)Tu_2=(0,1)^T this reads Av2=−32 u2Av_2=-3\sqrt2\,u_2, a sign mismatch with Av2=σ2u2=32 u2Av_2=\sigma_2u_2=3\sqrt2\,u_2; taking u2=(0,−1)Tu_2=(0,-1)^T gives Av2=32 u2Av_2=3\sqrt2\,u_2. Any column of VV may be negated (it is still an eigenvector), but the corresponding column of UU must be negated with it, otherwise UΣVTU\Sigma V^{\mathsf T} carries an extra sign.

3. How many nonzero singular values does a rank-one matrix have, and why?

Reference answer: Exactly one. The number of nonzero singular values equals rank⁡A\operatorname{rank}A, because AA maps the rr-dimensional row space isomorphically onto the column space, one positive stretch factor per direction, while null-space directions give σ=0\sigma=0. In example two, A=[4386]A=\begin{bmatrix}4&3\\8&6\end{bmatrix} gives ATA=[80606045]A^{\mathsf T}A=\begin{bmatrix}80&60\\60&45\end{bmatrix} with trace 125125 and rank 11, so the eigenvalues are 125125 and 00, giving σ1=55\sigma_1=5\sqrt5 and σ2=0\sigma_2=0.

4. How does the SVD of a symmetric positive definite matrix relate to its eigen-decomposition?

Reference answer: They coincide. A symmetric positive definite matrix has the spectral decomposition A=QΛQTA=Q\Lambda Q^{\mathsf T} with QQ orthogonal, Λ=diag⁡(λi)\Lambda=\operatorname{diag}(\lambda_i) and all λi>0\lambda_i>0. Matching this with A=UΣVTA=U\Sigma V^{\mathsf T} gives U=V=QU=V=Q and Σ=Λ\Sigma=\Lambda, because positive eigenvalues satisfy σi=λi2=λi\sigma_i=\sqrt{\lambda_i^2}=\lambda_i. Thus the left and right singular vectors coincide and SVD reduces to orthogonal diagonalization; for a general matrix the singular values differ from the eigenvalues, and singular values are always nonnegative.

5. If v1v_1 changes sign, how must UU, Σ\Sigma, and VV adjust to keep the factorization valid?

Reference answer: Replace the first column of VV by −v1-v_1 and simultaneously replace the first column of UU by −u1-u_1; leave Σ\Sigma unchanged. The reason is A=∑iσiuiviTA=\sum_i\sigma_iu_iv_i^{\mathsf T}, whose first term is σ1u1v1T\sigma_1u_1v_1^{\mathsf T}; under v1→−v1v_1\to-v_1, setting u1→−u1u_1\to-u_1 gives (−u1)(−v1)T=u1v1T(-u_1)(-v_1)^{\mathsf T}=u_1v_1^{\mathsf T}, so the sum is unchanged. Changing only VV would flip the sign of the whole sum. Note that σ1\sigma_1 must stay positive: absorbing the sign into Σ\Sigma is not allowed, since SVD requires nonnegative singular values.

How this connects to the course

The previous lecture characterized "one transformation, many bases" through similarity and Jordan form. This one allows different orthonormal bases on the input and output sides, producing a factorization valid for every matrix. The next lecture steps back to the more basic question: what a linear transformation is, and how a matrix is constructed once bases are chosen.

来源