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