第 27 章
正定矩阵与极小值:四个判据与一个碗
正定矩阵把主元、行列式、特征值与二次型串在一起;它的几何意义是碗形曲面,分析意义是多元函数的严格极小点。
Positive Definite Matrices and Minima: Four Tests, One Bowl
Positive definiteness ties pivots, determinants, eigenvalues, and quadratic forms together; geometrically it is a bowl, and analytically it is the second-order condition for a strict minimum.
篇内目录
- Why this lecture is a hinge
- Timeline
- A two-by-two example
- Three regimes
- The quadratic form is the definition
- Completing the square
- Completing the square is elimination
- From calculus to matrices: the second-order condition
- The picture
- A three-by-three example
- Leading minors
- Pivots
- Eigenvalues
- Quadratic form and geometry
- The principal axis theorem
- Common mistakes
- Takeaways
- Check your understanding
- How this connects to the course
这一讲为什么重要
正定矩阵不是一个新的计算技巧,而是整门课的汇合点。判断一个对称矩阵是否正定,可以用四套完全不同的语言:
- 特征值:全部大于零;
- 行列式:所有左上角顺序主子式都大于零;
- 主元:消元后所有主元大于零;
- 二次型:对任意非零向量 ,都有 。
这一讲的核心任务,是说明这四个判据为什么等价,以及它们共同描述的那个几何对象——一个开口向上的碗。
一句话总结: 正定矩阵是「二次型恒正」的矩阵,而主元、行列式、特征值都是同一件事的不同投影。
时间轴
| 时间 | 内容 |
|---|---|
| 0:05 | 正定矩阵与二次型:这一讲的主线 |
| 1:45 | 二阶矩阵:从行列式与主元开始 |
| 5:28 | 行列式为正但仍有例外情形需要检查 |
| 6:37 | 半正定:出现零特征值 |
| 8:32 | 二次型 的值 |
| 10:19 | 配方:把二次型写成平方和 |
| 12:15 | 不知道特征值也能判断正定性 |
| 16:49 | 图像:碗形、鞍形与谷形 |
| 19:24 | 二阶判据: 且 |
| 22:25 | 等高线与主轴方向 |
| 24:16 | 极值的必要条件:一阶导数为零 |
| 26:20 | 二阶导矩阵(Hessian) |
| 32:30 | 主轴与特征值:同一组方向 |
| 35:24 | Hessian 与泰勒展开的二次项 |
| 39:22 | 三阶例子:行列式与主元的计算 |
| 44:42 | 碗形、鞍形与橄榄球形的判别 |
| 48:20 | 三个不同特征值时的几何形状 |
从一个二阶例子开始
考虑对称矩阵
左上角一阶主子式是 ,所以只需要看二阶行列式:
三种临界状态
| 的取值 | 行列式 | 特征值 | 判定 |
|---|---|---|---|
| 半正定 | |||
| 一正一负 | 不定 | ||
| 两个正数 | 正定 |
当 时,第二行是第一行的 倍,矩阵秩为 ,只有一个主元 。特征值由迹与行列式确定:,,所以是 与 。
当 时,取 :
二次型在某个方向上取负值,矩阵不可能正定。图形上,这是鞍点:沿某些方向上升,沿另一些方向下降。
当 时,行列式为 ,迹为 。两个特征值乘积为正、和为正,因此只能同为正。
二次型:正定性的定义
把 代进去:
这是一个纯二次函数:没有常数项,没有一次项,也没有更高次项。矩阵的对角元给出平方项,非对角元成对出现,贡献交叉项。
定义:若对一切 都有 ,则称 正定。
配方法:把二次型写成平方和
对 的例子:
右边是两个平方的非负组合,所以恒大于等于零;只有 且 ,也就是 时才取零。这正是正定。
如果 :
只剩下一个平方,沿直线 全为零,所以只是半正定。
如果 :
出现负系数,沿 、 的方向为负。
配方就是消元
上面的系数不是巧合:
- 括号外的 是第一个主元;
- 括号内的 是消元乘数;
- 最后的 是第二个主元。
对 做消元:第二行减去第一行的 倍,得到 。主元是 和 ,乘数是 。
所以配方法就是高斯消元:主元变成平方项外的系数,乘数变成平方项内的系数。主元全为正,等价于二次型能写成系数全正的平方和。
这条联系可以推广到 阶:正定 存在分解 且 的对角元(主元)全正。
从微积分到矩阵:极小值的二阶条件
一元微积分里, 是极小点需要两个条件:一阶导数为零,二阶导数为正。二阶导数描述曲率方向。
多元情形完全平行。设 在原点附近光滑:
- 一阶条件:所有偏导数为零,即梯度为零;
- 二阶条件:海森矩阵(二阶偏导矩阵)正定。
海森矩阵是
它总是对称的,因为混合偏导与求导顺序无关:。
对 ,海森矩阵正是 。一阶偏导在原点为零,海森矩阵正定,所以原点是严格极小点。
二维情形可以写成熟悉的形式:
第二个条件就是海森矩阵的行列式为正。它保证两个特征值同号,而 保证同为正。
几何图像
- 正定:图形是开口向上的碗(椭圆抛物面),原点是唯一最低点。水平截面 是椭圆。
- 不定:图形是鞍面,某些方向上升、某些方向下降。水平截面是双曲线。
- 半正定:某个方向上平坦,碗底是一条线或一个平面,极值不唯一。
三阶例子:把结论推广
取
顺序主子式
三个都为正,所以正定。
主元
消元后主元为
它们两两相乘分别给出顺序主子式:,。
特征值
不用真的解三次方程,也能知道三个特征值都为正;它们的精确值是
检验:和为 ,等于迹;积为 ,等于行列式。
二次型与几何
水平截面 是一个椭球,有三个主轴,方向由特征向量给出。
主轴定理
对对称矩阵,
其中 的列是标准正交特征向量, 是特征值对角阵。这叫主轴定理,也是对称矩阵的对角化。
几何含义:
- 特征向量给出椭球的主轴方向;
- 特征值决定主轴的长度。
更精确地说,对水平集 ,沿第 个特征向量方向的半轴长度为
特征值越大,该方向越「陡」,椭球在该方向越短;反之亦然。
补充:课堂上说的是「长度由 决定」,严格写出来应是半轴 。推导方式是把 代入,二次型化为 ,于是 的最大值为 。
常见误区
- 只看对角元。对角元全正不足以保证正定。 的对角元都是正的,行列式却是负的。
- 半正定当成正定。行列式为零时,某个方向上的二次型为零,极小点不唯一。
- 忘记对称性。正定性只对对称矩阵定义;非对称矩阵的 只取决于其对称部分。
- 以为四个判据要分别验证。它们是等价的,任选一个最方便的计算路径即可。
本讲结论
- 正定矩阵的四个判据——特征值、顺序主子式、主元、二次型——互相等价。
- 配方法就是消元:主元在平方项外,乘数在平方项内。
- 海森矩阵正定是多元函数严格极小的二阶条件,是一元情形「二阶导数为正」的推广。
- 几何上,正定对应碗形与椭球,不定对应鞍面与双曲线。
- 对称矩阵可以写成 ,特征向量给方向,特征值给尺度。
理解检验
1. 为什么 只是半正定?它的零空间是什么?
参考答案:二阶行列式为 ,而一阶主子式 ,所以矩阵不满足「顺序主子式全正」,但二次型不会取负值。配方得 ,对一切 非负,且沿直线 恒为零,因此只是半正定。零空间就是这条直线:解 得 ,所以 。矩阵秩为 ,特征值为 与 。
2. 不用算特征值,如何判断 的两个特征值都为正?
参考答案:检查顺序主子式。一阶是 ;二阶是 。两个顺序主子式都为正,矩阵正定,因此两个特征值都为正。也可以看主元:第一主元 ,第二主元 ,都为正。两种判据都与「特征值全正」等价,不必解二次方程。
3. 配方法与消元中的主元、乘数如何一一对应?
参考答案:以 为例。括号外的系数 是第一个主元;括号内的 是消元乘数;最后一项的系数 是第二个主元。消元过程是:第二行减去第一行的 倍,得到 ,主元正是 与 。一般地,配方就是把 写成 ,其中 是第 个主元,线性式里的系数是消元乘数。这正是 分解。
4. 对 ,原点是极小、极大还是鞍点?
参考答案:先看梯度,,在原点为零,所以原点是驻点。海森矩阵是
一阶主子式 ,但行列式 ,所以 不定。特征值为 与 ,一正一负。沿方向 二次型为 ,沿方向 为 ,因此原点是鞍点,不是极值点。
5. 水平集 的半轴长度为什么是 而不是 ?
参考答案:令 ,其中 的列是标准正交特征向量。因为 ,有
水平集化为 ,这是 坐标下的椭球,第 个半轴满足 ,即 。又因为 是正交矩阵,变换 保持长度,所以 坐标下的半轴长度同样是 。 量纲不对:二次型是长度的平方,特征值要开方才能对应长度。
与前后课程的关系
上一讲用特征值分解处理了对称矩阵;这一讲把对称、正定、二次型与极小值连成一体。下一讲先从正定矩阵的两个运算性质(逆与和)与最小二乘中的 收尾,再转入相似矩阵与 Jordan 形。
Why this lecture is a hinge
Positive definiteness is not a new computational trick. It is where the whole course meets. For a symmetric matrix, four different languages answer the same question:
- Eigenvalues: all are positive.
- Determinants: every leading principal minor is positive.
- Pivots: every pivot after elimination is positive.
- Quadratic form: for every nonzero .
The lecture's job is to explain why these are equivalent, and what geometric object they describe: an upward-opening bowl.
One-sentence summary: A positive definite matrix is one whose quadratic form is always positive, and pivots, determinants, and eigenvalues are three projections of that single fact.
Timeline
| Time | Topic |
|---|---|
| 0:05 | Positive definite matrices and quadratic forms |
| 1:45 | 2 by 2 matrices, determinants and pivots |
| 5:28 | A positive determinant is not enough |
| 6:37 | Positive semidefinite, where an eigenvalue is zero |
| 8:32 | Values of the quadratic form |
| 10:19 | Completing squares into a sum of squares |
| 12:15 | Deciding definiteness without eigenvalues |
| 16:49 | The picture: a bowl, a saddle, a trough |
| 19:24 | The 2 by 2 test: and |
| 22:25 | Level curves and principal axes |
| 24:16 | A necessary condition: first derivatives vanish |
| 26:20 | The second derivative matrix, the Hessian |
| 32:30 | Principal axes and eigenvalues are the same directions |
| 35:24 | The Hessian and the quadratic Taylor term |
| 39:22 | A 3 by 3 example: determinant and pivots |
| 44:42 | Telling a bowl from a saddle and a football |
| 48:20 | The shape when the three eigenvalues are distinct |
A two-by-two example
Take the symmetric matrix
The first leading minor is , so only the full determinant matters:
Three regimes
| Determinant | Eigenvalues | Verdict | |
|---|---|---|---|
| positive semidefinite | |||
| one positive, one negative | indefinite | ||
| both positive | positive definite |
At the second row is three times the first, the rank is one, and there is only one pivot, . The trace is and the determinant is , so the eigenvalues are and .
At , choose :
A quadratic form that goes negative in some direction rules out positive definiteness. Geometrically this is a saddle: rising along some directions, falling along others.
At , the determinant is and the trace is . A positive product and a positive sum force both eigenvalues positive.
The quadratic form is the definition
Write :
This is purely quadratic: no constant, no linear terms, no higher powers. Diagonal entries produce the squares; off-diagonal entries appear in pairs and produce the cross term.
Definition: is positive definite if for every .
Completing the square
For :
The right side is a sum of nonnegative squares, zero only when and , that is, only at the origin. Hence positive definite.
For :
One square remains, and it vanishes along the whole line . That is positive semidefinite, not definite.
For :
A negative coefficient appears, so the form is negative along , .
Completing the square is elimination
The coefficients are not accidental:
- the outer is the first pivot;
- the inner is the elimination multiplier;
- the final is the second pivot.
Eliminating on means subtracting three times row one from row two, giving . The pivots are and ; the multiplier is .
So completing the square is Gaussian elimination. Positive pivots mean the quadratic form can be written as a sum of squares with positive coefficients. In general, positive definiteness is equivalent to a factorization with every diagonal entry of positive.
From calculus to matrices: the second-order condition
In one-variable calculus, a minimum needs two conditions: the first derivative vanishes, and the second derivative is positive. The second derivative measures the curvature.
The multivariable statement is exactly parallel. For a smooth :
- First order: every partial derivative vanishes; the gradient is zero.
- Second order: the Hessian matrix of second partials is positive definite.
It is always symmetric, because mixed partials do not depend on the order of differentiation: .
For , the Hessian is exactly . The gradient vanishes at the origin and the Hessian is positive definite, so the origin is a strict minimum.
In two variables this becomes the familiar test
The second inequality is the determinant of the Hessian. It forces the two eigenvalues to share a sign, and forces that sign to be positive.
The picture
- Positive definite: an upward bowl (elliptic paraboloid) with a unique lowest point at the origin. The level set is an ellipse.
- Indefinite: a saddle, rising in some directions and falling in others. The level set is a hyperbola.
- Semidefinite: flat in some direction; the bottom is a line or plane, so the minimum is not unique.
A three-by-three example
Leading minors
All positive, so the matrix is positive definite.
Pivots
Elimination gives
Their partial products reproduce the leading minors: and .
Eigenvalues
No cubic equation is needed to know they are all positive, but their exact values are
Check: the sum is , the trace; the product is , the determinant.
Quadratic form and geometry
The level set is an ellipsoid with three principal axes, whose directions come from the eigenvectors.
The principal axis theorem
For a symmetric matrix,
where the columns of are orthonormal eigenvectors and is diagonal. This is the principal axis theorem, and it is diagonalization for symmetric matrices.
Geometrically:
- eigenvectors give the directions of the ellipsoid's principal axes;
- eigenvalues set their lengths.
More precisely, for the level set , the semi-axis along the -th eigenvector has length
A larger eigenvalue means a steeper direction, hence a shorter semi-axis.
Background: the lecture phrases this as "lengths, or half-lengths, or one over the eigenvalues". The exact statement follows by substituting , which turns the form into ; the largest is .
Common mistakes
- Checking only the diagonal. Positive diagonal entries do not imply positive definiteness: has positive diagonal and negative determinant.
- Confusing semidefinite with definite. A zero determinant means the form vanishes along some direction, so the minimum is not unique.
- Forgetting symmetry. Positive definiteness is defined for symmetric matrices; the form of a non-symmetric matrix depends only on its symmetric part.
- Treating the four tests as independent work. They are equivalent; use whichever is cheapest to compute.
Takeaways
- The four tests — eigenvalues, leading minors, pivots, quadratic form — are equivalent.
- Completing the square is elimination: pivots outside, multipliers inside.
- A positive definite Hessian is the multivariable version of "second derivative positive", and it certifies a strict minimum.
- Geometrically, positive definite means a bowl and an ellipsoid; indefinite means a saddle and a hyperbola.
- Symmetric matrices factor as ; eigenvectors give directions, eigenvalues give scale.
Check your understanding
1. Why is only semidefinite? What is its null space?
Reference answer: The determinant is , while the leading minor is , so the matrix fails "all leading minors positive" but never makes the quadratic form negative. Completing the square gives , which is nonnegative everywhere and equals zero along the line ; hence it is only semidefinite. The null space is that line: gives , so . The rank is and the eigenvalues are and .
2. Without computing eigenvalues, how do you know both eigenvalues of are positive?
Reference answer: Check the leading principal minors. The first is ; the second is . Both are positive, so the matrix is positive definite and both eigenvalues are positive. Equivalently, the pivots are and , both positive. Each criterion is equivalent to "all eigenvalues positive", so no quadratic formula is needed.
3. How do the pivots and multipliers of elimination correspond to the coefficients in the completed square?
Reference answer: Take . The coefficient outside the bracket, , is the first pivot; the inside is the elimination multiplier; the final coefficient is the second pivot. Elimination subtracts times row 1 from row 2, producing , whose pivots are exactly and . In general, completing the square writes , where is the -th pivot and the coefficients of the linear forms are the multipliers — precisely the factorization.
4. For , is the origin a minimum, a maximum, or a saddle?
Reference answer: The gradient is , which vanishes at the origin, so the origin is a critical point. The Hessian is
Its leading minor , but its determinant , so is indefinite; the eigenvalues are and . Along the quadratic form is , while along it is . The origin is therefore a saddle point, not an extremum.
5. Why is the semi-axis of equal to rather than ?
Reference answer: Set , where the columns of are orthonormal eigenvectors. Since ,
The level set becomes , an ellipsoid in -coordinates whose -th semi-axis satisfies , i.e. . Because is orthogonal, preserves lengths, so the semi-axis in -coordinates has the same length . The expression has the wrong dimension: the quadratic form is a squared length, so its eigenvalues must be square-rooted to yield a length.
How this connects to the course
The previous lecture diagonalized symmetric matrices. This one unifies symmetry, positive definiteness, quadratic forms, and minima. The next lecture first finishes positive definiteness with inverses, sums, and the least-squares matrix , then turns to similar matrices and Jordan form.