第 30 章

线性变换与它的矩阵:先有变换,后有坐标

线性变换是无坐标的映射,保持加法与数乘;选定输入基与输出基后,变换才写成矩阵,矩阵的第 j 列就是 T(v_j) 在输出基下的坐标。

Linear Transformations and Their Matrices: Transformation First, Coordinates Second

A linear transformation is a coordinate-free map preserving addition and scaling; once input and output bases are chosen it becomes a matrix, whose j-th column is the coordinate vector of T(v_j).

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

把顺序倒过来

很多线性代数课从线性变换开始,先讲映射,再引入矩阵。Strang 在这门课的最后才回头讲它,是因为此时已经积累了足够多的工具:基、坐标、零空间、特征值,都可以用来理解同一个对象。

核心观点是:

线性变换是本质,矩阵是它在某组基下的坐标表示。

矩阵不是凭空出现的数字表。它依赖基的选择;换一组基,同一个变换会写成另一个矩阵。

时间轴

时间内容
0:07线性变换:把注意力放到整个空间上
1:39例一:投影到一条直线
5:37例二:平移,它不是线性变换
7:53零向量必须被映到零
10:35例三:旋转
13:38例四:由矩阵给出的变换
15:04矩阵如何作用于平面上的所有向量
20:30每个线性变换都对应一个矩阵
23:58输入基的选择决定矩阵
26:21坐标来自基
30:09一般的 nn 维到 mm 维变换
32:37投影例子:换一组基使矩阵变简单
36:58特征向量基使矩阵成为对角阵
38:4945 度投影及其矩阵
46:04求导作为线性变换
48:10求导在多项式基下的矩阵

什么是线性变换

一个映射 TT 把输入空间的向量送到输出空间。它是线性的,当且仅当保持向量运算:

T(v+w)=T(v)+T(w),T(v+w)=T(v)+T(w), T(cv)=c T(v).T(cv)=c\,T(v).

两条可以合并成一条:

T(cv+dw)=c T(v)+d T(w).T(cv+dw)=c\,T(v)+d\,T(w).

也就是说,线性组合先变换还是先组合,结果相同。

一个立刻可用的推论

T(0)=0.T(0)=0.

证明:取 v=0v=0,c=3c=3,则 T(0)=T(3⋅0)=3T(0)T(0)=T(3\cdot0)=3T(0),所以 2T(0)=02T(0)=0,即 T(0)=0T(0)=0。

这条推论是判断「不线性」的最快工具:只要原点被移动,映射一定不是线性的。

四个例子,两个不是

投影

把平面上每个向量投影到一条过原点的直线上。若 vv 伸长两倍,投影也伸长两倍;若 vv 变成 −v-v,投影也变成相反方向。所以投影是线性的。

整个描述不需要坐标,也不需要矩阵。

旋转

把平面绕原点旋转 45∘45^\circ。旋转保持加法与数乘,因此是线性的。

如果输入是一个房子的轮廓,输出就是旋转后的房子。线性变换可以一次作用在整片区域上:只要知道边界点去哪里,就知道整个图形去哪里。

平移

把每个向量 vv 变成 v+v0v+v_0,其中 v0v_0 是固定向量。这看起来很自然,但它不是线性的:

T(2v)=2v+v0≠2(v+v0)=2v+2v0.T(2v)=2v+v_0\neq 2(v+v_0)=2v+2v_0.

更直接地,T(0)=v0≠0T(0)=v_0\neq0。原点被移动了。

这也是为什么仿射变换(线性变换加平移)需要额外的一维坐标才能写成矩阵。

取长度

把向量送到它的长度 ∥v∥\lVert v\rVert。它满足 T(0)=0T(0)=0,也满足 T(2v)=2T(v)T(2v)=2T(v),但

T(−v)=∥−v∥=∥v∥≠−T(v).T(-v)=\lVert -v\rVert=\lVert v\rVert\neq -T(v).

负数的数乘被破坏了,所以不是线性的。

矩阵给出的线性变换

对任意矩阵 AA,映射

T(v)=AvT(v)=Av

都是线性的,因为矩阵乘法满足分配律与数乘结合律:

A(v+w)=Av+Aw,A(cv)=cAv.A(v+w)=Av+Aw,\qquad A(cv)=cAv.

