A die-like variable takes values in {1,…,K} with probabilities π1,…,πK. Given nk observations of category k (total n), derive the MLE of π with a Lagrange multiplier. For counts (30,50,20), what is it?

Probability and statistics, Maximum likelihood
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Constrained maximum likelihood on the probability simplex.

Key idea

Maximise ∑knklog⁡πk subject to ∑kπk=1. The Lagrangian gives πk=nk/λ, and the constraint gives λ=n.

Steps

  1. Write the log-likelihood: ℓ(π)=∑knklog⁡πk, since each observation of category k contributes a factor πk.
  2. Form the Lagrangian L=∑knklog⁡πk−λ(∑kπk−1), where λ enforces the sum-to-one constraint.
  3. Differentiate with respect to πk: nk/πk−λ=0, so πk=nk/λ.
  4. Sum over k and use ∑kπk=1: ∑knk/λ=n/λ=1, so λ=n and π^k=nk/n.
  5. Numbers: n=100, so π^=(0.3, 0.5, 0.2).
  6. Remark that the MLE is just the relative frequency. A category with nk=0 gets π^k=0, which motivates smoothing with a Dirichlet prior.

Common mistakes

How long your answer should be

Half a page; 4 minutes.

Last checked on 4 December 2026.

Read this

Previous in Probability and statistics: (X1,X2) is bivariate Gaussian with means (1,2) and covariance (4223). Why is X1∣X2=x2 Gaussian, and what are its mean and variance at x2=3?
Next in Probability and statistics: Why is the Bernoulli distribution with parameter θ in the exponential family? What are its natural parameter, sufficient statistic and log-partition function, and why does the derivative of the log-partition function give the mean?