TITLE: Shannon entropy of a fair dice
QUESTION [33 upvotes]: The formula for Shannon entropy is as follows,
$$\text{Entropy}(S) = - \sum_i p_i \log_2 p_i
$$
Thus, a fair six sided dice should have the entropy,
$$- \sum_{i=1}^6 \dfrac{1}{6} \log_2 \dfrac{1}{6} = \log_2 (6) = 2.5849...$$
However, the entropy should also correspond to the average number of questions you have to ask in order to know the outcome (as exampled in this guide under the headline Information Theory).
Now, trying to construct a decision tree to describe the average number of questions we have to ask in order to know the outcome of a dice, and this seems to be the optimal one:

Looking at the average number of questions in the image, there are 3 questions in 4/6 cases in 2 questions in 2/6 cases. Thus the entropy should be:
$$\dfrac{4}{6} \times 3 + \dfrac{2}{6} \times 2 = 2.6666...$$
So, obviously the result for the entropy isn't the same in the two calculations. How come?

REPLY [13 votes]: There is nothing wrong with what you did. In the book "Elements on Information Theory", there is a proof that the average number of questions needed lies between $H(X)$ and $H(X)+1$, which agrees with what you did. So, in terms of "questions", the entropy gives you an accuracy within $1$ question. The following argument is from "Elements on Information Theory":
Proof that $H(X) \leq L < H(X) + 1$
If $L$ is the average number of questions (in the book it is the referred to as the expected description length), it could be written as 
$$L = \sum p_i l_i$$
subject to the constraints that each $l_i$ is an integer, because $l_i$ reflects the number of questions asked to arrive at the answer of the $i^{th}$ outcome. Also, you have $$\sum D ^{-l_i} \leq 1$$where $D$ is the size of your alphabets. Furthermore, the optimal number of questions can be found by minimizing the $D-$adic probability distribution closest to the distribution of $X$ in relative entropy, that is, by finding the $D-$adic $r$, where 
$$r_i = \frac{D^{-l_i}}{\sum_j D^{-l_j}}$$ that minimizes
$$L - H(X) = D(p \Vert r) - \log(\sum D^{-l_i}) \geq 0$$
The choice of questions $l_i = \log_D \frac{1}{p_i}$ will give $L = H$. Since $\log_D \frac{1}{p_i}$ is not necessarily an integer, you could
$$l_i = \lceil \log_D \frac{1}{p_i} \rceil$$.
Using Kraft-McMillan's inequality, you can say
$$\sum D^{-\lceil \log_D \frac{1}{p_i} \rceil} \leq \sum D^{- \log \frac{1}{p_i}} = \sum p_i = 1$$
Now you'll get that the optimal $l_i$ are bounded between
$$\log_D \frac{1}{p_i} \leq l_i < \log_D \frac{1}{p_i} + 1$$
which gives you

$$H(X) \leq L < H(X) + 1$$
  You computed $L \simeq 2.666$ and $H(X) \simeq 2.58$