You are on page 1of 24

EE 605: Error Correcting Codes

Instructor: Saravanan Vijayakumaran


Indian Institute of Technology Bombay
Autumn 2011

Assignment 1 : 20 points

Due date: August 4, 2010

Each of the following exercises is worth 5 points. Every nontrivial step in a proof should
be accompanied by justification.
1. Prove that the Hamming distance satisfies the triangle inequality, i.e. d(u, v)
d(u, w) + d(w, v) for all n-tuples u, v, w.
2. Calculate the crossover probability of the binary symmetric channel which is equivalent to the system below.
BSC(p)

Binary
Input

BSC(p)

BSC(p)

Majority
function

BSC(p)

Binary
Output

BSC(p)

3. Derive the optimal decoding rule for a 2n-repetition code for use over a binary symmetric channel with crossover probability p. Is the optimal decoding rule unique?
Calculate the average probability of error for this code when the optimal decoding
rule is used.
4. Consider a binary block code C of length n having minimum distance dmin where dmin
is an odd integer. Show that when a overall parity bit is added to all the codewords
in C we obtain a code of length n + 1 and minimum distance dmin + 1.

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011

Solutions to Assignment 1
1. Prove that the Hamming distance satisfies the triangle inequality, i.e. d(u, v)
d(u, w) + d(w, v) for all n-tuples u, v, w.
Solution: For a set A, let |A| denote its cardinality. We know that |AB| |A|+|B|
and |A| |A B|. Also, if |A| |B| then |Ac | |B c |.
Note that d(u, v) = |A| where A = {i|ui 6= vi }.
Ac
Ac
|Ac |
|A|
|A|
d(u, v)

=
=

{i|ui = vi }
{i|ui = vi = wi } {i|ui = vi 6= wi }
|{i|ui = vi = wi }| = |{i|ui = wi } {i|vi = wi }|
|{i|ui = wi }c {i|vi = wi }c | = |{i|ui 6= wi } {i|vi 6= wi }|
|{i|ui 6= wi }| + |{i|vi 6= wi }|
d(u, w) + d(w, v)

2. Calculate the crossover probability of the binary symmetric channel which is equivalent to the system below.
BSC(p)

Binary
Input

BSC(p)

BSC(p)

w1
w2

Majority
function

BSC(p)

Binary
Output

w3
BSC(p)

Solution: The crossover probability of the equivalent binary symmetric channel is


Pr[u 6= y].
Pr[u 6= y] = Pr[u 6= v] Pr[v = y] + Pr[u = v] Pr[v 6= y]
= (1 p) Pr[v = y] + p Pr[v 6= y]
= (1 p) {Pr[v 6= x] Pr[x 6= y] + Pr[v = x] Pr[x = y]}
+p {Pr[v 6= x] Pr[x = y] + Pr[v = x] Pr[x 6= y]}
= (1 p) {Pr[v 6= x]p + Pr[v = x](1 p)} + p {Pr[v 6= x](1 p) + Pr[v = x]p}
= 2p(1 p) Pr[v 6= x] + [p2 + (1 p)2 ] Pr[v = x]

The calculation is complete if we can calculate Pr[v = x] which is equal to the


probability that at most one of w1 , w2 , w3 is different from v because the majority
function can correct at most one error. This probability is equal to (1p)3 +3p(1p)2 .
3. Derive the optimal decoding rule for a 2n-repetition code for use over a binary symmetric channel with crossover probability p. Is the optimal decoding rule unique?
Calculate the average probability of error for this code when the optimal decoding
rule is used.
Solution: If the codewords are equally, the optimal decoding rule for the 2n-repetition
code over a BSC is the minimum distance decoding rule. For each received vector,
its distance to the all zeros and all ones 2n-tuples is calculated. We decide the all
zeros codeword was sent if the distance of the received vector to it is smaller and
the all ones codeword was sent otherwise. But every received vector which has n
zeros and n ones is equidistant to the all zeros and all ones codewords. Such received
vectors can be decoded as either codeword without changing the average probability
of error. Thus the optimal decoder is not unique. The average probability of error of
the minimum distance decoder is
 

2n 
X
2n i
1 2n n
2ni
p (1 p)n
Pe =
p (1 p)
+
2
n
i
i=n+1
4. Consider a binary block code C of length n having minimum distance dmin where dmin
is an odd integer. Show that when a overall parity bit is added to all the codewords
in C we obtain a code of length n + 1 and minimum distance dmin + 1.
Solution: Consider any pair of codewords u, v which are at a distance dmin from
each other. Since dmin is odd, u and v differ in an odd number of locations. If we add
an
Pnto u and v, their parity bits will differ. For example, suppose
Pnoverall parity bit
v
=
0,
then
i=1 ui has to be 1 since we are changing an odd number of terms
i=1 i
in the summation. So any pair of codewords in C which are at a distance dmin will
be at a distance dmin + 1 after the addition of the overall parity check.
Now consider any pair of codewords which are not a minimum distance dmin . They
are at a distance of at least dmin + 1. After the addition of the overall parity check
bit, the distance between them will remain the same if their parity bits are the same
or increase by one if their parity bits are different. So they will still be at a distance
of at least dmin + 1.
Hence the minimum distance of the new code is dmin + 1.

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011