反过来,在有限维空间中,每个线性变换都来自某个矩阵——前提是选定了基。

矩阵的尺寸由输入输出空间的维数决定:从 R3\mathbb R^3 到 R2\mathbb R^2 的变换,对应一个 2×32\times3 矩阵。

知道基上的像,就知道整个变换

这是本讲最重要的结构事实。

设 v1,…,vnv_1,\dots,v_n 是输入空间的一组基。任意输入都可以唯一写成

v=c1v1+⋯+cnvn.v=c_1v_1+\cdots+c_nv_n.

由线性性,

T(v)=c1T(v1)+⋯+cnT(vn).T(v)=c_1T(v_1)+\cdots+c_nT(v_n).

所以,只要知道 TT 在基向量上的取值,就能算出它在任何向量上的取值。

反过来说,未知的也只有这些取值:nn 个基向量各有 mm 个输出坐标,共 mnmn 个数,正好是一个 m×nm\times n 矩阵。

坐标来自基

在标准基下,向量 [324]\begin{bmatrix}3\\2\\4\end{bmatrix} 的三个分量就是坐标——因为默认基是 e1,e2,e3e_1,e_2,e_3。

但基可以换。取任意一组基 v1,…,vnv_1,\dots,v_n,向量 vv 的坐标是唯一一组系数 c1,…,cnc_1,\dots,c_n,使得

v=c1v1+⋯+cnvn.v=c_1v_1+\cdots+c_nv_n.

换基就换坐标。同一个向量,在不同基下的坐标不同;同一个变换,在不同基下的矩阵也不同。

构造矩阵的规则

设:

  • 输入空间 Rn\mathbb R^n 的基为 v1,…,vnv_1,\dots,v_n;
  • 输出空间 Rm\mathbb R^m 的基为 w1,…,wmw_1,\dots,w_m。

矩阵 AA 的第 jj 列这样得到:

  1. 对第 jj 个输入基向量作用 TT,得到 T(vj)T(v_j);
  2. 把 T(vj)T(v_j) 写成输出基的线性组合:
T(vj)=a1jw1+a2jw2+⋯+amjwm;T(v_j)=a_{1j}w_1+a_{2j}w_2+\cdots+a_{mj}w_m;
  1. 系数 [a1j⋮amj]\begin{bmatrix}a_{1j}\\ \vdots\\ a_{mj}\end{bmatrix} 就是 AA 的第 jj 列。

这样构造出的矩阵满足:输入坐标左乘 AA,得到输出坐标。

为什么第 j 列是这样

取输入坐标为 (0,…,1,…,0)(0,\dots,1,\dots,0)(第 jj 个位置为 11),它对应的输入向量正是 vjv_j。用 AA 乘这个坐标向量,得到的就是 AA 的第 jj 列。而第 jj 列按定义是 T(vj)T(v_j) 的输出坐标。两边一致。

对每个基向量都成立,由线性性,对所有向量都成立。

例一:投影,两种基

把平面投影到 45∘45^\circ 直线上。

用特征向量基

取

v1=12[11](沿直线),v2=12[1−1](垂直于直线).v_1=\frac{1}{\sqrt2}\begin{bmatrix}1\\1\end{bmatrix}\quad(\text{沿直线}),\qquad v_2=\frac{1}{\sqrt2}\begin{bmatrix}1\\-1\end{bmatrix}\quad(\text{垂直于直线}).

输入基与输出基都取这一组。

  • T(v1)=v1T(v_1)=v_1,因为沿直线的向量投影后不变;
  • T(v2)=0T(v_2)=0,因为垂直分量被投影抹掉。

于是

T(v1)=1⋅v1+0⋅v2,T(v2)=0⋅v1+0⋅v2,T(v_1)=1\cdot v_1+0\cdot v_2,\qquad T(v_2)=0\cdot v_1+0\cdot v_2,

矩阵为

A=[1000].A=\begin{bmatrix}1&0\\0&0\end{bmatrix}.

这是对角矩阵,对角元正是特征值 11 与 00。特征向量基是「好基」:它让变换写成最简单的形式。

用标准基

取 e1=[10]e_1=\begin{bmatrix}1\\0\end{bmatrix},e2=[01]e_2=\begin{bmatrix}0\\1\end{bmatrix},输入输出都用标准基。

