[proofplan]
We apply Gibbs' inequality with the uniform distribution $q_i = 1/n$ as the reference measure. The cross-entropy against the uniform distribution simplifies to $\log_2 n$ because $\log_2(1/n) = -\log_2 n$ does not depend on $i$ and the weights $p_i$ sum to $1$. Gibbs' inequality then upper-bounds the entropy by $\log_2 n$, and its equality condition — that the two distributions coincide — gives the required characterisation.
[/proofplan]
[step:Verify the hypotheses of Gibbs' inequality for the uniform reference]
Define the uniform distribution
\begin{align*}
q : \{1, \ldots, n\} &\to [0, 1], \\
i &\mapsto \frac{1}{n}.
\end{align*}
Then $q_i = 1/n > 0$ for each $i$ and $\sum_{i=1}^n q_i = n \cdot \frac{1}{n} = 1$, so $q = (q_1, \ldots, q_n)$ is a probability distribution on $\{1, \ldots, n\}$. By hypothesis, $p = (p_1, \ldots, p_n)$ is also a probability distribution. The two hypotheses of [Gibbs' Inequality](/theorems/1629) — that $p$ and $q$ are probability distributions on a common finite index set — are therefore satisfied.
[/step]
[step:Apply Gibbs' inequality to obtain the upper bound $\log_2 n$]
By the definition of Shannon entropy,
\begin{align*}
H(p_1, \ldots, p_n) = -\sum_{i=1}^n p_i \log_2 p_i.
\end{align*}
[Gibbs' Inequality](/theorems/1629) applied to $p$ and $q$ gives
\begin{align*}
-\sum_{i=1}^n p_i \log_2 p_i \le -\sum_{i=1}^n p_i \log_2 q_i.
\end{align*}
Evaluate the right-hand side with $q_i = 1/n$:
\begin{align*}
-\sum_{i=1}^n p_i \log_2 q_i = -\sum_{i=1}^n p_i \log_2 \frac{1}{n} = -\log_2 \frac{1}{n} \sum_{i=1}^n p_i = (\log_2 n) \cdot 1 = \log_2 n,
\end{align*}
where we used $\log_2(1/n) = -\log_2 n$ and $\sum_{i=1}^n p_i = 1$. Combining,
\begin{align*}
H(p_1, \ldots, p_n) \le \log_2 n.
\end{align*}
[guided]
The uniform distribution is the natural reference because its log-probabilities $\log_2 q_i = -\log_2 n$ are constant in $i$. That turns the cross-entropy $-\sum p_i \log_2 q_i$ into $\log_2 n \cdot \sum p_i$, which by normalisation of $p$ equals $\log_2 n$. So the Gibbs bound "entropy $\le$ cross-entropy" reads "entropy $\le \log_2 n$" exactly when the reference is uniform — this is precisely the point of choosing $q_i = 1/n$.
[/guided]
[/step]
[step:Characterise the case of equality]
By the equality clause of [Gibbs' Inequality](/theorems/1629), the bound
\begin{align*}
-\sum_{i=1}^n p_i \log_2 p_i \le -\sum_{i=1}^n p_i \log_2 q_i
\end{align*}
is an equality if and only if $p_i = q_i$ for every $i \in \{1, \ldots, n\}$. With $q_i = 1/n$, this condition reads $p_i = 1/n$ for every $i$, i.e., $p_1 = p_2 = \cdots = p_n = 1/n$.
Conversely, if $p_i = 1/n$ for every $i$,
\begin{align*}
H(p_1, \ldots, p_n) = -\sum_{i=1}^n \frac{1}{n} \log_2 \frac{1}{n} = -\log_2 \frac{1}{n} = \log_2 n,
\end{align*}
which is equality in the bound. Hence $H(p_1, \ldots, p_n) = \log_2 n$ if and only if $p_1 = \cdots = p_n = 1/n$, completing the proof.
[/step]