Theorem 1 (Maximum likelihood minimizes the divergence from the data) Let \(x_1, \ldots, x_n\) be data, and let \(\mathop{\hat{\mathbb{p}}}\nolimits\) be their empirical distribution. Let \(q_\theta\) be probability mass functions with \(q_\theta(v) > 0\) wherever \(\mathop{\hat{\mathbb{p}}}\nolimits(v) > 0\), for parameter values \(\theta\). Then \(\theta\) maximizes the likelihood \(\prod_{i=1}^n q_\theta(x_i)\) exactly when it minimizes the Kullback–Leibler divergence \({{D_{\mathrm{KL}}}\mathopen{}\left(\mathop{\hat{\mathbb{p}}}\nolimits \,\Vert\, q_\theta\right)\mathclose{}}\).
Proof. Let \(n_v\) be the number of data equal to \(v\). Then \(n_v = n \, \mathop{\hat{\mathbb{p}}}\nolimits(v)\).
Group the terms of the log-likelihood by value:
\[\sum_{i=1}^n \log_2 q_\theta(x_i) = \sum_v n \, \mathop{\hat{\mathbb{p}}}\nolimits(v) \log_2 q_\theta(v).\]
Divide by \(n\). The right side is minus the cross-entropy \({\mathbb{H}\mathopen{}\left(\mathop{\hat{\mathbb{p}}}\nolimits, q_\theta\right)\mathclose{}}\):
\[\frac{1}{n} \sum_{i=1}^n \log_2 q_\theta(x_i) = -{\mathbb{H}\mathopen{}\left(\mathop{\hat{\mathbb{p}}}\nolimits, q_\theta\right)\mathclose{}}.\]
By the cross-entropy decomposition, the cross-entropy is the entropy of \(\mathop{\hat{\mathbb{p}}}\nolimits\) plus the divergence:
\[-{\mathbb{H}\mathopen{}\left(\mathop{\hat{\mathbb{p}}}\nolimits, q_\theta\right)\mathclose{}} = -{\mathbb{H}\mathopen{}\left(\mathop{\hat{\mathbb{p}}}\nolimits\right)\mathclose{}} - {{D_{\mathrm{KL}}}\mathopen{}\left(\mathop{\hat{\mathbb{p}}}\nolimits \,\Vert\, q_\theta\right)\mathclose{}}.\]
The entropy \({\mathbb{H}\mathopen{}\left(\mathop{\hat{\mathbb{p}}}\nolimits\right)\mathclose{}}\) does not depend on \(\theta\). So \(\theta\) maximizes the average log-likelihood exactly when it minimizes \({{D_{\mathrm{KL}}}\mathopen{}\left(\mathop{\hat{\mathbb{p}}}\nolimits \,\Vert\, q_\theta\right)\mathclose{}}\). The logarithm increases, and dividing by \(n\) keeps the order, so \(\theta\) maximizes the average log-likelihood exactly when it maximizes the likelihood.