0% found this document useful (0 votes)
199 views12 pages

HW 3

This document summarizes a session on coding theory and cryptography that covers bounds on codes, perfect codes, and cyclic codes. It provides readings and practice problems from various sources on these topics, including introductory coding theory via Hamming codes, bounds and properties of codes, and cyclic codes. Specific problems covered include finding bounds on code size, decoding using Hamming codes, evaluating polynomials modulo generator polynomials, and finding codewords with certain properties under cyclic shifts.

Uploaded by

api-484620426
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
199 views12 pages

HW 3

This document summarizes a session on coding theory and cryptography that covers bounds on codes, perfect codes, and cyclic codes. It provides readings and practice problems from various sources on these topics, including introductory coding theory via Hamming codes, bounds and properties of codes, and cyclic codes. Specific problems covered include finding bounds on code size, decoding using Hamming codes, evaluating polynomials modulo generator polynomials, and finding codewords with certain properties under cyclic shifts.

Uploaded by

api-484620426
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Coding Theory and Cryptography: Session 3

Paridhi Latawa

March 16, 2021

Abstract

This material covers bounds on codes, perfect codes, and cyclic codes.
Readings and practice problems covered are the following.

1. Module: Intro to Coding Theory via Hamming Codes. Problems: 22, 23,
25, 26.

2. Hankerson Section 3.1 - 3.7 and Chapter 4. Problems: 3.1.5ace, 3.3.10,


4.1.20, 21, 4.2.9, 4.3.4, 4.4.9, 4.5.5e.

3. Trappe and Washington Section 18.7. Problems: 12 and 13 on page


447.

4. Magma Software [separate HW doc]

1 Module: Intro to Coding Theory via Hamming Codes


22. Consider the code from Problem 7, that is C = 1010, 0101, 1111. Give an
example of a vector that has the same distance to more than one codeword.
The vector 1111 has the same distance to both 1010 and 01010.
d(1111, 1010) = d(1111, 0101) = 2.

23. Let C be a code with an even minimum distance. Show that there exists a
vector that has the same distance to more than one codeword.
Assume a code of length n, where n > 2. As the minimum distance is even, d = 2m
where m is any integer m ≥ 1. For c to be linear, there must be a codeword that
consists of all ones.

1
Assuming n = 3, the codewords with an even number of ones is 3c2 , which comes
out to be 3, or 2m + 1 generalized.

These 3 codewords will be at equal distance from the codeword with all ones.

Assume c = 000, 011, 110, 101, 111, where there is an even minimum distance
(meaning the weight is even).

d(111, 011) = 1 d(011, 110) = 2


d(111, 110) = 1 d(011, 101) = 2
d(111, 1010) = 1

For any codeword with even weight, 011, 110, or101, they will have the same dis-
tance to more than one codeword.
25. Show that the [6, 3, 3] is not perfect and [7, 4, 3] Hamming code is perfect using
the sphere packing bound.
For a code C of length n and odd distance d = 2t + 1 to be
 perfect, C needs to
attain the Hamming bound. This means that |C| ∗ n0 + n1 + ... + nt ≤ 2n
For [6, 3, 3], we get
23 ∗ 60 + 61 ≤ 26
 

Simplifying, we get:
23 ∗ 1 + 6 ≤ 26
As the left side is less than and doesn’t equal 26 , [6, 3, 3] is not perfect.
For [7, 4, 3], we get
24 ∗ 70 + 71 ≤ 27
 

24 ∗ 1 + 7 ≤ 27
24 ∗ 23 ≤ 27
27 = 27
Thus, [7, 4, 3] is perfect.
26. Show that the general Hamming codes are all perfect.
For a code C of length n and odd distance d = 2t + 1 to be perfect, C needs to
n
attain the Hamming bound. This means that |C| = n + n2 +...+ n
(0) (1) (t)

2
As per Hankerson section 3.3 page 73, we know that a Hamming code has a dis-
tance d = 3 and dimension n = 2r − 1. So, d = 3 = 2t + 1 gives us t = 1.

2n
Inputting this into the Hamming bound, we get:
(n0 )+...+(nt)
2n
As t = 1, we get
(n0 )+...+(n1 )
r
22 −1
As n = 2r − 1 and simplifying further, we get 1+n
r
22 −1
Inputting the value for n in the denominator, we get 1+2r −1

