第 04 章

A = LU:把消元写成一次分解

消元的每一步都是一个初等矩阵;把它们的逆按相反顺序乘回去,就得到 A = LU。L 里直接保存乘数,U 保存主元与消元结果。

A = LU: Writing Elimination as a Factorization

Each elimination step is an elementary matrix. Multiplying their inverses in reverse order gives A = LU: L stores the multipliers directly, U stores the pivots and the result.

首发于 2017.04.25中 / EN
系统课程linear-algebralu-factorizationeliminationpermutation
语言
字号
目录
篇内目录

从两个小公式开始

乘积的逆要反序

如果 AA、BB 都可逆,那么

(AB)−1=B−1A−1.(AB)^{-1}=B^{-1}A^{-1}.

验证:

(AB)(B−1A−1)=A(BB−1)A−1=AIA−1=I.(AB)(B^{-1}A^{-1})=A(BB^{-1})A^{-1}=AIA^{-1}=I.

顺序必须反过来,就像脱鞋和脱袜子:先脱鞋再脱袜,恢复时先穿袜再穿鞋。

转置与求逆可以交换顺序

从 A−1A=IA^{-1}A=I 出发,两边转置:

(A−1A)T=IT=I.(A^{-1}A)^T=I^T=I.

而 (A−1A)T=AT(A−1)T(A^{-1}A)^T=A^T(A^{-1})^T,所以

AT(A−1)T=I,A^T(A^{-1})^T=I,

即

(AT)−1=(A−1)T.(A^T)^{-1}=(A^{-1})^T.

对单个矩阵,转置和求逆谁先谁后都一样。

时间轴

时间内容
0:12第四讲:A=LUA=LU
2:04乘积与转置的逆
2:58乘积给出单位矩阵
4:23求逆公式
5:47(AT)−1=(A−1)T(A^T)^{-1}=(A^{-1})^T
9:53消元矩阵 EE
10:49LL 与 EE 的关系
12:01为什么叫 LL
14:57无行交换时的 A=LUA=LU
16:08按相反顺序求逆再相乘
17:23二阶例子
23:11三阶:乘数互不干扰
25:56把逆放到另一侧
29:24运算量
31:56消元的操作计数
36:31上界 n3n^3
39:23处理右端向量的代价
41:41行交换:PA=LUPA=LU
47:16n×nn\times n 排列矩阵的个数

核心:A=LUA=LU

假设消元过程中不需要交换行,主元都不为零。每一步消元都是一个初等矩阵 EijE_{ij},最后

E32E31E21A=U.E_{32}E_{31}E_{21}A=U.

把左边的乘积记作 EE,则 EA=UEA=U。要在右边得到 AA,两边左乘 E−1E^{-1}:

A=E−1U.A=E^{-1}U.

而 E−1E^{-1} 要按相反顺序拆开:

E−1=(E32E31E21)−1=E21−1E31−1E32−1.E^{-1}=(E_{32}E_{31}E_{21})^{-1} =E_{21}^{-1}E_{31}^{-1}E_{32}^{-1}.

这个乘积就是 LL:

A=LU.A=LU.

UU 是上三角,LL 是下三角,对角线上全是 11。

二阶例子

A=[2187].A=\begin{bmatrix}2&1\\8&7\end{bmatrix}.

第一个主元是 22,要用它消掉左下角的 88,乘数是 8/2=48/2=4。于是

E21=[10−41],U=[2103].E_{21}=\begin{bmatrix}1&0\\-4&1\end{bmatrix}, \qquad U=\begin{bmatrix}2&1\\0&3\end{bmatrix}.

验证 E21A=UE_{21}A=U:第二行是 −4-4 倍第一行加第二行,即 [8,7]−4[2,1]=[0,3][8,7]-4[2,1]=[0,3]。

LL 是 E21−1E_{21}^{-1},把减 4 改成加 4:

L=[1041].L=\begin{bmatrix}1&0\\4&1\end{bmatrix}.

