# Proving that Shannon entropy is maximised for the uniform distribution

I know that Shannon entropy is defined as $$-\sum_{i=1}^kp_i\log(p_i)$$. For the uniform distribution, $$p_i=\frac{1}{k}$$, so this becomes $$-\sum_{i=1}^k\frac{1}{k}\log\left(\frac{1}{k}\right)$$. Further rearrangement produces the following:

$$-\sum_{i=1}^k\frac{1}{k}\log(k)^{-1}$$

$$\sum_{i=1}^k\frac{1}{k}\log(k)$$

This is where I am stuck. I need the solution to come to $$\log(k)$$. What is the next step?

• You have the sum of $(1/k) \log k$, each repeated $k$ times. Try this one. What is $1/k$ repeated $k$ times? Just $k (1/k) = 1$. – Nick Cox Apr 20 '19 at 9:34

This is a constrained maximization problem in $$k$$ variables $$p_1,p_2,...p_k$$. The objective function is
$$-\sum_{i=1}^kp_i\log(p_i)$$
$$\sum_{i=1}^kp_i = 1$$