r −1−r
Simplifying further, we get 22
This confirms that any perfect code that has the length and distance mentioned
r
above, which are characteristic of Hamming codes, has exactly 22 −1−r codewords.
This is also a power of 2, so the general Hamming codes are all perfect.

2 Sections 3.1 - 3.7 and Chapter 4 of Hankerson


3.1.5: Find an upper bound for the size or dimension of a linear code with the
given values of n and d.

a. n = 8, d = 3

From d = 3 = 2t + 1, we get t = 1.
n 28 256 256

The Hamming bound gives |C| ≤ = = = .
t (80)+(81) 1+8 9

But |C| must be a power of 2, so |C| ≤ 16, and thus k ≤ 4.


So the upper bound for the size or dimension of a linear code with these values of
n and d is 24 .

b. n = 7, d = 3

From d = 3 = 2t + 1, we get t = 1.
n 27 128 128

The Hamming bound gives |C| ≤ = 7 = = .
t ( 0 )+(71) 1+7 8

This equals 16, which agrees with the condition that |C| must be a power of 2, so
|C| ≤ 16, and thus k ≤ 4.
So, the upper bound for the size or dimension of a linear code with these values

3
of n and d is 24 .

e. n = 15, d = 5

From d = 5 = 2t + 1, we get t = 2.
n 21 5 32768 32768

The Hamming bound gives |C| ≤ = = = .
t (150)+(151)+(152) 1+15+105 121

But |C| must be a power of 2, so |C| ≤ 256, and thus k ≤ 8.


So the upper bound for the size or dimension of a linear code with these values of
n and d is 28 .
3.3.10. Use the Hamming code of length 7 in Example 3.3.1 and the message
assignment in Exercise 2.6.12. Decode the message received: 1010111, 0110111,
1000010, 0010101, 1001011, 0010000, 1111100.
As per Example 3.3.1, we know a possibility
 for a parity check matrix for the
1 1 1
1 1 0
 
1 0 1
 
Hamming code of length 7(r = 3) is H = 
0 1 1 

1 0 0
 
0 1 0
0 0 1
The syndrome of wH = 1010111H = 101, which is the third row of H. Thus
the coset leader u is the third row of I7 : u = 0010000. Thus w is decoded as
w + u = 1000111.
The syndrome of wH = 0110111H = 100, which is the fifth row of H. Thus
the coset leader u is the fifth row of I7 : u = 0000100. Thus w is decoded as
w + u = 0110011.
The syndrome of wH = 1000010H = 101, which is the third row of H. Thus
the coset leader u is the third row of I7 : u = 0010000. Thus w is decoded as
w + u = 1010010.
The syndrome of wH = 0010101H = 000. This element is not any row of H.
Thus, it is not decodable.
The syndrome of wH = 1001011H = 111, which is the first row of H. Thus
the coset leader u is the first row of I7 : u = 1000000. Thus w is decoded as
w + u = 0001011.
The syndrome of wH = 0010000H = 101, which is the third row of H. Thus

4
the coset leader u is the third row of I7 : u = 001000. Thus w is decoded as
w + u = 0000000. This is A.
The syndrome of wH = 1111100H = 011, which is the fourth row of H. Thus
the coset leader u is the fourth row of I7 : u = 0001000. Thus w is decoded as
w + u = 1110100.
4.1.20: Let h(x) = 1 + x7 . Compute f (X)modh(x) and p(x)modh(x), and decide
whether f (X) ≡ p(x)(modh(x)).
a) f (x) = 1 + x3 + x8 , p(x) = x + x3 + x7
f (x)modh(x) = (1 + x3 + x8 )mod(1 + x7 ).r(x) = x3 − x + 1
p(x)modh(x) = x + x3 + x7 mod(1 + x7 ), r(x) = x3 + x − 1
f (x)and ≡ p(x)(modh(x)) if and only if they have the same remainder when
divided by h(x)
Both have the same remainder r(X), so f (x)and ≡ p(x)(modh(x))
b) f (x) = x + x5 + x9 , p(x) = x + x5 + x6 + x1 3
f (x)modh(x) = (x + x5 + x9 )mod(1 + x7 ).r(x) = x5 − x2 + x
p(x)modh(x) = x + x5 + x6 + x1 3mod(1 + x7 ), r(x) = x5 + x
Both do not have the same remainder so f (x) is not equivalent to p(x)
c) f (x) = 1 + x, p(x) = x + x7
f (x)modh(x) =(1 + x)mod(1 + x7 ). r(x) = 0
p(x)modh(x) = x + x7 mod(1 + x7 ), r(x) = x − 1
Both do not have the same remainder so f (x) is not equivalent to p(x)
4.1.21: Let h(x) = 1 + x7 . Compute (f (x) + g(x)) mod h(x) and (f (x)g(x)) mod
h(x), where a) f (x) = 1 + x6 + x8 , g(x) = 1 + x
f (x) + g(x) = x8 + x6 + x + 2 (f (x) + g(x)) mod h(X) = x6 + 2 = r(x)
f (X)g(x) = x9 + x8 + x7 + x6 + x + 1 (f (x)g(x)) mod h(X) = x6 − x2 = r(x)
b) f (x) = 1 + x5 + x9 , g(x) = x + x2 + x7
f (x) + g(x) = 1 + x + x2 + x5 + x7 + x9 (f (x) + g(x)) mod h(X) = x5 + x = r(x)
f (X)g(x) = x16 + x12 + x11 + x10 + 2x7 + x6 + x2 + x (f (x)g(x)) mod h(X) =
x6 − x5 − x4 − x3 + 2x2 + x − 2 = r(x)

