Solution

ID: past-exam-of-the-communication-theory-course-of-the-university-of-oxford/2007/2/b/solution

Work on the source support, so its listed probabilities are positive; zero-probability symbols may be omitted. An optimal binary prefix code minimizes the expected codeword length for that distribution. The same optimal expected length is attained when optimization is over uniquely decipherable codes, by the converse and existence parts of Kraft–McMillan inequality.
Choose Shannon lengths . They satisfy , so the preceding existence theorem gives a prefix code with those lengths. Also for every symbol, including the integer cases. Thus its expected length is less than . An optimal code cannot have a larger expected length, proving
For a deterministic one-symbol source the empty word has length zero, consistent with this bound.

New to topics? Read the docs here!