Week 10 Golay codes. Classification of perfect codes

Version 2023-11-29. To PDF of this week only Open the whole set of notes in PDF

Synopsis. One can explore cyclic codes of a given length over a given finite field in an attempt to find codes with interesting/useful properties. In fact, all types of codes we have considered so far will arise as cyclic codes. In this chapter, we define two new linear equivalence classes of codes called Golay codes. In our approach, these arise as cyclic codes, however, historically they were found in a different way. We give without proof a complete classification of perfect codes over alphabets of prime power size up to parameter equivalence, conjectured by Golay and proved by Tietäväinen and van Lint.

Recall that:

  • • the only way to specify a general non-linear code in Fqn is to list all the codewords, which consist of a total of qk×n symbols;

  • • a linear code can be specified by a generator matrix, which has k×n entries;

  • • a cyclic code can be specified in an even more compact way — by giving its generator polynomial, which corresponds to a single codeword! We only need to specify nk coefficients of the generator polynomial (its degree is nk and its leading coefficient is 1).

Approach to searching for interesting/perfect/etc codes:

Look for divisors of xn1 and hope that the cyclic codes they generate have a large minimum distance. For example, among the cyclic codes in F27, there are two perfect, Hamming codes (Exercise).

We will now describe two codes found by Marcel Golay in 1949. They are known as the binary Golay code G23 and the ternary Golay code G11, respectively.

The binary Golay code G23

In F2[x], x231=(x+1)g(x)g(x), where g(x)=x11+x10+x6+x5+x4+x2+1 and g(x)=x11+x9+x7+x6+x5+x+1.

Exercise: check this! You may use a computer algebra system but it is always instructive to multiply these out by hand.

Definition: binary Golay code G23

Define a binary Golay code to be the cyclic code in F223 generated by g(x), or any code linearly equivalent to it. (Any) binary Golay code is denoted G23.

Remark: The cyclic code generated by g(x) is seen to be linearly equivalent to the cyclic code generated by g(x); the linear equivalence is by writing all the codevectors backwards.

The above definition does not reflect how the code was originally found (see below) but suggests a practical way to construct a G23 code if need be: factorise x231 over F2 into irreducible factors (e.g., using a computer algebra system) and take one such factor of degree greater than 1 to be the generator polynomial of a cyclic code.

Theorem 10.1: parameters of G23

G23 is a perfect [23,12,7]2-code.

Proof of Theorem 10.1 — part 1. The code is binary (q=2) of length n=23 by construction. The dimension is k=23degg=12.

It is easy to see that the weight of G23 is at most 7: indeed, the vector gG23 is 10101110001100000000000, of weight 7, and so w(G23)7.

It is more difficult to show that the weight of G23 is exactly 7. We will present a theoretical proof of this result using the extended code G24, and will also show how to obtain the same result by a computer calculation.

We now prove that a [23,12,7]2 -code is perfect. The Hamming bound for a binary code in in logarithmic form is knlog2((n0)++(nt)). Here t=[(71)/2]=3 so the argument of log2 is 1+(231)+(232)+(233)=1+23+23×222+23×222×213=1+23(1+11+77)=2048. One has 12=23log22048 hence the Hamming bound is attained.

The proof that w(G23)=7 will be given after a series of lemmas (proof to be continued).

Binary vectors: extending, overlaps, weights and orthogonality

To proceed, we need a mini-toolbox containing tools for working with binary vectors.

A binary vector v=(v1,v2,,vn) is extended to obtain the vector v^ =(v1,,vn,vn+1) where vn+1=v1++vn in F2. That is, a vector is extended by appending one bit so that the resulting vector has even weight. Explicitly, we may write

v^={(v,0),if w(v) is even,(v,1),if w(v) is odd.

By extending each vector in a given binary code, we obtain the extended code:

Definition: extended code

If C is a binary linear code of length n, we define the extended code C^ of length n+1 as {c^:cC}.

The following notion is useful:

Definition: overlap

If u,vF2n, the overlap of u and v is the number of positions i such that ui=vi=1.

It is easy to see that

(10.1)w(u+v)=w(u)+w(v)2×overlap(u,v)

and

(10.2)uv=0overlap(u,v) is even.

It follows that

(10.3)w(u),w(v) are multiples of 4, uv=0w(u+v) is a multiple of 4.

Indeed, by (10.1), w(u+v) is (multiple of 4) + (multiple of 4) 2× overlap(u, v), and by (10.2), 2× overlap(u, v) is a multiple of 4 so the result is a multiple of 4.

The extended binary Golay code G24

Definition: the extended binary Golay code G24

The extended code G^23 is called the extended binary Golay code and is denoted G24.

The code G24 is not cyclic, but we can modify the cyclic code methods used for G23 to answer questions about G24. For example:

Example: generator matrix for G24

Write down a generator matrix for G24.

Solution. Theorem 9.4 gives a generator matrix for G23 as follows: the top row is the vector g=10101110001100000000000, and the rest of the rows are its cyclic shifts xg,,x11g. Extending each of these rows (of weight 7 which is odd) by appending 1 gives twelve codevectors of G24, forming the matrix

G=[101011100011000000000001010101110001100000000001001010111000110000000001000101011100011000000001000010101110001100000001000001010111000110000001000000101011100011000001000000010101110001100001000000001010111000110001000000000101011100011001000000000010101110001101000000000001010111000111]

The rows of G are linearly independent, because they give a linearly independent set if you delete the last bit). By definition of extended code, #G24=#G23=212 and so dimG24=12, same as the number of rows of G. Hence G is a generator matrix for G24.

