Why is $ -\sum_{i \in \text I} p_i \log_2(p_i)$ maximized for all $p_i$ equal? Is it true if $|\text I | = \infty$? Reading a text it is stated without proof that $$ -\sum_{i \in \text I} p_i \log_2(p_i)$$ where $\sum_{i \in \text I} p_i = 1$ is maximized if $p_i$ is a constant.
In the case of my theorem, the index set $\text I$ is finite.
My question is, why is it true that the above sum is maximized for all $p_i$ equal? Does it also hold if the index set $\text I$ is infinite?
 A: $$
\text{Entropy} = -\sum_{i\in I}p_i\log_2 p_i
$$
maximise as
$$
\mathcal{L} = -\sum_{i\in I}p_i\log_2 p_i+\lambda \left(\sum_{i\in I} p_i - 1\right)
$$
maximise the lagrangian
$$
\frac{\partial\mathcal{L}}{\partial p_i} = -\left(\log_2p_i + 1 -\lambda\right) = 0
$$
thus
$$
\log_2 p_i = -(1+\lambda)\implies p_i = 2^{-(1-\lambda)} 
$$
thus is a constant.
To get $\lambda$ you use the other condition (for completeness)
$$
\sum_i 2^{-(1-\lambda)} = 1 \\
\mathrm{e}^{-(1-\lambda)\ln 2}\sum_{i\in I} 1 = 1
$$
or
$$
\lambda  = 1 - \frac{\ln\left(\sum_{i\in I} 1\right)}{\ln 2}
$$
A: since
$$f(x)=x\log_{2}{x}\Longrightarrow f'(x)=\log_{2}{x}+x\cdot\dfrac{\log_{2}{e}}{x}=\log_{2}{x}$$
$$\Longrightarrow f''(x)=\dfrac{\log_{2}{e}}{x}>0$$
then use this Jensen's inequality
$$\sum_{i\in I}p_{i}\log_{2}{p_{i}}=\sum_{i\in I}f(p_{i})\ge |I|f\left(\dfrac{\sum_{i\in I}p_{i}}{|I|}\right)=|I|f\left(\dfrac{1}{|I|}\right)=|I|\log_{2}{\dfrac{1}{|I|}}$$
so
$$-\sum_{i\in I}p_{i}\log_{2}{p_{i}}\le |I|\log_{2}{|I|}$$
if and only of
$$p_{1}=p_{2}=\cdots=p_{|I|}=\dfrac{1}{|I|}$$
where $|I|=card{(I)}$