于是

A=[1041][2103]=[2187].A=\begin{bmatrix}1&0\\4&1\end{bmatrix} \begin{bmatrix}2&1\\0&3\end{bmatrix} = \begin{bmatrix}2&1\\8&7\end{bmatrix}.

还可以再拆出主元:LDULDU

把 UU 的对角线提出来:

U=[2003][11/201]=DU′.U= \begin{bmatrix}2&0\\0&3\end{bmatrix} \begin{bmatrix}1&1/2\\0&1\end{bmatrix} =D U'.

于是 A=LDU′A=LDU',两侧都是单位三角矩阵,中间是对角矩阵。MATLAB 两种形式都可能给出;课程主要使用 LULU。

三阶情形:为什么 LL 里直接是乘数

三阶时,消元顺序是

E32E31E21A=U,E_{32}E_{31}E_{21}A=U,

所以

A=E21−1E31−1E32−1U=LU.A=E_{21}^{-1}E_{31}^{-1}E_{32}^{-1}U=LU.

关键问题是:为什么 LL 比 EE 好用?

取一个典型例子。设

E21=[100−210001],E31=I,E32=[1000100−51].E_{21}=\begin{bmatrix}1&0&0\\-2&1&0\\0&0&1\end{bmatrix}, \qquad E_{31}=I, \qquad E_{32}=\begin{bmatrix}1&0&0\\0&1&0\\0&-5&1\end{bmatrix}.

先算 E=E32E21E=E_{32}E_{21}:

E=[100−21010−51].E= \begin{bmatrix} 1&0&0\\ -2&1&0\\ 10&-5&1 \end{bmatrix}.

第三行第一列出现了 1010。它是怎么来的?先减去 22 倍第一行到第二行,再减去 55 倍新的第二行到第三行,于是有 5×2=105\times 2=10 倍第一行被间接减掉。

这不是错误,但让 EE 变得难读:乘数 22 和 55 混在了一起。

现在按相反顺序求逆:

L=E21−1E32−1=[100210001][100010051]=[100210051].L=E_{21}^{-1}E_{32}^{-1} = \begin{bmatrix}1&0&0\\2&1&0\\0&0&1\end{bmatrix} \begin{bmatrix}1&0&0\\0&1&0\\0&5&1\end{bmatrix} = \begin{bmatrix} 1&0&0\\ 2&1&0\\ 0&5&1 \end{bmatrix}.

乘数 22 和 55 原封不动地待在它们该在的位置,(3,1)(3,1) 位置是 00。

一句话总结: 不用交换行时,LL 就是一本乘数账本——消元时用了什么乘数,就直接写进 LL 的对应位置。

这也解释了为什么 LULU 是消元的正确记录方式:消元结束后,AA 的信息完整地保存在 LL 与 UU 中,原矩阵可以丢掉。

运算量:为什么是 n3/3n^3/3

消元有多贵?对 n×nn\times n 矩阵,第一步要更新大约 n2n^2 个数;第二步处理剩下的 (n−1)×(n−1)(n-1)\times(n-1),约 (n−1)2(n-1)^2 次;依此类推:

n2+(n−1)2+⋯+22+12.n^2+(n-1)^2+\cdots+2^2+1^2.

这个和的首项是 n2n^2,共有 nn 项,所以上界是 n3n^3;更精确地,

∑k=1nk2=n(n+1)(2n+1)6≈n33.\sum_{k=1}^{n}k^2=\frac{n(n+1)(2n+1)}{6}\approx\frac{n^3}{3}.

用积分看更直观:

∫0nx2 dx=n33.\int_0^n x^2\,dx=\frac{n^3}{3}.

所以消元是 O(n3)O(n^3)。右端向量 b\mathbf{b} 只有一列,处理它的代价是 O(n2)O(n^2)。