The next two propositions establish two main properties of G24.

Proposition 10.2: G24 is self-dual

G24 is a self-dual code, that is, G24=G24.

  • Proof. It is enough to check that the above generator matrix G for G24 satisfies GGT=0 — that is, its rows r0,,r11 are orthogonal to each other — and n=2k. The latter is clear as 24=2×12. The former can be done in two ways.

    Way 1 (manual): recall (10.2). Manually check that the overlap of ri and rj is even for all i,j. It is enough to check the overlap of the top row with the other rows — the rest follows by cyclic shifts of the first 23 bits.

    Way 2 (working with polynomials): Write the rows of G as ri=xig^=(xig,1) for i=0,1,,11. We calculate the inner product, (xig,1)(xjg,1)=xigxjg+1, of two rows of G. Recall from the proof of Theorem 9.4 that the inner product of vectors a and b is the coefficient of xn1 in the polynomial a(x)b(x). The vector xjg written backwards is seen to be x11jg(x), so

    xigxjg+1=(coef. of x22 in xi+11jg(x)g(x))+1.

    Note that

    g(x)g(x)=x231x1=x22+x21++x+1

    is a polynomial where the coefficients of x0,,x22 are all 1 and so x22 appears in the polynomial xi+11jg(x)g(x) with coefficient 1. Thus, xigxjg+1=1+1=0.

Self-duality of G24 allows us to deduce other further properties of this code.

Proposition 10.3: weights in G24

The weight of every codevector of G24 is a multiple of 4.

  • Proof. Each row ri of the generator matrix G constructed in the proof of Proposition 10.2 has weight 8 which is a multiple of 4. By Proposition 10.2, rows of G are mutually orthogonal, so by (10.3), a sum ri+rj of two rows of G also has weight divisible by 4.

    We can now apply (10.3) to a sum of ri+rj and rk (both are codevectors of G24 so their inner product is zero by Proposition 10.2) to show that a sum of three rows of G has weight divisible by 4. Continuing in the same way, we show that a sum of any number of rows of G, i.e., any codevector of G24, has weight divisible by 4.

Remark: rest of proof of Theorem 10.1

We are now ready to finish the proof of Theorem 10.1 about the parameters of G23.

  • Proof of Theorem 10.1 — part 2 (final).. We are left to prove that the binary Golay code G23 does not contain non-zero codevectors of weight less than 7.

    We will take G23 to be cyclic with generator polynomial g(x), and will interchangeably use vectors and polynomials. Assume vG23. If a vector v obtained from v by applying the cyclic shift m times, then vG23; note that a term xi in the polynomial v(x) is shifted to xi+m in v(x) if i+m<n, more generally to (i+m)modn, where n=23.

    w(v) cannot be 1, 2, 5 or 6. If vG23 has weight 1, 2, 5 or 6, then the extended vector v^G24 has weight 2 or 6, not divisible by 4, contradicting Proposition 10.3.

    w(v) cannot be 3. Assume w(v)=3 so that v(x)=xi+xj+xk. Out of the 22 possible cyclic shifts of v, at most six can have non-zero overlap with v: these shift xa to xb for some a,b{i,j,k}. Hence there exists a shift v of v which has zero overlap with v. Then v+vG23 has weight 6, contradicting the previous case.

    w(v) cannot be 4. Suppose it can, and shift v so that v(x)=1+xa+xb+xc with 0<a<b<c. Pick a code polynomial of weight 4 of least possible degree c.

    Shifting v(x) to the left a times gives v(x)=1+xba+xca+xna. Note that (v,0) and (v,0) lie in G24=G24 and so have inner product 0, hence vv=0 and by (10.2) the overlap of v and v must be even. The overlap is not 4 because v(x)v(x): otherwise one would have b=2a, c=3a and n=4a, impossible as n=23. The overlap is not 0 as v(x) and v(x) have term 1 in common. Hence the overlap of v and v is 2.

    Observe that na=c is impossible, as it would give the code polynomial v(x)v(x) of degree less than c and weight 2 (impossible by earlier cases) or 4 (contradicts minimality of c), so na>c. Neither xna nor xc contribute to the overlap of v and v, which leaves three cases of how overlap 2 could be achieved.

    Case ca=b. Then v(x)=1+xa+xb+xa+b which factorises as (1+xa)(1+xb). The code polynomial v(x) is divisible by the generator polynomial g(x) which is irreducible, so 1+xa or 1+xb must be divisible by g(x). But this means a codevector of weight 2, a contradiction.

    Case ca=a. Writing b=a+d, we have v(x)=1+xa+xa+d+x2a. Shift d times to obtain v(x)=xd+xa+d+xa+2d+x2a+d (since 2a<na, we have 2a+d<n). The polynomials v(x) and v(x) have the term xa+d in common, and the only possibility for the overlap of v and v to be 2 is a+2d=2a, that is, a=2d. Then v(x)=1+x2d+x3d+x4d which factorises as (1+xd)(1+xd+x3d). As above, either 1+xd or 1+xd+x3d must be divisible by g(x), so there is a codevector of weight 2 or 3, a contradiction.

    Case ba=a. We have v(x)=1+xa+x2a+xc, and shift 2a times gives v(x)=x2a+x3a+x4a+x(c+2a)modn. The overlap of v and v must be 2, and the two polynomials have the term x2a in common, so there must be another common term. This is only possible in two subcases.

    Subcase c=4a. We have v(x)=1+xa+x2a+x4a which factorises as (1+xa)(1+x2a+x3a). As above, this means a codevector of weight 2 or 3, contradicting earlier results.

    Subcase (c+2a)modn=0. Here we have the code polynomial v(x)=1+x2a+x3a+x4a, which factorises in the same way as in the case ca=a above, so that we arrive at the same contradiction.

    Conclusion. We showed that G23 has no codevectors of weight 1,2,3,4,5,6 and so w(G23)7 as claimed. This completes the proof of Theorem 10.1.