投影到 45∘45^\circ 直线的投影矩阵是

P=aaTaTa=12[11][11]=[12121212].P=\frac{aa^{\mathsf T}}{a^{\mathsf T}a} =\frac{1}{2}\begin{bmatrix}1\\1\end{bmatrix}\begin{bmatrix}1&1\end{bmatrix} =\begin{bmatrix}\frac12&\frac12\\[2pt]\frac12&\frac12\end{bmatrix}.

检查:

P[10]=[1212],P[01]=[1212].P\begin{bmatrix}1\\0\end{bmatrix} =\begin{bmatrix}\frac12\\[2pt]\frac12\end{bmatrix}, \qquad P\begin{bmatrix}0\\1\end{bmatrix} =\begin{bmatrix}\frac12\\[2pt]\frac12\end{bmatrix}.

两个标准基向量都落到同一条直线上,正是投影。

同一个变换,在特征向量基下是 diag⁡(1,0)\operatorname{diag}(1,0),在标准基下是 12[1111]\frac12\begin{bmatrix}1&1\\1&1\end{bmatrix}。矩阵不同,变换相同。

例二:求导也是线性变换

取输入空间为次数不超过 22 的多项式:

p(x)=c1+c2x+c3x2,p(x)=c_1+c_2x+c_3x^2,

基为 1,x,x21,x,x^2。输出空间取次数不超过 11 的多项式,基为 1,x1,x。

求导:

ddxp(x)=c2+2c3x.\frac{d}{dx}p(x)=c_2+2c_3x.

按构造规则:

  • T(1)=0T(1)=0,输出坐标 [00]\begin{bmatrix}0\\0\end{bmatrix};
  • T(x)=1T(x)=1,输出坐标 [10]\begin{bmatrix}1\\0\end{bmatrix};
  • T(x2)=2xT(x^2)=2x,输出坐标 [02]\begin{bmatrix}0\\2\end{bmatrix}。

所以矩阵是

D=[010002].D=\begin{bmatrix}0&1&0\\0&0&2\end{bmatrix}.

验证:

D[c1c2c3]=[c22c3].D\begin{bmatrix}c_1\\c_2\\c_3\end{bmatrix} =\begin{bmatrix}c_2\\2c_3\end{bmatrix}.

这正是导数的坐标。

补充:求导之所以能如此高效,正是因为它线性。知道少数几个基本函数的导数,就能通过线性组合得到所有组合的导数。这也是微分法则背后的结构原因。

矩阵运算的变换解释

一旦把矩阵理解为变换的坐标表示,矩阵运算就有了自然含义:

  • 矩阵乘法对应变换的复合:先做 BB,再做 AA,矩阵是 ABAB;
  • 逆矩阵对应逆变换:A−1A^{-1} 把输出送回输入;
  • 相似 M−1AMM^{-1}AM 对应换基:同一个变换在新基下的矩阵。

矩阵乘法「行乘列」的规则不是约定,而是为了保证复合变换的坐标计算正确。

常见误区

  1. 把平移当成线性变换。它移动了原点,违反 T(0)=0T(0)=0。
  2. 以为矩阵唯一确定变换。矩阵依赖基;换基后同一个变换对应不同矩阵。
  3. 只给输入基,不给输出基。构造矩阵需要两组基,输出基决定列坐标如何读出。
  4. 混淆向量与坐标。向量是几何对象,坐标是它在某组基下的系数。

本讲结论

  • 线性变换保持加法与数乘,等价于保持一切线性组合。
  • 线性变换必然把零送到零;平移与取长度都不是线性的。
  • 知道变换在一组基上的像,就确定了整个变换。
  • 选定输入基与输出基后,矩阵的第 jj 列是 T(vj)T(v_j) 在输出基下的坐标。
  • 好基(特征向量基)让矩阵变成对角;标准基让计算方便,但矩阵通常不简单。
  • 矩阵乘法、逆、相似,分别对应复合、逆变换、换基。

理解检验

1. 用定义证明 T(0)=0T(0)=0,并说明为什么平移不满足它。

