A positive definite matrix is the matrix version of a positive number. Covariance
matrices, kernel (Gram) matrices, the Hessian at a strict minimum, the Fisher information
and finite-element stiffness matrices all have this property. Three practical questions
follow. Is my matrix PD? (Is the loss a bowl here? Is my covariance valid?) How do I
compute with it cheaply? (Cholesky: solve, sample, log-determinant.) How do I compare
two such matrices? (The Loewner order: "the posterior uncertainty is smaller than the
prior uncertainty in every direction".) Gaussian processes and Kalman filters use all three
every time they condition on data, and the formula they use is a Schur complement.
Start with one number s. The function f(x)=sx2 is a parabola that opens upward
when s>0, is flat when s=0, and opens downward when s<0.
Now take a 2×2 diagonal matrix S=diag(λ1,λ2). Its
energy (also called the quadratic form) is x⊤Sx=λ1x12+λ2x22.
λ1,λ2>0: a bowl. The energy is positive in every direction.
λ1>0=λ2: a trough. The energy is zero along the x2-axis.
λ1>0>λ2: a saddle. Up in one direction, down in another.
A general symmetric S is the same picture, rotated. The spectral theorem gives
S=QΛQ⊤ with Q orthogonal (lesson 06). In the rotated coordinates y=Q⊤x:
x⊤Sx=y⊤Λy=i∑λiyi2.
So the signs of the eigenvalues decide everything. All positive: a bowl (PD). All
non-negative: a bowl or a trough (PSD). Mixed signs: a saddle (indefinite). For a PD
S, the level set {x:x⊤Sx=1} is an ellipse (an ellipsoid in n dimensions)
with axes along the eigenvectors qi and semi-axis lengths 1/λi.
Interactive figure: loading…
Change a,b,c in S=(abbc) and drag to rotate. The
surface is the energy x⊤Sx:aqua where it is positive,
magenta where it is negative. The arrows on the floor are the eigenvectors
q1 and q2. Go from bowl to trough to saddle and watch
λ2 cross 0. Then try (1221): positive entries, but a saddle.
Covariance. For a random vector x with covariance Σ and a fixed direction w,Var(w⊤x)=w⊤Σw. A variance cannot be negative, so covariance
matrices are PSD.
Quick check
A symmetric 2×2 matrix has eigenvalues 3 and 0, with eigenvectors q1 and q2. What does its energy surface x⊤Sx look like?
Why.
In eigen-coordinates the energy is 3y12+0⋅y22. It is 0 when y1=0, that is, along q2, and positive elsewhere. So S is PSD but not PD. A saddle needs a negative eigenvalue, and a flat plane needs both eigenvalues equal to 0.
By the picture above, S≻0 exactly when all eigenvalues are >0, and S⪰0
exactly when all eigenvalues are ≥0. We always assume S is symmetric. For a
non-symmetric M, the energy only sees the symmetric part:
x⊤Mx=x⊤21(M+M⊤)x.
Sample covariance is PSD. Let X∈RN×d hold N samples as rows,
let xˉ be the mean sample, and let Xc be the centered data (row j is
(xj−xˉ)⊤). The sample covariance is S=Xc⊤Xc/(N−1). For any
w∈Rd:
w⊤Sw=N−1∥Xcw∥2=N−11j=1∑N(w⊤(xj−xˉ))2≥0,
the sample variance of the data projected on w. It is zero exactly when Xcw=0:
every centered sample is orthogonal to w, so the data lie in a hyperplane (for example,
two features that are exact copies). The rows of Xc sum to zero, so
rankS≤N−1. With d≥N features, S is always singular.
For a symmetric S∈Rn×n, these five statements are equivalent:
Eigenvalues: all λi>0.
Energy:x⊤Sx>0 for every x=0.
Gram form:S=A⊤A for some matrix A with independent columns.
Leading minors:Dk=detS[1:k,1:k]>0 for k=1,…,n (the top-left
k×k blocks).
Pivots: elimination without row exchanges gives n pivots d1,…,dn, all >0.
Proof of 1 ⇔ 2 ⇔ 3.
(1 ⇒ 2) Write S=QΛQ⊤. For x=0,y=Q⊤x=0 because Q is
invertible. Then x⊤Sx=∑iλiyi2>0: every λi>0 and some
yi=0.
(2 ⇒ 1) Take a real unit eigenvector q with Sq=λq (it exists because S is
symmetric). Then 0<q⊤Sq=λq⊤q=λ.
(3 ⇒ 2) x⊤A⊤Ax=∥Ax∥2≥0. It is 0 only if Ax=0, and independent
columns force x=0.
(1 ⇒ 3) Set A=Λ1/2Q⊤. It is square and invertible, so its columns are
independent, and A⊤A=QΛ1/2Λ1/2Q⊤=S.
Why the determinant tests work, in one line. Elimination does not change the leading minors,
and at the end Dk=d1d2⋯dk. So the pivots are the ratios dk=Dk/Dk−1, and
"all Dk>0" is the same as "all dk>0". The proof below makes this precise and links
tests 4 and 5 to the energy.
Proof of 4 ⇔ 5, and how they join 1–3
Elimination without row exchanges subtracts a multiple of row j from a later row
i>j. If i≤k, this is a row operation inside the top-left k×k block, so
the block's determinant does not change. If i>k, the block does not change at all.
So every Dk stays the same during elimination.
At the end, the top-left k×k block of U is upper triangular with diagonal
d1,…,dk. So Dk=d1d2⋯dk, and dk=Dk/Dk−1 (with D0=1).
Hence all Dk>0 ⇔ all dk>0. (If all Dk>0, each pivot is a ratio of
positive numbers, so elimination never meets a zero pivot.)
(2 ⇒ 4) For x whose entries after position k are zero,
x⊤Sx=x1:k⊤S[1:k,1:k]x1:k. So each leading block is PD, its
eigenvalues are positive, and Dk, their product, is positive.
(5 ⇒ 2) With nonzero pivots, elimination gives S=L~U with L~ unit lower
triangular. Symmetry and the uniqueness of the LDU factorization give
U=DL~⊤ with D=diag(d1,…,dn), so S=L~DL~⊤. Then
x⊤Sx=∑jdj((L~⊤x)j)2>0 for x=0, because L~⊤
is invertible. ■
Tests 1–3 carry over to PSD with ≥: eigenvalues ≥0, energy ≥0, and S=A⊤A
for anyA (dependent columns give the zero eigenvalues). Test 4 does not carry over.
PD (≻0)
PSD (⪰0)
determinant test
the nleading minors are >0
all2n−1principal minors are ≥0
why the shortcut fails
—
a zero leading minor hides what comes after it
counterexample
—
T=(000−1): leading minors 0,0, but e2⊤Te2=−1
A principal minor is the determinant of the submatrix with the same set of row and column
indices, for example rows and columns {2} or {1,3}. The leading minors are only the
index sets {1},{1,2},….
Why the shortcut fails, step by step. For PD, each Dk>0 and the pivot dk=Dk/Dk−1
is defined. When some Dk−1=0, this ratio does not exist: the leading minors stop giving
information about the later pivots. In T,D1=0 already, so D2=0 says nothing about
the entry −1. The principal minor with index set {2} sees it directly. The 3×3
version is the minors 0, 0, 0 preset in the figure: leading minors 0,0,0, but the principal
minor M22=−1.
Test 5 is stated for PD: a singular PSD matrix has a zero pivot, and plain elimination then
stops (pivoted Cholesky handles this case).
Interactive figure: loading…
Edit an entry or pick a preset; all five tests run at once. For a PD matrix all five pass, and
otherwise all five fail: they are one property seen five ways. Note how the pivots, the Cholesky
radicands and the ratios Dk/Dk−1 are the same numbers. Try minors 0, 0, 0: the leading minors
look harmless, but a principal minor is negative, so the matrix is not even PSD.
Quick check
M=11011000−1 has leading minors D1=1,D2=0,D3=0. Is M positive semidefinite?
Why.
For PSD you must check all principal minors, not only the leading ones. The 1×1 principal minor M33=−1 shows e3⊤Me3=−1<0. (The eigenvalues are −1,0,2.) Once D2=0, the leading minors give no information about what comes after.
Entry (2,2):ℓ212+ℓ222=3, so ℓ222=3−1=2 and ℓ22=2.
So L=(2102), and the energy is a sum of squares:
x⊤Sx=∥L⊤x∥2=(2x1+x2)2+2x22.
Where it breaks. Do the same for the predict matrix (1221):ℓ11=1,ℓ21=2, and step 3 needs ℓ222=1−22=−3. No real number
squares to −3, so the factorization stops. The number under the square root, −3, is the second
pivot 1−2⋅2/1. The energy shows the same thing: x⊤Sx=(x1+2x2)2−3x22, which is
−3 at x=(−2,1).
The general algorithm. The same matching works for any n.
For i≥j, entry (i,j) of LL⊤ is Sij=∑k=1jLikLjk (terms with
k>j vanish because Ljk=0).
Diagonal (i=j):Ljj=Sjj−∑k<jLjk2.
Below the diagonal (i>j):Lij=(Sij−∑k<jLikLjk)/Ljj.
Go column by column, j=1,…,n. Each formula uses only entries of earlier
columns and the current Ljj.
Where PD is needed. From S=L~DL~⊤ (proof of the five tests), the matrix
L~D1/2 is lower triangular with diagonal dj, so by uniqueness it is L.The
number under the square root at step j (the radicand) is exactly the j-th pivot dj. If S
is not PD, some radicand is ≤0 and the algorithm stops. This is the standard practical PD
test: np.linalg.cholesky raises LinAlgError.
Uniqueness of the Cholesky factor
Let LL⊤=MM⊤ with both diagonals positive. Then
M−1L=M⊤L−⊤. The left side is lower triangular and the right side is upper
triangular, so both equal a diagonal matrix Δ with positive diagonal Lii/Mii.
Then L=MΔ, and MM⊤=MΔ2M⊤ gives Δ2=I, so Δ=I.
So for a PD matrix and a fixed order of the variables, the Cholesky factor with a positive
diagonal is unique. Other factors appear only with negative diagonal entries or reordered
variables. ■
Cost and uses. About n3/3 flops, half of LU's 2n3/3. After that, Sx=b costs
two triangular solves (Ly=b, then L⊤x=y), and logdetS=2∑jlogLjj.
Quick check
What is ℓ22 in the Cholesky factor of S=(9335)?
Why.
ℓ11=9=3, then ℓ21=3/3=1, then ℓ22=5−ℓ212=4=2. The answer 5 forgets to subtract ℓ212; the answer 4 forgets the square root; 5−3 subtracts S21 instead of ℓ212.
To draw x∼N(μ,S): draw z∼N(0,I) (independent standard normals)
and set x=μ+Lz.Why the covariance is S, in two steps.
E[Lz]=LE[z]=0, so Cov(Lz)=E[(Lz)(Lz)⊤].
(Lz)(Lz)⊤=Lzz⊤L⊤, and the expectation is linear, so
E[Lzz⊤L⊤]=LE[zz⊤]L⊤=LIL⊤=S.
A linear map of a Gaussian vector is Gaussian, and a Gaussian is fixed by its mean and covariance.
So x=μ+Lz has exactly the distribution N(μ,S). Step 2 never used that L is
triangular: anyM with MM⊤=S works, for example the symmetric square root
S1/2=QΛ1/2Q⊤. Cholesky is the cheapest such M. With N samples stored as
rows (Z is N×d):X=1μ⊤+ZL⊤.
Interactive figure: loading…
Switch between white noise z, μ + Lz, μ + √S z and both, and follow the
magenta point. The round cloud of white noise becomes the
aqua ellipse of S. With both, the blue cloud (Lz) and the
orange cloud (S1/2z) fill the same ellipse and have almost the same sample
covariance, but the same z lands in two different places. The violet arrows are
the columns of the map; for L the second one is vertical, because L is lower triangular.
Change ρ and drag μ.
The picture. Eliminate the first variable of S=(4223):
subtract 2/4 times row 1 from row 2. The entry that is left is 3−2⋅2/4=2. It is the
second pivot, and it is ℓ222 from the hand computation above. Do the same with whole
blocks instead of single entries, and the number 3−2⋅2/4 becomes a matrix.
Let M=(AB⊤BC) be symmetric, with A of size k×k and
invertible. The Schur complement of A in M is
M/A=C−B⊤A−1B.
Block elimination subtracts B⊤A−1 times the first block row from the second one:
the second block row becomes (0C−B⊤A−1B). So the pivots of
M are the pivots of A followed by the pivots of M/A, and detM=detA⋅det(M/A).
Theorem (Schur complement test).M≻0⟺A≻0 and C−B⊤A−1B≻0.
Proof.
Let E=(I0A−1BI). It is invertible (block triangular with
identity blocks). Multiply out:
E⊤(A00M/A)E=(AB⊤BB⊤A−1B+M/A)=M.
So for any x, with y=Ex:x⊤Mx=y⊤(A00M/A)y.
Because E is invertible, x=0⟺y=0.
Hence M≻0 exactly when the block-diagonal matrix is PD, that is, when A≻0 and
M/A≻0. (If M≻0, then A≻0 as a leading block, so A−1 exists.) ■
With A≻0, the same argument gives M⪰0⟺M/A⪰0.
Gaussian conditioning (the ML use). Split a Gaussian vector into two parts,
x=(xa,xb)∼N(μ,Σ) with
Σ=(ΣaaΣbaΣabΣbb). After you observe xa,
The conditional covariance is the Schur complement Σ/Σaa. It is PSD (by the test), and
it is ⪯Σbb, because the subtracted term ΣbaΣaa−1Σab is PSD:
observing xa never increases the uncertainty about xb in any direction.
Small check with Cholesky. Let Σ=(4223) and μ=0. With
L from above, x1=2z1 and x2=z1+2z2. Observing x1 fixes z1=x1/2.
What is left is x2=x1/2+2z2: mean x1/2=Σ21Σ11−1x1 and variance
2=3−2⋅2/4, the Schur complement. A Gaussian-process posterior is this formula with
Σaa=K+σ2I (training points) and xb = function values at test points.
Quick check
(x1,x2) is Gaussian with covariance Σ=(2112). What is Var(x2∣x1)?
Why.
The conditional variance is the Schur complement Σ22−Σ21Σ11−1Σ12=2−1⋅1/2=1.5. It is smaller than the prior variance 2, because x1 carries information about x2. The answer 1 subtracts Σ12 without dividing by Σ11; the answer 0.5 is the regression coefficient Σ21/Σ11.
For symmetric A,B:A⪯B means B−A⪰0, that is,
x⊤Ax≤x⊤Bx for every x. This is the Loewner order. The PSD matrices form a
convex cone: sums and non-negative multiples of PSD matrices are PSD. The cone is not a
subspace: if S=0 is PSD, then −S is not.
Theorem.⪯ is a partial order on symmetric matrices (reflexive, antisymmetric,
transitive), and it is not a total order: some pairs cannot be compared. Example:
A=diag(2,1) and B=diag(1,2).B−A=diag(−1,1) is
indefinite, so neither A⪯B nor B⪯A.
Proof that ⪯ is a partial order
Reflexive: A−A=0⪰0.
Antisymmetric: let B−A⪰0 and A−B⪰0. The symmetric matrix D=B−A
has all eigenvalues ≥0 and ≤0, so all are 0, and D=Q0Q⊤=0.
(Symmetry matters here: a 90° rotation R has x⊤Rx=0 for all x but R=0.)
Transitive: C−A=(C−B)+(B−A) is a sum of PSD matrices, so it is PSD.
Not total: the pair diag(2,1),diag(1,2) above. ■
Useful facts. If A⪯B, then C⊤AC⪯C⊤BC for any matrix C (apply
the energy to Cx), and λk(A)≤λk(B) for every k (Courant–Fischer, lesson 06).
For PD matrices, A⪯B implies B−1⪯A−1. Geometrically, for PD A⪯B
the ellipsoid {x:x⊤Bx≤1} lies inside {x:x⊤Ax≤1}. Ridge is the
simplest example: S⪯S+λI for every λ≥0.
The covariance picture. For a covariance it is more natural to draw
EM={x:x⊤M−1x≤1}={M1/2z:∥z∥≤1}, with half-axes λi
along the eigenvectors. Its width in a unit direction u is
max∥z∥≤1u⊤M1/2z=∥M1/2u∥=u⊤Mu, the standard deviation along u.
So A⪯B says: in every direction, EA is at most as wide as EB, that is,
EA⊆EB.
Interactive figure: loading…
Compare two ellipses EA (blue) and EB (orange). Turn the grey handle u:
the dashed lines touch each ellipse at its width u⊤Mu in that direction. For
diag(2,1) and diag(1,2), each is wider somewhere, so they are
incomparable. Switch to S vs S + 0.8I (ridge) or posterior vs prior (a Kalman update): one
ellipse sits inside the other, A⪯B. Drag the half-axis handles to make your own pair.
The generalized eigenproblem Sx=λBx
Linear discriminant analysis (LDA) maximizes w⊤SBw/w⊤SWw (between-class over
within-class scatter), and canonical correlation analysis (CCA) has the same form. The critical
points solve Sx=λBx with S symmetric and B≻0. Cholesky reduces this to a
symmetric problem of lesson 06:
Factor B=LL⊤ and put y=L⊤x, so x=L−⊤y.
Then Sx=λLL⊤x becomes L−1SL−⊤y=λy.
C=L−1SL−⊤ is symmetric, so the λi are real and the yi can be chosen
orthonormal. The xi=L−⊤yi are then B-orthonormal: xi⊤Bxj=δij.
Example: S=(2113),B=(4223) gives
λ=0.5 and 1.25. In SciPy: scipy.linalg.eigh(S, B).
Answers to section 1. (1) No. The eigenvalues are 3 and −1, and x=(1,−1)
gives x⊤Sx=−2. Cholesky stops with radicand −3. (2) No. e2⊤Te2=−1<0. The
leading-minor test works only for PD, with strict inequalities.
Leading minors: D1=4,D2=4⋅5−2⋅2=16,D3=detS=(detL)2=82=64.
The ratios 4/1,16/4,64/16 give the pivots back.
Energy as a sum of squares, from x⊤Sx=∥L⊤x∥2:x⊤Sx=(2x1+x2+x3)2+(2x2+x3)2+(2x3)2, which is >0 unless x=0.
Gram form: A=L⊤ is triangular with a nonzero diagonal, so its columns are independent.
Eigenvalues (numerically): 2.32,2.79,9.89. Check: sum =15=trS, product =64=detS.
Schur complement. Split after the first row and column: A=(4),B=(2,2),C=(5336). Then
M/A=C−B⊤A−1B=(5336)−41(4444)=(4225).
Its leading minors are 4 and 16, so it is PD, and 4>0: by the Schur test, S is PD. Its
Cholesky factor is (2102), the bottom-right block of L.
Sampling.x=Lz reads x1=2z1,x2=z1+2z2,x3=z1+z2+2z3. Two
entries by hand: Var(x2)=1+4=5 and Cov(x1,x2)=2⋅1=2. ✓
A failure. Change S33 from 6 to 1. Columns 1 and 2 of L do not change, and
the last radicand is 1−1−1=−1. Cholesky stops: the matrix is not PD. Indeed
D3=4⋅4⋅(−1)=−16<0. (Preset S₃₃ = 1 in the five-tests figure.)
Loewner.λminI⪯S⪯λmaxI, here 2.32I⪯S⪯9.89I.
But S and its diagonal DS=diag(4,5,6) are incomparable: DS−S=0 has
trace 0, so it has a positive and a negative eigenvalue (here −4.70,1.70,3).
Quick check
You store N white-noise samples as the rows of Z(N×3) and L is the Cholesky factor of the S above. Which data matrix has sample covariance close to S?
Why.
Row j of ZL⊤ is zj⊤L⊤=(Lzj)⊤, a sample of Lz, with covariance LL⊤=S. Row j of ZL is (L⊤zj)⊤, with covariance L⊤L, whose first row is (6,3,2), not (4,2,2).ZS has covariance S2.
NumPy checks the hand computations above. The notebook for this lesson has these cells and the exercises.
importnumpyasnpS=np.array([[4.,2.,2.],[2.,5.,3.],[2.,3.,6.]])L=np.linalg.cholesky(S)# lower triangular, positive diagonalprint(L)# [[2,0,0],[1,2,0],[1,1,2]]print(np.diag(L)**2)# the pivots: [4. 4. 4.]print(np.array([np.linalg.det(S[:k,:k])forkin(1,2,3)]).round(6))# [ 4. 16. 64.]print(np.linalg.eigvalsh(S).round(2))# [2.32 2.79 9.89]S_bad=S.copy()S_bad[2,2]=1.0try:np.linalg.cholesky(S_bad)exceptnp.linalg.LinAlgErroraserr:print("not PD:",err)# not PD: Matrix is not positive definiteT=np.array([[0.,0.],[0.,-1.]])# leading minors 0 and 0print(np.linalg.eigvalsh(T))# [-1. 0.]: not PSDA,B,C=S[:1,:1],S[:1,1:],S[1:,1:]# Schur complement of the 1x1 blockschur=C-B.T@np.linalg.solve(A,B)print(schur)# [[4. 2.] [2. 5.]]print(np.linalg.cholesky(schur))# [[2. 0.] [1. 2.]] = L[1:, 1:]D_S=np.diag(np.diag(S))print(np.linalg.eigvalsh(D_S-S).round(2))# [-4.7 1.7 3. ]: incomparablerng=np.random.default_rng(0)X=rng.multivariate_normal(np.zeros(3),S,size=200_000,method="cholesky")print(np.cov(X,rowvar=False).round(1))# close to S
Kernel and Gram matrices are PSD. If Kij=φ(xi)⊤φ(xj) for a feature map
φ, then K=ΦΦ⊤ with rows φ(xi)⊤, and
c⊤Kc=∥Φ⊤c∥2≥0. A function k(x,x′) is a valid kernel exactly when every
matrix [k(xi,xj)] is PSD; this is the condition of Mercer's theorem. Kernel ridge
regression, SVMs and Gaussian processes rely on it.
Gaussian processes. GP regression factors K+σ2I=LL⊤ once, solves with two
triangular solves, and gets logdet from diag(L). The posterior covariance at test
points is a Schur complement. When Cholesky fails, add jitter such as 10−6I.
Optimization. A PD Hessian at a stationary point means a strict local minimum.
Newton solvers try a Cholesky of the (shifted) Hessian. The Gauss–Newton matrix
J⊤J is PSD by the Gram test.
Data assimilation (ML for science). The error covariances B and R in 3D-Var or a
Kalman filter must be PD. The Kalman posterior covariance
Pa=Pf−PfH⊤(HPfH⊤+R)−1HPf⪯Pf is the Schur complement of the
joint covariance of state and observation: data never increase the uncertainty in any direction.
Correlated ensemble perturbations are drawn as μ+Lz.
Statistics. The Cramér–Rao bound is a Loewner inequality: an unbiased estimator has
Cov(θ^)⪰I(θ)−1, with I(θ) the Fisher information.
Simulation. Finite-element stiffness matrices (with boundary conditions) are
symmetric PD, solved by Cholesky or conjugate gradients (lesson 14).
"Positive entries mean PD."(1221) is indefinite;
(2−1−12) is PD.
"detS>0 means PD."diag(−1,−1) has determinant 1.
Leading minors ≥0 as a PSD test. Wrong (see T). Use all principal minors, or
eigenvalues ≥−tol.
Forgetting symmetry.M=(1031) has eigenvalues 1,1, but
x=(1,−1) gives x⊤Mx=−1. Test the symmetric part 21(M+M⊤).
Trusting random energy checks. They can find a negative direction but never prove
PD: a singular PSD matrix passes.
Sampling with the wrong factor.x=L⊤z has covariance L⊤L=S (in the
worked example, L⊤L has first row (6,3,2)). With samples as rows, use ZL⊤,
not ZL.
Checking only the Schur complement. The test needs both A≻0 and M/A≻0.
For M=(−1110) with A=(−1), the Schur complement is
0−1⋅1/(−1)=1>0, but M is indefinite (detM=−1), because A<0.
"A⪯B implies A2⪯B2." False. A=diag(2,0) and
B=(3111):B−A=(1111)⪰0, but
B2−A2=(6442) has determinant −4<0. (The square root
does keep the order.)
Is (1225) PD? Give its Cholesky factor and its energy as a sum of squares.AnswerYes: D1=1 and D2=5−4=1.L=(1201), so x⊤Sx=(x1+2x2)2+x22.
For which a is (1aa1) PD? PSD?AnswerThe eigenvalues are 1±a. PD for ∣a∣<1, PSD for ∣a∣≤1. (It is the correlation matrix of two variables with correlation a.)
Show that S≻0 implies S−1≻0.AnswerS−1 is symmetric with eigenvalues 1/λi>0. Or: for x=0 put y=S−1x=0; then x⊤S−1x=y⊤Sy>0.
You have N=5 samples of d=10 features. Can the sample covariance be PD?AnswerNo. rankS≤N−1=4<10, so S has at least 6 zero eigenvalues. Regularize (S+λI, shrinkage) before you invert it.
For which c is M=11012101c PD? Use the Schur complement of the top-left 2×2 block.AnswerA=(1112) is PD (D1=1,D2=1) and A−1=(2−1−11). With B=(0,1)⊤:B⊤A−1B=1, so M/A=c−1.M is PD exactly when c>1. (Check: detM=c−1.)
If A⪯B, must λmax(A)≤λmax(B)? Is the converse true?AnswerYes: λmax(A)=max∥x∥=1x⊤Ax≤max∥x∥=1x⊤Bx=λmax(B). The converse is false: diag(2,1) and diag(1,2) have the same eigenvalues but are incomparable.
Recall cardsAnswer in your head first, then reveal. Add the cards to your review deck to see them again just before you would forget.
Define a positive definite matrix.
A symmetric S with x⊤Sx>0 for every x=0. Equivalently, all eigenvalues of S are positive.
Name the three PD tests that use eigenvalues, the energy, or a factor A.
All λi>0;x⊤Sx>0 for x=0;S=A⊤A with A having independent columns.
Name the two PD tests that use determinants or elimination, and how they are linked.
All leading minors Dk>0; all pivots dk>0. They are linked by dk=Dk/Dk−1.
Why can leading minors ≥0 not prove that a matrix is PSD?
A zero leading minor hides the entries after it. diag(0,−1) has leading minors 0,0 but is not PSD; PSD needs all principal minors ≥0.
Compute the Cholesky factor of (4223).
L=(2102):ℓ11=4,ℓ21=2/2,ℓ22=3−1.
When does a Cholesky factorization S=LL⊤ (positive diagonal) exist, and is it unique?
Exactly when S is symmetric positive definite. Then it is unique. The radicands are the pivots, so a radicand ≤0 means "not PD".
Why does x=μ+Lz with z∼N(0,I) have covariance LL⊤?
Cov(Lz)=E[Lzz⊤L⊤]=LE[zz⊤]L⊤=LIL⊤.
Why is every Gram matrix K=ΦΦ⊤ PSD?
For any c,c⊤ΦΦ⊤c=∥Φ⊤c∥2≥0. (A covariance is PSD for the same reason: w⊤Σw=Var(w⊤x).)
State the Schur complement test for M=(AB⊤BC).
M≻0 exactly when A≻0 and C−B⊤A−1B≻0.
What does A⪯B mean in the Loewner order?
B−A is PSD: x⊤Ax≤x⊤Bx for every x. For covariances, the ellipse of A lies inside the ellipse of B.
"How do you check that a matrix is PD in practice?" — Try a Cholesky factorization: about
n3/3 flops, and it fails exactly when a pivot is ≤0. Use eigvalsh if you need the
margin λmin. Never use det alone.
"My GP kernel matrix fails Cholesky. Why, and what do you do?" — It is numerically
singular (close inputs, a very smooth kernel). Add jitter εI: this moves it
up in the Loewner order and lowers its condition number.
"Derive the conditional of a Gaussian." — Block-eliminate the covariance: the conditional
mean is μb+ΣbaΣaa−1(xa−μa) and the conditional covariance is the Schur
complement Σbb−ΣbaΣaa−1Σab.
"Is the sum of two PD matrices PD? The product?" — The sum, yes. The product AB is
usually not symmetric, but its eigenvalues are real and positive: AB is similar to
A1/2BA1/2≻0.
Open on YouTube · the player loads from youtube-nocookie.com when you press playOpen on YouTube · the player loads from youtube-nocookie.com when you press playOpen on YouTube · the player loads from youtube-nocookie.com when you press play
Rasmussen and Williams, Gaussian Processes for Machine Learning,
free PDF: §2.2 and appendix A.2 (Gaussian conditioning, the Schur complement in GP regression).
Code along in Colab
Runs in your browser with nothing to install. The notebook repeats the key demos and has exercises with checks; solutions are inside, folded.