Proof. Every sum here runs over the values \(x\) with \(p(x) > 0\). For every such \(x\),
\[
-\log_2 q(x)
= -\log_2 p(x) + \log_2 \frac{p(x)}{q(x)}.
\tag{10}\]
Multiply by \(p(x)\) and add over \(x\):
\[
-\sum_x p(x) \log_2 q(x)
= -\sum_x p(x) \log_2 p(x) + \sum_x p(x) \log_2 \frac{p(x)}{q(x)}.
\tag{11}\]
Reading left to right, these are \({\mathbb{H}\mathopen{}\left(p, q\right)\mathclose{}}\), \({\mathbb{H}\mathopen{}\left(p\right)\mathclose{}}\) and \({{D_{\mathrm{KL}}}\mathopen{}\left(p \,\Vert\, q\right)\mathclose{}}\).