Updating the Covariances
The second update runs the same argument as the first, with a harder derivative. §11.2.3 spends three pages on matrix calculus to reach a formula you could have guessed — and the interesting part is what it does to page 1101’s decomposition once it is in place.
What you’ll learn
Section titled “What you’ll learn”- Theorem 11.2, Equation 11.30, and Example 11.4 reproduced: , , , rounding to the book’s , , .
- Which Equation 11.30 means. Written with the old means it gives , , ; with the just-updated means it gives the book’s numbers. The equation does not say, and the answer differs by a factor of on the third component.
- Equations 11.31–11.38: the proof, and the single cancellation that turns a messy stationarity condition into a weighted second moment. Measured to .
- Why no positive-definiteness repair is ever needed: measured over variances from random responsibilities, zero negative results.
- An invariant the book does not state, stronger than page 1104’s: after any M-step, the mixture’s variance equals the sample variance exactly — measured to over arbitrary responsibility matrices, and for every from to .
- So EM moves variance from between components to within them and back, with the total pinned — page 1101’s decomposition, in motion.
- And the singularity from the covariance side: as a component’s responsibility concentrates on one point, linearly in the leftover mass.
Intuition: the same weighted average, one moment up
Section titled “Intuition: the same weighted average, one moment up”Page 1104’s update was with . This one is — the same weights, applied to squared deviations instead of positions.
That is the whole of Theorem 11.2. The three pages of matrix calculus exist to show that the derivative of and the derivative of a quadratic form conspire to leave exactly this, with the inverse covariances cancelling as they did for the means.
flowchart TD A["d p / d Sigma_k, Equations 11.32 to 11.35"] A -->|"chain rule through 1/p(x_n)"| B["r_nk appears again
Equation 11.36b"] B --> C["N_k Sigma^-1 = Sigma^-1 (sum r (x-mu)(x-mu)') Sigma^-1
Equation 11.37a"] C -->|"cancel Sigma^-1 once from each side"| D["N_k I = (sum r (x-mu)(x-mu)') Sigma^-1
Equation 11.37b"] D --> E["Sigma_k = (1/N_k) sum_n r_nk (x_n-mu_k)(x_n-mu_k)'
Equation 11.30"] E --> F["a weighted second moment:
always positive semi-definite"]
§11.2.3 Theorem 11.2
Section titled “§11.2.3 Theorem 11.2”Theorem 11.2 (Updates of the GMM Covariances). The update of the covariance parameters of the GMM is given by
The proof needs two identities from Chapter 5 — Equation 5.101 for and Equation 5.106 for the derivative of the quadratic form — which combine into
and, after the responsibilities reappear and the derivative is set to zero,
Cancelling once from each side gives Equation 11.37b and then Equation 11.30. In one dimension, checked on the book’s numbers:
with a gap of .
Which mean does Equation 11.30 use?
Section titled “Which mean does Equation 11.30 use?”The equation writes with no superscript. It matters:
| with the old means | |||
| with the new means from Equation 11.20 | |||
| Example 11.4 as printed |
Always positive semi-definite, for free
Section titled “Always positive semi-definite, for free”Equation 11.30 is with — a non-negative combination of rank-one positive semi-definite matrices. So the result is positive semi-definite by construction, with no projection, clipping or eigenvalue repair.
Measured in one dimension over random responsibility matrices ( variances):
| value | |
|---|---|
| variances that came out negative | |
| smallest value seen |
Compare page 1005’s measurement, where eigh on a badly conditioned returned
negative eigenvalues of . Here the structure of the update guarantees what the numerics
there could not.
The invariant, one moment up
Section titled “The invariant, one moment up”Page 1104 measured . The same swap-the-summation argument, applied to second moments, gives more:
so the fitted mixture’s variance is the sample variance, exactly, after any M-step:
| value | |
|---|---|
| sample mean | |
| sample variance | |
| worst mixture mean sample mean, random | |
| worst mixture variance sample variance |
and it does not depend on :
| worst mean gap | worst variance gap | |
|---|---|---|
The singularity, from this side
Section titled “The singularity, from this side”As a component’s responsibility concentrates on a single point, Equation 11.30’s weighted second moment about that point collapses:
-
What does the three-page derivation of Theorem 11.2 actually produce?
The matrix calculus exists to show that the derivatives of the log-determinant and the quadratic form conspire so the inverse covariances cancel, exactly as they did for the means. What is left is a weighted second moment — checked against Equation 11.37b to 0.0.
pch.quizShowAnswer
B — The same responsibility-weighted average as the means, applied to squared deviations instead of positions — The matrix calculus exists to show that the derivatives of the log-determinant and the quadratic form conspire so the inverse covariances cancel, exactly as they did for the means. What is left is a weighted second moment — checked against Equation 11.37b to 0.0.
-
Equation 11.30 writes mu_k without saying whether it is the old or the new mean. Does it matter?
The book resolves it by ordering: Example 11.4 follows Example 11.3, and Figure 11.6(a) is Figure 11.5(b). Section 11.3's algorithm makes it explicit. Using stale means is not merely different but worse — 19.98 is the squared distance from 8 to data that lives below 5.
pch.quizShowAnswer
B — Yes — the old means give 1.83, 0.60 and 19.98; the new ones give the book's 0.14, 0.44 and 1.53 — The book resolves it by ordering: Example 11.4 follows Example 11.3, and Figure 11.6(a) is Figure 11.5(b). Section 11.3's algorithm makes it explicit. Using stale means is not merely different but worse — 19.98 is the squared distance from 8 to data that lives below 5.
-
Why does the covariance update never need a positive-definiteness repair?
Measured over 60,000 variances from random responsibility matrices: zero negatives. Compare page 1005, where eigh on a badly conditioned product returned 18 negative eigenvalues of 200 — there the numerics broke a mathematical guarantee; here the structure of the update supplies it.
pch.quizShowAnswer
B — It is a non-negative combination of rank-one positive semi-definite matrices, so the result is PSD by construction — Measured over 60,000 variances from random responsibility matrices: zero negatives. Compare page 1005, where eigh on a badly conditioned product returned 18 negative eigenvalues of 200 — there the numerics broke a mathematical guarantee; here the structure of the update supplies it.
-
After any M-step, what is the fitted mixture's variance?
So EM cannot make the model narrower or wider than the data overall. It can only decide how much of the spread is between components and how much is within them — page 1101's decomposition, with the total pinned. A collapsing component satisfies the invariant and is still useless.
pch.quizShowAnswer
B — Exactly the sample variance — measured to 3.6e-15 over 20,000 arbitrary responsibility matrices and every K from 2 to 10 — So EM cannot make the model narrower or wider than the data overall. It can only decide how much of the spread is between components and how much is within them — page 1101's decomposition, with the total pinned. A collapsing component satisfies the invariant and is still useless.
Exercises
Section titled “Exercises”Exercise 1 – Reproduce Example 11.4, and find which mean it used
Section titled “Exercise 1 – Reproduce Example 11.4, and find which mean it used”Exercise 2 – The cancellation in Equation 11.37
Section titled “Exercise 2 – The cancellation in Equation 11.37”Exercise 3 – A weighted second moment cannot be negative
Section titled “Exercise 3 – A weighted second moment cannot be negative”Exercise 4 – The invariant, one moment up
Section titled “Exercise 4 – The invariant, one moment up”Exercise 5 – Watch the within/between trade run
Section titled “Exercise 5 – Watch the within/between trade run”Recall card
Section titled “Recall card”- Theorem 11.2 is the mean update one moment higher: the same responsibility weights, applied to squared deviations instead of positions.
- Three pages of matrix calculus produce one cancellation — an inverse covariance removed from each side of the stationarity condition — and Equation 11.30 falls out. Checked to 2.2e-16.
- Equation 11.30 does not say which mean it uses, and it matters: the old means give 1.83, 0.60 and 19.98, the just-updated ones give the book’s 0.14, 0.44 and 1.53.
- The ordering is the answer. Section 11.3’s M-step updates the means first; using stale means measures spread about a point the component has already left.
- The update is a non-negative combination of squares, so it is positive semi-definite by construction — zero negatives in sixty thousand measured values, with no repair step anywhere.
- An invariant stronger than page 1104’s: after any M-step the mixture’s variance equals the sample variance exactly, measured to 3.6e-15 over twenty thousand arbitrary responsibility matrices.
- And it holds for every K from two to ten, because the argument is only the rows of the responsibility matrix summing to one.
- So EM cannot make the model wider or narrower than the data. It can only decide how much spread is between components and how much is within them.
- That is page 1101’s decomposition, in motion: on the book’s example the total drops to 8.336735 at the first M-step and never moves again, while within and between keep trading.
- It also reframes the collapse: a component shrinking to zero width pushes all its variance into the between term, satisfies the invariant, and is useless.
- From this side the singularity is linear: the variance falls in step with the responsibility mass the component has left elsewhere, reaching 2.5e-04 at a responsibility of 0.99999.
Next: Updating the Mixture Weights — §11.2.4, the shortest of the three, and the only one that needs a Lagrange multiplier.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading