Coding Theory
Coding Theory
Mihai Prunescu
* This is more or less a translation in English of some sections of the book Codierungstheorie from Wolfgang
Willems, published by de Gruyter, Berlin, New York, 1999.
University of Bucharest, Faculty of Mathematics and Informatics; and Simion Stoilow Institute of Mathematics
of the Romanian Academy, Research unit 5, P. O. Box 1-764, RO-014700 Bucharest, Romania.
[email protected], [email protected]
1
Contents
I Introduction 4
1 What is a code 5
2 Perfect codes 7
3 Linear codes 8
II Code constructions 10
9 Griesmer bound 17
10 Gilbert-Varshamov bound 18
III Duality 19
14 Weight polynomial 24
15 Theorem of Prange 25
16 Equivalence of codes 25
17 Subfield codes 27
IV Cyclic codes 29
18 Codes as ideals 30
2
19 BCH codes 32
20 Newton’s Equations 35
29 Exercises 55
3
Part I
Introduction
4
1 What is a code
Definition 1.1 Let F be a finite set with q = |F | elements. We call the set:
C ⊆ F n = {(u1 , . . . , un ) | ui ∈ F }, C 6= ∅,
Theorem 1.3 The Hamming distance induces a structure of metric space over the set F n or over
the code C. With other words, the distance fulfills the following metric properties:
Proof: (1) and (2) are immediate. Proof of (3): If we transform u in w and then w in v, we do
more modifications as when we transform u in v, because some coordinates must be modified two
times. Proof of the invariance under translations:
ui 6= vi ↔ ui + wi 6= vi + wi .
5
Definition 1.6 The code C is t-error recognizing if for all c ∈ C,
Bt (c) ∩ C = {c}.
Be (c) ∩ Be (c0 ) = ∅.
Definition 1.9 If the code C ⊂ F n has the minimal distance d = d(C) and has M = |C| elements,
we say that C is a (n, M, d)-code over F .
2
Here are some examples of codes used in the every-day life.
C = {(c, . . . , c) | c ∈ F }.
n−1
As d(C) = n, C is ≤ 2 -error correcting.
Example 1.12 Bank-account code. Take F = {0, 1, 2, . . . , 9}. Let Q(z) be the digit-sum of z.
We observe that z ; Q(2z) is a permutation of F . The code consists of all (c1 , . . . , cn ) such that:
The code is 1-error recognizing, but it recognizes also accidental transpositions of neighbor digits.
Example 1.13 ISBN-10 Code. F = {0, 1, 2, . . . , 9, X}. The code is a succession of blocks, repre-
senting the language, the editor house, the book, and a final check digit. Example:
0 − 387 − 96617 − X.
The rule is that 10z1 + 9z2 + · · · + 2z9 + z10 = 0 mod 11. Observe that as Z11 is a field, i ; iz is a
permutation for all z 6= 0. This code recognizes one false digit, but recognizes as well an accidental
transposition.
Example 1.14 EAN-13 Code. F = {0, 1, 2, . . . , 9}. The code-words have length 13, and the
condition is that:
6
2 Perfect codes
Definition 2.1 A code C is called perfect if and only if there is an e ∈ N such that:
G
Fn = Be (c)
c∈C
Theorem 2.2 If |F | = q, C is a code of length n and d(C) ≥ 2e + 1 then the following inequality
holds. This is called Hamming bound.
e
n
X n
q ≥ |C| (q − 1)j .
j=0
j
2
n
We observe that trivial codes, F and repetition codes of length n = 2e + 1 are perfect.
Example 2.3 The (n, |C|, d) = (7, 24 , 3) Hamming Code. The code consists of all the tuples
(c1 , . . . , c7 ) ∈ F72 such that following equalities are fulfilled:
c1 + c4 + c6 + c7 = 0,
c2 + c4 + c5 + c7 = 0,
c3 + c5 + c6 + c7 = 0.
The code is a linear variety of dimension 4, so it contains |C| = 24 elements. We observe that F72
is an abelian group, so the Hamming distance is invariant under translations. It follows that:
We show now that d(C) ≥ 3. It is to show that every code word contains at least three digits
different from 0. Let c1 = 1. From the first equation, it follows that one of c4 , c6 or c7 is 1. From
the other two equations it follows now that one of c2 , c5 or c7 must be 1. The same happens also
if we start with another ci 6= 0.
Now we show that d(C) ≤ 3. Indeed the point c = (0, 0, 0, 1, 1, 1, 0) ∈ C, and it has d(c, 0) = 3.
So d(C) = 3. If we take e = 1 then d(C) ≥ 2 · 1 + 1 so C is 1-error correcting and 2-error
recognizing.
Moreover, C is perfect:
27 ≥ |C|(1 + n) = 24 (1 + 7) = 27 ,
so the Hamming bound condition is fulfilled.
Remark 2.4 Zinov’ev and Leont’ev, The nonexistence of perfect codes over Galois fields. Prob-
lems of control and information theory 2, 123 - 132, 1973, proved the following: If q is a prime
power, the only perfect codes are:
7
k
−1 n−k
- The ( qq−1 ,q , 3) Hamming codes,
- The (23, 212 , 7) binary Golay code,
- The (11, 36 , 5) ternary Golay code.
If q is not a prime power, there are not known perfect codes and the problem is open.
d ≤ n − logq |C| + 1.
Proof: Consider some projection α : F n → F n−d+1 , for example α(u1 , . . . , un ) = (u1 , . . . , un−d+1 ).
Because the minimal distance d(C) = d, α|C is an injection, so:
d = n − logq |C| + 1
3 Linear codes
Definition 3.1 Let K be a finite field and C ≤ K n be a vector subspace. We call C linear code
over K. We speak about an:
[n, k, d]
code if k = dimK C and d = d(C).
The set {i | ui 6= 0} is called support of u and denoted supp (u). Shortly, wt (u) = |supp (u)|. For
a subset U ⊆ K n , [
supp (U ) = supp (u).
u∈U
8
Remark 3.4 To save a linear code, it is enough to keep a basis instead of the whole code.
Definition 3.5 Let Mk×n (K) the set of matrices with k rows and n columns with elements in
K. If A ∈ Mk×n (K) then the transposed matrix AT ∈ Mn×k (K). We denote by rk A the rank of
A, which is the number of linear independent columns or the number of linear independent rows.
Definition 3.6 Let C be an [n, k]-code over K. A matrix G ∈ Mk×n (K) is a generating matrix
of C if we consider G : K k → K n by:
and C = G(K k ) = Im(G) is the image of G. The rows of G form a basis for C. Then:
Definition 3.7 Let C be an [n, k]-code over K. A matrix H ∈ M(n−k)×n (K) is a check matrix
for C if :
C = {u | u ∈ K n , HuT = 0} = Ker(H),
the code is the kernel of H. In this case:
Theorem 3.9 Let C be a nontrivial [n, k]-code over K and H its check matrix. Then:
Proof: Let h1 , . . . , hn be the columns of H. As C 6= {0}, this family of vectors is linear dependent.
Let w ∈ N minimal such that there are w many linear dependent columns hi1 , . . . , hiw . So there
is a relation:
Xn
cj hj = 0,
j=1
9
Part II
Code constructions
10
4 Hamming and Simplex codes
Let K be a finite field with q elements and k ≥ 2 a natural number.
The projective space of dimension k − 1 is the set:
Here hui is the equivalence class of u for the equivalence relation defined as hui = hvi if and only
if ∃ λ ∈ K × , u = λv. The projective space has n elements, where:
qk − 1
n = |Pk−1 (q)| = .
q−1
Definition 4.1 We define a Hamming Code as the code C over K with check matrix H:
C = {c | c ∈ K n , HcT = 0} ≤ K n .
As rk (H) = k, dim C = n − k.
Every two columns of H are linear independent, but hh1 i, hh2 i and hh1 + h2 i are linear dependent.
So wt (C) = d(C) = 3.
So C has the parameters [n, n − k, 3], where n = (q k − 1)/(q − 1). As 3 ≥ 2 · 1 + 1, C is 1-error
correcting.
The fact that C is perfect follows from the sphere-packing equation:
[ qk − 1
B1 (c) = |C| |B1 (0)| = q n−k (1 + n(q − 1)) = q n−k 1 + (q − 1) = q n .
q−1
c∈C
Definition 4.2 We define a Simplex Code as the code C over K with generating matrix H:
C = {aH | a ∈ K k } ≤ K n .
Theorem 4.3 Let C be a Simplex code and c ∈ C \ {0}. Then wt (c) = q k−1 .
k
X k
X
0 6= c = (c1 , . . . , cn ) = ai zi = ai (zi1 , . . . , zin ) ∈ C.
i=1 i=1
k
X
T
U = {(b1 , . . . , bk ) | bi ∈ K, ai bi = 0}
i=1
is a (k − 1)-dimensional vector space and contains q k−1 elements. A number of (q k−1 − 1)/(q − 1)
of the columns hj of H are equivalent with elements of U . In fact:
cj = 0 ←→ ∃ b ∈ U ∃j hhj i = hbi.
11
In conclusion:
q k−1 − 1 q k − 1 q k−1 − 1
wt (c) = n − = − = q k−1 .
q−1 q−1 q−1
2
k−1 k−1
So the Hamming distance between two code-words is q , and the minimal distance is q as
well. So the Simplex Code is a
h qk − 1 i
, k, q k−1
q−1
code. For the Simplex Code one has the special notation Simq (k).
we define deg f = max{e1 +· · ·+en | k(e1 ,...,em ) 6= 0}, and define deg 0 = −∞. If K m = {P1 , . . . , Pn }
- so n = 2m - we consider the evaluation:
f ; cf = (f (P1 ), . . . , f (Pn )) ∈ K n ,
where f (P ) = f (a1 , . . . , an ) for P = (a1 , . . . , an ). As the polynomials x and x2 define the same
function in K, we evaluate only polynomials like:
X
f= k(e1 ,...,em ) xe11 . . . xemm .
0≤ei ≤1
We stress the fact that the evaluation is done with the convention 00 = 1.
Let V be the vector space of these polynomials and for r ≤ m:
Vr = {f ∈ V | deg f ≤ r}.
Pr
and dim Vr = i=0 mi .
Then dim V = 2m
Theorem 5.2 The Reed-Müller code RM (r, m) is a linear code with parameters:
r
h X m i
2m , , 2m−r .
j=0
j
12
Proof: The linearity and the length are trivial. The dimension of the code comes from the fact
that the evaluation is an injective morphism, like for the Reed-Solomon codes. So in the rest of
the proof we will compute the minimal distance.
The evaluation of the polynomial f (x1 , . . . , xm ) = x1 . . . xr has the weight 2m−r because this is
the number of vectors (x1 , . . . , xm ) that evaluate 1. Now we show that every polynomial f ∈ Vr
generates a code-word of weight ≥ 2m−r . This is done by induction. For m = 0, this is true.
Suppose that this is already true for RM (r, m − 1) for m ≥ 1 and all 0 ≤ r ≤ m − 1. We can write
f ∈ Vr as:
f = f (x1 , . . . , xm ) = g(x1 , . . . , xm−1 ) + h(x1 , . . . , xm−1 )xm .
Consider the cardinalities:
a = |{P = (∗, . . . , ∗, 0) | P ∈ K m , f (P ) 6= 0}|,
b = |{P = (∗, . . . , ∗, 1) | P ∈ K m , f (P ) 6= 0}|.
If h = 0, we get by induction a, b ≥ 2m−1−r so a + b ≥ 2m−r . If h 6= 0, we get by induction
a ≥ 2m−1−r if g 6= 0 and b ≥ 2m−1−r if g + h 6= 0. Finally if g = 0 or if g = −h then deg h ≤ r − 1
and by induction b ≥ 2(m−1)−(r−1) = 2m−r . 2
As all (d − 1) × (d − 1) minors are regular, d(GRSd (a, v)) = d. Also, this code has dimension
n − rk (H) = n − d + 1. So GRSd (a, v) is a code:
[n, n − d + 1, d].
Now recall that for finite fields K, the multiplicative group K × is cyclic. Let α be a generator of
this group. If v = a = (1, α, . . . , αq−2 ) we are dealing with a Reed-Solomon Code of dimension
q − d.
Definition 6.1 A code C is cyclic if for every c = (c1 , . . . , cn ) ∈ C, one has (cn , c1 , . . . , cn−1 ) ∈ C.
13
for all j = 1, . . . , d − 1. So:
q−2
X q−2
X
0 = αj ci αij = ci α(i+1)j = cq−2 + c0 αj + · · · + cq−3 α(q−2)j
i=0 i=0
C = C1 & C2 = {(c1 , c1 + c2 ) | c1 ∈ C1 , c2 ∈ C2 } ≤ K 2n
r−1 X r
X m m
=1+ = .
i=0
i + 1 i=0
i
We observe also that always RM (r − 1, m) ⊂ RM (r, m) and that (1, 1, . . . , 1) ∈ RM (r, m).
RM (1, 5) is a [32, 6, 16]-code and was used by the Mariner Mars Mission 1969 - 1976. As 7 ≤
(d − 1)/2 = 15/2, so 7 errors per code-word could be corrected. The code-words encoded 26 = 64
different tones of grey for black and white pictures of high resolution.
14
8 Linear code mappings
Recall that GL(n, K) is the group of invertible square matrices with coefficients in K.
Definition 8.1 A matrix A ∈ GL(n, K) is an isometry according to the Hamming metric if for
all u, v ∈ K n , d(uA, vA) = d(u, v).
Let Iso(n, K) mean the set of these matrices, which are Hamming isometries. Iso(n, K) ≤
GL(n, K) is a subgroup. We observe that the group of permutations Sn can be also embed-
ded in GL(n, K), as follows. An element π ∈ Sn corresponds to the permutation matrix P (π),
where: (
1, i = πj,
P (π) = (pij ) =
0, else.
M = Diag(a1 , . . . , an )P (π),
for some ai 6= 0 and some π ∈ Sn . The monomial matrices build the monomial group M (n, K).
Proof: It is clear that M (n, K) ⊆ Iso(n, K). For the converse, consider an A ∈ Iso(n, K). When
acting on a standard basis vector ei = (0, . . . , 0, 1, 0, . . . , 0), 1 = wt (ei ) = wt (ei A), so ei A = ai ei0
with ai 6= 0 and such that (i ; i0 ) is a permutation π of {1, . . . , n}.
So A = Diag(a1 , . . . , an )P (π −1 ). 2
15
2. Let n ≥ 2 and 1 ≤ i ≤ n. The code:
is called truncation of C. If C has length n, Či is a [n−1, k−1]-code. Also, d(Č) ≥ d(C). The
check matrix Ȟ is the check matrix H without the column corresponding to the coordinate
which is truncated.
3. Let n ≥ 2 and 1 ≤ i ≤ n. The code:
is called punctuation of C.
Examples: If C is a binary code with odd d(C), then d(Ĉ) = d(C) + 1 because we have an even
number of ones in every code-word. In particular the extended binary Hamming code has minimal
distance 4.
If C = GRSd (a, v) then Ĉ = GRSd+1 (â, v̂) where â = (a, 0) and v̂ = (v, 1).
If C is an M DS-code, then a truncation of C is an M DS-code again. 2
Observation 8.6 A finite field K with q m elements is a vector space of dimension m over a
field K0 with q elements. So every n-code C over K is an mn-code C0 over K0 . If C is e-error
correcting, C0 can correct e groups of m many consecutive errors, which in a transmision are very
usual.
Observation 8.7 Given a [n, k, d]-code, by simple concatenation of t code-words in all possible
ways, one constructs a [tn, tk, d]-code named interleaving of the original code.
Definition 8.8 Let E be a set and U ≤ S(E) be a subgroup of its permutation group.
If U is k-transitive, then:
(U is transitive over E) and (every stabilizer Ui is (k − 1)-transitive over E \ {i}).
Proof: (1) Take i ∈ {1, . . . , n − 1}. As P er(C) is transitive, there is a monomial matrix M =
P (π)Diag(a1 , . . . , an ) ∈ Aut(C) with πn = i. For every (c1 , . . . , cn ) ∈ C there is a (c̃1 , . . . , c̃n ) ∈ C
such that:
(c1 , . . . , cn ) = (c̃1 , . . . , c̃n )M = (a1 c̃π1 , . . . , an c̃πn ).
(c1 , . . . , cn−1 ) = (a1 c̃π1 , . . . , an−1 c̃π(n−1) ) =
= (c̃1 , . . . , c̃i−1 , c̃i+1 , c̃n )P (σ)Diag(a1 , . . . , an−1 ),
where σ ∈ Sn−1 is some permutation. So C̊n = C̊i P (σ)Diag(a1 , . . . , an−1 ).
16
(2) Take 0 6= c = (c1 , . . . , cn ) ∈ C with wt (c) minimal. If wt (c) = 1 then c is some ei and with
P er(C) transitive, all ei ∈ C and C = K n , which is a contradiction. So wt (c) ≥ 2. Suppose
that D = Diag(a1 , . . . , an ) ∈ Aut(C) with an 6= ai for some i. As P er(C) is 2-transitive, one can
suppose that ci 6= 0 and cn 6= 0. So:
an c − cD = ((an − a1 )c1 , . . . , (an − an−1 )cn−1 , 0) ∈ C.
But (an − ai ) 6= 0 and wt (can − cD) < wt (c), which is a contradiction to the minimality of wt (c).
So Diag(a, a, . . . , a) with a ∈ K × are the unique diagonal automorphisms of C. 2
Proof: Let G be the generating matrix of some [n, k]-code over K. As G has rank k, there
are k many columns of G, say si−1 , . . . , si−k ∈ (K k )T such that X = (si−1 , . . . , si−k ) is a
regular matrix. Choose π ∈ Sn such that GP (π) = (X | Y ). It follows that X −1 GP (π) =
(Ek | Z). Because K k X −1 G = K k G = C, the matrix X −1 G is a generating matrix for C. Also,
K k X −1 GP (π) = CP (π) = C 0 , a code obtained from C by permuting some coordinates, and the
matrix X −1 GP (π) = (Ek | Z) is the generating matrix for C 0 . 2
9 Griesmer bound
Theorem 9.1 Let K be a field with q elements and let C be a [n, k, d]-code over K. Then:
k−1
Xl dm
n≥ .
i=0
qi
17
Over elementary transformations of (G1 | G2 ) we can reach every 0 6= v ∈ C2 . The induction
hypothesis reads now:
k−2
X l d2 m k−2 X l d m k−1 Xl d m
n−d≥ i
≥ i+1
= ,
i=0
q i=0
q i=1
qi
k−1 k−1
Xl d m l d m Xl d m
n≥ + 0 = .
i=1
qi q i=0
qi
0
m If there is a [n, k, d]-code over some field, then there is also a [n − d, k − 1, d ]-code
Corollaryl 9.2
with d0 ≥ dq .
Theorem 9.3 The binary Reed-Muller-codes RM (1, m) reach the Griesmer bound. Moreover,
they are uniquely determined by their parameters [2m , m + 1, 2m−1 ] up to code equivalence.
10 Gilbert-Varshamov bound
Theorem 10.1 Let K be a field with q elements and let n, k, d ∈ N with k ≤ n and
d−2
n−k
X n−1
q > (q − 1)i .
i=0
i
0 0
Then there exists a [n, k, d ]-code with d ≥ d.
Proof: If k = n then d = 1 and the statement is true. So let k < n, V = K n−k , v1 , . . . vn−k be
a basis of V and suppose that we already found vectors vn−k+1 , . . . , vn−k+s ∈ V such that every
d − 1 elements in Vs = {v1 , . . . , vn−k+s } are linear independent. The number of vectors which can
be represented as linear combination of at most d − 2 many elements of Vs , is ≤
d−2
X n−k+s
(q − 1)i .
i=0
i
If this sum is strictly smaller then q n−k , we can find vn−k+s+1 ∈ V \ hVs i such that every d − 1
vectors in:
Vs+1 = Vs ∪ {vn−k+s+1 }
are linear independent. Finally we get Vk = {v1 , . . . , vn }. We write those vectors as the columns
of a matrix H ∈ M(n−k)×n (K), so is H the check matrix of a [n, k, d0 ]-code with d0 ≥ d. 2
18
Part III
Duality
19
11 The dual code
Definition 11.1 Let K be some field and n ∈ N. The function h , i : K n × K n → K given by:
n
X
hu, vi = u i vi
i=1
defines a symmetric non-degenerated K-bilinear form over K n . For C ⊆ K n (code or just subset),
C ⊥ = {u ∈ K n | ∀ c ∈ C hu, ci = 0}
1. H is the check matrix for C if and only if H is the generating matrix for C ⊥ .
2. (Ek | A) is generating matrix for C if and only if (−AT | En−k ) is generating matrix for C ⊥ .
Proof: Let G be a generating matrix for C. Some (n − k) × n matrix H over K is a check matrix
for C if HGT = 0 and the rank of H is n − k. For the second statement, observe that:
Ek
T T T
(−A | En−k )(Ek | A) = (−A | En−k ) T = −AT + AT = 0.
A
2
Theorem 11.3 Let GRSd (a, v) be a generalized Reed-Solomon code over the field K with 2 ≤ d ≤
n ≤ q. Then there is a vector v 0 such that:
Proof: Observe first that dim GRSn (a, v) = 1, because GRSd (a, v) is a [n, n − d + 1, d]-code. Take
a 0 6= v 0 = (v10 , . . . , vn0 ) such that:
1 ... 1 0
0
a1 v1 v1
. . . a n .
0
.. .. = .. .
..
. . .
n−2 n−2 vn vn0
a1 . . . an 0
Suppose that vi0 = 0 for some i. We exclude the column i from the matrix and the component i in
both vectors. We get a square system of equations with non-singular matrix, so then all vj vj0 = 0,
so v 0 = 0, contradiction. It follows that all components of v 0 are different from 0. For 0 ≤ r ≤ d−2
and 0 ≤ s ≤ n − d we observe:
n
X n
X
ari vi asi vi0 = ar+s
i vi vi0 = 0.
i=1 i=1
This means that GRSd (a, v)⊥ ⊆ (GRSn−d+2 (a, v 0 )⊥ )⊥ ⊆ GRSn−d+2 (a, v 0 ). But they have both
dimension d − 1, so the sets are equal.
20
In order to determine v 0 , we consider the system:
1 ... 1 0
a1 ... an u 1 0
.. .. .. ..
. . = . .
n−2 .
a1 n−2
. . . an un 0
an−1
1 . . . an−1
n 1
Proof: As (C ⊥ )⊥ = C, it is enough to prove only one direction. Suppose that n is the length of
C. Suppose there is an element 0 6= c⊥ ∈ C ⊥ with wt (c⊥ ) ≤ k. We can choose c⊥ as row in a
generating matrix G⊥ of C ⊥ . So there are n − k columns in G⊥ , which are linear dependent. But
d(C) = n − k + 1, so every n − k columns must be linear independent. This contradiction shows
that d(C ⊥ ) ≥ k + 1. By the singleton bound, we see that:
k + 1 ≤ d(C ⊥ ) ≤ n − (n − k) + 1 = k + 1,
so is C ⊥ an M DS-code. 2
Proof: Take some c = (c1 , . . . , cn ) ∈ C. Every ci ∈ {0, 1} for p = 2 or in {0, −1, 1} for p = 3. So
c2i = 1 if ci 6= 0 and
0 = hc, ci = wt (c) mod p.
Moreover for p = 2 and v = (1, . . . , 1),
hc, vi = wt (c) = 0,
so v ∈ C ⊥ . 2
1. If C ⊆ C ⊥ and if C has a basis consisting of vectors, whose weights are all divisible by 4,
then C is 4-divisible.
21
2. If C is 4-divisible, then C ⊆ C ⊥ .
Definition 12.1 Gol(11) is the ternary code generated by the matrix G11 = (E6 | G) where:
0 1 −1 −1 1
1
0 1 −1 −1
−1 1 0 1 −1
G= .
−1 −1 1 0 1
1 −1 −1 1 0
1 1 1 1 1
Proof: Gol(12) has length 12 and dimension 6. If we add to G11 the column:
−1
−1
−1
,
−1
−1
0
we get G12 , the generating matrix for Gol(12). Let z1 , . . . , z6 the rows of G12 . One verifies
that hzi , zj i = 0 for all pairs (i, j), including the cases i = j. So Gol(12) ⊆ Gol(12)⊥ . But
dim Gol(12)⊥ = 12 − dim Gol(12) = 12 − 6 = 6, Gol(12) = Gol(12)⊥ , so the code is self-dual.
We must show now that d(Gol(12)) = 6. We observe that G12 = (E6 | A6 ) and that G̃12 =
(−AT6 | E6 ) is also a generating matrix for Gol(12). Being self-orthogonal over F3 , Gol(12) is
3-divisible. Suppose now that there is some c ∈ Gol(12) with wt (c) = 3.
We know that wt (zi ) = 6 for all i, so c 6= zi . So is c a linear combination of 2 or 3 different zi .
If it is a linear combination of 2 different zi , in the last 6 coordinates has c exactly one which is
different from 0. If we now look to G̃12 , c has to be ± a row of this matrix. But all such rows have
weight 6. If it is a linear combination of 3 different zi , it must have 0 on all last 6 coordinates,
and this contradicts again G̃12 . As Gol(12) is 3-divisible and all zi have weight 6, it follows that
d(Gol(12)) = 6. 2
22
Proof: It is immediate that the parameter are 11, 6 and 5. To show that it is perfect, compute:
[ 11 11
311 ≥ | B2 (c)| = |Gol(11)| |B2 (0)| = 36 1 + ·2+ ·4 =
1 2
c∈Gol(11)
= 36 (1 + 22 + 220) = 36 · 35 = 311 .
2
Definition 12.4 Gol(23) is the binary code generated by the matrix G23 = (E12 | G), where the
rows of G are all the 11 rotations of the vector:
(1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0)
completed with a last row of ones. The code Gol(24) is the corresponding extension. They are
the binary Golay code and the extended binary Golay code.
It is a similar job to show that Gol(24) is a [24, 12, 8]-code self-dual and that Gol(23) is a [23, 12, 7]
perfect code.
As the value T rE/K (a) remains fixed by all the automorphisms γ ∈ G, this value belongs to K.
If K has q elements and [E : K] = n, it is known that the automorphisms are generated by the
Frobenius automorphism x ; xq and consequently the trace can be defined by:
2 n−1
T rE/K (a) = a + aq + aq + · · · + aq .
In particular, the set Ch(A) is an orthonormal basis of CA for the Hermitian product.
23
14 Weight polynomial
Definition 14.1 Let C be a code of length n. Let Ai be the number of code-words of weight i in
C. The polynomial:
X n
AC (z) = Ai z i ∈ Z[z]
i=0
Theorem 14.2 Let C be an [n, k]-code over K = Fq with the weight polynomial A(z), and let
A⊥ (z) be the weight polynomial of C ⊥ , then:
1−z
A⊥ (z) = q −k (1 + (q − 1)z)n A .
1 + (q − 1)z
Proof: Let χ be a non-trivial character of the additive group of K, this means a non-constant
homomorphism χ : (K, +, 0) → (C× , ·, 1). For u ∈ K n we define:
X
gu (z) = χ(hu, vi)z wt (v) ∈ C[z].
v∈K n
We observe that:
X X X X
gc (z) = χ(hc, vi)z wt (v) = f (v)z wt (v) ,
c∈C c∈C v∈K n v∈K n
where f (v) = c∈C χ(hc, vi). The mapping c ; χ(hc, vi) is a character χv of C which is trivial
P
So: X X ⊥
gc (z) = |C|z wt (c )
= |C|A⊥ (z).
c∈C c⊥ ∈C ⊥
Now we compute the left side in a different way. For c = (c1 , . . . , cn ) ∈ C one has:
X
gc (z) = z wt (v) χ(hc, vi)
v∈K n
X Pn n
X
wt (ai )
= z i=1 χ ci ai
(a1 ,...,an )∈K n i=1
X n
Y
= z wt (ai ) χ(ci ai )
(a1 ,...,an )∈K n i=1
n X
Y
= z wt (ai ) χ(ci ai ).
i=1 ai ∈K
P
But as χ 6= 1 is a∈K × χ(a) = −1, so:
(P
X
wt (ai ) z wt (ai ) = 1 + (q − 1)z
ai ∈K ci = 0,
z χ(ci ai ) = P
ai ∈K
1 + z a∈K × χ(a) = 1 − z ci 6= 0.
24
This means that:
gc (z) = (1 − z)wt (c) (1 + (q − 1)z)n−wt (c) .
We can finally conclude:
X
A⊥ (z) = |C|−1 gc (z)
c∈C
X1−z wt (c)
= q −k (1 + (q − 1)z)n
1 + (q − 1)z
c∈C
1−z
= q −k (1 + (q − 1)z)n A .
1 + (q − 1)z
2
⊥
In this context we recall that Simq (k) = Hamq (k) and that we already implicitly shown that
the Simplex code has the following weight polynomial:
k−1
A(z) = 1 + (q k − 1)z q .
So using the theorem, one can compute the weight polynomial of the Hammimg code as well.
15 Theorem of Prange
Pn
Theorem 15.1 A binary code C has the weight polynomial A(z) = i=0 Ai z i and its extension
Pn
Ĉ has the weight polynomial  = i=0 Âi z i . Suppose that P er(Ĉ) is transitive. Then:
2iA2i 2iÂ2i
A2i−1 = =
n + 1 − 2i n+1
n+1
for 1 ≤ i ≤ 2 . In particular, the minimal weight of C is odd.
Proof: It is easy to see that Â2i = A2i + A2i−1 and Â2i−1 = 0. In Ĉ exactly A2i−1 many code-
words of weight A2i have the digit 1 in the last coordinate. This is true for all other coordinates,
because P er(Ĉ) is transitive over the set {1, . . . , n + 1}.
X
wt (ĉ) = 2iÂ2i .
wt (ĉ)=2i
This implies:
2iÂ2i
A2i−1 = ,
n+1
and because Â2i = A2i + A2i−1 ,
2iA2i
A2i−1 = .
n + 1 − 2i
16 Equivalence of codes
Let K be a finite field and V ≤ K n . The projection fi (v) = vi is a linear function over V , so
fi ∈ V ∗ . The prime field of K is F = Fp = {0, 1, . . . , p − 1} and ε 6= 1 a complex p-root of 1. We
recall that every f ∈ V ∗ determines a character χf of V over:
25
Lemma 16.1 For all v ∈ V ,
n X
X
(n − wt (v))|K| = χafi (v).
i=1 a∈K
P
Proof: If fi (v) = 0 then χafi (v) = 1 and a∈K χafi (v) = |K|.
If fi (v) 6= 0, recall that T r : K → F is surjective, so there is a decomposition:
p−1
[
K= (ai + Kern T r),
i=0
with T r(ai ) = i.
X X X p−1
X
χafi (v) = εT r(afi (v)) = εT r(a) = |Kern T r| εi = 0.
a∈K a∈K a∈K i=0
2
The following theorem was discovered by MacWilliams. The proof is from Ward and Wood.
Theorem 16.2 Let C and C 0 two linear codes of dimension k in K n . Then C ' C 0 if and only
if there is weight preserving K-linear isomorphism of vector spaces ϕ : C → C 0 .
Proof: If C ' C 0 then every isometry is in particular a weight preserving isomorphism from C to
C 0 . Now consider a linear isomorphism ϕ : C → C 0 with wt ϕ(c) = wt c for all c ∈ C. We consider
the projections fi (c) = ci and fi0 (c) = (ϕ(c))i . Both fi , fi0 ∈ C ∗ . We apply the Lemma and we
find out that for all c ∈ C one has:
n X
X
χafi (c) = (n − wt (c))|K| =
i=1 a∈K
n X
X
= (n − wt (ϕ(c)))|K| = χbfj0 (c).
j=1 b∈K
Recall now that the characters of C build a basis of CC , there is a σ(1) ∈ {1, . . . .n} and a a1 ∈ K ×
such that χa1 fσ(1) = χf10 . This implies a1 fσ(1) = f10 . Then one has that:
X X
χafσ(1) = χbf10 ,
a∈K × b∈K ×
X X n X
X
χafi = χbfj0 .
i6=σ(1) a∈K × j=2 b∈K ×
26
Inductively we find a permutation σ ∈ Sn and elements ai ∈ K ∗ such that ai fσ(i) = fi0 for
i = 1, . . . , n.
(f1 (c), . . . , fn (c))Diag(aσ−1 (1) , . . . , aσ−1 (n) )P (σ) = (a1 fσ(1) (c), . . . , an fσ(n) (c))
Theorem 16.3 Both the Hamming code Hamq (k) and the simplex code Simq (k) have the group
of automorphisms isomorphic with GL(k, q).
Proof: It is clear that Aut Hamq (k) ' Aut Simq (k) because the codes are dual. Let C =
Simq (k) ≤ K n with |K| = q and n = (q k − 1)/(q − 1). Every ϕ ∈ GL(C) is weight preserving
because all 0 6= c ∈ C have the same weight. MacWilliams’ Theorem shows that ϕ can be extended
to a monomial application of K n . So GL(C) is a subgroup of Aut(C). We need to show that the
homomorphism of natural restriction Aut(C) → GL(C) corresponding to the restriction of some
C-preserving automorphism of K n to C, is injective. Let M = Diag(a1 , . . . , an )P (π) a monomial
isometry of K n , such that M |C is the identity. Suppose that for some i, π(i) 6= i. But the
columns of the generating matrix of C are linear independent over K, so there exists c ∈ C with
ci 6= aπ(i) cπ(i) . But:
17 Subfield codes
In this section K = Fq ≤ E = Fqm , so m = [E : K]. The Galois group G of E over K is generated
by the Frobenius automorphism x ; xq . The action of G on E can be extended over E n by:
τ (x1 , . . . , xn ) = (τ x1 , . . . , τ xn ).
Similarly one can extend the action of the trace function T r = T rE/K to tuples, as:
Definition 17.1 Let C be a linear E-vector subspace of E n . The code C|K = C ∩ K n is called
subfield code of C. The set T r(C) ≤ K n is the trace code of C.
It is clear that C|K consists of all elements in C which are let invariant by the Frobenius auto-
morphism of E n .
Theorem 17.2 Hamming codes are subfield codes of GRS codes. If gcd(m, q − 1) = 1, the Ham-
ming code Hamq (m) is equivalent to a cyclic code. In particular, every binary Hamming code is
equivalent to a cyclic code.
Proof: Let n = (q m − 1)/(q − 1). Let hj = (h1j , . . . , hmj )T the column Pm j of a check matrix
of Hamq (m). Consider a K-basis u1 , . . . , um of E over K and vj = i=1 hij ui ∈ E. Let
v = (v1 , . . . , vn ) ∈ E m . Then Hamq (m) = v ⊥ |K. But as v ⊥ = GRS2 (∗, v), Hamming codes are
subfield codes of generalized Reed-Solomon codes.
27
Now consider the case gcd(m, q − 1) = 1. But then:
qm − 1
n= = q m−1 + · · · + q + 1 =
q−1
(C|K)⊥ = T r(C ⊥ ).
Proof: We show first that (C|K)⊥ ⊆ T r(C ⊥ ), or equivalent that (T r(C ⊥ ))⊥ ⊆ C|K. Take
x = (x1 , . . . , xn ) ∈ (T r(C ⊥ ))⊥ and y = (y1 , . . . , yn ) ∈ C ⊥ . For every a ∈ E, because x ∈ K n , one
has:
X n
0 = hx, T r(ay)i = xi T r(ayi ) = T r(ahx, yi).
i=1
28
Part IV
Cyclic codes
29
18 Codes as ideals
Instead of subset of K n , we can see a code also as subset of R = {f | f ∈ K[x], deg f < n}. The
advantage is that now we have a new operation defined by:
Proof: This follows immediately from the observation that if c(x) = c0 + c1 x + · · · + cn−1 xn−1 ∈ C
then:
c(x) ◦ x = cn−1 + c0 x + · · · + cn−2 xn−1 .
2
1. There is a uniquely determined monic polynomial g ∈ K[x] with deg g = n − k such that
g | xn − 1 and C = g ◦ R.
2. {gxj | j = 0, 1, . . . , k − 1} is a K-basis of C.
Proof: Every ideal in K[x] is a principal ideal and is generated by a polynomial of lest degree,
contained inside. This property is heired by the factor algebra K[x]/(xn − 1)K[x]. So C = g ◦ R.
If we choose g monic, then is g uniquely determined. But xn − 1 = gh + r with deg r < deg g and
because −r = g ◦ h ∈ C it follows that r = 0, so g | xn − 1. Also:
Definition 18.3 If C ≤ R is a cyclic code, the polynomial g given by the theorem above is called
generating polynomial of C. The polynomial
xn − 1
h=
g
is called check polynomial of C.
Lemma 18.4 Let C ≤ R be a cyclic [n, k]-code. Further let g = g0 +· · ·+gn−k xn−k its generating
polynomial and h = h0 + · · · + hk xk the check polynomial of C. Then is:
g0 g1 . . . gn−k 0 ... 0
0 g0 g1 ... gn−k . . . 0
G=. .. ∈ Mk×n (K)
. . .
.. .. .. .. .
0 0 ... g0 g1 ... gn−k
a generating matrix of C, and
hk hk−1 ... h0 0 ... 0
0 hk hk−1 ... h0 ... 0
H= . .. ∈ M(n−k)×n (K)
.. .. ..
.. . . . .
0 0 ... hk hk−1 ... h0
a check matrix of C.
30
Proof: G is of course a generating matrix for C. The equality:
n n−k
X X
xn − 1 = gh = gj hi−j xi ,
i=0 j=0
implies that:
n−k
X
gj hi−j = 0
j=0
Corollary 18.6 Let C be a cyclic code of dimension k with generating polynomial g and check
polynomial h. Then is g ⊥ = h(0)−1 h∗ the generating polynomial of C ⊥ . Moreover, C ⊥ is equiva-
lent to the code generated by h.
Using the Theorem of Delsarte, if the caracteristic of K = Fq does not divide the length ofQthe code,
cyclic codes are trace codes. In this case there is an extension of K such that xn − 1 = (x − αi )
where α is a primitive n-root of 1. The polynomials g ∈ K[x] such that g | (xn − 1) correspond
uniquely to sets:
R(g) = {i | i ∈ Zn , g(αi ) = 0}.
where R(g) is closed under the mapping i ; iq mod n. If g is the generating polynomial of a
cyclic code C of length n over K,
n−1
X
C = {(c0 , . . . , cn−1 ) | ci ∈ K, ∀ j ∈ R(g) ci αij = 0}.
i=0
Theorem 18.7 If K is a finite field, its characteristic does not divide n, α is a primitive n-root of
1 in some extension E ≥ K and h ∈ K[x] with h | (xn −1), the following statements are equivalent:
2
Application: Let C be a cyclic [n, k]-code with generating polynomial g. Consider a message
m ∈ Rk,K . To encode this message, one builds the code-word:
31
For error detection, one checks if the received message v(x) is divisible by g. If yes, we can read
directly xn−k m(x) in v(x), because v(x) = xn−k m(x) + b(x) where deg b(x) < n − k. If there is
an error, one ask for the repetition of the message. This is the principle of the CRC-codes, cyclic
redundancy check codes. 2
This error recognition is even faster if the code is generated by an idempotent element e, that is
an element such that e2 = e. Such elements decompose the ring as:
R = eR ⊕ (1 − e)R.
Indeed, from r = er + (1 − e)r one has R = eR + (1 − e)R. But multiplication with e produces
the identity on eR and the zero function on (1 − e)R, so eR ∩ (1 − e)R = 0 and the sum is direct.
If a code is generated by an idempotent element e, then v 6= ev means that an error occurred
during the transmission.
Theorem 18.8 Suppose that K is a field of characteristic p and that p 6 | n. Let C ≤ R = Rn,K
be a cyclic code. Then there is a uniquely determined e ∈ K[x] with deg e < n such that C = e ◦ R
and e ◦ e = e. We call e the idempotent of C.
Proof: Let g be the generating polynomial of C and h the check polynomial of C. One can prove
that gcd(p, n) = 1 implies that gcd(g, h) = 1. So there are a, b ∈ K[x] such that ga + hb = 1.
Define e = g ◦ a = 1 − h ◦ b ∈ C. For c = g ◦ f ∈ C one has:
e ◦ c = (1 − h ◦ b) ◦ (g ◦ f ) = g ◦ f − h ◦ b ◦ g ◦ f = g ◦ f = c.
This shows also that e ◦ e = e and that C = e ◦ R. If also C = e0 ◦ R with e0 ◦ e0 = e0 then
e0 = e0 ◦ e = e because both multiplications with e and with e0 are identities. 2
We can take:
x ◦ g ◦ h0
e= ,
n
where h0 is the differentiation of h. This can be seen by derivating the identity xn − 1 = gh.
Theorem 18.9 Let the characteristic of K does not divide n and let C ≤ R = Rn,K be a cyclic
code with generating polynomial g. Further α is a primitive n-root of 1 over K and e ∈ K[x] with
deg e < n and e = e ◦ e.
The element e is the idempotent of C if and only if e and g have the same roots in the multiplicative
group generated by α.
Proof: As the characteristic of K does not divide n, all roots of g have multiplicity 1 and are
contained in hαi. Now e ◦ R = g ◦ R if and only if e = g ◦ a and g = e ◦ b for a, b ∈ K[x]. So g
and e have the same roots in hαi. On the other side, if g and e have the same roots in hαi, then
gcd(e, xn − 1) = g. This implies eK[x] + (xn − 1)K[x] = gK[x], so e ◦ R = g ◦ R. 2
19 BCH codes
The following result was discovered by Hocquenghem in 1959 and independently by Bose and
Ray-Chaudhuri in 1960 in the binary case. It is called BCH-bound.
Theorem 19.1 Let K be a finite field and let α be a primitive n-root of 1 over K. Further
l ∈ N \ {0}, 2 ≤ d ≤ n and r ∈ N with gcd(n, r) = 1. If the elements:
αl , αl+r , . . . , αl+(d−2)r
are roots for the generating polynomial of a cyclic code C of length n over K, then C has the
minimal weight d(C) ≥ d.
32
Proof: We define a = (1, αr , . . . , α(n−1)r ) and v = (1, αl , . . . , αl(n−1) ). As gcd(n, r) = 1, αr is
itself a primitive n-root of 1. We observe that C ≤ GRSd (a, v)|K. The bound is true because
d(GRSd (a, v)) = d. 2
Definition 19.2 Let GRSd (a, v) be the generalized Reed-Solomon code with a = (1, α, . . . , αn−1 )
and v = (1, αl , . . . , αl(n−1) ), where α is a primitive n-root of 1 over K = Fq and l ≥ 1. The existence
of α is equivalent with gcd(q, n) = 1. The subfield code C = GRSd (a, v)|K is called BCH-code of
designed distance d. A BCH-code C with n = q m − 1 is called primitive. If moreover l = 1, C is
a classic BCH-code (in narrow sense). All BCH-codes are cyclic.
Theorem 19.3 The generating polynomial of a BCH-code with designated distance d is:
g = lcm(mαi | i = l, . . . , l + d − 2)
Proof: This polynomial is the polynomial of smallest degree with the given roots. The statement
about the minimal distance is just the BCH bound. 2
Example 19.4 A Reed-Solomon code C over K = Fq with minimal distance d has the generating
polynomial
d−1
Y
g= (x − αi ),
i=1
Example 19.5 K = Fq and gcd(k, q − 1) = 1. The Hamming code Hamq (k) ' GRS2 (∗, v)|K =
v ⊥ |K with v = (1, α, . . . , αn−1 ). So in this case the Hamming code is a BCH-code. The generating
polynomial is the minimal polynomial mα of α. The minimal distance is ≥ 3 because for each
root α of mα , αq is a root as well. Also, n and q − 1 are relatively prime.
Definition 19.6 For A ∈ GL(V ) and w ∈ V we define the mapping (A, w) : V → V as:
(A, w)(v) = Av + w.
33
Proof: Let α be a primitive n-root of 1 in E = Fqm ≥ K. We identify the indexes 0, 1, . . . n used
to denote positions in a vector v ∈ K n+1 with elements of E, as we identify i with αi for i 6= n
and we identify n with 0 ∈ E. If AGL(1, E) = {(a, b) | a ∈ E × , b ∈ E}, this group operates over
K n+1 as follows:
(c0 , . . . , cn )(a, b) = (c(a,b)−1 (0) , . . . , c(a,b)−1 (n) ).
For (c0 , . . . , cn ) ∈ Ĉ, (c0 , . . . , cn )(α, 0) = (cn−1 , c0 , . . . , cn−3 , cn−2 , cn ) ∈ Ĉ, as C is cyclic. So Ĉ is
invariant for the group {(a, 0) | a ∈ E × }. But (a, b) = (a, 0)(1, a−1 b) and (1, u) = (u, 0)(1, 1)(u−1 , 0),
we must show only that (1, 1) ∈ P er(Ĉ). If d is the designed distance of the BCH-code C, for
1 ≤ j ≤ d − 1 we have:
n−1
X n−1
X n−1
X
c(1,1)−1 (i) αij = c(1,−1)(i) αij = ci (αi + 1)j + cn =
i=0 i=0 i=0, αi 6=−1
n−1 n−1 j
X
i j
X X j
= ci (α + 1) + cn = ci αir + cn =
i=0 i=0 r=0
r
j n−1 n
X j X X
= ci αir + cn = ci = 0,
r=0
r i=0 i=0
So Ĉ is invariant for (1, 1). It follows that ACL(1, q m ) ≤ P er(Ĉ). But it is known that ACL(1, E)
operates 2-transitively on E (exercise!), so P er(Ĉ) operates 2-transitively on {0, . . . , n}. 2
Corollary 19.8 Using the Theorem of Prange, it follows that the minimal distance of binary
primitive classic BCH-codes is always an odd number.
Example 19.10 Take n = 25 − 1 = 31 and d = 8. Now the generating polynomial g has degree
20 because also mα7 divides g. So C is a [31, 11]-code with d(C) ≥ d = 8. Because g(αj ) = 0 for
j = 1, 2, . . . , 10, we get with the BCH-bound d(C) ≥ 11. If d(C) ≥ 12, as d(C) must be odd, we
get d(C) ≥ 13. Using the Griesmer bound,
10 l
X dm
31 = n ≥ = 33,
i=0
2i
34
20 Newton’s Equations
For a very special kind of primitive classic BCH-codes, the minimal distance proves to be the same
as the designed distance. But in order to prove this, we must shortly develop some theory about
symmetric polynomials. Recall that the elementary symmetric functions sj = sj (x1 , . . . , xm ) for
j = 0, . . . , m are defined as follows:
s0 = 1,
s1 = x1 + · · · + xm ,
X
s2 = xi xj ,
i<j
.. ..
. .
sm = x1 . . . xm .
We define also another family of symmetric polynomials:
m
X
pr = pr (x1 , . . . , xm ) = xri .
i=1
We apply the differentiation ∂/∂x and we develop the result as a sum of power series:
m
X m
X Y
(−1)j jsj xj−1 = σ 0 (x) = − xj (1 − xi x) =
j=0 j=1 i6=j
m m ∞ ∞
X σ(x) X X X
=− xj = −σ(x) xj (xj x)k = −σ(x) pk+1 xk .
j=1
1 − xj x j=1 k=0 k=0
If one compares the coefficients of x in the first and in the last expression, one finds Newton’s
identities. 2
35
Proof: Of course h + 1 ≤ n. Is E = hai, then 1 = a0 , a, . . . , ah are linear independent over K. So
there is a regular matrix B ∈ M(h+1)×(h+1) (K) such that:
(u0 , . . . , uh )B = (1, a, . . . , ah ).
i i
If we apply different powers of the Frobenius automorphism, we find that for all i ∈ N, (uq0 , . . . , uqh )B =
i i
(1, aq , . . . , ahq ). All together:
a2 ah
1 a ...
1 aq a2q ... ahq
AB = .. .. .. .. .
. . . .
h h h
1 aq a2q ... ahq
u0 ... uh
uq0 ... q
uh h h h
(x0 , x1 , . . . , xh−1 ) .. .. = −(uq0 , uq1 , . . . , uqh−1 )
. .
h h
uq0 ... uqh
But the elements ui build a basis of U and raising to the power q is the identity on K = Fq , so it
follows:
h−1
h X j
uq + a j uq = 0
j=0
Q all u ∈ U . On the other hand, all elements u ∈ U solve this equation and the equation
for
u∈U (x − u). As they have the same degree, are both monic and have the same solution, both
polynomials must be equal. 2
Theorem 20.4 Let K = Fq and let C be a primitive classical BCH-code over K with designed
distance d = q h − 1. Then d(C) = d.
36
The code-words from C are indexed again with the elements from E × using i ; αi for i =
0, . . . , n − 1, where α is a primitive root of 1 in E. We choose c as the vector which has 1 exactly
on the positions u ∈ U \ {0}. Then wt (c) = |U \ {0}| = q h − 1 = d, and the formula (1) shows
that c ∈ C.
In order to prove (1) we observe that:
h
Y q
X
(x − u) = (−1)j sj xj =
u∈U j=0
h h−1
= xq + ah−1 xq + · · · + a0 x ∈ E[x].
rsr = 0 for all r = 0, . . . , q h . If we
So if the characteristic of K does not divide j is sj = 0, so P
compute the power functions pr in the elements of u, pr = u∈U ur . According with Newton’s
equations,
r−1
X r−1
X
pr = − sj pr−j + (−1)r rsr = − sj pr−j
j=1 j=1
for r = 1, . . . , q h −2. We apply now induction over r and find that pr = 0 for all r = 1, . . . , q h −2 =
d − 1. So the relations (1) are proven. 2
37
Definition 21.1 If p 6= r are odd primes and r mod p is a quadratic residue, we denote by Q, N ,
Q̄, N̄ codes over K = Fr of length p generated by q(x), n(x), (x − 1)q(x) and (x − 1)n(x). They
are quadratic rest codes, or QR-codes.
Proof: The first statement follows from the fact that a cyclic code has dimension n − deg g, where
g is the generating polynomial. For the second one, observe that if l ∈ Np , then the mapping
i ; li mod p is a bijection between Qp and Np . The corresponding permutation matrix produces
both equivalences because:
p−1 p−1 p−1
X X −1 X
ci (αj )i = ci (απ(j) )π (i)
= cπ(i) (απ(j) )i .
i=0 i=0 i=0
over K = F2 . The QR-code corresponding to q(x) is a BCH-code. We have already seen that it is
the binary [7, 4, 3] Hamming code.
Both polynomials of degree 11 are irreducible, because if they were reducible, there was a primitive
23-root of 1 in F2t for t ≤ 10. But this is not the case because 23 does not divide any 2t − 1 for
t ≤ 10. For a good choice of a 23-root of 1, we may choose
Y
q(x) = (x11 + x10 + x6 + x5 + x4 + x2 + 1) = (x − αi ).
i∈Q23
so the QR-code is a BCH-code with parameters [23, 12, d]. But the set of squares
The squares contain the arithmetic progression 1, 2, 3, 4 so the minimal distance is d ≥ 5. We will
show later that d = 7 and that this QR-code is the Golay code Gol(23).
38
In F11 [x] one has the following decomposition:
and both polynomials of degree 5 are irreducible because 11 does not divide any number 2t − 1
for t ≤ 4. Any one of the two polynomials can be chosen to be q(x), and we get a QR-code
with parameters [11, 6, d]. With l = 1 and r = 2 in the definition of the BCH-bound, as Q11 =
{1, 3, 4, 5, 9} we get the minimal distance d ≥ 4. We will show that d = 5. The code is equivalent
with Golay code Gol(11).
Let α 6= 1 a p-root of 1 over K = Fr , where p is an odd prime and r 6= p is a prime such that
r = x2 mod p. We define:
p−1
X i i
γ= α.
i=1
p
As pr = 1 and −1 = 1 in characteristic 2, we get the equation:
1. Q⊥ = Q̄.
2. Q̃⊥ = Q̃.
Proof: In the following we use the fact that −1 is not a square modulo p, so the application
x ; −x maps Qp one in one onto Np .
Let q(x) = i∈Qp (x − αi ) be the generating polynomial of Q. As always in cyclic codes, Q⊥ has
Q
as generating polynomial:
p+1
1 1 Y
q ⊥ (x) = −n(0)−1 x 2 n − 1 = −n(0)−1 (1 − αj x)(1 − x) =
x x
j∈Np
Y Y Y
= (α−j − x)(1 − x) = (αi − x)(1 − x) = (x − αi )(x − 1) = q(x)(x − 1).
j∈Np i∈Qp i∈Qp
So Q⊥ = Q̄.
In order to prove that Q̃ is self-dual, we consider a generating matrix Ḡ of Q̄ and the extended
matrix:
Ḡ
G= ∈ M p+1 ×p (K).
1 ... 1 2
39
We know that:
p−1
X xp − 1
xi = = q(x)n(x)
i=0
x−1
So Q̃ ⊆ Q̃⊥ but as they have equal dimension (p + 1)/2, they are equal sets. 2
Now we finally can compute the minimal distance of the Golay code as QR-codes.
Example 21.8 The QR-code Q with parameters [23, 12] is equivalent with the Golay code Gol(23).
Q̄ has the generating polynomial (x+1)q(x) = x12 +x10 +x7 +x4 +x3 +x2 +x+1. In particular, Q̄
has a basis consisting of vectors of weight 8. Now we look to the generating matrix of the extended
QR-code G̃ and we observe, that Q̃ has a basis consisting of vectors whose weights are divisible
with 8. But Q̃ is a self-dual binary code, so it is 4-divisible. We know already that d(Q) ≥ 5. So
it is d(Q̃) ≥ 8 and d(Q) ≥ 7. On the other hand, by the Hamming bound d(Q) ≤ 7, so d(Q) = 7.
Example 21.9 The ternary [11, 6]-code Q is equivalent with the Golay code Gol(11).
Because Q̃ is self-dual, it is 3-divisible. We already know d(Q) ≥ 4, so d(Q̃) ≥ 6, which implies
d(Q) ≥ 5. Using again the Hamming bound, we get d(Q) = 5.
The proof that a code with parameters [23, 12, 7] or [11, 6, 5] that contains 0 is always a linear
code, and is isomorphic with Gol(23) or with Gol(11) is more complicated, but the statement is
true.
In the rest of this section we show some interesting properties of the case p = 8k + 7, r = 2. We
define the following polynomials: X
eq = xi ∈ F2 [x],
i∈Qp
X
en = xi ∈ F2 [x].
i∈Np
40
Also en ◦ en = en . So eq (α), en (α) ∈ {0, 1}. But:
Theorem 21.11 For p = 8k − 1 and r = 2 is the extended QR-code Q̃ self-dual and 4-divisible.
Proof: We already know that the code is self-dual. We also know that the elements (1 + en ) ◦ xi
(i = 0, . . . , p − 1) generate Q̄. All those elements have weight (p + 1)/2, which is divisible with 4.
So Q̃ has a basis of elements, which have all weights divisible with 4. 2
41
Part V
42
22 Classic Goppa codes
Let K be a field. With K(x) we denote the field of rational functions over K. This is the field
of fractions of the ring of polynomials over K, which is a domain of integrity. If f, h ∈ K(x) and
g ∈ K[x] we write f ≡ h mod g if
u
f −h=
v
with u, v ∈ K[x], gcd(u, v) = 1 and g | u. This congruence is a relation of equivalence over K(x).
Definition 22.1 Consider the fields K = Fq ≤ E = Fqm . Let P = {a1 , . . . , an } a finite subset of
E and g a monic polynomial in E[x] with g(ai ) 6= 0 for all i. The linear code:
n
n X ci o
Γ(P, g) = c = (c1 , . . . , cn ) | ci ∈ K, ≡ 0 mod g
i=1
x − ai
is a classic Goppa code. The polynomial g is the Goppa polynomial. If g is irreducible, we say
that the code is irreducible as well.
The classic Goppa codes are subfield codes for some generalized Reed-Solomon codes.
Theorem 22.2 Let Γ(P, g) be a classic Goppa code with P = {a1 , . . . , an } and deg g = t. Then:
1. If t ≥ n then Γ(P, g) = 0.
2. If t < n then Γ(P, g) = GRSt+1 (a, v)|K, if a = (a1 , . . . , an ) and v = (g(a1 )−1 , . . . , g(an )−1 ).
g(x) − g(ai )
fi (x) = − g(ai )−1 ,
x − ai
such that:
(x − ai )fi (x) = 1 − g(ai )−1 g(x) ≡ 1 mod g,
1
fi (x) ≡ mod g.
x − ai
The polynomial h(x) = g(x) − g(ai ) has h(ai ) = 0 so is divisible by the polynomial x − ai . It
follows that fi ∈ E[x] and that deg fi = t − 1. It follows that c = (c1 , . . . , cn ) ∈ C if and only
if c1 f1 (x) + · · · + cn fn (x) ≡ 0 mod g. But the left-hand side has degree < t, so the condition is
c1 f1 (x) + · · · + cn fn (x) = 0.
We observe the identity:
g(x) − g(y)
= gt (xt−1 + xt−2 y + · · · + y t−1 ) + gt−1 (xt−2 + xt−3 y + · · · + y t−2 ) + · · · +
x−y
+ g2 (x + y) + g1 .
Put y = ai and vi = g(ai )−1 . Then the condition c1 f1 (x) + · · · + cn fn (x) = 0 can be written down
in the form of a check matrix:
gt v1 ... gt vn
(gt−1 + a1 gt )v1 ... (gt−1 + an gt )vn
=
.. ..
. .
(g1 + a1 g2 + · · · + at−1
1 gt )v1 ... (g1 + an g2 + · · · + at−1
n gt )vn
43
gt 0 0 ... 0 v1 ... vn
gt−1 gt 0 ... 0 a1 v1 ... an vn
= . .
.. ..
..
.. ..
.. . . . . .
g1 g2 g3 ... gt at−1
1 v1 ... at−1
n vn
As gt 6= 0, the right matrix is itself a check matrix for C. In the case t ≥ n, the kernel of the right
matrix consists of 0 only. 2
It follows that d(Γ(P, g)) ≥ 1 + t, for t < n.
Example 22.3 Let C be a classic BCH-code over K of length n and of designed distance d. Let
α be the corresponding primitive n-root of 1 over K. If we define P = {αi | i = 0, 1, . . . , n − 1}
and g = xd−1 , then C ' Γ(P, g).
Definition 23.1 Let K be a commutative field, not necessarily finite. Let t ≥ 1 and n = 3t + 1.
We consider the following linear code C of length n over K. Let x1 , . . . , xn ∈ K be fixed pairwise
different elements.
C = {(f (x1 ), . . . , f (xn )) | f ∈ K[x], deg f ≤ t}.
where f0 , f1 ∈ K[x], deg f0 ≤ 2t, deg f1 ≤ t and f1 (0) = 1. Suppose that the received code-word is
(y1 , . . . , yn ) and that there are at most e transmission errors. This means that there is a code-word
c = (c1 , . . . , cn ) ∈ C and there is a set of indexes i1 , . . . , ie such that cij 6= yij but ck = yk for
k 6= ij .
We write down the conditions Q(xk , yk ) = 0. This means that we have got a system of n = 3t + 1
equations with (2t + 1) + t = 3t + 1 unknowns, which are the unknown coefficients of f0 and f1 . We
solve the system and we find out the polynomial f which has produced the code-word by division
with remainder in the ring K[x]:
f0 (x)
f (x) = .
f1 (x)
Now we must prove that f1 | f0 and the result of the polynomial division is really f , the polynomial
corresponding to c. Indeed, consider the polynomial P (x) = Q(x, f (x)), where f is the polynomial
we are trying to determine. The polynomial has degree ≤ 2t but at least n − e roots - the valid
points. But:
n − e > n − t > 3t − t = 2t,
so the polynomial has a number of roots which is bigger that its degree. As being defined over a
commutative field, P (x) must be 0, so the equality:
is a polynomial identity.
44
Now we can generate the original code-word:
(c1 , . . . , cn ) = (f (x1 ), . . . , f (xn )).
Definition 24.1 Let c = (c1 , . . . , cn ) ∈ C. Let c̃ = c+f the received word. f = (f1 , . . . , fn ) ∈ K n
is the error vector, with wt (f ) = t ≤ (d − 1)/2. Let s = (s1 , . . . , sd−1 ) be the syndrome of c̃. This
means:
(s1 , . . . , sd−1 )T = H c̃T = H(c + f )T = Hf T .
The set F = supp f = {i1 , . . . , it } is the set of mistaken positions. The polynomial:
Y
σ(x) = (1 − al x) = σ0 + σ1 x + · · · + σt xt ∈ E[x],
l∈F
2. For i = t + 1, . . . , d − 1,
t
X
si = − σj si−j .
j=1
Proof: (1) follows directly from the definition of the syndrom. In order to prove (2) compute for
i = t + 1, . . . , d − 1:
Xt Xt X i−j−1
σj si−j = σj al vl fl =
j=0 j=0 l∈F
t
X
σj a−j
X
= ali−1 vl fl l =
l∈F j=0
X
= ai−1
l vl fl σ(a−1
l ) = 0.
l∈F
2
The first part of the Lemma says that if we have the error positions, then we can use the syndrome
in order to compute c. The second part is useful to compute the error location polynomial.
45
Lemma 24.3 Consider η(x) = 1 + η1 x + · · · + ηt xt ∈ E[x]. If for j = t + 1, . . . , d − 1,
t
X
si = − ηj si−j ,
j=1
So η(a−1
l ) = 0 for l ∈ F , and η(x) = σ(x). 2
With other words, the error location polynomial is the polynomial of least degree, whose coefficients
satisfy the given linear constraints.
Remark 24.5 The first t equations in Lemma 24.2 say that the coefficients σi of the error local-
ization polynomial are solutions of the system:
σt st+1
St ... = − ... .
σ1 s2t
If we know the number of mistaken coordinates t, then we can compute the error localization
polynomial, and this results from the following Lemma.
t X
X t
(ABC T )hk = ahj bjm ckm =
j=1 m=1
t X
X t
= aih−1
j
vij δjm fim ak−1
im =
j=1 m=1
46
t
X
= ah−1 k−1
ij vij fij aij =
j=1
t
X
= aih+k−2
j
vij fij = sh+k−1 = shk = (St )hk
j=1
Theorem 24.7 Let e = [(d − 1)/2]. Then t = |F | = rk Se and Sr is singular for t < r ≤ e.
As t ≤ e, we already know that the first t columns of Se are linear independent, so rk Se ≥ t. Take
t < r ≤ e. The equalities from Lemma 24.2 mean that the column r of Se is linear dependent on
the t columns preceding it. So rk Se = t. 2
To sum up, the Peterson, Gorenstein and Zierler algorithm works as follows:
1. Compute the syndrome (s1 , . . . , sd−1 )T = H c̃T . If all si = 0, then c = c̃ and STOP.
2. Determine t = max{r | 1 ≤ r ≤ [(d − 1)/2], det Sr 6= 0}. If all det Sr = 0 there are too many
mistakes, return FALSE.
σ1 s2t
6. Return c = c̃ − f .
Steps 2, 3 and 5 are computationally intensive. So new algorithms are done in order to optimize
them.
47
25 Error correction using Euclid’s algorithm
This section is a completion to Section 24. We keep all definitions and notations of this section.
The algorithm was discovered by Sugiama, Kasahara, Hirasawa and Namekawa.
Lemma 25.2 Let σ 0 (x) be the derivative of σ(x). Then we can compute the errors using:
ω(a−1
l ) al
fl = − 0 −1 · v
σ (al ) l
for l ∈ F .
X h d−2
X i Y
= vl fl (1 − al x) (al x)i (1 − al0 x) =
l∈F i=0 l0 ∈F \{l}
X h i Y
= vl fl 1 − (al x)d−1 (1 − al0 x) =
l∈F l0 ∈F \{l}
X Y
= vl fl (1 − al0 x) mod xd−1 = ω(x) mod xd−1 .
l∈F l0 ∈F \{l}
2
We show now an algorithm that computes in the same time σ(x) and ω(x). The algorithm works
in the following way. Because S(x)σ(x) ≡ ω(x) mod xd−1 , there is a true polynomial identity:
We set r−1 (x) = xd−1 and r0 (x) = S(x), and we compute recursively:
48
where deg rk (x) < deg rk−1 (x). This works since finally rm (x) = gcd(xd−1 , S(x)) and rm+1 (x) = 0.
On the way backwards, we find relations for k = −1, 0, 1, . . . , m:
Proof: (1) For k ≥ 1 we have rk (x) = rk−2 (x) − qk (x)rk−1 (x) and so
It follows:
ak (x) bk (x) ak−2 (x) bk−2 (x)
det = det = ...
ak−1 (x) bk−1 (x) ak−1 (x) bk−1 (x)
a−1 (x) b−1 (x) 1 0
· · · = ± det = ± det = ±1,
a0 (x) b0 (x) 0 1
and it follows also that gcd(ak (x), bk (x)) = 1 for k ≥ 1.
(2) For k = 0 the statement is correct, so take k ≥ 1. We have bk (x) = bk−2 (x) − qk (x)bk−1 (x)
and deg qk ≥ 1, so we get by induction deg bk (x) > deg bk−1 (x). Now we make a new induction
and get:
deg bk (x) = deg qk (x)bk−1 (x) = deg qk (x) + deg bk−1 (x) =
= deg qk (x) + (d − 1 − deg rk−2 (x)) = deg qk (x) + d − 1 − deg qk (x)rk−1 (x) =
= d − 1 − deg rk−1 (x).
2
d−1 d−1
1. There is a k ∈ {0, 1, . . . , m} such that rk (x) 6= 0, deg rk (x) < 2 and deg rk−1 (x) ≥ 2 .
2. For this k, σ(x) = µbk (x) and ω(x) = µrk (x), where µ = bk (0)−1 .
Proof: Because of rm (x) = gcd(xd−1 , S(x)) and S(x)σ(x) + u(x)xd−1 = ω(x), rm (x) | ω(x) and :
d−1
deg rm (x) ≤ deg ω(x) ≤ t − 1 < .
2
So there is a k as in the statement.
The following relations are true:
49
Because of deg σ(x) = t ≤ (d − 1)/2 and deg rk (x) < (d − 1)/2, deg σ(x)rk (x) < d − 1. Further:
d−1 d−1
deg bk (x) = d − 1 − deg rk−1 (x) ≤ d − 1 − = .
2 2
d−1
deg ω(x) ≤ t − 1 < −→ deg ω(x)bk (x) < d − 1.
2
Sot the congruence says in fact that:
Theorem 26.1 For r = 1, . . . , N let (Lr , σ (r) ) be a recursion of minimal length, which generates
the sequence (sk ) with k = 1, . . . , r. Let (L0 , σ (0) (x)) the trivial recursion. We define:
Lr−1
(r−1)
X
δr = σj sr−j .
j=0
It follows: (
Lr−1 , δr = 0,
Lr =
max(Lr−1 , r − Lr−1 ), δr 6= 0,
for all 1 ≤ r ≤ N .
(1) Lr + 1 ≤ r − Lr−1 ≤ r − j ≤ r − 1,
50
Lr−1 Lr
(r−1) (r)
X X
= σj σi sr−j−i because (1)
j=1 i=1
Lr Lr−1
(r) (r−1)
X X
= σi σj sr−j−i
i=1 j=1
Lr
(r)
X
= σi sr−i because (2)
i=1
= sr .
L = max(Lr−1 , r − Lr−1 ).
Now we see that (L, σ (r) (x)) is a recursion that generates the sequence s1 , . . . , sr , because:
L Lr−1
X (r)
X (r−1) δr Lm−1 (m−1)
sk + σj sk−j = sk + σj sk−j − sk+m−r + σj=1 σj sk+m−r−j =
j=1 j=1
δm
(
δr
δr − δm δm = 0 k = r,
=
0 k = L + 1, . . . , r − 1.
In order to apply this for k = L+1, . . . , r−1, we observe that (L+1)+m−r > (r−Lr−1 )+m−r =
r − (m − Lm−1 ) + m − r = Lm−1 , hence k + m − r ≥ Lm−1 + 1 for k = L + 1, . . . , r − 1. In conclusion
the recursion (L, σ (r) (x)) the sequence s1 , . . . , sr . Also, Lr ≥ L, and by minimality Lr = L. 2
The Berlekamp - Masey Algorithm works as follows:
51
(b) If δr = 0 set (Lr , σ (r) (x)) = (Lr−1 , σ (r−1) (x)).
(c) If δr 6= 0 set:
Lr = max(Lr−1 , r − Lr−1 ),
δr r−m (m−1)
σ (r) (x) = σ (r−1) (x) − x σ (x),
δm
where m = max{i | 0 ≤ i ≤ r − 1, Li > Li−1 }. If this maximum is 0, set σ (r) (x) = 1.
3. (LN , σ (N ) (x)) is a recursion of minimal length that generates s1 , . . . , sN .
In order to find the error localisation polynomial, one constructs the recursion of minimal length
that generates the syndrome sequence. If L > d−1 2 then send an error message. Else, we have got
σ(x) and we compute ω(x) with S(x)σ(x) ≡ ω(x) mod xd−1 .
Theorem 27.1 Every (23, 212 , 7) binary code C that contains (0, 0, . . . , 0) is a linear code and is
equivalent with the binary Golay code Gol(23).
Proof: The Hamming bound theorem is a result about codes in general, not only about linear
codes. We compute that:
[ 23 23 23
223 ≥ | B3 (c) | = 212 | B3 (0) | = 212 1 + + + = 212 211 .
1 2 3
c∈C
The code is perfect as it satisfies the equality in the Hamming bound theorem. 2
Proof of the theorem: We will show here that the code is linear and is formal equivalent with
Gol(23): has the same weight polynomial, and some other common properties. A complete proof
of the equivalence is too long and not appropriate for this lecture series.
Denote F2 with K. We choose a c0 ∈ C. Let Ai = |{c | c ∈ C, d(c, c0 ) = i}|. Moreover, for
0 ≤ j ≤ 23 we define the set:
We will count Xj in two different ways. As C is perfect, for every x ∈ K 23 there is exactly one
c ∈ C such that d(x, c) ≤ 3. So one has:
23 23 23
|Xj | = |{x | x ∈ K , d(x, c0 ) = j}| = |{x | x ∈ K , d(x, 0) = j}| = .
j
On the other hand:
X
|Xj | = |{x | x ∈ K 23 , d(x, c0 ) = j, d(x, c) ≤ 3}|.
c∈C
52
= |{y | y ∈ K 23 , d(y + c0 , c0 ) = j, d(y + c0 , c0 + fi ) ≤ 3}| =
= |{y | y ∈ K 23 , d(y, 0) = j, d(y, fi ) ≤ 3}|.
This quantity depends now only of j and i = d(fi , 0). So we conclude:
23
23 X
= |Xj | = Ai · |{y | y ∈ K 23 , d(y, 0) = j, d(y, fi ) ≤ 3}|.
j i=0
for j = 1, . . . , k.
Definition 28.1 The 2-party graph is called (l, r) regular if every vertex x ∈ V has degree l and
every vertex y ∈ W has degree r.
53
In this case the check matrix has k lines and n columns and one has the equality:
rk = nl.
∂U = {w ∈ W | w connected with U }.
Theorem 28.4 Let E be a (n, l, r, α, δ)-expander such that δ ≥ 2l . Then the corresponding code
C(E) has minimal distance d > αn and consequently can correct < αn 2 many errors.
nl
Proof: Recall that nl = rk. As C(E) is determined by k = r equations, its dimension is:
nl
dim C(E) ≥ n − .
r
Let 0 6= v ∈ C(E). Consider the set U = {i | vi = 1}. A number of l|U | edges start in U . They
end in ≥ 2l |U | many conditions. If wt (v) ≤ αn, there must be a condition that contains only
one edge, because if not there would be less then |U |/2 conditions, and this contradicts with the
property of being an expander. So a condition reads y = vj = 1 and v ∈ / C(E). Contradiction. 2
Definition 28.5 For Low Density Parity Check Codes (LDPCC) one considers the following
correction algorithm:
1. Compute all conditions for v.
2. Find xi present in strictly more false conditions as in correct conditions. If there is no false
condition, then stop.
3. Flip xi in v. This means vi := 1 − vi .
4. Go to 1.
54
But as s + k > 34 lt, we get:
lt
s> .
2
So there is a value such that more than half of its edges end in incorrect conditions. This value
will be flipped. The value was not necessarily a corrupted one, but the number s becomes smaller
by every flip, and that is what matters. 2
29 Exercises
Exercise 1: A [7, 4, 3] Hamming code C has the following check-matrix:
1 0 0 1 1 0 1
H = 0 1 0 1 0 1 1
0 0 1 0 1 1 1
x1 + x4 + x5 + x7 = 0
x2 + x4 + x6 + x7 = 0
x3 + x5 + x6 + x7 = 0
x1 = a+b+d
x2 = a+c+d
x3 = b+c+d
We have found a basis of the code C. The rows of the generating matrix are the basis vectors. So:
1 1 0 1 0 0 0
1 0 1 0 1 0 0
G= 0 1 1 0 0 1 0 .
1 1 1 0 0 0 1
2
Exercise 2: A [7, 4, 3] Hamming code C has the following generating matrix:
1 1 0 1 0 0 0
1 0 1 0 1 0 0
G= 0 1 1
.
0 0 1 0
1 1 1 0 0 0 1
55
A check-matrix H has 3 rows and 7 columns, such that HGT = 0. Let a arbitrary row of H be:
(a, b, c, d, e, f, g).
We observe that the right-most 4 × 4 minor of G is the unit matrix, we can choose the parameters
(a, b, c) ∈ F32 . The general solution decomposes as follows:
a 1 0 0
b
0
1
0
c
0
0
1
a + b = a 1 + b 1 + c 0 .
a+c 1 0 1
b+c 0 1 1
a+b+c 1 1 1
Taking for (a, b, c) the standard basis vectors, one finds three linear independent possible rows of
the check-matrix. So we found:
1 0 0 1 1 0 1
H = 0 1 0 1 0 1 1 .
0 0 1 0 1 1 1
Observe that neither the generating matrix, nor the check-matrix, are unique. 2
Exercise 3: Compute the error syndromes for one error in the [7, 4, 3] Hamming code C of the
last exercises.
Consider the vectors ei ∈ F72 given by:
0
0
..
.
1 .
ei =
.
..
0
containing only one 1 at position i. Using the known check-matrix H we get:
c̃ = (1, 1, 0, 0, 1, 1, 1).
We compute immediately:
H c̃ = (1, 1, 1),
so the corrected word will be:
c = c̃ + e7 = (1, 1, 0, 0, 1, 1, 0).
56
Exercise 5: A code C consists of 4 binary words of length 4. Show that this code can NOT be
1-error correcting.
If it was 1-error correcting, the code would have d ≥ 3. But d = 4 is impossible for length 4,
because C would have at most 2 elements. So d = 3. However, any (4, 4, 3) code contradicts the
Hamming bound, because one has:
4
16 = 24 ≤ |C| 1 · (2 − 1)0 + (2 − 1)1 = 4(1 + 4) = 20,
1
By subtracting the relations, we get: (j − i)(ci − cj ) = 0 mod 11. But Z11 is a field and we get
ci = cj unless i = j. 2
Exercise 7: Show that there is no binary code with parameters (7, 8, 5).
If d = 5 then e = 2. By Hamming Bound:
7 7 7!
27 ≥ 23 1 + + ) = 23 (1 + 7 + = 23 (1 + 7 + 21) = 23 · 29,
1 2 2!5!
is equivalent with 4096 ≥ 4096. As it transform the Hamming Bound in equality, this code, if it
exist, should be perfect. But this code is neither the binary Golay code because 23 6= 90, nor a
Hamming code, because d = 5. So this code cannot exist. 2
Exercise 9: Show that there is no binary code P with parameters (90, 278 , 5), but without using
the characterisation of the perfect codes.
We may suppose that 0 ∈ P . We consider the sets:
57
On the other hand, for some v ∈ V , at most one c ∈ C has the property that hc, vi = 1. Of course,
if c1 6= c2 would fulfill this condition, then d(c1 , c2 ) < 5. But there must be at least one c, because
else there would be less then 278 codewords, so there is exactly one.
It follows 88 = 3| C |, contradiction.
Exercise 10: Let p be a prime number, q = pt and n = (q k − 1)/(q − 1) with k ≥ 2. Let C be a
linear code with parameters [n, n − k, 3]. Show that C is a Hamming code.
Let K = Fq , C ≤ K n , dim C = n − k. C is the intersection of k many independent hyperplanes.
If the hyperplane Hi has the equation:
ai1 v1 + · · · + ain vn = 0,
c ∈ C ↔ HcT = 0.
C has d = 3 so every two columns of H are linear independent. So every two columns generate
different lines in K k . But there are n many columns, so for every line going through 0 in K k , one
has a column generating this line. So H is the check-matrix for the Hamming code. 2
Exercise 11: Let n ≥ 1 and let C be the set of binary words of length n containing an even
number of ones. Show that C is a linear code and analyze this code.
The word 0n belongs to C. Let c1 , c2 ∈ C. If ci contains an even number ki of ones, and s is the
number of positions at which both words contain ones, then c1 + c2 contains (k1 − s) + (k2 − s) =
k1 + k2 − 2s many ones, which is an even number. So C is a vector space.
The condition that determines the code words is:
c1 + c2 + · · · + cn = 0.
This means that the check matrix is the matrix H = (1, 1, . . . , 1) because:
c1
c2
(1, 1, . . . , 1) . = 0.
..
cn
The minimal distance is d(C) = min wt (c) = 2 and the parameters of the code are [n, n − 1, 2].
The code is 1-recognising and 0-correcting.
C is the image of the mapping G : Fn−1
2 → Fn2 given by:
58
The parameters are [n, 1, n]. The generating matrix is G = (1, 1, . . . , 1) ∈ Fn2 , because the code
words are xG with x ∈ {0, 1}. For a check-matrix, observe that the condition met by the code
words is to satisfy the following system of n − 1 equations:
x1 = xn ,
x2 = xn ,
... = ...
xn−1 = xn ,
Exercise 13: Over the field K = Fq let C be the code implicitly given by the condition c1 + c2 +
· · · + cn = 0. Study this code.
The check-matrix is the vector (1, 1, . . . , 1). We observe that the minimal distance is 2 because
the words containing one 1 and one −1 have minimal weight. Also, 2 is the minimal number d
such that every family of d − 1 columns of H is linear independent. The dimension of C is n − 1.
All the following n − 1 vectors belong to C:
v1 = (1, −1, 0, . . . , 0, 0)
v2 = (0, 1, −1, . . . , 0, 0)
.. ..
. = .
vn−1 = (0, 0, 0, . . . , 1, −1)
From:
α1 v1 + · · · + αn−1 vn−1 = (α1 , α2 − α1 , . . . , αn−1 − αn−2 , −αn−1 ),
we deduce that those vectors are linear independent, so they build a basis. So they are the rows
of a generating matrix G. The parameters of the code are [n, n − 1, 2] as in the case of the binary
codes. 2
Exercise 14: Show that the Reed-Solomon code is a maximum distance separable code. (MDS
code)
Recall the Singleton Bound:
d ≤ n − logq | C | + 1.
The Reed-Solomon Code with polynomials with degree < k has parameters [n, k, d] with d =
n − k + 1. So:
n − k + 1 ≤ n − logq (q k ) + 1 = n − k + 1,
realizes the equality, so the code is MDS. 2
Exercise 15: Show that the Reed-Solomon code has the generating matrix:
1 1 ... 1
a1 a 2 ... an
Gk = .. .. .. .
..
. . . .
ak−1
1 ak−1
2 ... ak−1
n
59
For k ≤ n−1 the application given by x ; xG from K k to K n generates the code. This matrix can
be imbedded in the n × n matrix Gn which has determinant 6= 0 as a Vandermonde determinant.
So Gk has maximal rank. (Also, Gk contains a Vandermonde minor, which is invertible. ) 2
P
Exercise 16: Show that RM (m − 1, m) consists of all words with ci = 0.
The parameters of the code are [2m , 2m − 1, 2[m−(m−1)] ] = [2m , 2m − 1, 2]. It follows that the code
is a hyperplane, and the minimal distance is 2. For every monomial xi1 . . . xik , if we evaluate it in
every point (x1 , . . . , xm ) ∈ {0, 1}m , one gets an even mumber of values 1. It follows that only even
code-words are present in RM (m − 1, m). Because of the dimension and of the minimal distance,
there must be all of them and exactly them. 2
Exercise 17: Show that RM (r, m)⊥ = RM (m − r − 1, m).
We observe that:
r m r m m−r−1
X m
X m X m X m X m
n− = − = = ,
l l l l l
l=0 l=0 l=0 l=r+1 l=0
m m
because l = m−l . It follows that those spaces have the same dimension.
Now take x ∈ RM (r, m) and y ∈ RM (m − r − 1, m). We consider the scalar product:
n
X
hx, yi = xi yi .
i=1
The code-word xy = (x1 y1 , . . . , xn yn ) is the result of the evaluation in all points of a polynomial
P degree less or equal r + (m − r − 1) = m − 1. So this code-word is an even weight word, so
of
xi yi = 0. 2
Exercise 18: Let m be odd and r = (m − 1)/2. Show that RM (r, m) is self-dual.
It follows that r = m − r − 1 and we apply the previous exercise. 2
Exercise 19: Consider the following sequence of Hadamard matrices over the field F2 , defined as
follows: H0 = (0),
Hn Hn
Hn+1 =
Hn Hn + Un
where the matrix Un ∈ M2n ×2n (F2 ) contains only the digit 1. Show that the rows of the matrix
Hn build together the code RM (1, n).
Exampes:
0 0 0 0
0 0 0 1 0 1
H0 = (0), H1 = , H3 = .
0 1 0 0 1 1
0 1 1 0
We show that the rows of Hn build a vector space of dimension n over F2 . This is true for n = 0
and n = 1.
Suppose the claim true for n. Consider Hn+1 . Let u, v ∈ Hn+1 be two rows.
Case 1: If u, v belong to the first half of Hn+1 , there exist u0 , v 0 ∈ Hn such that u = (u0 , u0 ) and
v = (v 0 , v 0 ). By the hypothesis of induction, u0 + v 0 ∈ Hn so u + v ∈ Hn+1 . Moreover, u + v lies
in the first half of the matrix.
Case 2: If u, v belong to the second half of Hn+1 , there exist u0 , v 0 ∈ Hn such that u = (u0 , ~1 + u0 )
and v = (v 0 , ~1+v 0 ). By the hypothesis of induction, u0 +v 0 ∈ Hn so u+v = (u0 +v 0 , u0 +v 0 ) ∈ Hn+1 .
Moreover, u + v lies in the first half of the matrix.
60
Case 3: If u = (u0 , u0 ) comes from the first half of the matrix and v = (v 0 , ~1 + v 0 ) from the second
hald, then the sum u + v = (u0 + v 0 , ~1 + u0 + v 0 ) is in Hn+1 in the second half of the matrix.
It is immediate that all rows of Hn are pair-wise different, so the dimension is n.
If Bn = {x1 , . . . , xn } is a basis of Hn , then Bn+1 = {y1 , . . . .yn , yn+1 } is a basis of Hn+1 , where
yi = (xi , xi ) for i = 1, . . . , n and yn+1 = (~0, ~1). We observe that for all n, if u ∈ Hn \ {0}, u
contains an equal number of 0 and 1. So ~1 ∈ / Hn . We observe that Hn is the simpex code of length
2n and minimal distance 2n−1 , which is also known as RM (1, n). 2
Exercise 20: Let C be the Simplex Code with parameters [2k − 1, k, 2k−1 ] over F2 . Compute its
weight-polynomial AC (x).
Every c ∈ C \ {0} has weight 2k−1 . So the polynomial is:
k−1
AC (x) = 1 + (2k − 1)x2 .
2
k
Exercise 21: Find out the weight-polynomial of the [n = 2 − 1, n − k, 3] Hamming Code.
We apply MacWilliams for the polynomial corresponding to the Simplex Code:
1h n 2k−1 2k−1 −1
i
AC ⊥ (x) = (1 + x) + n(1 − x) (1 + x)
2k
1 h n−1
i
= (1 + x)n + n(1 − x)(1 − x2 ) 2
n+1
n−1
n 2 n−1
1 hX n j X i
= x + n(1 − x) 2 (−1)j x2j
n + 1 j=0 j j=0
j
n−1
h i
i
1 n
n+1 i + n(−1) 2 2i i = 2s
A⊥
i =
h
n
2
i+1 n−1
i
1 + n(−1) 2 i−1 2
i = 2s + 1
n+1 i 2
2
Exercise 22: A code of length n = 2k over Fq is self-dual. What can we say about the coefficients
A0 , A1 and A2 ?
n
X
A(x) = A⊥ (x) = q −k Aj (1 − x)j (1 + (q − 1)x)n−j =
j=0
n
−k
X j 2 n−j
=q Aj [1 − jx + x + . . . ][1 + (n − j)(q − 1)x + (q − 1)2 x2 + . . . ]
j=0
2 2
61
But the following are new:
n
X
A1 = q −k Aj ((n − j)(q − 1) − j) =
j=0
Xn
= q −k Aj (n(q − 1) − jq) =
j=0
n
X
−k+1
= n(q − 1) − q jAj .
j=0
n
−k
X j n−j
A2 = q Aj (−j(n − j)(q − 1) + + (q − 1)2 ).
j=0
2 2
2
Exercise 23: Show that the weight polynomial of the [24, 12, 8] extended Golay code is:
So 0 = A2 = 2−12 [552 + 40A − 12B]. This system of equations has the solution: A = 759,
B = 2576. 2
Exercise 24: Show that the weight polynomial of the extended ternary [12, 6, 6] Golay code is:
The code is self-dual and 3-divisible, so A(x) = 1 + Ax6 + Bx9 + Cx12 . We apply the relations
for self-dual codes and we deduce the following equations:
A+B+C = 36 − 1 = 728
6A + 9B + 12C = 5832
3A − 6B + 66C = −264
y1 = x1 + x2 + x3
y2 = x4 + x5 + x6
y3 = x7 + x8 + x9
y4 = x1 + x4 + x7
y5 = x2 + x5 + x8
y6 = x3 + x6 + x9
62
(a) Show that this check matrix corresponds to a (9, 2, 3, 29 , δ)-expander for δ < 23 .
(b) Deduce that the code C has minimal distance d ≥ 3.
(c) Correct the word v = (0, 0, 1, 1, 1, 0, 0, 1, 1).
(a) n = 9, (l, r) = (2, 3), α = 92 .
3
(b) δ < 2 = 34 l. We apply the Theorem. It follows that dim C ≥ 3 and d > αn = 2 so d ≥ 3.
(c) We observe that y1 = 1 and y4 = 1. Also {1, 2, 3} ∩ {1, 4, 7} = {1}. So x1 occurs in two
incorrect conditions and in none correct condition. We flip x1 . The vector (1, 0, 1, 1, 1, 0, 0, 1, 1)
verifies all conditions. 2
63