参考答案:取数乘公理 T(cv)=c T(v)T(cv)=c\,T(v),令 c=0c=0、vv 任意,得 T(0)=0⋅T(v)=0T(0)=0\cdot T(v)=\mathbf{0}。另一种写法是 T(0)=T(0+0)=T(0)+T(0)T(0)=T(0+0)=T(0)+T(0),两边减去 T(0)T(0) 也得 T(0)=0T(0)=0。平移 T(v)=v+v0T(v)=v+v_0 把零向量送到 T(0)=v0T(0)=v_0;只要 v0≠0v_0\ne0,就有 T(0)≠0T(0)\ne0,违反这条必要条件,所以平移不是线性变换。这也是仿射变换需要额外一维坐标才能写成矩阵的原因。

2. 为什么「取长度」在 c=2c=2 时成立,在 c=−2c=-2 时不成立?

参考答案:T(v)=∥v∥T(v)=\lVert v\rVert 满足 T(cv)=∥cv∥=∣c∣ ∥v∥=∣c∣ T(v)T(cv)=\lVert cv\rVert=|c|\,\lVert v\rVert=|c|\,T(v)。当 c=2>0c=2>0 时 ∣c∣=c|c|=c,所以 T(2v)=2T(v)T(2v)=2T(v) 成立。当 c=−2<0c=-2<0 时 ∣c∣=−c|c|=-c,得 T(−2v)=2∥v∥T(-2v)=2\lVert v\rVert,而 −2T(v)=−2∥v∥-2T(v)=-2\lVert v\rVert;两者只在 ∥v∥=0\lVert v\rVert=0 时相等,一般情况下不等。破坏的正是「负数数乘」这一条:线性变换必须区分方向,而长度丢掉了符号。同时它也违反 T(−v)=−T(v)T(-v)=-T(v)。

3. 已知 TT 在一组基上的像,为什么就能确定 TT 在所有向量上的值?

参考答案:设 v1,…,vnv_1,\dots,v_n 是输入空间的一组基,任一 vv 都能唯一写成 v=∑jcjvjv=\sum_j c_jv_j。由线性性(把有限和的每一项拆开、系数提出),

T(v)=T(∑jcjvj)=∑jcjT(vj).T(v)=T\Big(\sum_j c_jv_j\Big)=\sum_j c_jT(v_j).

右边的系数 cjc_j 由 vv 的坐标给出,T(vj)T(v_j) 已知,所以 T(v)T(v) 被完全确定。这也解释了为什么一个 m×nm\times n 变换只需要 mnmn 个数——每个基向量给出 mm 个输出坐标。

4. 对 45∘45^\circ 投影,特征向量基与标准基给出的矩阵分别是什么?它们为什么相似?

参考答案:在特征向量基 v1=12(1,1)Tv_1=\frac1{\sqrt2}(1,1)^T、v2=12(1,−1)Tv_2=\frac1{\sqrt2}(1,-1)^T 下,T(v1)=v1T(v_1)=v_1、T(v2)=0T(v_2)=0,矩阵是 diag⁡(1,0)\operatorname{diag}(1,0)。在标准基下,投影矩阵是

P=aaTaTa=12[1111].P=\frac{aa^{\mathsf T}}{a^{\mathsf T}a}=\frac12\begin{bmatrix}1&1\\1&1\end{bmatrix}.

两者相似,因为它们是同一个变换在不同基下的矩阵,换基公式为 P=S−1diag⁡(1,0)SP=S^{-1}\operatorname{diag}(1,0)S,其中 S=[v1 v2]S=[v_1\ v_2] 是以特征向量为列的基变换矩阵。相似不变量(迹 11、行列式 00、特征值 11 和 00)在两边一致。

5. 求导矩阵 [010002]\begin{bmatrix}0&1&0\\0&0&2\end{bmatrix} 的零空间是什么?它在原函数空间中对应什么?

参考答案:求 Dc=0Dc=0:

[010002][c1c2c3]=[c22c3]=[00],\begin{bmatrix}0&1&0\\0&0&2\end{bmatrix}\begin{bmatrix}c_1\\c_2\\c_3\end{bmatrix}=\begin{bmatrix}c_2\\2c_3\end{bmatrix}=\begin{bmatrix}0\\0\end{bmatrix},