The above theoretical proof that w(G23)=7 gives the taste of how Coding Theory was done in the last century. Today, the weight of G23 can be easily found using a computer — consider for example the following code written for the computer algebra system SageMath:

1     sage : R. < x > =GF (2)[]
2     sage :     factor ( x^23 − 1)
3     ( x +1)∗( x^11+x^9+x^7+x^6+x^5+x+1)∗(x^11+x^10+x^6+x^5+x^4+x^2+1)
4     sage : g = factor ( x^23 −         1)[1][0]
5     sage :     messagepolynomials      = R. monics ( max_degree=23−g. degree ()−1 )
6     sage :     codepolynomials      = [ u∗g for u in    messagepolynomials      ]
7     sage : min ([ len ( c .   coefficients    ()) for c in   codepolynomials        ])
8     7

Is the above code a proof? Many mathematicians would accept it as the source code can be checked, and the calculation reproduced.

Remark: trivia

The code G24 was used by Voyager 1 & 2 spacecraft to transmit information back to Earth (NASA, Jupiter and Saturn, 1979–81).

The ternary Golay code G11

In F3[x], x111=(x1)g(x)g1(x) where g(x)=x5+x4+2x3+x2+2 and g1(x)=g(x)=x5+2x3+x2+2x+2.

Definition: the ternary Golay code G11

A ternary Golay code is the the cyclic code in F311 generated by g(x), or any code linearly equivalent to it. (Notation: G11.)

Theorem 10.4: paremeters of G11

G11 is a perfect [11,6,5]3 code.

The crucial, and difficult, step in a theoretical proof of Theorem 10.4 is showing that G11 does not contain non-zero codevectors of weight less than 5. We omit the proof.

An alternative approach is a computer-based calculation:

  • Exercise. Prove Theorem 10.4, modifying the computer code provided after the proof of Theorem 10.1 to calculate the weight of G11.

Historical notes

Golay found his two perfect codes in 1949, before cyclic codes were discovered. He wrote check matrices for G23 and G11. Crucially, Golay observed that (230)+(231)+(232)+(233) is a power of two. From the proof of perfectness above one can see that the condition (n0)++(nt)=2r is necessary for the existence of a perfect t-error-correcting binary code of length n. This condition is not sufficient: e.g., in his 1949 paper Golay also observes that (900)+(901)+(902)=212 but this does not lead to any perfect binary code of length 90.

Amazingly, Golay’s 1949 paper where he constructs all the Hamming codes and the two Golay codes, is barely half a page long.

Now we can state the classification result about perfect codes.

Definition: parameter equivalence

We say that two codes are parameter equivalent, if they both are [n,k,d]q-codes for some n,k,d and q.

The following theorem was proved by Tietäväinen and van Lint in 1973, more than twenty years since Golay gave a conjectural list of perfect codes in alphabets of prime power size. We will not give its proof here, but you should learn the statement of the theorem.

Theorem 10.5: classification of perfect codes where q is a prime power

Let q be a power of a prime number. A perfect [n,k,d]q-code is parameter equivalent to one of the following:

  • • a trivial code: n arbitrary, k=n, d=1, q any prime power;

  • • a binary repetition code of odd length: n odd, k=1, d=n, q=2;

  • • a Hamming code Ham(r,q): n=qr1q1, k=nr, d=3, q any prime power;

  • • the Golay code G23, which is a [23,12,7]2-code;

  • • the Golay code G11 which is an [11,6,5]3-code.

Remark: perfect codes over general alphabets

Classification of perfect codes over alphabets of size not equal to a prime power is, in general, an open problem.