这带来一个实用结论:如果有很多个右端向量共享同一个 AA,先做一次 LULU 分解,再对每个 b\mathbf{b} 做 O(n2)O(n^2) 的前代与回代,比每次重新消元便宜得多。

需要交换行时:排列矩阵

如果主元位置出现 00,就要交换行。交换行由排列矩阵 PP 完成,它由单位矩阵重排行得到。

3×33\times 3 的排列矩阵一共有 3!=63!=6 个;4×44\times 4 有 4!=244!=24 个。它们构成一个群:

  • 两个排列矩阵相乘,结果仍是排列矩阵;
  • 每个排列矩阵都可逆,且逆仍是排列矩阵;
  • 特别地,P−1=PTP^{-1}=P^T。交换两行的操作再做一次就还原,所以很多 PP 是自己的逆;更一般地,逆等于转置。

有行交换时,分解写成

PA=LU.PA=LU.

先记录交换,再做消元;PP 把行的顺序整理好,LL 与 UU 的结构不变。

本讲结论

  • (AB)−1=B−1A−1(AB)^{-1}=B^{-1}A^{-1},顺序必须反过来。
  • (AT)−1=(A−1)T(A^T)^{-1}=(A^{-1})^T。
  • 无行交换时,E32E31E21A=UE_{32}E_{31}E_{21}A=U,因此 A=E21−1E31−1E32−1U=LUA=E_{21}^{-1}E_{31}^{-1}E_{32}^{-1}U=LU。
  • LL 的对角线为 11,非对角元就是消元乘数;UU 的对角线是主元。
  • A=LDU′A=LDU' 是把主元单独提出来的一种变体。
  • 消元的运算量约为 n3/3n^3/3,每个右端向量约 n2n^2。
  • 有行交换时写作 PA=LUPA=LU;n×nn\times n 排列矩阵共有 n!n! 个,且 P−1=PTP^{-1}=P^T。

理解检验

1. 验证 (AB)−1=B−1A−1(AB)^{-1}=B^{-1}A^{-1},并说明为什么顺序不能反过来。

参考答案:直接相乘验证:

(AB)(B−1A−1)=A(BB−1)A−1=AIA−1=I,(AB)(B^{-1}A^{-1})=A(BB^{-1})A^{-1}=AIA^{-1}=I,

所以 B−1A−1B^{-1}A^{-1} 确实是 ABAB 的逆。顺序不能换,因为

(AB)(A−1B−1)=A(BA−1)B−1,(AB)(A^{-1}B^{-1})=A(BA^{-1})B^{-1},

中间的 BA−1BA^{-1} 一般不等于 A−1BA^{-1}B,除非两个矩阵恰好可交换,结果就不再是 II。直观上像穿脱衣服:先穿袜子再穿鞋,脱的时候必须先脱鞋、再脱袜,顺序必须反过来。

2. 对 A=[2187]A=\begin{bmatrix}2&1\\8&7\end{bmatrix} 写出 E21E_{21}、UU、LL,并验证 A=LUA=LU。

参考答案:主元是 22,要消掉左下角的 88,乘数为 8/2=48/2=4,所以

E21=[10−41],U=[2103].E_{21}=\begin{bmatrix}1&0\\-4&1\end{bmatrix},\qquad U=\begin{bmatrix}2&1\\0&3\end{bmatrix}.

验证 E21A=UE_{21}A=U:第二行是 [8,7]−4[2,1]=[0,3][8,7]-4[2,1]=[0,3]。LL 是 E21−1E_{21}^{-1},把 −4-4 改成 +4+4:

L=[1041].L=\begin{bmatrix}1&0\\4&1\end{bmatrix}.

于是

LU=[1041][2103]=[2187]=A.LU=\begin{bmatrix}1&0\\4&1\end{bmatrix}\begin{bmatrix}2&1\\0&3\end{bmatrix} =\begin{bmatrix}2&1\\8&7\end{bmatrix}=A.

3. 在三阶例子中,EE 的 (3,1)(3,1) 元素为什么是 1010?为什么 LL 里是 00?