所以 c2=0c_2=0、c3=0c_3=0,c1c_1 自由。零空间是 span⁡{(1,0,0)T}\operatorname{span}\{(1,0,0)^T\},维数 11,等于 3−rank⁡D=3−23-\operatorname{rank}D=3-2。在多项式空间中,(c1,0,0)(c_1,0,0) 对应常数多项式 p(x)=c1p(x)=c_1,其导数为零。所以零空间正是所有常函数组成的子空间——这与微积分里「导数为零当且仅当函数为常数」完全一致。

与前后课程的关系

上一讲的 SVD 通过选择两组正交基把任意矩阵对角化。这一讲回到更根本的层次:变换先于矩阵,矩阵依赖基。接下来的课程会在此基础上讨论基变换、图像压缩,以及整个课程的总结。

Reversing the usual order

Many linear algebra courses start with transformations and only then introduce matrices. Strang saves this topic for late in the course, when enough machinery exists — bases, coordinates, null spaces, eigenvalues — to understand the same object from several sides.

The central claim:

A linear transformation is the object; a matrix is its coordinate representation in a chosen basis.

A matrix is not a table of numbers that appears from nowhere. It depends on the bases. Change the bases and the same transformation is written as a different matrix.

Timeline

TimeTopic
0:07Linear transformations: looking at the whole space
1:39Example one: projection onto a line
5:37Example two: translation, which is not linear
7:53The zero vector must map to zero
10:35Example three: rotation
13:38Example four: a transformation given by a matrix
15:04How a matrix acts on every vector
20:30Every linear transformation comes from a matrix
23:58The input basis determines the matrix
26:21Coordinates come from a basis
30:09The general map from Rn\mathbb{R}^n to Rm\mathbb{R}^m
32:37A basis that simplifies the projection matrix
36:58An eigenvector basis makes the matrix diagonal
38:49Projection onto the 45 degree line
46:04Differentiation as a linear transformation
48:10The matrix of differentiation in a polynomial basis

What makes a transformation linear

A map TT sends vectors from an input space to an output space. It is linear exactly when it preserves the two vector operations:

T(v+w)=T(v)+T(w),T(v+w)=T(v)+T(w), T(cv)=c T(v).T(cv)=c\,T(v).

The two combine into one statement:

T(cv+dw)=c T(v)+d T(w).T(cv+dw)=c\,T(v)+d\,T(w).

In words: transforming a linear combination gives the same result as combining the transformed pieces.

An immediate consequence

T(0)=0.T(0)=0.

Proof: take v=0v=0 and c=3c=3. Then T(0)=T(3⋅0)=3T(0)T(0)=T(3\cdot0)=3T(0), so 2T(0)=02T(0)=0, hence T(0)=0T(0)=0.

This is the fastest test for non-linearity: if the origin moves, the map cannot be linear.

Four examples, two of them not linear

Projection

Project every vector in the plane onto a line through the origin. Doubling vv doubles its projection; replacing vv by −v-v reverses the projection. So projection is linear.

The description needs no coordinates and no matrix.

Rotation

Rotate the plane by 45∘45^\circ about the origin. Rotation preserves addition and scaling, so it is linear.

If the input is the outline of a house, the output is the rotated house. A linear transformation acts on a whole region at once: once the boundary points are known to move, the entire figure moves.

Translation

Send every vv to v+v0v+v_0 for a fixed v0v_0. Natural as it looks, it is not linear:

T(2v)=2v+v0≠2(v+v0)=2v+2v0.T(2v)=2v+v_0\neq 2(v+v_0)=2v+2v_0.

More directly, T(0)=v0≠0T(0)=v_0\neq0: the origin moved.

This is why an affine map (a linear map plus a translation) needs one extra coordinate before it can be written as a matrix.

Length

Send a vector to its length ∥v∥\lVert v\rVert. It satisfies T(0)=0T(0)=0 and T(2v)=2T(v)T(2v)=2T(v), but

T(−v)=∥−v∥=∥v∥≠−T(v).T(-v)=\lVert -v\rVert=\lVert v\rVert\neq -T(v).

Scaling by a negative number fails, so it is not linear.

The linear transformations matrices produce

For any matrix AA, the map

T(v)=AvT(v)=Av

is linear, because matrix multiplication distributes over addition and commutes with scaling:

A(v+w)=Av+Aw,A(cv)=cAv.A(v+w)=Av+Aw,\qquad A(cv)=cAv.

Conversely, in finite dimensions, every linear transformation comes from some matrix — once bases are chosen.

