Weight Distributions Weight Distribution of a Code Given an (n,M,d)- q-ary code, let Ai = number of code words of weight i, for 0 ≤ i ≤ n (can assume that the zero vector is in the code, so A0 = 1). The ordered set of Ai is called the weight distribution of the code. Clearly we have: n M =∑ Ai . i =0 Generating Function It is most convenient to represent the weight distribution as a generating function in two variables, called the weight enumerator. Thus, for an (n,M,d) code C we would have: n W C x , y=∑ Ai x y i n−i . i=0 It follows immediately that: W C 0,1= A0 =1 W C 1,1=∑ Ai =M W C 1,0= An =0∨1 (binary case) n−1 n W C 1,−1= An − An−1⋯−1 A1 −1 A0 . Examples The [7,4]- Hamming code has A0 = A7 = 1 and A3 = A4 = 7, so we obtain: 7 3 4 4 3 7 W [7,4 ] x , y = y 7x y 7x y x . For the ternary code C with generator matrix 2 0 2 1 0 G= 1 1 0 0 1 we obtain: 5 3 2 4 5 W C x , y= y 4x y 2x y2x . Problem Suppose C is a binary code (not necessarily linear) with length 23, minimum distance 7, having 212 codewords. Assuming that C contains the zero vector, show that C is a perfect code. By counting pairs (x,c) with c ∈ C, wt(x) = 4 and d(x,c) =3 show that there are 253 words of weight 7 in C. Show that the weight enumerator of C is completely determined by knowing that C is perfect and contains the zero vector. MacWilliams Identity For a binary linear [n,k]-code C we have: 1 W C x , y = W C y −x , y x . ∣C∣ ⊥ The identity is not restricted to binary codes, but this is the “prettiest” form for the identity. We will rewrite the identity using generating functions (weight enumerators) of one variable before proving the result in the binary case. Alternate Form The one variable form of the weight enumerator is: WC(x) = WC(x,1). We can rewrite the MacWilliams identity using z = x/y to obtain (do this): 1 1−z n W C z = 1z W C . ∣C∣ 1z ⊥ Note: The non-binary form for the identity can be obtained by replacing the (1+z) terms above by (1+(q-1)z). Binary Proof Let V be vector space [n,2] containing the linear code C. Define for u ∈ V: g u= ∑ −1 z wt v . v∈V Now, ∑ g u= ∑ ∑ −1 u∈C 〈u , v〉 u∈C v∈V 〈u , v〉 z wt v =∑ z v∈V wt v ∑ −1 〈u ,v 〉 . u∈ C But, <u,v> = 0 if v ∈ C┴ and the inner sum is |C|, while if v ∉ C┴ half of the terms in this inner sum are +1, and the rest are -1, so the inner sum is 0. So, ∑ g u=∣C∣W C z . ⊥ u∈C Binary Proof On the other hand we have: n g u= ∑ ∏ −1 v 1, v 2, , v n ∈V i =1 n ui vi vi z . ui = ∏ 1−1 z i =1 wt u =1−z 1z From which the result follows. n−wt u . Corollary If we let {Bj} be the weight distribution of the code C┴, we can equate coefficients in the MacWilliams identity to prove that: n j i B j =2 ∑ Ai ∑ −1 l i =0 l =0 −k l n−i . j−l Example Consider the [8,4,3] extended binary Hamming code. The weight distribution is A0 = A8 = 1, A4 = 14 ( & no other wts.) The weights of the dual code are: 0 1 B4 = A0 ∑ −1l 0 16 l l= 0 0 l 8 8 A 4 4 A −1 −1 4∑ 8∑ −l l −l l l =0 l =0 B 0= 4 0 1 l B 0= A0 ∑ −1 0 16 l l =0 l 0 −l 1 A0 A4 A8 =1 16 4 4 l 4 l 8 8 A 4 A 4 ∑ −1 8 ∑ −1 4−l l 4−l l l =0 l =0 1 B4 = 70A 06A470A 8 =14 . 16 0 4−l Example Since we know that this extended Hamming code is selfdual, we will get Bi = Ai for all i. Consider one more computation: B 2= 2 1 l A0 ∑ −1 0 16 l l =0 2 l 4 8 A −1 4∑ 2−l l l =0 B 2= 2 l 8 4 A −1 8∑ 2−l l l =0 1 28A0−4A 428A8 =0 . 16 0 2−l Codes from Designs We have seen how some designs can be contained in (held by) a code. We now reverse the roles and discuss some instances where a design gives rise to a code. The simplest way to do this is to consider the binary code which is the row space of the block vs. point incidence matrix of a design. As a simplification, we will consider the codes that arise this way from the Steiner designs S(2, n+1, n2+n+1) where n ≡ 2 mod 4. [These are projective planes of order n]. The Extended Code The generator matrix of this code has rows with weight n+1 ≡ 3 mod 4 which is odd. The extended code thus has generator matrix with all rows having weight a multiple of 4. Furthermore, the inner product of two distinct rows is exactly 2 (before adding the parity check, these rows represented lines of a projective plane – which always meet in a point), and the inner product of a row with itself is n+2 (even), hence every two rows are orthogonal. By Theorem 4, the extended code C', is a doubly even self-orthogonal code. Thus C must have dimension k ≤ ½(n2 + n + 2). The Extended Code We can go further and prove that the code C has dimension ½(n2 + n + 2), and so C' is in fact self-dual. Let C have dimension k and define r := n2 + n + 2 – k = dim C⊥. Let H be the parity check matrix for C, permuted into the form [Ir A]. Define: P= Ir 0 At Ik . With N the incidence matrix of the design, we have ½(n2+n) det (NP) = det N = (n+1)n Since all entries in the first r columns of NP are even, The Extended Code det N must have a factor of 2r (since every term in this determinant must have such a factor). But then, since n only has 2 as a factor, we must have r ≤ ½(n2+n), and hence k = n2 + n + 2 – r ≥ ½(n2 + n + 2) and the equality now follows. Minimum Weight Codewords The code C we are examining has minimum weight n+1 and every codeword of minimum weight corresponds to a line in the projective plane of order n. Recall that the lines of the projective plane give codewords in the extended code C' that have a 1 for a parity check. Let c be a codeword of C with weight d. Since C' is self-dual, when d is odd c must meet every line at least once (an odd number of times) and if d is even then every line which meets c (thought of as a set of points) must meet c a second time. Minimum Weight Codewords The code C we are examining has minimum weight n+1 and every codeword of minimum weight corresponds to a line in the projective plane of order n. When d is even, as there are n+1 lines through a point, we must have d > n+1 (because the second points are all distinct on the lines through a given point). If d is odd, we have d(n+1) ≥ n2+n+1, so d ≥ n+1. Now suppose wt(c) = n+1, which is odd. The line L determined by two points of c must intersect c in at least one more point. If P is a point of L not in c, then the n lines through P other than L must meet c, so wt(c) ≥ n + 3 →← Thus c must be the line L. Hyperovals In the code C, the codewords of weight n+2 are precisely the hyperovals in the projective plane. Let c be a codeword of C of weight n+2. As the weight is even, every line meets c in an even number of points. Let L be a line meeting c in 2a points. Each one of the n lines other than L through one of these points must meet c at least once more. Thus 2a+n ≤ n+2, so a = 0 or 1, and c is a hyperoval. Let H be a hyperoval. Each point not on H is on ½(n+2) secant lines (an even number since n≡2 mod 4), and each point on H is on n+1 (an odd number) of secants. Thus, the algebraic sum of all the secants (codewords) is the characteristic function of H, and so, a codeword. Weight Distribution The weight of any codeword of C is ≡ 0,3 mod 4. Since C', the extended code, is doubly even, the code words of C which have even weight must have weight divisible by 4, while the odd weight ones (which would have a parity check of 1) have weight one less than a multiple of 4. Ai = An-i for all 0 ≤ i ≤ n. As C' is self-dual, it contains the all 1 vector. But then C must contain the all 1 vector of length n, from which the result follows. Looking for S(2,11,111) Consider the case n = 10. It can be shown that the weight distribution of the code C is completely determined from the values of A12, A15 and A16 (A0 and A11 are already known). In 1973, MacWilliams, Sloane and Thompson showed that A15 = 0 by a theoretical argument with a little computer assist. In 1983, Lam et.al, carried out an extensive computer search to show that A12 = 0 (at which point I lost interest in the problem.) Looking for S(2,11,111) In 1986, Lam et.al, finished a computer search started by Carter for his Ph.D. thesis which showed that W16 = 0. The weight distribution was now known for C. Finally, in 1989, Lam et. al., with another massive computer search showed that A19 = 24,675 did not lead to a solution. nd Stirling Numbers - 2 kind The number of partitions of an n-set is denoted by B(n) and is called a Bell number. The number of partitions of an n-set into k (non-empty) pieces (blocks, boxes, etc.) is denoted by S(n,k) and called a Stirling number of the second kind. Clearly, n B n= ∑ S n , k n1. k =1 Example: Let n = 3, then B(3) = 5. {1,2,3}, {1}{2,3}, {2}{1,3}, {3}{1,2}, {1}{2}{3} so S(3,1) = 1, S(3,2) = 3 and S(3,3) = 1. nd Stirling Numbers - 2 Kind We shall define S(0,0) = 1, but S(n,0) = 0 for n > 0. Also we have S(n,k) = 0 if k > n. The Stirling numbers of the 2nd kind satisfy the recursion: S(n+1,k) = kS(n,k) + S(n,k-1) for n ≥ k ≥ 1. Pf: Distinguish an element of the (n+1)-set. This element is in precisely one of the partition pieces for any partition into k pieces. There are S(n,k-1) partitions in which this element is in a singleton piece. Otherwise, removal of this element from any of the k pieces it could be in would leave a partition of an n-set into k pieces, i.e, kS(n,k) ways that this could happen. nd Stirling Numbers - 2 Kind S(n,1) = S(n,n) = 1 for all n ≥ 1 is clear since there is only one partition in these cases. Together with the recursion relation, we can now construct a “Pascal” - like triangle for these Stirling numbers. 1 1 1 1 3 1 1 7 6 1 1 15 25 10 1 1 31 90 65 15 1 nd Stirling Number - 2 Kind We also have a direct formula for the computation of the Stirling Numbers of the 2nd Kind. k 1 k− i k n S n , k = ∑ −1 i . k ! i =0 i Pless Power Moments Let C be a binary [n,k] code with weight distribution {Ai } and let the weight distribution of C⊥ be {Bj} then: n ∑ j= 0 n j A j =∑ −1 B j r j j =0 n r r ∑ s ! Sr ,s2 k−s s=0 n ∑ n− j A j =∑ B j j =0 j =0 r ∑ s! S r ,s2 s=0 n− j n−s k −s n− j n−s and . where S(r,s) is a Stirling number of the 2nd kind, and r ≥ 0. These equations are known as the Pless Power Moments. Pless Power Moments The Pless Power Moment equations can be derived from the MacWilliams identity and some properties of the Stirling numbers of the 2nd kind. These equations are useful if not all the Bi are known, since they lead to sets of linear equations which may be solved and often have unique solutions (when the determinant of the system is a Vandermonde determinant). Pless Power Moments Example: Consider a [24,12,8] doubly even binary code C. As doubly even codes are self dual (by definition), we have that B1 = B2 = 0 because C = C⊥. Writing the first three Pless Power Moment equations (recall A0 = A24 =1, A4 = A20 = 0): A8 + A12 + A16 = 212 – 2 = 4094 8A8 + 12A12 + 16A16 = 211(24) – 24 64A8 + 144A12 + 256A16 = 210(24)(25)- (24)2 as the determinant of this system is Vandermonde, there is a unique solution : A8 = A16 = 759, A12 = 2576. Gleason Polynomials In 1970 A. Gleason showed that the weight enumerators of certain classes of self-dual codes can be generated by fixed pairs of polynomials, now called Gleason polynomials. [Recent work by Nebe, Rains & Sloane (2006) has increased the number of classes of self-dual codes that can be dealt with in this way]. A binary self-dual code C has its weight enumerator in the ring ℂ[f,g] where f(x,y) = x2 + y2 and g(x,y) =x2y2(x2-y2)2. A binary doubly even code C has its weight enumerator in the ring ℂ[f,g] where f(x,y) = x8 + 14x4y4 + y8 and g(x,y) = x4y4(x4-y4)4 Proof of Assmus-Mattson Theorem 95: Let C be an [n,k,d] binary code, and let 0 < t < d. Let Bi be the number of vectors of weight i in C⊥, and let s = | {i: Bi ≠ 0 and 0 < i ≤ n-t} |. If s ≤ d-t, then the vectors of weight d in C hold a t-Design and the vectors of any weight i in C⊥ such that i ≤ n-t hold a t-Design. Pf: Let T be a set of t coordinate positions and I the remaining n-t positions. Let C(I) be the code obtained from C by removing these t positions. Now C(I) is an [n-t,k] code since t < d (so n-t ≥ n-d+1) and any n-d+1 columns of C contain k independent columns. The minimum weight of C(I) is ≥ d – t. Consider the subcode D of C⊥ which is 0 in all the positions of T. C(I) and D(I) are dual codes (clearly, D(I) ⊆ C(I)⊥ , now take d' in C(I)⊥ and extend it with 0's to get a vector in D). Proof of Assmus-Mattson Theorem 95: Let C be an [n,k,d] binary code, and let 0 < t < d. Let Bi be the number of vectors of weight i in C⊥, and let s = | {i: Bi ≠ 0 and 0 < i ≤ n-t} |. If s ≤ d-t, then the vectors of weight d in C hold a t-Design and the vectors of any weight i in C⊥ such that i ≤ n-t hold a t-Design. Pf(cont): Let Bi' be the number of vectors of weight i in D(I). Then Bi' ≤ Bi and if s' is the number of i so that Bi' ≠ 0, then s' ≤ s. So, s' ≤ d-t and thus s' is less than or equal to the minimum weight of C(I). In this situation the Pless Moment Equations give a unique solution to the weight enumerator which depends only on the dimensions of the codes. This means that the enumerator does not depend on the choice of T, just its size. Proof of Assmus-Mattson Theorem 95: Let C be an [n,k,d] binary code, and let 0 < t < d. Let Bi be the number of vectors of weight i in C⊥, and let s = | {i: Bi ≠ 0 and 0 < i ≤ n-t} |. If s ≤ d-t, then the vectors of weight d in C hold a t-Design and the vectors of any weight i in C⊥ such that i ≤ n-t hold a t-Design. Pf (cont.): Consider the vectors of weight d in C, all of which have 1's on a fixed T of size t. Each of these gives rise to a vector of weight d-t in C(I). Conversely, every vector of weight d-t in C(I) comes from a weight d vector in C in the obvious way since d is the minimum weight. Since the number of vectors of weight d-t in C(I) is independent of the set T, the vectors of weight d in C hold a t-design. Proof of Assmus-Mattson Theorem 95: Let C be an [n,k,d] binary code, and let 0 < t < d. Let Bi be the number of vectors of weight i in C⊥, and let s = | {i: Bi ≠ 0 and 0 < i ≤ n-t} |. If s ≤ d-t, then the vectors of weight d in C hold a t-Design and the vectors of any weight i in C⊥ such that i ≤ n-t hold a t-Design. Pf (cont): Let {ci} be the complements of vectors of weight w in C⊥. Consider the ci's that are 1 throughout T. Each such ci is the complement of a vector of weight w in D. The number of these ci's is therefore independent of the particular choice of T since the weight distribution of D is the same as the weight distribution of D(I), and that is independent of T. The {ci} thus hold a t-design, and so their complements hold a t-design.