Suppose that $p_1 ,...,p_n,$ and $q_1,...,q_n$ are positive numbers and $\sum_i p_i$ = 1 = $\sum_i q_i$.
Show that $\sum_{i=1}^m p_i \log(1/q_i)$ ≥ $\sum_{i=1}^m p_i \log(1/p_i)$ with equality if and only if $p_i$ = $q_i$, i = 1, ..., n.
My Attempt (I think I made an error early on?):
\begin{align} \sum_{i=1}^m p_i \log(1/q_i) - \sum_{i=1}^m p_i \log(1/p_i) &= \sum_{i=1}^m p_i [ \log(1/q_i) - \log (1/p_i)] \\ &=\sum_{i=1}^m p_i \log(p_i/q_i) \\ &= \sum_{i=1}^m p_i \ln(p_i/q_i) \\ &≥ \sum_{i=1}^m (p_i/q_i -1) \\ &= \sum_{i=1}^m 1/q_i -\sum_{i=1}^m 1/p_i \\ &= 0 \end{align}
$p_i \ln (p_i/q_i) = -p_i \ln(q_i/p_i) \geq -p_i(q_i/p_i -1) = (p_i - q_i)$. Also, for your proof you need to observe that the equality $-p_i \ln(q_i/p_i) = -p_i(q_i/p_i -1)$ holds if and only if $q_i/p_i=1$ or equivalently, if and only if $p_i=q_i$. [and so of course $-p_i\ln(p_i/q_i) =$ 0].
However, what is correct is that $\sum_{i=1}^n p_i \log(p_i/q_i)$ is nonnegative iff $\sum_{i=1}^n p_i \ln(p_i/q_i)$ is nonnegative, which is what it looked like you were trying to show. To this end, you could say at the end of your top line of your proof that $\sum_{i=1}^n p_i \log(p_i/q_i)$ is positive/zero iff $\sum_{i=1}^n p_i \ln(p_i/q_i)$ is positive/zero, which is what you will next show.
See if this is enough for you to correct.