参考答案:E=E32E21E=E_{32}E_{21}。第二行经过 E21E_{21} 后变成原第二行减去 22 倍第一行;接着 E32E_{32} 让第三行减去 55 倍新的第二行,于是第三行一共减掉了 5×2=105\times2=10 倍第一行,(3,1)(3,1) 位置因此出现 −5⋅(−2)=10-5\cdot(-2)=10。也就是说,EE 把两步的乘数相乘混合在了一起。L=E21−1E32−1L=E_{21}^{-1}E_{32}^{-1} 则是按相反顺序作用:先补回 55 倍第二行,再补回 22 倍第一行。此时乘数 22 和 55 各归各位,(3,1)(3,1) 没有再被交叉乘上,保持为 00。这就是 LL 比 EE 好读的原因:它直接记录每一步用了什么乘数。

4. 用求和公式与积分分别解释 n3/3n^3/3 的来源。

参考答案:第一步消元要更新大约 n2n^2 个元素,第二步处理剩下的 (n−1)×(n−1)(n-1)\times(n-1) 块,约 (n−1)2(n-1)^2 次,依此类推,总运算量是

∑k=1nk2=n(n+1)(2n+1)6=n33+O(n2)≈n33.\sum_{k=1}^{n}k^2=\frac{n(n+1)(2n+1)}{6}=\frac{n^3}{3}+O(n^2)\approx\frac{n^3}{3}.

用积分看更直观:把这个和看成对 x2x^2 在 [0,n][0,n] 上的黎曼和,

∫0nx2 dx=n33,\int_0^n x^2\,dx=\frac{n^3}{3},

两者只差低阶项。所以消元是 O(n3)O(n^3),而处理一个右端向量只要 O(n2)O(n^2)——这正是「多个右端共享同一个 AA 时先做一次 LULU」更划算的原因。

5. 为什么排列矩阵的逆等于它的转置?

参考答案:排列矩阵 PP 是把单位矩阵的行重新排列得到的,所以它的每一列恰好是某个标准基向量 eσ(i)\mathbf{e}_{\sigma(i)}。两个不同的列是互相垂直的单位向量,自身点积为 11。因此

PTP=I,P^{T}P=I,

即 PTP^{T} 是 PP 的逆。直观上:PP 把行按某个置换搬动,PTP^{T} 把它搬回去;搬过去再搬回来就是原样,所以转置恰好完成了逆的操作。

与前后课的关系

LULU 把消元从一个过程变成了一个对象。下一讲转向转置、排列与向量空间 RnR^n,为四个基本子空间做准备。

Two small formulas first

The inverse of a product reverses the order

If AA and BB are invertible, then

(AB)−1=B−1A−1.(AB)^{-1}=B^{-1}A^{-1}.

Check:

(AB)(B−1A−1)=A(BB−1)A−1=AIA−1=I.(AB)(B^{-1}A^{-1})=A(BB^{-1})A^{-1}=AIA^{-1}=I.

The order must reverse, like shoes and socks: shoes come off first, so socks go on first when undoing the process.

Transpose and inverse commute

Start from A−1A=IA^{-1}A=I and transpose both sides:

(A−1A)T=IT=I.(A^{-1}A)^T=I^T=I.

Since (A−1A)T=AT(A−1)T(A^{-1}A)^T=A^T(A^{-1})^T,

AT(A−1)T=I,A^T(A^{-1})^T=I,

so

(AT)−1=(A−1)T.(A^T)^{-1}=(A^{-1})^T.

For a single matrix, transposing and inverting can be done in either order.

Timeline