The shape of the matrix is fixed by the dimensions: a map from R3\mathbb R^3 to R2\mathbb R^2 corresponds to a 2×32\times3 matrix.

Knowing a basis is enough

This is the key structural fact of the lecture.

Let v1,…,vnv_1,\dots,v_n be a basis of the input space. Every input has a unique expansion

v=c1v1+⋯+cnvn.v=c_1v_1+\cdots+c_nv_n.

By linearity,

T(v)=c1T(v1)+⋯+cnT(vn).T(v)=c_1T(v_1)+\cdots+c_nT(v_n).

So knowing what TT does to the basis vectors determines what it does to every vector.

Conversely, those values are all that must be specified: nn basis vectors, each with mm output coordinates, give mnmn numbers — exactly an m×nm\times n matrix.

Coordinates come from a basis

In the standard basis, the entries of [324]\begin{bmatrix}3\\2\\4\end{bmatrix} are its coordinates, because the basis e1,e2,e3e_1,e_2,e_3 is implicit.

But any basis will do. For a basis v1,…,vnv_1,\dots,v_n, the coordinates of vv are the unique coefficients c1,…,cnc_1,\dots,c_n with

v=c1v1+⋯+cnvn.v=c_1v_1+\cdots+c_nv_n.

Change the basis and the coordinates change. The same vector has different coordinates; the same transformation has different matrices.

The rule for constructing the matrix

Let:

  • the input space Rn\mathbb R^n have basis v1,…,vnv_1,\dots,v_n;
  • the output space Rm\mathbb R^m have basis w1,…,wmw_1,\dots,w_m.

The jj-th column of AA is obtained as follows:

  1. Apply TT to the jj-th input basis vector, producing T(vj)T(v_j).
  2. Expand it in the output basis:
T(vj)=a1jw1+a2jw2+⋯+amjwm.T(v_j)=a_{1j}w_1+a_{2j}w_2+\cdots+a_{mj}w_m.
  1. The coefficients [a1j⋮amj]\begin{bmatrix}a_{1j}\\ \vdots\\ a_{mj}\end{bmatrix} form the jj-th column.

The resulting matrix satisfies: input coordinates multiplied by AA give output coordinates.

Why the j-th column is exactly that

Take the input coordinate vector (0,…,1,…,0)(0,\dots,1,\dots,0) with a one in position jj. The corresponding input vector is vjv_j. Multiplying by AA returns the jj-th column. By construction, that column is the output coordinate vector of T(vj)T(v_j). The two agree.

It holds for every basis vector, and by linearity it holds for every vector.

Example one: the same projection, two bases

Project the plane onto the 45∘45^\circ line.

In the eigenvector basis

Take

v1=12[11](along the line),v2=12[1−1](perpendicular).v_1=\frac{1}{\sqrt2}\begin{bmatrix}1\\1\end{bmatrix}\quad(\text{along the line}),\qquad v_2=\frac{1}{\sqrt2}\begin{bmatrix}1\\-1\end{bmatrix}\quad(\text{perpendicular}).

Use this basis for both input and output.

  • T(v1)=v1T(v_1)=v_1, since a vector along the line is unchanged;
  • T(v2)=0T(v_2)=0, since the perpendicular component is annihilated.

So

T(v1)=1⋅v1+0⋅v2,T(v2)=0⋅v1+0⋅v2,T(v_1)=1\cdot v_1+0\cdot v_2,\qquad T(v_2)=0\cdot v_1+0\cdot v_2,

and the matrix is

A=[1000].A=\begin{bmatrix}1&0\\0&0\end{bmatrix}.

Diagonal, with the eigenvalues 11 and 00 on the diagonal. The eigenvector basis is the good basis: it writes the transformation in its simplest form.

In the standard basis

Take e1=[10]e_1=\begin{bmatrix}1\\0\end{bmatrix} and e2=[01]e_2=\begin{bmatrix}0\\1\end{bmatrix} for both input and output.

The projection matrix onto the line through a=[11]a=\begin{bmatrix}1\\1\end{bmatrix} is

P=aaTaTa=12[11][11]=[12121212].P=\frac{aa^{\mathsf T}}{a^{\mathsf T}a} =\frac{1}{2}\begin{bmatrix}1\\1\end{bmatrix}\begin{bmatrix}1&1\end{bmatrix} =\begin{bmatrix}\frac12&\frac12\\[2pt]\frac12&\frac12\end{bmatrix}.