Assignment 2 : 20 points

Due date: August 30, 2011

Each of the following exercises is worth 5 points. Every nontrivial step in a proof should
be accompanied by justification.
1. Construct the standard array and syndrome decoding table for the (7, 4) linear block
code with generator matrix

1 0 0 0 0 1 1
0 1 0 0 1 0 1

0 0 1 0 1 1 0
0 0 0 1 1 1 1
2. A burst error of length l is an error pattern which causes l consecutive locations in
the transmitted code to be corrupted. Let H be the parity check matrix of a binary
linear block code.
(a) What is the necessary and sufficient condition on the columns of H so that every
burst error of length up to t can be detected?
(b) What is the necessary and sufficient condition on the columns of H so that every
burst error of length up to t can be corrected?
3. Let C be (n, k) linear code. Let T be a set of coordinates of the codewords i.e.
T {1, 2, . . . , n}. Let C T be the code obtained by puncturing C on the coordinates
in T and let CT be the code obtained by shortening C on the coordinates in T . Prove
that
(a) (C )T = (C T )
(b) (C )T = (CT )
4. Let C1 be a (n1 , k1 ) binary linear block code with minimum distance d1 and let C2
be a (n2 , k2 ) binary linear block code with minimum distance d2 . The direct sum of
C1 and C2 is defined as
C1 C2 = {(c1 , c2 )kc1 C1 , c2 C2 }.
Show that C1 C2 is a (n1 + n2 , k1 + k2 ) linear block code with minimum distance
min(d1 , d2 ). Derive the generator matrix of C1 C2 in terms of the generator matrices
of C1 and C2 . Derive the parity check matrix of C1 C2 in terms of the parity check
matrices of C1 and C2 .

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011
Solutions to Assignment 2
1. Construct the standard array and syndrome decoding table for the (7, 4) linear block
code with generator matrix

1 0 0 0 0 1 1
0 1 0 0 1 0 1

0 0 1 0 1 1 0
0 0 0 1 1 1 1
Solution:
The standard array is given in Table 1 and the syndrome decoding table is given in
Table 2. The parity check matrix which is given by

0 1 1 1 1 0 0
H = 1 0 1 1 0 1 0
1 1 0 1 0 0 1
The syndrome decoding table is obtained by multiplying the coset leaders in the
standard array by H T .
2. A burst error of length l is an error pattern which causes l consecutive locations in
the transmitted code to be corrupted. Let H be the parity check matrix of a binary
linear block code.
(a) What is the necessary and sufficient condition on the columns of H so that every
burst error of length up to t can be detected?
Solution: We know that the syndrome of a received vector is equal to the syndrome of the error pattern. If r = v+e where v is the transmitted codeword and
e is the error vector, rH T = eH T . Suppose H has no zero columns, then every
error pattern of weight 1 will be detected by a scheme which declares an error
detection whenever a nonzero syndrome is observed. Suppose no 2 consecutive
columns in H add up to zero, then no error pattern with 2 consecutive ones
will result in a zero syndrome. Thus every burst of length two can be detected
by a scheme which declares an error detection whenever a nonzero syndrome is
observed. Similarly if no 3, 4, ..., t consecutive columns in H add up to zero, then
every burst error of length upto t can be detected. Thus a sufficient condition
for detecting a burst of length upto t is that H has no zero columns and the
sum of any 2, 3, . . . , t consecutive columns is not zero.
We claim that the above sufficient condition is also necessary. Consider an error
detection scheme which is capable of detecting burst errors of length upto t.

Any error detection scheme for an (n, k) block code C is a partition of the space
Fn2 into two subsets E and E c such that an error detection is declared when the
received vector r E. Since the scheme should not declare an error when the
error pattern e is the all zeros vector i.e. when r = v, we require C E c . Thus
an error is not detected whenever r C. If a burst error of length upto t results
in the received vector which is equal to a codeword then this error will not be
detected. So it is necessary that v + e
/ C for any v C and any burst error
e of length upto t. Since v + e
/ C if and only if e
/ C, it is necessary for
every burst error e of length upto t does not belong to C for the error detection
scheme to be able to detect it. Since e
/ C eH T 6= 0, it is necessary
that eH T is not equal to zero for any burst error e of length up to t. Thus it is
necessary that there are no nonzero columns in H and no 2, 3, . . . , t consecutive
columns of H add up to zero.
(b) What is the necessary and sufficient condition on the columns of H so that every
burst error of length up to t can be corrected?
Solution: Suppose that all the columns of H are nonzero and distinct. Also
suppose that the sum of any 2, 3, . . . , t consecutive columns add up to a distinct
vector. This is sufficient to correct any burst error of length upto t because each
one of these burst errors corresponds will result in a distinct syndrome (because
it is a sum of columns). If r = v + e where v is the transmitted codeword and
e is the error vector, rH T = eH T = s. A burst error vector e of length upto
t can be identified from the syndrome (due to the uniqueness) and the errors
introduced can be corrected by adding e to r.
To prove the necessity of the above condition, consider any error correction
scheme capable of correcting burst errors of length upto t. Any error correction
scheme for an (n, k) block code is a partition of the space Fn2 into 2k subsets
Ai , i = 1, 2, . . . , 2k each of which corresponds to a codeword. If r Ai , we
decode it as the codeword vi . Since the scheme is capable of correcting burst
errors of length upto t, it is necessary for vi + e to be in Ai where e is a burst
error of length upto t. Since the Ai s are disjoint, we have vi + e1 6= vj + e2
where i 6= j and e1 , e2 are burst errors of length upto t. Multiplying both sides
by H T , we get e1 H T 6= e2 H T for any two distinct burst errors of length upto t.
If we set e1 to be a weight one error pattern and e2 = 0, we see that e1 H T 6= 0
which means that all the columns of H are necessarily nonzero. Setting both
e1 and e2 to be weight one error patterns we see that all the columns of H are
necessarily distinct. When e is an error pattern of weight two or more, eH T
corresponds to a sum of columns in H which needs to be necessarily distinct for
different values of e.
3. Let C be (n, k) linear code. Let T be a set of coordinates of the codewords i.e.
T {1, 2, . . . , n}. Let C T be the code obtained by puncturing C on the coordinates
in T and let CT be the code obtained by shortening C on the coordinates in T . Prove
that
(a) (C )T = (C T )
Solution: Let u (C )T . Then u is obtained by shortening a vector v in C
on the coordinates in T . So v is zero in the coordinates specified by T . Since
2