5
c) f (x) = 1 + x4 + x5 , g(x) = 1 + x + x2
f (x)+g(x) = x5 +x4 +x2 +x+2 (f (x)+g(x)) mod h(X) = x5 +x4 +x2 +x+2 = r(x)
f (X)g(x) = x7 + 2x6 + 2x5 + x4 + x2 + x + 1 (f (x)g(x)) mod h(X) = 2x6 + 2x5 +
x4 + x2 + x = r(x)
4.2.9: Find all words v of length 6 such that a) pi2 (v) = v v = 000000, 101010, 010101, 110011, 001100,
b) pi3 (v) = v v = 000000, 0110110, 001001, 100100, 111111
4.3.4) Let g(x) = 1 + x2 + x3 be the generator polynomial of a linear cyclic code
of length 7.
a) Encode the following message polynomials: 1 + x3 , x, x + x2 + x3 k = 4 a(x) =
1 + x3 .c(x) = a(x)g(x)c(x) = (1 + x3 )(1 + x2 + x3 ) = 1 + x2 + 2x3 + x5 + x6 So,
c = 1010011
a(x) = x.c(x) = a(x)g(x)c(x) = (x)(1 + x2 + x3 ) = x + x3 + x4 So, c = 0101100
a(x) = x + x2 + x3 c(x) = a(x)g(x)c(x) = (x + x2 + x3 )(1 + x2 + x3 ) = x + x2 +
2x3 + 2x4 + 2x5 + x6 So, c = 1100010
b) Find the message polynomial corresponding to the codewords c(x) : x2 + x4 +
x5 , 1 + x + x2 + x4 , x2 + x3 + x4 + x6
If c(x) = x2 +x4 +x5 , the corresponding message polynomial is c(x)/g(x) = a(x) =
x2 . So, c = 0010
If c(x) = 1 + x + x2 + x4 , the corresponding message polynomial is c(x)/g(x) =
a(x) = −1 + x with a remainder of 2x2 + 2. So, c = 1100
If c(x) = x2 + x3 + x4 + x6 , the corresponding message polynomial is c(x)/g(x) =
a(x) = −2 + 2x − x2 + x3 with a remainder of 4x2 − 2x + 2. So, c = 0011
4.4.9. Find a generator and a generating matrix for a linear code of length n and
dimension k where
a) n = 12, k = 5 1 + x12 factored is (1 + x6 )2 = (x4 + 1)(x8 − x4 + 1). So, one
generator for this linear code is simply x4 + 1.
One generator matrix is the one in which the rows are the codewords that corre-
spond to the generator polynomial and its first k − 1 cyclic shifts.
The generator matrix has size k x n
So if g(x) = x4 + 1, this is also the same as 100010000000.
xg(x) = 1x + x5 = 010001000000.

6
x2 g(x) = 1x2 + x6 = 001000100000.
x3 g(x) = 1x3 + x7 = 000100010000.
x4 g(x) = 1x4 + x8 = 000010001000
   
g(x) 100010000000
 xg(x)  010001000000
 2   
