Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Bowls, saddles and domes
Drop a marble into a bowl and it rolls to the bottom, whichever side it starts from. On a saddle (like a horse’s saddle or a crisp) it rolls off: uphill in one direction, downhill in another. On a dome it rolls away everywhere.
Certain symmetric matrices describe bowls. They’re called positive definite. Their “energy” is positive in every direction, so there’s exactly one lowest point.
Move the sliders and watch the shape change:
Training an AI means rolling a marble downhill on a very bumpy landscape. Near the bottom of a valley, the landscape looks like a bowl described by a positive definite matrix. That’s how we know we’ve found a minimum.
- 1. Where does a marble end up in a bowl?
- 2. Energy x² + y² at the point (3, 4)?
- 3. On a saddle, how many directions curve upwards (in 2D)?
Level 1: Beginner
★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.The quadratic form
For a symmetric matrix , the quadratic form is the number . In 2D, with :
For example, gives , which equals 5 at .
The definitions
| Name | Condition for all | Shape |
|---|---|---|
| positive definite (PD), | bowl | |
| positive semidefinite (PSD), | bowl or flat valley | |
| negative definite | dome | |
| indefinite | takes both signs | saddle |
- 1. Is diag(2, 3) positive definite?
- 2. diag(2, −1) is…
- 3. xᵀSx for S = [[2,1],[1,2]] and x = (1, −1)?
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Tests for positive definiteness
For a symmetric , the following are equivalent:
- for all ;
- all eigenvalues are positive (spectral theorem: );
- all leading principal minors are positive (Sylvester’s criterion). For 2×2: and ;
- for some with independent columns;
- a Cholesky factorization exists, with positive diagonal (A2.3-4).
For semi-definite, replace > with ≥. Sylvester’s criterion then needs all principal minors, not just the leading ones.
Example. : the minors are 4 and , both positive, so it’s PD. In contrast, has eigenvalues 3 and −1, so it’s indefinite.
Where PSD matrices come from
| Source | Why it’s PSD |
|---|---|
| Gram matrices | |
| Covariance matrices | |
| Kernel matrices | the definition of a valid kernel (B3) |
| Hessians at a minimum | second-order condition for a local minimum (A6) |
| Graph Laplacians | |
| Mass and inertia matrices of robots | kinetic energy (R4) |
Ellipsoids and Mahalanobis distance
For PD , the set is an ellipsoid. Its axes point along the eigenvectors, with lengths . The Mahalanobis distance measures how unusual a point is taking correlations into account. It’s the basis of uncertainty ellipses in robot localization, and of anomaly detection on telemetry (Practice Code 5).
- 1. [[4, 2], [2, 3]]: leading minors are 4 and…
- 2. The Gram matrix XᵀX is always…
- 3. Hessian [[2, 1], [1, 2]] at a critical point means…
Level 3: Advanced
★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.Why the tests are equivalent
For symmetric : ⟺ all ⟺ with having independent columns.
Proof. Write and . Then , which is positive for all iff every . If the , take . Conversely, whenever , which independence guarantees for . ∎
Closure properties
- If , then , and for . PSD matrices form a convex cone, the setting of semidefinite programming (A6.2).
- . That’s why adding “jitter” fixes numerically singular kernel matrices, and why ridge regression uses .
- for any (congruence). Covariances stay PSD under linear maps: .
- Hadamard products of PSD matrices are PSD (Schur, A2.2-6).
The Schur-complement test
⟺ and .
For example, iff . This test converts nonlinear matrix inequalities into linear ones (LMIs). That’s the key trick behind proving stability of robot controllers with Lyapunov functions, and behind robust control design (S2, S3).
Exercise 3.1: Prove that every PD matrix is invertible
If , then , so . The kernel is trivial, so is invertible. Also, is PD, with eigenvalues .
- 1. [[1, 1], [1, 1]] is…
- 2. PD + PSD is always…
- 3. [[4, 2], [2, c]] is PD exactly when c >…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Sampling and estimation with Gaussians
A Gaussian needs . To sample it, factor (Cholesky) and set with . This trick is used everywhere: Gaussian processes, VAEs’ reparameterization (H3), particle and unscented Kalman filters for robot state estimation (T1), and domain randomization in simulation (V1).
Keeping matrices PSD in learning systems
Models that predict covariances or kernels must output valid PSD matrices. Common parameterizations:
- predict a lower-triangular with a positive diagonal (via softplus or exp) and use ;
- predict eigenvalues through a positive function, and an orthogonal basis.
This shows up in learned uncertainty for robot perception, in heteroscedastic regression (I1), and in learned metrics for SLAM. In optimization, positive definite preconditioners (Adam’s diagonal, natural-gradient Fisher matrices, Shampoo) are what make second-order ideas practical (A6).
Certifying robot safety with PSD constraints
A Lyapunov function with proves that a linear system is stable if (Lyapunov, 1892). Searching for such a is a semidefinite program. Boyd et al. (1994) showed that a huge range of control problems can be written as such linear matrix inequalities and solved efficiently. Today they’re used to certify neural-network controllers (S6, M2).
References
- J. J. Sylvester (1852). “A demonstration of the theorem that every homogeneous quadratic polynomial is reducible by real orthogonal substitutions to the form of a sum of positive and negative squares.” Philosophical Magazine, 4.
- A. M. Lyapunov (1892). The General Problem of the Stability of Motion. (English translation: International Journal of Control, 1992.)
- P. C. Mahalanobis (1936). “On the generalised distance in statistics.” Proceedings of the National Institute of Sciences of India, 2.
- S. Boyd, L. El Ghaoui, E. Feron, V. Balakrishnan (1994). Linear Matrix Inequalities in System and Control Theory. SIAM.
- C. Rasmussen and C. Williams (2006). Gaussian Processes for Machine Learning. MIT Press. Appendix A.
- R. Bhatia (2007). Positive Definite Matrices. Princeton University Press.