P
P
v C , we have ni=1 vi wi = 0 for all w C which implies iT c vi wi = 0
(as vi = 0 for i T ). This implies that the vector x obtained by puncturing
v on T is perpendicular to all the codewords in C T . But u = x as it is the
vector obtained by puncturing v on T . Thus u (C T ) and we have shown that
(C )T (C T ) .
Let u (C T ) . Then u is perpendicular to all the codewords v C T . Each
v is obtained by puncturing a codeword w in C on the coordinates in T . We
can extend the vector u to another vector x of length n such that x has zeros
in the coordinates in T and is equal to u in the other coordinates. Now x is
perpendicular to all the codewords w in C obtained by extending each v C T
(because u and v are perpendicular on T and x,w are extended versions of them
with x being zero in the new coordinates). Thus x C . Since x has zeros on
T and u can be obtained by puncturing x on T we conclude that u (C )T .
We have shown that (C T ) (C )T .
Since each set is the subset of the other they have to be equal.
(b) (C )T = (CT )
Solution: Similar argument as in (a).
4. Let C1 be a (n1 , k1 ) binary linear block code with minimum distance d1 and let C2
be a (n2 , k2 ) binary linear block code with minimum distance d2 . The direct sum of
C1 and C2 is defined as
C1 C2 = {(c1 , c2 )kc1 C1 , c2 C2 }.
Show that C1 C2 is a (n1 + n2 , k1 + k2 ) linear block code with minimum distance
min(d1 , d2 ). Derive the generator matrix of C1 C2 in terms of the generator matrices
of C1 and C2 . Derive the parity check matrix of C1 C2 in terms of the parity check
matrices of C1 and C2 .
Solution: By definition, C1 C2 is a nonempty subset of Fn2 1 +n2 . To show that it
is a linear code of dimension k1 + k2 , we have to first show that it is a subspace of
Fn2 1 +n2 over F2 . Consider any two elements x and y in C1 C2 . Then x = (x1 , x2 )
and y = (y1, y2 ) for some x1 , y1 C1 and x2 , y2 C2 . Their sum x + y is equal to
(x1 + x2 , y1 + y2). This sum belongs to C1 C2 because x1 + x2 C1 and y1 + y2 C2
(as C1 and C2 are linear codes). For any a F2 and x C1 C2 , ax = x or
ax = (0n1 , 0n2 ) where the former happens when a = 1 and the latter happens when
a = 0. Here 0ni is a ni -tuple of zeros. In both cases ax C1 C2 . Thus C1 C2
satisfies the two conditions required for a nonempty subset to be subspace. Hence
C1 C2 is a linear code.
To show that the dimension of C1 C2 is k1 +k2, consider bases for C1 and C2 . Let A =
{a1 , a2 , . . . , ak1 } be a basis for C1 and let B = {b1 , b2 , . . . , bk2 } be a basis for C2 . We
claim that the set D = {(a1 , 0n2 ), (a2 , 0n2 ), . . . , (ak1 , 0n2 ), (0n1 , b1 ), (0n1 , b2 ), . . . , (0n1 , bk2 }
is a basis for C1 C2 . Each element in this set is in C1 C2 because ai , 0n1 C1
and bi , 0n2 C2 . First we check that this set spans C1 C2 . Consider anyPelement
1
in C1 C2 . It is of the form (x, y) where x C1 and y C2 . Then x = ki=1
i ai
Pk2
where i F2 and y = i=1 i bi where i F2 because the ai s form a basis for C1
3

and the bi s form a basis for C2 . We can write (x, 0n2 ) as


k1
X

i (ai , 0n2 )

k2
X

i (0n1 , bi ).

(x, 0n2 ) =

i=1

and (0n1 , y) as
(0n1 , y) =

i=1

Combining these two equations we get


(x, y) =

k1
X

i (ai , 0n2 ) +

i=1

k2
X

j (0n1 , bj ).

j=1

Thus D spans C1 C2 . Now we need to show that the elements of D are linearly
independent. Consider a linear combination of the vectors in D which is equal to
zero.
k1
X
i=1

i (ai , 0n2 ) +

k2
X

j (0n1 , bj ) = (0n1 , 0n2 )

j=1

k1
X

i ai = 0n1 and

i=1

k2
X

j bj = 0n2

j=1

Since the elements of A and B form a basis of C1 and C2 respectively, they are linearly
independent and the above equation gives us i = 0 and i = 0. Thus the elements
of D are linearly independent. Since they also span C1 C2 , they form a basis for
this space. Since the number of elements in D is k1 + k2 , the dimension of C1 C2
is k1 + k2 .
The basis D also gives us the structure of the generator matrix of C1 C2 . If G1 is
the generator matrix of C1 , then it has the ai s in the set A as its rows and if G2 is
the generator matrix of C2 then it has the bi s in the set B as its rows. The generator
matrix for C1 C2 has the elements in the set D as its rows. Thus it is given by


G1
0k1 n2
G=
0k2 n1
G2
If H1 is the parity check matrix of C1 and H2 is the parity check matrix of C2 , the
parity check matrix of C1 C2 is given by


H1
0(n1 k1 )n2
H=
H2
0(n2 k2 )n1
This can be verified by writing v H T = 0 where v Fn2 1 +n2 .
Since C1 C2 is a linear code, its minimum distance is equal to the minimum weight
of its nonzero codewords. Let x be a nonzero codeword of minimum weight in C1
i.e. d1 = wH (x). Let y be a nonzero codeword of minimum weight in C2 i.e. d2 =
wH (y). Then (x, 0n2 ) C1 and (0n1 , y) C2 because 0n1 C1 and 0n2 C2 . Since
4

wH ((x, 0n2 )) = d1 and wH ((0n1 , y)) = d2 , the minimum distance dmin of C1 C2


satisfies the following inequality
dmin min(d1 , d2 ).
Let z be a nonzero codeword in C1 C2 . Then z = (u, v) where u C1 , v C2
and both u and v acannot be zero codewords. The Hamming weight of z is wH (z) =
wH (u) + wH (v). Since at least one of u and v is nonzero and wH (u) d1 when
u 6= 0n1 , wH (v) d2 when v 6= 0n2 , we have
wH (z) min(d1 , d2 ).
Since z was an arbitrary nonzero codeword, we have
dmin min(d1 , d2 ).
Thus dmin = min(d1 , d2 ).

0000000
0000001
0000010
0000100
0001000
0010000
0100000
1000000

1000011
1000010
1000001
1000111
1001011
1010011
1100011
0000011

0100101
0100100
0100111
0100001
0101101
0110101
0000101
1100101

0010110
0010111
0010100
0010010
0011110
0000110
0110110
1010110

0001111
0001110
0001101
0001011
0000111
0011111
0101111
1001111

1100110
1100111
1100100
1100010
1101110
1110110
1000110
0100110

1010101
1010100
1010111
1010001
1011101
1000101
1110101
0010101

1001100
1001101
1001110
1001000
1000100
1011100
1101100
0001100

0110011
0110010
0110001
0110111
0111011
0100011
0010011
1110011

0101010
0101011
0101000
0101110
0100010
0111010
0001010
1101010

0011001
0011000
0011011
0011101
0010001
0001001
0111001
1011001

1110000
1110001
1110010
1110100
1111000
1100000
1010000
0110000

1101001
1101000
1101011
1101101
1100001
1111001
1001001
0101001

Table 1: Standard array for the code given in Exercise 1

1011010
1011011
1011000
1011110
1010010
1001010
1111010
0011010

0111100
0111101
0111110
0111000
0110100
0101100
0011100
1111100

1111111
1111110
1111101
1111011
1110111
1101111
1011111
0111111

Coset leader
0000000
0000001
0000010
0000100
0001000
0010000
0100000
1000000

Syndrome
000
001
010
100
111
110
101
011

Table 2: Syndrome table for the code given in Exercise 1

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011

Assignment 3 : 20 points

Due date: October 10, 2011

Each of the following exercises is worth 5 points. Every nontrivial step in a proof should
be accompanied by justification.
1. Let g(X) be the generator polynomial of a binary cyclic code of length n.
(a) Show that if g(X) has X + 1 as a factor, the code contains no codewords of odd
weight.
(b) If n is odd and X + 1 is not a factor of g(X), show that the code contains a
codeword consisting of all ones.
(c) Show that the code has a minimum weight of at least 3 if n is the smallest integer
such that g(X) divides X n + 1.
2. (a) For a cyclic code, if an error pattern e(X) is detectable, show that its ith cyclic
shift e(i) (X) is also detectable.
(b) Let v(X) be a code polynomial in a cyclic code of length n. Let i be the smallest
integer such that v (i) (X) = v(X). Show that if i 6= 0, i is a factor of n.
3. Consider a binary (n, k) cyclic code C generated by g(X). Let g (X) = X nk g(X 1 )
be the reciprocal polynomial of g(X).
(a) Show that g (X) also generates an (n, k) cyclic code.
(b) Let C be the cyclic code generated by g (X). Show that C and C have
the same weight distribution. (Hint: If v(X) is a code polynomial in C, then
X n1 v(X 1 ) is a code polynomial in C ).
4. Draw the Meggitt decoder circuit for the (7, 3) binary cyclic code generated by g(X) =
(X + 1)(X 3 + X + 1)

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011

Solution to Assignment 3
1. Let g(X) be the generator polynomial of a binary cyclic code of length n.
(a) Show that if g(X) has X + 1 as a factor, the code contains no codewords of odd
weight.
Solution: Since every code polynomial in a cyclic code is a multiple of the
generator polynomial g(X), every code polynomial has X + 1 as a factor. This
implies that c(1) = 0 for a code polynomial c(X) which in turn requires c(X) to
have an even number of terms. So every codeword is of even weight.
(b) If n is odd and X + 1 is not a factor of g(X), show that the code contains a
codeword consisting of all ones.
Solution: The oddness of n is in fact not required for the existence of a codeword
consisting of all ones. We know that the generator polynomial g(X) divides
X n + 1. We have
a(X)g(X) = X n + 1 = (X + 1)(X n1 + X n2 + + X + 1).

(1)

Since X + 1 appears on the right hand side and is not a factor of g(X), it has
to be a factor of a(X). Let a(X) = (X + 1)b(X). This implies
b(X)g(X) = X n1 + X n2 + + X + 1.

(2)

So g(X) divides X n1 + X n2 + + X + 1 and hence the all ones codeword is


contained in this code.
(c) Show that the code has a minimum weight of at least 3 if n is the smallest integer
such that g(X) divides X n + 1.
Solution: For this question to be well defined n has to be at least 3. In the
minimum weight calculation of a code, we consider only nonzero codewords. So
it is enough to show that weight one and weight two codewords do not exist.
If a weight one codeword exists, its corresponding code polynomial will be of
the form X i for 0 i n 1 which has to be divisible by g(X). The generator
polynomial of a cyclic code has a nonzero constant term. We have g(X) 6= 1
because otherwise g(X) would divide X + 1 which is not equal to X n + 1 for
n 3. So g(X) has at least two terms which implies that any polynomial
multiple of g(X) has at least two terms. Thus X i cannot be a multiple of g(X).
In fact, X i and g(X) have no factors in common because if they do the common
factor will have to be of the form X j for 1 j i. Such a factor has zero as a
root but zero is not a root of g(X) because it has a nonzero constant term.

If a weight two codeword exists, its corresponding code polynomial will be of


the form X i + X j for 0 i < j n 1 which has to be divisible by g(X). So
X j (X ij + 1) has to be divisible by g(X). Since g(X) and X j have no factors
in common, X ij + 1 has to be divisible by g(X) but this is not possible since
i j n 1.
Since no weight one or two codewords exist, the minimum weight is at least
three.
2. (a) For a cyclic code, if an error pattern e(X) is detectable, show that its ith cyclic
shift e(i) (X) is also detectable.
Solution: If an error pattern e(X) is detectable, e(X) 6= 0 mod g(X). The ith
cyclic shift e(i) (X) is equal to X i e(X) mod X n + 1 where n is the blocklength
of the cyclic code. Let a(X) be the quotient when X i e(X) is divided by X n + 1.
Then X i e(X) = a(X)(X n + 1) + e(i) (X) which implies e(i) (X) = X i e(X) +
a(X)(X n + 1). If we divide both sides by g(X), we get
e(i) (X) mod g(X) = X i e(X)
= X i e(X)

mod g(X) + a(X)(X n + 1) mod g(X)


mod g(X)

where the second equality is obtained by the fact that g(X) divides X n + 1. The
error pattern e(i) (X) is undetectable if and only if e(i) (X) mod g(X) is equal
to zero which happens if and only if X i e(X) mod g(X) is equal to zero. Since
g(X) and X i have no factors in common (see solution to question 1(c)), g(X)
would need to divide e(X). But this is not possible as e(X) mod g(X) is not
equal to zero.
(b) Let v(X) be a code polynomial in a cyclic code of length n. Let i be the smallest
integer such that v (i) (X) = v(X). Show that if i 6= 0, i is a factor of n.
Solution: Since n cyclic shifts of a codeword of length n returns the codeword
to the initial state, v (n) (X) = v(X). If i is not a factor of n, divide n by i to get
a quotient q and remainder r (0 r < i), n = qi + r. We get
v(X) = v (n) (X) = v (qi+r) (X) = v (i+[q1]i+r)(X) = v ([q1]i+r) (X) = = v (r) (X)
Since i is the smallest integer such that v(X) = v (i) (X) and 0 r < i, we must
have r = 0. Thus i divides n.
3. Consider a binary (n, k) cyclic code C generated by g(X). Let g (X) = X nk g(X 1 )
be the reciprocal polynomial of g(X).
(a) Show that g (X) also generates an (n, k) cyclic code.
Solution: Since any polynomial which divides X n + 1 generates an (n, k) cyclic
code, we need to prove that g (X) divides X n +1. Since g(X) generates an (n, k)
cyclic code it has degree n k and it divides X n + 1. Let g(X)h(X) = X n + 1
where the degree of h(X) is k. We get
g(X 1 )h(X 1 ) = X n + 1
X n g(X 1 )h(X 1 ) = X n (X n + 1) = 1 + X n
X nk g(X 1)X k h(X 1 ) = 1 + X n .
2

Both X nk g(X 1 ) and X k h(X 1 ) are polynomials in X since g(X) has degree
n k and h(X) has degree k. From the above expression, we see that g (X) =
X nk g(X 1 ) divides X n + 1 and as a consequence it generates an (n, k) cyclic
code.
(b) Let C be the cyclic code generated by g (X). Show that C and C have
the same weight distribution. (Hint: If v(X) is a code polynomial in C, then
X n1 v(X 1 ) is a code polynomial in C ).
Solution: Any codeword in C corresponds to a code polynomial v(X) =
u(X)g(X) where the degree of u(X) is at most k 1. The number of terms
in v(X) corresponds to the weight of the corresponding codeword. The polynomial X n1 v(X 1 ) has the same number of terms as v(X) albeit in reverse order.
We will show that for every code polynomial in C there is a code polynomial in
C with the same number of terms. This will in turn prove that for every codeword in C there is an equal weight codeword in C . So the weight distributions
of these two codes will have to be the same. We have
v(X)
X v(X 1 )
X n1 v(X 1 )
X n1 v(X 1 )
n1

=
=
=
=

u(X)g(X)
X n1 u(X 1 )g(X 1)
X k1 u(X 1 )X nk g(X 1)
X k1 u(X 1 )g (X)

Since the degree of u(X) is at most k 1, X k1 u(X 1) is a polynomial. Thus


X n1 v(X 1 ) is a polynomial multiple of g (X). It is thus a code polynomial in
C . So for every code polynomial in C there is a code polynomial in C .
4. Draw the Meggitt decoder circuit for the (7, 3) binary cyclic code generated by g(X) =
(X + 1)(X 3 + X + 1)
Solution: For the Meggitt decoder, we need to identify all correctable error patterns
which have a one in the last location, i.e. the corresponding polynomial representation
has the term X 6 . For this code n = 7 and k = 3, so there are 2nk = 24 = 16
correctable error patterns. These can be found by constructing the standard array.
First we calculate the eight codewords and find that the minimum weight of the
nonzero codewords is four. So if we take weight one coset leaders the cosets will
contain vectors of weight at least three. So after we choose all weight one vectors as
coset leaders we are free to choose any weight two vector as a coset leader for the
ninth coset because it has not appeared so far in the standard array. But we choose
those weight two vectors as coset leaders which have a one in the last location so that
the Megitt decoder can immediately correct it. When weight two vectors are chosen
as coset leaders other weight two vectors can appear in the coset and hence care must
be taken to make sure
 that they are not chosen as coset leaders for the subsequent
7
cosets. There are 2 = 21 weight two vectors of length 7 and they all appear within
the first 15 cosets. For the last coset, the coset leader has to be of weight three and
we choose it to be 0100011 because it has a one in the last location. We could also
have chosen 0001101 or 1010001.
Once we have constructed the standard array, we see that the coset leaders of cosets
2, 9, 10, 11, 12, 13, 14 and 16 have a one in the last location i.e. their corresponding
3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

0000000
0000001
0000010
0000100
0001000
0010000
0100000
1000000
0000011
0000101
0001001
0010001
0100001
1000001
0100010
0100011

1011100
1011101
1011110
1011000
1010100
1001100
1111100
0011100
1011111
1011001
1010101
1001101
1111101
0011101
1111110
1111111

0101110
0101111
0101100
0101010
0100110
0111110
0001110
1101110
0101101
0101011
0100111
0111111
0001111
1101111
0001100
0001101

0010111
0010110
0010101
0010011
0011111
0000111
0110111
1010111
0010100
0010010
0011110
0000110
0110110
1010110
0110101
0110100

1110010
1110011
1110000
1110110
1111010
1100010
1010010
0110010
1110001
1110111
1111011
1100011
1010011
0110011
1010000
1010001

1001011
1001010
1001001
1001111
1000011
1011011
1101011
0001011
1001000
1001110
1000010
1011010
1101010
0001010
1101001
1101000

0111001
0111000
0111011
0111101
0110001
0101001
0011001
1111001
0111010
0111100
0110000
0101000
0011000
1111000
0011011
0011010

1100101
1100100
1100111
1100001
1101101
1110101
1000101
0100101
1100110
1100000
1101100
1110100
1000100
0100100
1000111
1000110

polynomials have a X 6 term. So the error pattern detection circuit of the Megitt
decoder should output a one when the syndromes corresponding to these coset leaders
appears in the syndrome register. The truth table of the error pattern detection circuit
is given in the last two columns of the following table. If the syndrome is represented
as the bit string abcd, using Karnaugh map minimization we get the error pattern
detection circuit to be equal to bd + (b + c)(a
c+a
c).

Coset leader
1
0
2
X6
3
X5
4
X4
5
X3
6
X2
7
X
8
1
9
X6 + X5
10
X6 + X4
11
X6 + X3
12
X6 + X2
13
X6 + X
14
X6 + 1
15
X5 + X
16 X 6 + X 5 + X

Syndrome
Syndrome (binary)
0
0000
3
2
X +X +X
0111
2
X +X +1
1110
X3 + X2 + 1
1011
3
X
0001
2
X
0010
X
0100
1
1000
X3 + 1
1001
X +1
1100
2
X +X
0110
X3 + X
0101
3
2
X +X
0011
X3 + X2 + X + 1
1111
2
X +1
1010
3
X +X +1
1101

0
1
0
0
0
0
0
0
1
1
1
1
1
1
0
1

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011

Assignment 4 : 20 points

Due date: November 11, 2011

Each of the following exercises is worth 5 points. Every nontrivial step in a proof should
be accompanied by justification.
1. Let F16 be the field generated by p(X) = 1 + X + X 4 . Let be a primitive element
of F16 which is a root of p(X). Devise a circuit which is capable of multiplying any
element in F16 by 7 .
2. Consider a t-error-correcting binary BCH code of length n = 2m 1. If 2t+1 is a factor
of n, prove that the minimum distance of the code is exactly2t + 1. You can assume
the BCH bound in your solution (dmin 2t + 1). (Hint: Let n = l(2t + 1). Show
n +1
is a code polynomial of weight 2t + 1. Remember that a code polynomial
that XX l +1
2
has , , . . . , 2t as roots where is a primitive element of F2m which has order
n = 2m 1.)
3. Prove that the dual of a Reed-Solomon code is a Reed-Solomon code. (Hint: The
dual code of an (n, k) cyclic code with generator polynomial g(X) has generator
n 1
polynomial X k h(X 1 ) where h(X) = Xg(X)
.)


4. Consider a (2, 1) convolutional code with encoder matrix G(D) = 1 + D 2 1 + D + D 2 + D 3 .
(a) Draw the encoder circuit.
(b) Draw the encoder state diagram.
(c) Is this encoder catastrophic? If yes, find an infinite weight information sequence
which generates a codeword of finite weight.

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011
Solution to Assignment 4
1. Let F16 be the field generated by p(X) = 1 + X + X 4 . Let be a primitive element
of F16 which is a root of p(X). Devise a circuit which is capable of multiplying any
element in F16 by 7 .
Solution: Any element in the field F16 can be represented as a0 + a1 + a2 2 + a3 3 .
If we multiply this element by 7 , we get the element a0 7 + a1 8 + a2 9 + a3 10 .
We have the following identities.
7 = 3 + + 1
8 = 2 + 1
9 = 3 +
10 = 2 + + 1
Using these identities, the product can be written as
a0 7 + a1 8 + a2 9 + a3 10 = a0 (3 + + 1) + a1 (2 + 1) + a2 (3 + ) + a3 (2 + + 1)
= a0 + a1 + a3 + (a0 + a2 + a3 ) + (a1 + a3 )2 + (a0 + a2 )3
The circuit for multiplication by 7 can be now obtained by taking a register containing a0 , a1 , a2 , a3 and using XOR gates to obtain a0 + a1 + a3 , a0 + a2 + a3 , a1 + a3
and a0 + a2 .
2. Consider a t-error-correcting binary BCH code of length n = 2m 1. If 2t+1 is a factor
of n, prove that the minimum distance of the code is exactly2t + 1. You can assume
the BCH bound in your solution (dmin 2t + 1). (Hint: Let n = l(2t + 1). Show
n +1
that XX l +1
is a code polynomial of weight 2t + 1. Remember that a code polynomial
2
has , , . . . , 2t as roots where is a primitive element of F2m which has order
n = 2m 1.)
Solution: Since the BCH bound gives us dmin 2t + 1, we will be done if we can
show the existence of a codeword whose weight is equal to 2t + 1. Let Y = X l . The
we have the following identities.
X l(2t+1) + 1
Y 2t+1 + 1
Xn + 1
=
=
= 1 + Y + Y 2 + + Y 2t
Xl + 1
Xl + 1
Y +1
= 1 + X l + X 2l + + X 2tl
So we can see that c(X) =

X n +1
X l +1

c() =

is a polynomial of weight 2t + 1. We have


n + 1
1+1
= l
= 0.
l
+1
+1

The above calculation is valid since the denominator l + 1 6= 0 due to the fact that
l < n = 2m 1 and has order 2m 1 (note that t 1). Similarly, we get
c(i ) =

ni + 1
1+1
= li
=0
li
+1
+1

for i = 2, 3, . . . , 2t since 2tl < n. Hence c(X) is a codeword of weight 2t + 1.


3. Prove that the dual of a Reed-Solomon code is a Reed-Solomon code. (Hint: The
dual code of an (n, k) cyclic code with generator polynomial g(X) has generator
n 1
.)
polynomial X k h(X 1 ) where h(X) = Xg(X)
Solution: Consider a t-error correcting Reed-Solomon code over a field Fq .Q
Then the
length of the codewords is n = q 1. It has a generator polynomial Q
g(X) = 2t
i=1 (X
q2
(X i ) and
i ) where is a primitive element of Fq . In any field X q1 1 = i=0
consequently we have
q1
q2
Y
Y
Xn 1
X q1 1
i
h(X) =
(X i )
(X ) =
=
= (X 1)
g(X)
g(X)
i=2t+1
i=2t+1

since q1 = 1. Here the degree of h(X) is k (remember that the degree of the
generator polynomial of an (n, k) cyclic code is nk). Then the generator polynomial
of the dual code is given by
k

X h(X

q1
Y

)=

(1 i X).

i=2t+1

Since q1 = 1, the generator polynomial of the dual code has roots q2t2 , q2t1 ,
. . ., q1 . Thus the dual code is a Reed-Solomon code (see comment in Moodle for
the definition of a general RS code).


4. Consider a (2, 1) convolutional code with encoder matrix G(D) = 1 + D 2 1 + D + D 2 + D 3 .
(a) Draw the encoder circuit.
(b) Draw the encoder state diagram.
(c) Is this encoder catastrophic? If yes, find an infinite weight information sequence
which generates a codeword of finite weight.
Solution: The encoder is catastrophic since the greatest common divisor of
the polynomials is 1 + D 2 which is not of the form D l . Consider the all ones
infinite length information sequence whose polynomial representation is given
1
. The output corresponding to this input is
by 1 + D + D 2 + D 3 + = 1+D


1
v(D) = 1+D G(D) = 1 + D 1 + D 2 .

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011

Quiz 1 : 15 points

Duration: 60 minutes

Each of the following questions is worth 5 points. Every nontrivial step in a proof
should be accompanied by justification.
1. Find the smallest binary linear block code which contains the following codewords
{100101, 110010, 010111, 001011}. Find a systematic generator matrix for this code.
What is the minimum distance of this code?
2. Let C1 and C2 be two linear block codes of same length n.
(a) Show that C1 C2 is a linear code.
(b) Show that C1 C2 is a linear code if and only if either C1 C2 or C2 C1 .
3. Show that in every binary linear block code either all the codewords have even Hamming
weight. Hint:
Pn weight or exactly half of the codewords have even Hamming
T
i=1 vi = 0 for a codeword v of even weight or equivalently v 1 = 0 where 1 is the
1 n vector containing all ones.

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011

Quiz 2 : 10 points

Duration: 60 minutes

Every nontrivial step in a proof should be accompanied by justification.


1. Let m be a positive integer. If m is not a prime, prove that the set {1, 2, 3, . . . , m 1}
is not a group under modulo-m multiplication.
[2 points]
2. Prove that a group G cannot have a subgroup H with |H| = n1, where n = |G| > 2.
[2 points]
3. Prove that a nonzero finite field element satisfies m = 1 for some positive integer
m if and only if m is divisible by the order of .
[3 points]
4. Construct a finite field F8 with 8 elements. You have to write down the addition and
multiplication tables for this field.
[3 points]

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011

Quiz 3 : 10 points

Duration: 60 minutes

1. (a) Using the field F16 generated by the primitive polynomial p(X) = X 4 + X 3 + 1,
determine the generator polynomial of the double error correcting binary BCH
code of length 15. The power and remainder representations of the field elements
in F16 in terms of a primitive element are given below.
[3 points]
0
1

2
3
4
5
6
7
8
9
10
11
12
13
14

0
1

2
3
3 + 1
3 + + 1
3
+ 2 + + 1
2 + + 1
3 + 2 +
2 + 1
3 +
3 + 2 + 1
+1
2 +
3 + 2

(b) Suppose for the BCH code described above the error locator polynomial found
by the Berlekamp-Massey algorithm is (X) = 1 + 10 X + 12 X 2 . If the all
zeros codeword was sent, determine a received vector r = r0 r1 rn1
which results in this error locator polynomial.
[3 points]
2. Determine the generator polynomial of a double error correcting Reed-Solomon code
with symbols from F16 . Assume a primitive element for F16 whose minimal polynomial is p(X) = X 4 + X 3 + 1 (you can use the table above for calculations involving
). What is the codeword corresponding to the following information bits?
[4
points]


u = 0001 0001 0000 0000 0000

EE 605: Error Correcting Codes


Instructor: Saravanan Vijayakumaran
Indian Institute of Technology Bombay
Autumn 2011
Midsemester Exam : 30 points

Duration: 120 minutes

Each of the following questions is worth 5 points.


1. Construct the standard array and syndrome decoding table for the (6, 3) binary linear
block code with generator matrix

1 0 0 0 1 1
0 1 0 1 0 1
0 0 1 1 1 0
Decode the following received vectors using the syndrome table generated.
(a) 110110
(b) 110111
(c) 110001
2. Consider a binary linear code with generator

1 1 0 0

G= 0 0 1 1
0 0 0 0

matrix

0 0
0 0
1 1

Suppose N codewords from this code are sent over a binary symmetric channel with
crossover probability p. What is the probability that no undetected errors occur
during this transmission?
3. State and prove the Singleton bound for binary block codes.
4. Let C1 be an (n, k1 ) binary linear block code with minimum distance d1 and let C2 be
an (n, k2 ) binary linear block code with minimum distance d2 . Consider the following
set of 2n-tuples
C = {(u, u + v)|u C1 , v C2 }.
Prove that the set C is a binary linear block code with dimension k = k1 + k2 and
minimum distance dmin = min{2d1 , d2 }.
5. Let C1 and C2 be two cyclic codes of same length n with generator polynomials g1 (X)
and g2 (X) respectively. Show that C1 C2 if and only if g2 (X) divides g1 (X).
6. Let C1 and C2 be two cyclic codes of same length n with generator polynomials g1 (X)
and g2 (X) respectively. Show that C1 C2 is a cyclic code. What is its generator
poynomial?

You might also like