x3 g(x) = 001000100000
So a generating matrix for C is G =    
x g(x) 000100010000
x4 g(x) 000010001000
b) n = 12, k = 7 1 + x12 factored is (1 + x6 )2 = (x4 + 1)(x8 − x4 + 1). So, one
generator for this linear code is simply x4 + 1.
One generator matrix is the one in which the rows are the codewords that corre-
spond to the generator polynomial and its first k − 1 cyclic shifts.
The generator matrix has size k x n
So if g(x) = x4 + 1, this is also the same as 100010000000.
xg(x) = 1x + x5 = 010001000000.
x2 g(x) = 1x2 + x6 = 001000100000.
x3 g(x) = 1x3 + x7 = 000100010000.
x4 g(x) = 1x4 + x8 = 000010001000
x5 g(x) = 1x5 + x9 = 000001000100
x6 g(x) = 1x6 + x1 0 = 000000100010
   
g(x) 100010000000
 xg(x)  010001000000
 2   
x g(x) 001000100000
 3   
So a generating matrix for C is G = x
 4 g(x) = 000100010000
  
x g(x) 000010001000
 5   
x g(x) 000001000100
x6 g(x) 000000100010
c) n = 14, k = 5 1+x14 factored is (1+x7 )2 = (x2 +1)(x1 2−x1 0+x8 −x6 +x4 −x2 +1).
So, one generator for this linear code is simply x2 + 1.
One generator matrix is the one in which the rows are the codewords that corre-
spond to the generator polynomial and its first k − 1 cyclic shifts.
The generator matrix has size k x n

7
So if g(x) = x2 + 1, this is also the same as 10100000000000.
xg(x) = x3 + 1x = 01010000000000
x2 g(x) = x4 + 1x2 = 00101000000000
x3 g(x) = x5 + 1x3 = 00010100000000
x4 g(x) = x6 + 1x4 = 00001010000000
   
g(x) 10100000000000
 xg(x)  01010000000000
 2   
So a generating matrix for C is G = x
 3 g(x)  = 00101000000000
  
x g(x) 00010100000000
x4 g(x) 00001010000000
d) n = 14, k = 6
1 + x14 factored is (1 + x7 )2 = (x2 + 1)(x1 2 − x1 0 + x8 − x6 + x4 − x2 + 1). So, one
generator for this linear code is simply x2 + 1.
One generator matrix is the one in which the rows are the codewords that corre-
spond to the generator polynomial and its first k − 1 cyclic shifts.
The generator matrix has size k x n
So if g(x) = x2 + 1, this is also the same as 10100000000000.
xg(x) = x3 + 1x = 01010000000000
x2 g(x) = x4 + 1x2 = 00101000000000
x3 g(x) = x5 + 1x3 = 00010100000000
x4 g(x) = x6 + 1x4 = 00001010000000
x5 g(x) = x7 + 1x5 = 00000101000000
   
g(x) 10100000000000
 xg(x)  01010000000000
 2   
x g(x) 00101000000000
So a generating matrix for C is G =  3

 = 00010100000000
  
x
 4 g(x)  
x g(x) 00001010000000
x5 g(x) 00000101000000
e) n = 14, k = 8 1+x14 factored is (1+x7 )2 = (x2 +1)(x1 2−x1 0+x8 −x6 +x4 −x2 +1).
So, one generator for this linear code is simply x2 + 1.
One generator matrix is the one in which the rows are the codewords that corre-
spond to the generator polynomial and its first k − 1 cyclic shifts.

8
The generator matrix has size k x n
So if g(x) = x2 + 1, this is also the same as 10100000000000.
xg(x) = x3 + 1x = 01010000000000
x2 g(x) = x4 + 1x2 = 00101000000000
x3 g(x) = x5 + 1x3 = 00010100000000
x4 g(x) = x6 + 1x4 = 00001010000000
x5 g(x) = x7 + 1x5 = 00000101000000
x6 g(x) = x8 + 1x6 = 00000010100000
x7 g(x) = x9 + 1x7 = 00000001010000
   
g(x) 10100000000000
 xg(x)  01010000000000
 2   
x g(x) 00101000000000
 3   
x g(x) 00010100000000
So a generating matrix for C is G =  4
   
x
 5 g(x)

00001010000000
 
x g(x) 00000101000000
 6   