TimeTopic
0:12Lecture four: A=LUA=LU
2:04The inverse of a product and of a transpose
2:58Products that give the identity
4:23The inverse formula
5:47(AT)−1=(A−1)T(A^T)^{-1}=(A^{-1})^T
9:53The elimination matrix EE
10:49How LL relates to EE
12:01Why the letter LL
14:57A=LUA=LU when no rows are exchanged
16:08Inverting the factors in reverse order
17:23The 2×22\times2 case
23:11The 3×33\times3 case: multipliers do not interfere
25:56Moving the inverses to the other side
29:24Counting the operations
31:56The cost of elimination
36:31The upper bound n3n^3
39:23The cost of handling b\mathbf{b}
41:41Row exchanges: PA=LUPA=LU
47:16How many n×nn\times n permutation matrices

The core: A=LUA=LU

Assume no row exchanges are needed and no pivot is zero. Each elimination step is an elementary matrix EijE_{ij}, and at the end

E32E31E21A=U.E_{32}E_{31}E_{21}A=U.

Call the product EE, so EA=UEA=U. To isolate AA, multiply on the left by E−1E^{-1}:

A=E−1U.A=E^{-1}U.

The inverse of a product reverses the order:

E−1=(E32E31E21)−1=E21−1E31−1E32−1.E^{-1}=(E_{32}E_{31}E_{21})^{-1} =E_{21}^{-1}E_{31}^{-1}E_{32}^{-1}.

That product is LL:

A=LU.A=LU.

UU is upper triangular; LL is lower triangular with ones on the diagonal.

A 2×22\times 2 example

A=[2187].A=\begin{bmatrix}2&1\\8&7\end{bmatrix}.

The first pivot is 22, and eliminating the 88 below it needs multiplier 8/2=48/2=4:

E21=[10−41],U=[2103].E_{21}=\begin{bmatrix}1&0\\-4&1\end{bmatrix}, \qquad U=\begin{bmatrix}2&1\\0&3\end{bmatrix}.

Check E21A=UE_{21}A=U: the second row is −4-4 times row one plus row two, [8,7]−4[2,1]=[0,3][8,7]-4[2,1]=[0,3].

LL is E21−1E_{21}^{-1}: change −4-4 to +4+4.

L=[1041],A=[1041][2103]=[2187].L=\begin{bmatrix}1&0\\4&1\end{bmatrix}, \qquad A=\begin{bmatrix}1&0\\4&1\end{bmatrix} \begin{bmatrix}2&1\\0&3\end{bmatrix} = \begin{bmatrix}2&1\\8&7\end{bmatrix}.

Pulling out the pivots: LDULDU

Factor the diagonal out of UU:

U=[2003][11/201]=DU′.U= \begin{bmatrix}2&0\\0&3\end{bmatrix} \begin{bmatrix}1&1/2\\0&1\end{bmatrix} =D U'.

Then A=LDU′A=LDU': unit triangular matrices on both sides and a diagonal matrix in the middle. MATLAB may return either form; the course mostly uses LULU.

The 3×33\times 3 case: why LL holds the multipliers directly

For three dimensions the elimination sequence is

E32E31E21A=U,E_{32}E_{31}E_{21}A=U,

so

A=E21−1E31−1E32−1U=LU.A=E_{21}^{-1}E_{31}^{-1}E_{32}^{-1}U=LU.

The real question is why LL is nicer than EE. Take a typical case:

E21=[100−210001],E31=I,E32=[1000100−51].E_{21}=\begin{bmatrix}1&0&0\\-2&1&0\\0&0&1\end{bmatrix}, \qquad E_{31}=I, \qquad E_{32}=\begin{bmatrix}1&0&0\\0&1&0\\0&-5&1\end{bmatrix}.

First compute E=E32E21E=E_{32}E_{21}:

E=[100−21010−51].E= \begin{bmatrix} 1&0&0\\ -2&1&0\\ 10&-5&1 \end{bmatrix}.

A 1010 appears in position (3,1)(3,1). Where from? Subtracting twice row one from row two, then five times the new row two from row three, throws 5×2=105\times 2=10 copies of row one into row three.

Nothing is wrong, but EE is hard to read: the multipliers 22 and 55 are entangled.

