In this paper I'm stumped on the proof of Lemma 5 (page 4).
Not the whole lemma, just the part that says if $\mathbf{x}\in\{0,1\}^{n}$, such that $\mathbf{p\cdot x} = p$ and $\mathbf{q\cdot x} = q$, for $p,q \in [0,1]$ then using Lagrangian multipliers, together with the fact that $D$ is convex, it can be shown that $D(\mathbf{p}\|\mathbf{q})$ is minimised when:
(1) $p_{i}$ is the same for all $i$ with $x_{i}=1$
(2) $q_{i}$ is the same for all $i$ with $x_{i}=1$
(3) $p_{i}$ is the same for all $i$ with $x_{i}=0$
(4) $q_{i}$ is the same for all $i$ with $x_{i}=0$
When I use Lagrange multipliers to minimise $D(\mathbf{p}\|\mathbf{q})$ I end up with $\mathbf{p}=\mathbf{q}$, as expected, but $\mathbf{p}$ can't equal $\mathbf{q}$, otherwise it's trivial and I'm not sure how to get those 4 conditions above.
EDIT: Here's my working so far (and I think I made some progress):
$$L = \sum_{i}p_{i}\log{\frac{pi}{qi}} + \lambda (p - \sum_{i} p_{i}x_{i} ) + \nu (q - \sum_{i} q_{i}x_{i})$$
$$\nabla_{p_{i}}L = 1 + \log{\frac{p_{i}}{q_{i}}} - \lambda x_{i}= 0$$
$$\nabla_{\lambda}L = \sum_{i} p_{i}x_{i} - p = 0$$
$$\nabla_{\nu}L = \sum_{i} q_{i}x_{i} - q = 0$$
Which gives me $$p_{i} = q_{i}e^{\lambda - 1}$$
for $x_{i} = 1$. And
$$p_{i} = q_{i}e^{- 1}$$
for $x_{i} = 0$.
Let $x_{i} = 1$, for $i = \{1,...,d\}$:
Then
$$\sum_{i = 1}^{d} p_{i} = p$$
and we can let $p_{i} = \frac{p}{d}$. Similarly we can have $q_{i} = \frac{q}{d}$.
Let $x_{i} = 0$, for $i = \{d+1,...,n\}$:
Then
$$\sum_{i = d+1}^{n} p_{i} = 1 -p$$
and we have $p_{i} = \frac{1-p}{n-d}$. Similarly we have $q_{i} = \frac{1-q}{n-d}$.
But I'm still not clear where it comes out that the $p_{i}$'s must be the same for $i$ with $x_{i} = 1$ etc.