Check:

P[10]=[1212],P[01]=[1212].P\begin{bmatrix}1\\0\end{bmatrix} =\begin{bmatrix}\frac12\\[2pt]\frac12\end{bmatrix}, \qquad P\begin{bmatrix}0\\1\end{bmatrix} =\begin{bmatrix}\frac12\\[2pt]\frac12\end{bmatrix}.

Both standard basis vectors land on the line, as projection requires.

One transformation, two matrices: diag⁡(1,0)\operatorname{diag}(1,0) in the eigenvector basis, 12[1111]\frac12\begin{bmatrix}1&1\\1&1\end{bmatrix} in the standard basis. The matrix changes; the transformation does not.

Example two: differentiation is linear

Let the input space be polynomials of degree at most two,

p(x)=c1+c2x+c3x2,p(x)=c_1+c_2x+c_3x^2,

with basis 1,x,x21,x,x^2. Let the output space be polynomials of degree at most one, with basis 1,x1,x.

Differentiation gives

ddxp(x)=c2+2c3x.\frac{d}{dx}p(x)=c_2+2c_3x.

Following the rule:

  • T(1)=0T(1)=0, with output coordinates [00]\begin{bmatrix}0\\0\end{bmatrix};
  • T(x)=1T(x)=1, with output coordinates [10]\begin{bmatrix}1\\0\end{bmatrix};
  • T(x2)=2xT(x^2)=2x, with output coordinates [02]\begin{bmatrix}0\\2\end{bmatrix}.

So the matrix is

D=[010002].D=\begin{bmatrix}0&1&0\\0&0&2\end{bmatrix}.

Check:

D[c1c2c3]=[c22c3],D\begin{bmatrix}c_1\\c_2\\c_3\end{bmatrix} =\begin{bmatrix}c_2\\2c_3\end{bmatrix},

exactly the coordinates of the derivative.

Background: differentiation is efficient precisely because it is linear. Knowing the derivatives of a few basic functions lets you differentiate every linear combination. That is the structural reason the differentiation rules work.

Matrix operations as transformation operations

Once matrices are understood as coordinate representations, the operations acquire natural meanings:

  • Matrix multiplication is composition: apply BB, then AA, and the matrix is ABAB.
  • The inverse matrix is the inverse transformation: it sends outputs back to inputs.
  • Similarity M−1AMM^{-1}AM is a change of basis: the same transformation in a new basis.

The row-by-column rule for matrix multiplication is not an arbitrary convention. It is forced by the requirement that composition of transformations compose correctly in coordinates.

Common mistakes

  1. Treating a translation as linear. It moves the origin, violating T(0)=0T(0)=0.
  2. Believing the matrix is unique. A matrix depends on the basis; one transformation has many matrices.
  3. Specifying only the input basis. Constructing the matrix needs both bases; the output basis determines how columns are read off.
  4. Confusing a vector with its coordinates. A vector is a geometric object; coordinates are its coefficients in a chosen basis.

Takeaways

  • A linear transformation preserves addition and scaling, hence all linear combinations.
  • Linearity forces T(0)=0T(0)=0; translation and length are not linear.
  • Knowing the image of a basis determines the whole transformation.
  • With input and output bases chosen, column jj of the matrix is the coordinate vector of T(vj)T(v_j).
  • A good basis (the eigenvectors) diagonalizes the matrix; the standard basis is convenient but usually not simple.
  • Matrix multiplication, inversion, and similarity correspond to composition, inverse maps, and change of basis.

Check your understanding

1. Prove T(0)=0T(0)=0 from the definition, and explain why translation fails it.

Reference answer: Apply the scaling axiom T(cv)=c T(v)T(cv)=c\,T(v) with c=0c=0 and any vv: T(0)=0⋅T(v)=0T(0)=0\cdot T(v)=\mathbf{0}. Equivalently, T(0)=T(0+0)=T(0)+T(0)T(0)=T(0+0)=T(0)+T(0), and subtracting T(0)T(0) from both sides gives T(0)=0T(0)=0. Translation T(v)=v+v0T(v)=v+v_0 sends the zero vector to T(0)=v0T(0)=v_0; whenever v0≠0v_0\ne0 we get T(0)≠0T(0)\ne0, violating this necessary condition, so translation is not linear. This is exactly why affine maps need an extra coordinate to be written as matrices.

