Paper 1, Section II, 11K11 K

Coding and Cryptography
Part II, 2021

Let Σ1={μ1,,μN}\Sigma_{1}=\left\{\mu_{1}, \ldots, \mu_{N}\right\} be a finite alphabet and XX a random variable that takes each value μi\mu_{i} with probability pip_{i}. Define the entropy H(X)H(X) of XX.

Suppose Σ2={0,1}\Sigma_{2}=\{0,1\} and c:Σ1Σ2c: \Sigma_{1} \rightarrow \Sigma_{2}^{*} is a decipherable code. Write down an expression for the expected word length E(S)E(S) of cc.

Prove that the minimum expected word length SS^{*} of a decipherable code c:Σ1Σ2c: \Sigma_{1} \rightarrow \Sigma_{2}^{*} satisfies

H(X)S<H(X)+1.H(X) \leqslant S^{*}<H(X)+1 .

[You can use Kraft's and Gibbs' inequalities as long as they are clearly stated.]

Suppose a decipherable binary code has word lengths s1,,sNs_{1}, \ldots, s_{N}. Show that

NlogNs1++sN.N \log N \leqslant s_{1}+\cdots+s_{N} .

Suppose XX is a source that emits NN sourcewords a1,,aNa_{1}, \ldots, a_{N} and pip_{i} is the probability that aia_{i} is emitted, where p1p2pNp_{1} \geqslant p_{2} \geqslant \cdots \geqslant p_{N}. Let b1=0b_{1}=0 and bi=j=1i1pjb_{i}=\sum_{j=1}^{i-1} p_{j} for 2iN2 \leqslant i \leqslant N. Let si=logpis_{i}=\left\lceil-\log p_{i}\right\rceil for 1iN1 \leqslant i \leqslant N. Now define a code cc by c(ai)=bic\left(a_{i}\right)=b_{i}^{*} where bib_{i}^{*} is the (fractional part of the) binary expansion of bib_{i} to sis_{i} decimal places. Prove that this defines a decipherable code.

What does it mean for a code to be optimal? Is the code cc defined in the previous paragraph in terms of the bib_{i}^{*} necessarily optimal? Justify your answer.