Now invert in reverse order:

L=E21−1E32−1=[100210001][100010051]=[100210051].L=E_{21}^{-1}E_{32}^{-1} = \begin{bmatrix}1&0&0\\2&1&0\\0&0&1\end{bmatrix} \begin{bmatrix}1&0&0\\0&1&0\\0&5&1\end{bmatrix} = \begin{bmatrix} 1&0&0\\ 2&1&0\\ 0&5&1 \end{bmatrix}.

The multipliers 22 and 55 sit exactly where they belong, and position (3,1)(3,1) is 00.

One-sentence summary: With no row exchanges, LL is a ledger of multipliers — whatever multiplier elimination used goes straight into the corresponding slot of LL.

This is why LULU is the right record of elimination: once it is done, all the information in AA lives in LL and UU, and the original matrix can be discarded.

Operation count: why n3/3n^3/3

How expensive is elimination? For an n×nn\times n matrix, the first step updates about n2n^2 entries. The second works on the remaining (n−1)×(n−1)(n-1)\times(n-1) block, about (n−1)2(n-1)^2 operations. Continuing:

n2+(n−1)2+⋯+22+12.n^2+(n-1)^2+\cdots+2^2+1^2.

There are nn terms, the largest is n2n^2, so the crude bound is n3n^3. More precisely,

∑k=1nk2=n(n+1)(2n+1)6≈n33.\sum_{k=1}^{n}k^2=\frac{n(n+1)(2n+1)}{6}\approx\frac{n^3}{3}.

The integral makes the constant visible:

∫0nx2 dx=n33.\int_0^n x^2\,dx=\frac{n^3}{3}.

So elimination is O(n3)O(n^3). The right-hand side b\mathbf{b} is a single column, so handling it costs O(n2)O(n^2).

That yields a practical rule: when many right-hand sides share the same AA, factor once into LULU, then run forward and back substitution at O(n2)O(n^2) per right-hand side. It is far cheaper than re-eliminating each time.

When rows must be exchanged: permutations

If a zero appears in a pivot position, rows must be swapped. A permutation matrix PP does the swapping; it is the identity with its rows rearranged.

There are 3!=63!=6 permutation matrices of size 33, and 4!=244!=24 of size 44. They form a group:

  • the product of two permutations is another permutation;
  • every permutation is invertible, and its inverse is also a permutation;
  • in fact, P−1=PTP^{-1}=P^T. Swapping two rows twice restores the original, so many PP are their own inverse; in general the inverse equals the transpose.

With row exchanges, the factorization becomes

PA=LU.PA=LU.

The permutation records the row order first, and LL and UU keep the same structure.

Takeaways

  • (AB)−1=B−1A−1(AB)^{-1}=B^{-1}A^{-1}: the order reverses.
  • (AT)−1=(A−1)T(A^T)^{-1}=(A^{-1})^T.
  • Without row exchanges, E32E31E21A=UE_{32}E_{31}E_{21}A=U, hence A=E21−1E31−1E32−1U=LUA=E_{21}^{-1}E_{31}^{-1}E_{32}^{-1}U=LU.
  • LL has ones on the diagonal and the multipliers off it; UU has the pivots on its diagonal.
  • A=LDU′A=LDU' separates the pivots from the unit triangular factors.
  • Elimination costs about n3/3n^3/3; each right-hand side costs about n2n^2.
  • With row exchanges, PA=LUPA=LU. There are n!n! permutation matrices, and P−1=PTP^{-1}=P^T.

Check your understanding

1. Verify (AB)−1=B−1A−1(AB)^{-1}=B^{-1}A^{-1} and explain why the order cannot be preserved.

Reference answer: Multiply directly:

(AB)(B−1A−1)=A(BB−1)A−1=AIA−1=I,(AB)(B^{-1}A^{-1})=A(BB^{-1})A^{-1}=AIA^{-1}=I,

so B−1A−1B^{-1}A^{-1} really is the inverse of ABAB. The order cannot be kept, because

