Let
Let
Then its Expected word length
where
and
Proof
The lower bound is given by combining Gibbs’ inequality and Kraft’s inequality.
Take
Where
Hence:
We get equality iff
For the upper bound, let
We have
So by McMillan’s Theorem
there is a prefix-free code with word lengths
Also