2. Why does "take the length" satisfy the rule for c=2c=2 but fail for c=−2c=-2?

Reference answer: T(v)=∥v∥T(v)=\lVert v\rVert gives T(cv)=∥cv∥=∣c∣ ∥v∥=∣c∣ T(v)T(cv)=\lVert cv\rVert=|c|\,\lVert v\rVert=|c|\,T(v). For c=2>0c=2>0 we have ∣c∣=c|c|=c, so T(2v)=2T(v)T(2v)=2T(v) holds. For c=−2<0c=-2<0 we get T(−2v)=2∥v∥T(-2v)=2\lVert v\rVert, whereas −2T(v)=−2∥v∥-2T(v)=-2\lVert v\rVert; these agree only when ∥v∥=0\lVert v\rVert=0. The failure is precisely the negative-scaling case: a linear map must track direction, while length forgets the sign. It also violates T(−v)=−T(v)T(-v)=-T(v).

3. Why does knowing the images of a basis determine TT on every vector?

Reference answer: Let v1,…,vnv_1,\dots,v_n be a basis, so every vv has a unique expansion v=∑jcjvjv=\sum_jc_jv_j. By linearity (splitting a finite sum and pulling out scalars),

T(v)=T(∑jcjvj)=∑jcjT(vj).T(v)=T\Big(\sum_jc_jv_j\Big)=\sum_jc_jT(v_j).

The coefficients cjc_j come from the coordinates of vv and the T(vj)T(v_j) are known, so T(v)T(v) is completely determined. This also explains why an m×nm\times n transformation needs only mnmn numbers — each basis vector contributes mm output coordinates.

4. For the 45∘45^\circ projection, what matrices arise in the eigenvector basis and in the standard basis, and why are they similar?

Reference answer: In the eigenvector basis v1=12(1,1)Tv_1=\frac1{\sqrt2}(1,1)^T, v2=12(1,−1)Tv_2=\frac1{\sqrt2}(1,-1)^T we have T(v1)=v1T(v_1)=v_1 and T(v2)=0T(v_2)=0, so the matrix is diag⁡(1,0)\operatorname{diag}(1,0). In the standard basis the projection matrix is

P=aaTaTa=12[1111].P=\frac{aa^{\mathsf T}}{a^{\mathsf T}a}=\frac12\begin{bmatrix}1&1\\1&1\end{bmatrix}.

They are similar because they are matrices of the same transformation in different bases, related by P=S−1diag⁡(1,0)SP=S^{-1}\operatorname{diag}(1,0)S with S=[v1 v2]S=[v_1\ v_2] the change-of-basis matrix. The similarity invariants agree: trace 11, determinant 00, eigenvalues 11 and 00.

5. What is the null space of the derivative matrix [010002]\begin{bmatrix}0&1&0\\0&0&2\end{bmatrix}, and what does it correspond to among polynomials?

Reference answer: Solve Dc=0Dc=0:

[010002][c1c2c3]=[c22c3]=[00],\begin{bmatrix}0&1&0\\0&0&2\end{bmatrix}\begin{bmatrix}c_1\\c_2\\c_3\end{bmatrix}=\begin{bmatrix}c_2\\2c_3\end{bmatrix}=\begin{bmatrix}0\\0\end{bmatrix},

so c2=0c_2=0, c3=0c_3=0, and c1c_1 is free. The null space is span⁡{(1,0,0)T}\operatorname{span}\{(1,0,0)^T\} of dimension 1=3−rank⁡D=3−21=3-\operatorname{rank}D=3-2. In polynomial space (c1,0,0)(c_1,0,0) corresponds to the constant polynomial p(x)=c1p(x)=c_1, whose derivative vanishes. The null space is therefore exactly the subspace of constant functions, matching the calculus fact that a function has zero derivative precisely when it is constant.

How this connects to the course

The previous lecture used SVD to diagonalize any matrix by choosing two orthonormal bases. This one returns to the more basic layer: transformations come before matrices, and matrices depend on bases. The remaining lectures build on this to discuss change of basis, image compression, and the course's overall synthesis.

来源