Docsity

8 Solved Problems on the Information Theory - Assignment 3 | ECE 563, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE 563 Information Theory
Homework 3 Solutions
Instructor: R. Srikant TA: Akshay Kashyap
5.1
All instantaneous codes are uniquely deco dable, therefore L2≤L1.
Now, say some set of codewords, say Cuachieves the minimum in the definition of L2. Since Cuis 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 L1≤L2too.
Therefore, L1=L2.
5.4
(a) The Huffman tree for this distribution is:
Codeword
1x10.49 0.49 0.49 0.49 0.49 0.51 1
00 x20.26 0.26 0.26 0.26 0.26 0.49
011 x30.12 0.12 0.12 0.13 0.25
01000 x40.04 0.05 0.08 0.12
01001 x50.04 0.04 0.05
01010 x60.03 0.04
01011 x70.02
(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
0x10.49 0.49 0.49 1
1x20.26 0.26 0.26
20 x30.12 0.12 0.25
22 x40.04 0.09
210 x50.04 0.04
211 x60.03
212 x70.02
The expected length of the ternary code is 1.34 (ternary) symbols (H3(X) = 1.27 ternary symbols).
5.5
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 ×3
5+ 3 ×2
5=12
5bits. 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, 12
5. Huffman
codes are optimal and since our code has the same length as the Huffman code, it is optimal too.
1
pf3
pf4

Partial preview of the text

Download 8 Solved Problems on the Information Theory - Assignment 3 | ECE 563 and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

ECE 563 Information Theory

Homework 3 Solutions

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

= Q

i

qi log

ri

= Q

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:

  1. a = 0: In this case , Y = X always, and so max I(X; Y ) = max H(X) = 1 bit. So, C = 1 bit per channel use.
  2. a /∈ { 0 , 1 , − 1 }: In this case, Y can take four possible values: 0, 1, a and 1 + a. Upon seeing Y , we can identify which X was input to the channel, so H(X|Y ) = 0, and again C = max I(X; Y ) = max H(X) = 1 bit per channel use.
  3. a = 1: Now, Y can take three possible values, 0, 1 and 2. The channel is identical to the binary erasure channel: Z = a corresponds to an erasure. The capacity is therefore (see Section 7.1.5 of text) 1 − 12 = 12 bits per channel use.

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

I(X; Y ) =

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.