Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2023/iii/paper-224/3/b/solution

For the direct half of the code-distribution correspondence, let be the length function of a binary prefix code and put
Then is a probability mass function and
Thus every prefix code determines a distribution whose ideal description lengths do not exceed the codeword lengths.
Conversely, given a probability mass function , set
for . Then , so the Kraft inequality is satisfied. Its converse supplies a binary prefix code with these lengths, and
If real lengths are allowed, the ideal choice satisfies Kraft with equality.

New to topics? Read the docs here!