(AB)(A−1B−1)=A(BA−1)B−1,(AB)(A^{-1}B^{-1})=A(BA^{-1})B^{-1},

and BA−1BA^{-1} is generally not A−1BA^{-1}B unless the two matrices commute; then the product is not II. The picture is getting dressed: socks first, then shoes, so undressing must remove the shoes first and the socks second — reversed order.

2. For A=[2187]A=\begin{bmatrix}2&1\\8&7\end{bmatrix}, write E21E_{21}, UU, and LL, and verify A=LUA=LU.

Reference answer: The first pivot is 22; clearing the 88 uses multiplier 8/2=48/2=4, so

E21=[10−41],U=[2103].E_{21}=\begin{bmatrix}1&0\\-4&1\end{bmatrix},\qquad U=\begin{bmatrix}2&1\\0&3\end{bmatrix}.

Check E21A=UE_{21}A=U: row two becomes [8,7]−4[2,1]=[0,3][8,7]-4[2,1]=[0,3]. Then L=E21−1L=E_{21}^{-1} changes −4-4 to +4+4:

L=[1041].L=\begin{bmatrix}1&0\\4&1\end{bmatrix}.

Indeed

LU=[1041][2103]=[2187]=A.LU=\begin{bmatrix}1&0\\4&1\end{bmatrix}\begin{bmatrix}2&1\\0&3\end{bmatrix} =\begin{bmatrix}2&1\\8&7\end{bmatrix}=A.

3. In the 3×33\times 3 example, why is the (3,1)(3,1) entry of EE equal to 1010, while the same entry of LL is 00?

Reference answer: Here E=E32E21E=E_{32}E_{21}. After E21E_{21}, row two is the original row two minus twice row one; then E32E_{32} subtracts five times that new row two from row three. So row three loses 5×2=105\times2=10 times row one in total, and the (3,1)(3,1) entry becomes −5⋅(−2)=10-5\cdot(-2)=10: the two multipliers have been multiplied together and mixed. In L=E21−1E32−1L=E_{21}^{-1}E_{32}^{-1} the operations are undone in reverse order — first restore five times row two, then twice row one — so the multipliers 22 and 55 sit in their own positions and (3,1)(3,1) is untouched at 00. That is why LL reads as a ledger of multipliers.

4. Explain the n3/3n^3/3 count both with the sum of squares and with an integral.

Reference answer: The first elimination step updates roughly n2n^2 entries; the next works on the remaining (n−1)×(n−1)(n-1)\times(n-1) block, about (n−1)2(n-1)^2 operations, and so on, giving

∑k=1nk2=n(n+1)(2n+1)6=n33+O(n2)≈n33.\sum_{k=1}^{n}k^2=\frac{n(n+1)(2n+1)}{6}=\frac{n^3}{3}+O(n^2)\approx\frac{n^3}{3}.

As an integral, the sum is a Riemann sum for x2x^2 on [0,n][0,n]:

∫0nx2 dx=n33,\int_0^n x^2\,dx=\frac{n^3}{3},

differing only in lower-order terms. Hence elimination costs O(n3)O(n^3), while each right-hand side costs O(n2)O(n^2) — which is why one LULU factorization pays off when many right-hand sides share AA.

5. Why is the inverse of a permutation matrix equal to its transpose?

Reference answer: A permutation matrix is the identity with its rows rearranged, so each column is a standard basis vector eσ(i)\mathbf{e}_{\sigma(i)}. Distinct columns are orthogonal unit vectors, and each has squared length 11. Therefore

PTP=I,P^{T}P=I,

so PTP^{T} is the inverse of PP. In words: PP moves rows by a permutation, and PTP^{T} moves them back; doing both is the identity.

How it connects

LULU turns elimination from a process into an object. The next lecture turns to transposes, permutations, and the vector space RnR^n, preparing the ground for the four fundamental subspaces.

来源