Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2018/ii/paper-1/3h/solution

Let a memoryless source have probabilities , and let a uniquely decodable -ary code have word lengths and mean length . The Shannon source coding theorem states
and that some prefix code satisfies
For the lower bound, the Kraft inequality gives . Set . The Gibbs inequality, or nonnegativity of relative entropy, gives
Therefore .
For achievability choose . Then , so the converse part of the Kraft theorem supplies a prefix code with these lengths, and
Hence the entropy is the optimal mean code length up to less than one code symbol.

New to topics? Read the docs here!