In EM for a Gaussian mixture with weights πk, means μk and covariances Σk, how do you derive the M-step updates for πk, μk and Σk from the expected complete-data log-likelihood?

Unsupervised learning, Gaussian mixtures
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can maximise Q(θ) using responsibilities, with a Lagrange multiplier for the weights.

Key idea

With responsibilities rik=P(zi=k∣xi,θold) fixed from the E-step, the M-step maximises Q=∑i∑krik[ln⁡πk+ln⁡N(xi∣μk,Σk)]. Each parameter group separates and gives a weighted version of the usual Gaussian maximum-likelihood estimate.

Steps

  1. Start from the complete-data log-likelihood ∑iln⁡πziN(xi∣μzi,Σzi). Replace the unknown indicator 1[zi=k] by its expectation rik to get Q above.
  2. Weights: maximise ∑i,krikln⁡πk subject to ∑kπk=1. The Lagrangian is ∑i,krikln⁡πk+λ(1−∑kπk). Setting the derivative to zero gives Nk/πk=λ, where Nk=∑irik. Summing over k gives λ=n, so πk=Nk/n.
  3. Means: the μk part of Q is −12∑irik(xi−μk)⊤Σk−1(xi−μk). Its gradient is Σk−1∑irik(xi−μk). Setting it to zero gives μk=1Nk∑irikxi.
  4. Covariances: the Σk part is −12∑irik[ln⁡∣Σk∣+(xi−μk)⊤Σk−1(xi−μk)]. Differentiating in Σk−1 gives Σk=1Nk∑irik(xi−μk)(xi−μk)⊤, the weighted sample covariance.
  5. Each M-step cannot decrease the observed-data likelihood, because Q is a lower-bound surrogate that touches the likelihood at the current parameters.

Common mistakes

How long your answer should be

One page; 6–8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Unsupervised learning: A 1-D Gaussian mixture has two components with equal weights π1=π2=0.5, means μ1=0 and μ2=4, and both variances equal to 1. For the data {0,1,5}, what are the E-step responsibilities and the updated weights and means after one EM iteration?
Next in Unsupervised learning: A graph on four nodes has edge weights w12=1, w34=1, w23=0.1 and no other edges. Write the unnormalised Laplacian L=D−W and find its second-smallest eigenvalue and eigenvector. What clustering does the sign of that eigenvector give, and how does the eigenvalue compare with the RatioCut of that split?