x g(x) 00000010100000
x7 g(x) 00000001010000
4.5.5: Find the generator polynomial for the dual code of the cyclic code of length
n having generator polynomial g(x) where:
e) n = 15, g(x) = 1 + x + x4
1+x15
1+x+x4
= x11 − x8 − x7 + x5 + 2x4 + x3 − x2 − 3x − 3 = h(x)
The dual code generator polynomial would be xn h(x−1 ), when computed taking
the values from above. This is called the reciprocal of H.
This could be inputted into Magma as a calculation.
So,
h(X) = (x1 5 − 1)/g(x). We can verify that G is a divisor of H by taking the
modulus. When conducted, the result is 0, confirming that it is a divisor.

3 Trappe and Washington Section Page 447


12. Let g(x) = 1 + x + x3 be a polynomial with coefficients in Z2 a) Show that
g(x) is a factor of x7 − 1 in Z2 [x]

9
x7 −1
1+x+x3
= x4 − x2 − x + 1, with a remainder
b) The polynomial g(x) is the generating polynomial for a cyclic code [7, 4] code
C. Find the generating matrix for C.
Knowing n = 7 and k = 4, we can conduct the following algorithm to get the
generating matrix. g(x) = 1 + x + x3 = 1101000
xg(x) = 1x + x2 + x4 = 0110100
x2 g(x) = 1x2 + x3 + x5 = 0011010
x3 g(x) = 1x3 + x4 + x6 = 0001101
   
g(x) 1101000
 xg(x)  0110100
So a generating matrix G = x2 g(x) = 0011010
  

x3 g(x) 0001101
c) Find a parity check matrix H for C.
 
1101000
0110100
From part a, we get the generator matrix G =  
0011010
0001101
 
1000 110
  0100 011
Row reducing the generator matrix, we get G = Ik P = 
0010 111


0001 101
The standard definition of a parity check matrix is H = [−P T |In−k ]
 
1011 100
Applying these transformations to the generator matrix, we get H = 1110 010
0111 001
 
1101000
0110100
d) Show that G0 H T = 0, where G0 = = 0011010

0111001

10
 
110
011
   
1011 100 111
 
T
101
H = 1110 010 The transpose of H is H = 

0111 001 100
 
010
001
 
110
  011
1101000  
111
0110100  
G0 H T = 
0011010 101 = 0
 
100
0111001  
010
001
e) Show that the rows of G0 generate C
G0 has the same first three rows as G, and the last row is generated by the linear
combination of row two and four from G. The generator matrix is the basis of the
linear code, so G0 is a generator matrix for C.
f) Show that a permutation of the columns of G0 gives the generating matrix for
the Hamming [7, 4] code, and therefore these two codes are equivalent.
We know that n = 7 and k = 4 So, we can find irreducible factors of 1 + x7 , which
are (x + 1)(x6 − x5 + x4 − x3 + x2 − x + 1)
So, one generator for this linear code is x + 1
A generator matrix is a matrix in which the rows are the codewords that correspond
to the generator polynomial and its first k − 1 cyclic shifts.
The generator matrix has size k x n
So if g(x) = x + 1, this is also the same as 1100000.
xg(x) = x3 + 1x = 0110000
x2 g(x) = x4 + 1x2 = 0011000
x3 g(x) = x5 + 1x3 = 0001100
  
g(x) 1100000
 xg(x)  0110000
x2 g(x) 0011000 This row reduces to the
So a generating matrix for C is G =   

x3 g(x) 0001100

11
 
1000100
0100100
matrix  
0010100
0001100
The G0 , when arranged such that I4 is the beginning four columns, will form
a generating matrix. While this will not match the above generating matrix, a
Hamming code can have multiple generating matrices.
13. Let C be the cyclic binary code of length 4 with generating polynomial g(x) =
x2 + 1. Which of the following polynomials correspond to elements of C?
f1 (x) = 1 + x + x3 f2 (x) = 1 + x + x2 + x3 f3 (x) = x2 + x3
As written on page 430 of Trappe and Washington, if m(x) corresponds to an
element of C, then m(x) = g(x)f (x) or h(x)m(x) = 0mod(xn − 1)
1+x+x3 1 1+x+x2 +x3 2 3 −x−1
x2 +1
=x+ x2 +1 x2 +1
= x + 1 xx2+x
+1
=x+1+ x2 +1

f2 (x) = 1 + x + x2 + x3 is the only polynomial that does not have a remainder so


it is the only polynomial that corresponds to an element of C.

12

You might also like