


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



ECE 563 Information Theory
Instructor: R. Srikant TA: Akshay Kashyap
All instantaneous codes are uniquely decodable, therefore L 2 ≤ L 1.
Now, say some set of codewords, say Cu achieves the minimum in the definition of L 2. Since Cu is uniquely decodable, it satisfies the Kraft-McMillan inequality. But then, we can construct an instantaneous code, Ci with the same codeword lenghts, and therefore the same L. Therefore, we have L 1 ≤ L 2 too.
Therefore, L 1 = L 2.
(a) The Huffman tree for this distribution is:
Codeword 1 x 1 0.49 0.49 0.49 0.49 0.49 0.51 1 00 x 2 0.26 0.26 0.26 0.26 0.26 0. 011 x 3 0.12 0.12 0.12 0.13 0. 01000 x 4 0.04 0.05 0.08 0. 01001 x 5 0.04 0.04 0. 01010 x 6 0.03 0. 01011 x 7 0.
(b) The expected length of the codewords for the binary Huffman code is 2.02 bits (H(X) = 2.01 bits).
(c) The ternary Huffman code tree is
Codeword 0 x 1 0.49 0.49 0.49 1 1 x 2 0.26 0.26 0. 20 x 3 0.12 0.12 0. 22 x 4 0.04 0. 210 x 5 0.04 0. 211 x 6 0. 212 x 7 0.
The expected length of the ternary code is 1.34 (ternary) symbols (H 3 (X) = 1.27 ternary symbols).
The Huffman ocde for the source with the given probability distribution has codewords { 00 , 10 , 11 , 010 , 011 }.
Now, the expected length of this code is 2 × 35 + 3 × 25 = 125 bits. The Huffman code for the distribution { 1 / 5 , 1 / 5 , 1 / 5 , 1 / 5 , 1 / 5 } is { 01 , 10 , 11 , 000 , 001 }, which clearly has the same expected length, 125. Huffman codes are optimal and since our code has the same length as the Huffman code, it is optimal too.
We proceed in a way similar to the proof of Theorem 5.3.1 of the text. We wish to minimize C =
i picili subject to
2 −li^ ≤ 1. We will assume equality in the constraint. Define
ri = 2 −li^ (1) Q =
i
pici.
Further, let qi = pi Q^ c i, for i = 1,... , m, and q = (q 1 , q 2 ,... , qm). Then q forms a probability distribution and we can write C as
C =
i
picili
i
qi log
ri
i
qi log
qi ri
i
qi log qi
= Q (D(q||r) + H(q)).
Since r = (r 1 ,... , rm) is the only variable and D(q||r) ≥ 0, we can can minimize C by choosing r = q, or (from (1))
l∗ i = − log pici ∑ j pj^ cj
= log qi,
where we have, as said in the question, ignored any integer constraints on li. The minimum cost C∗^ for this assignement of codewords is C∗^ = QH(q).
(b) If we use q instead of p in the Huffman procedure, we will obtain a code that will minimize the expected cost (see Section 5.7 (item 2) of the text on pp. 121).
(c) Let ˆli be the lengths of the codewords resulting from using the Huffman coding procedure as described in part (b) above. Then, we know
H(q) ≤
i
qiˆli ≤ H(q) + 1.
Multiplying by Q gives us the required relationship,
C∗^ ≤ CHuffman < C∗^ + Q.
Let us denote the capacity by C. Consider the following cases:
Let x = Pr[X = 1]. Note that Pr[Y = 1] = x 2. Now,
H(Y |X) = Pr[X = 0].0 + Pr[X = 1].1 = x H(Y ) = H(x/2) I(X; Y ) = H(Y ) − H(Y |X) = H(x/2) − x (8)
From (8), we see that I(X; Y ) = 0 for x = 0, 1, and so the maximum mutual information is achieved at some x ∈ (0, 1).
Now, again using (8) d dx
log 2
1 − x 2 x 2
at x = 25. So, the capacity of the Z channel is H(1/5) − 2 /5 bits per channel use, and is achieved at Pr[X = 1] = 25.