aa r X i v : . [ m a t h . C O ] A p r On linear codes and distinct weights
Alessio MeneghettiNovember 9, 2018
Abstract
We provide a combinatorial construction for linear codes attaining the maximum possi-ble number of distinct weights. We then introduce the related problem of determining theexistence of linear codes with an arbitrary number of distinct non-zero weights, and we com-pletely determine a solution in the binary case.
Introduction
A recent work on extremal properties of linear codes presented the problem of determin-ing the maximum possible number of distinct non-zero weights in a linear code [SZSC18],partially providing solutions and leaving the general case as a conjecture. For the sake ofcompleteness, we introduce the problem and the conjecture.Let C be an [ n, k ] q linear code and let us denote with A ( C ) the weight distribution of thecode C . We also denote with len ( C ) the length of a code C and with dim ( C ) its dimension.We are interested in the maximum number of distinct weights that a linear code of dimension k over F q can have: L q ( k ) := max {|A ( C ) | : dim ( C ) = k } We remark that this value is obtained by considering all possible codes of dimension k over F q , regardless on their length. A related problem would be to determine the maximum num-ber of weights in a code of length n , a value which we will denote as L q ( n, k ) . The relationbetween L q ( k ) and L q ( n, k ) is L q ( k ) := max n L q ( n, k ) , and an interested reader can go through [SZSC18] for more results on this function.By linearity it has to hold L q ( k ) ≤ q k − q − , (1)and in [SZSC18] it is proved that L ( k ) ≥ k , and L q ( k ) ≥ q + 2 , (2) amely bound (1) is achieved with equality by binary codes regardless of their dimension,and by q -ary codes of dimension . In the same work this result was presented as a hint thatBound (1) could actually be the value of L q ( k ) .In [AN18], the authors prove the conjecture both from an algebraic and a geometric pointof view, and call Maximum Weight Spectrum (MWS) the codes with maximum number ofdistinct weights. They conclude by providing bounds on the minimum length of MWS codes.We show here a third, combinatorial proof of the same conjecture, namely in Section 1 weprove the following: Theorem 1. L q ( k ) = q k − q − + 1 . In the subsequent section, we discuss a related problem, the existence of linear codes ac-cordingly to the number of distinct weights.
In this section we prove Theorem 1. The proof is by induction, where we use the results of[SZSC18] as a starting point for deducing the general case.To ease the notation, we denote a q-ary code of dimension k with C k , its generator matrixwith G k , and we use w ( S ) for the set of distinct weights of a set of vectors S . Finally, we use ¯ C k (and ¯ G k ) for a code with the largest possible number of distinct weights, i.e. (cid:12)(cid:12) w (cid:0) ¯ C k (cid:1)(cid:12)(cid:12) = L q ( k ) . We can thus state Theorem 1 in a slightly alternative way. Theorem 2.
For each q and for each k there exists an [ n, k ] q code ¯ C k for which (cid:12)(cid:12) w (cid:0) ¯ C k (cid:1)(cid:12)(cid:12) = q k − q − . (3)The assumption of our proof is therefore that for all dimensions up to k , there exists alinear code ¯ C k with q k − q − + 1 distinct weights.Starting by a code ¯ C k we then obtain a new code ¯ C k +1 of dimension k + 1 with (cid:12)(cid:12) w (cid:0) ¯ C k +1 (cid:1)(cid:12)(cid:12) = q k +1 − q − + 1 . Lemma 1.
Let ¯ C k = (cid:8) c , . . . , c q k (cid:9) satisfies Equation (3) . If there exists x / ∈ C such that d ( c i , x ) =d ( c j , x ) for each pair of indices i = j , then there also exists a code ¯ C k +1 satisfying Equation (3) .Proof. Let m be the maximum weight of a codeword in ¯ C k . We construct ¯ G k +1 as the ( k + 1) × (cid:0) len (cid:0) ¯ C k (cid:1) + m (cid:1) q -ary matrix in the following way: ¯ G k +1 = " ¯ G k x · · · . If we ignore the m zeros at the end, the linear combinations of the first k rows of G k +1 areexactly the codewords of ¯ C k , hence we have at least q k − q − + 1 distinct weights.Any other codeword in ¯ C k +1 is a linear combination involving the last row of ¯ G k +1 and acodeword c ∈ ¯ C k . More precisely, any other codeword is of the form αy , with α = 0 anelement of F q , and y the concatenation of c − x and a sequence of m + 1 ones. Observe that ( αy ) = w ( y ) .The weight of y is equal to the sum between m and the distance between c and x . By hypoth-esis, d ( c , x ) = d ( c , x ) for each c = c ∈ ¯ C k , hence we have q k distinct weights. Moreover,for any y we have w ( y ) = m + d ( c, x ) > m .We conclude that | w ( C k +1 ) | = | w ( C k ) | + q k = q k +1 − q − + 1 .Lemma 1 deals with a very particular case, still, in such restrictive hypotheses, it allowsus to directly derive ¯ C k +1 from ¯ C k . However we cannot always assume the existence of thevector x with the desired properties. To address the general case we will therefore also useLemma 2.Let C be a code and x a vector of the same length of C . We denote with C − x the coset of C obtained by translating the codewords of C by − x , namely, C − x = { c − x | c ∈ C } . Lemma 2.
Let F q be a finite field with at least elements, and let C k be a linear code of dimension k over F q . Let x / ∈ C k , with | w ( C k − x ) | < q k . Then there exist x ′ / ∈ C ′ k with | w ( C ′ k − x ′ ) | > | w ( C k − x ) | .Proof. Given C k and x , if there exists x ′ for which | w ( C k − x ′ ) | > | w ( C k − x ) | , we can con-clude. We can therefore assume that no such vector x ′ in ( F q ) len( C k ) exists.In this setting, we construct a new code C ′ k and a new vector x (3) outside of it by tripling eachcoordinate. The new code will have three times the length of C k , and the distance betweenany two codewords will be three times larger. The same is true for the distance between x (3) and a codeword c ′ of C ′ k . In particular, if we consider two codewords c and c in C k such that d ( c , x ) = d ( c , x ) , then d (cid:16) c ′ , x (3) (cid:17) = d (cid:16) c ′ , x (3) (cid:17) = 3d ( c , x ) . We remark that the existenceof such two codewords c and c is guaranteed by the hypotheses of the lemma. We denote d ( c , x ) with t , hence d (cid:16) c ′ , x (3) (cid:17) and d (cid:16) c ′ , x (3) (cid:17) are both equal to t . Since c ′ = c ′ , there isat least a coordinate in which the two codewords are different, so without loss of generalitywe suppose they differ in the first coordinate. Let α , β and γ ∈ F q be respectively the valuesof the first coordinates of the two codewords c ′ , c ′ and of x (3) .We have two cases:1. γ is equal to either α or β ;2. γ is not equal to α nor to β .In the first case, let us say that γ = α , namely both c ′ and x ′ are equal to α in the firstcoordinate, while c have β = α in the first coordinate. We substitute now the first coordinateof x (3) with an element of F q different from both α and β , so that the distance between x (3) and c ′ would increase by . We denote with x ′ this modified vector. By computing the distanceswe obtain d ( c ′ , x ′ ) = 3 t + 1d ( c ′ , x ′ ) = 3 t. In the second case, γ = α = β = γ . We change γ into α , and we obtain d ( c ′ , x ′ ) = 3 t −
1d ( c ′ , x ′ ) = 3 t. ither case, the distance between c ′ and c ′ did not change.To conclude, the proof that | w ( C ′ k − x ′ ) | > | w ( C k − x ) | directly follows from the fact that forany codeword c ′ ∈ C ′ k we have | d (cid:16) c ′ , x (3) (cid:17) , and to obtain x ′ from x (3) we changed a singlecoordinate.Observe that in the proof we are using the fact that q ≥ , so this proof cannot be directlyapplied to the binary case. However, we will not need it, since the binary case was alreadycovered in [SZSC18]. Proof of Theorem 1.
As already mentioned, we prove the theorem by induction, using Equa-tion (2) as initial step. Let q > and let ¯ C k be a q -ary code as defined above, namely a code ofdimension k for which (cid:12)(cid:12) w (cid:0) ¯ C k (cid:1)(cid:12)(cid:12) = q k − q − + 1 . If there exists x as in the hypotheses of Lemma1, then we can construct a code ¯ C k +1 .Otherwise, we make use of Lemma 2. We remark that if we start by ¯ C k , by tripling its coordi-nates we end up with a code ¯ C ′ k which satisfy itself Equation (3). We keep applying Lemma2, and each time we increase the number of distinct weights of the coset (cid:8) ¯ C k − x (cid:9) . Since thenumber of elements are q , we eventually end up with q k distinct weights, and we can applyLemma 1.The proposed proof provides a method to explicitly construct codes with the largest pos-sible number of distinct weights. This method also gives us a coarse upper bound on theminimum length of such a code. In the worst-case scenario, Lemma 2 will be applied q k − times before applying Lemma 1. Since the codeword of larger weight in ¯ C k has at most len (cid:0) ¯ C k (cid:1) non-zero coordinates, then there exist ¯ C k +1 such that len (cid:0) ¯ C k +1 (cid:1) ≤ (cid:16) q k − + 1 (cid:17) len (cid:0) ¯ C k (cid:1) . In this section we look at the problem from a slightly different angle, asking ourselves whetherit exist a linear q -ary code for a given number of distinct weights. The results presented inthis section allow us to completely solve this problem in the binary case, though the general q -ary case still remains an open problem.We denote with I q the set of integers for which it exist a code over F q with s distinct non-zeroweights. Observe that Theorem 1 give us the largest i in each I q , hence I q ⊆ n , . . . , q k − q − + 1 o .Moreover, we recall that for each field F q and for each dimension k , it exist a linear equidistantcode S q,k . We recall here its definition and parameters, an interested reader can go through[HP10] for a more deep understanding on the subject. Definition 1.
Let G k be a k × q k − q − matrix over F q with the property that its columns arepair-wise independent. We call Simplex code S q,k the code generated by G . Proposition 1. S q,k is an [ q k − q − , k, q k − ] equidistant code, namely any pair of codewords are atdistance q r − . ur interest in the class of Simplex codes is that their existence prove that for any q andany k there exist a code with a single non-zero weight. We will make use of these codes toprove the existence of codes with arbitrary distinct weights. Lemma 3.
Assume that there exist a q -ary linear code of dimension k with s distinct weights. Then,there exists a q -ary linear code of dimension k + 1 with s + 1 distinct weights.Proof. First of all, notice that Proposition 1 implies the existence of C k, for each dimension k .We denote with G k,s the generator matrix of an [ n, k ] q code C k,s with s distinct weights.We consider now a matrix of the form G k +1 ,s +1 = " G k,s G q,k +1 . (4)Any non-zero linear combination of its rows can be written as c = ( c ′ | c ′′ ) , where c ′ belongs tothe code generated by G k,s , and c ′′ is a non-zero codeword of the Simplex code of dimension k + 1 . Observe that if c ′ has a weight equal to w , then the weight of c is w + q k . Hence, G k +1 ,s +1 generates a code C k +1 ,s +1 of dimension k + 1 and with s + 1 distinct weights. Lemma 4.
Assume that there exists a q -ary linear code of dimension k with s distinct weights. Then,there exists a q -ary linear code of dimension k + 1 with q k + s distinct weights.Proof. Let C be a code as in our hypothesis. Then, by applying the same argument as in theproof of Theorem 1, we obtain a code which proves our claim.By combining together the results of Lemmas 3 and 4 we cannot prove yet the general q -ary case. Indeed, we observe that, even if we assume the existence of codes with s distinctweight for any dimension up to k and for any s in the range n , . . . , q k − q − o , we cannot con-struct codes of dimension k + 1 corresponding to values of s between q k − q − and q k . Still, wecan focus on the binary case, and complete the characterisation in this particular case. Corollary 1.
For any dimension k and for any integer s ∈ (cid:8) , . . . , k − (cid:9) , there exists a linearbinary code with s distinct non-zero weights.Proof. We proceed by induction on the dimension, using as initial step k = 1 . In this partic-ular case we are dealing with codes containing only words, and the maximum number ofnon-zero weights is trivially k − , i.e. any code of dimension proves the case k = 1 . Wealso observe that for s = 1 we simply rely on the existence of the k -th dimensional SimplexCode.As inductive step, we assume that for any integer s in the range (cid:8) , . . . , k − (cid:9) there exitsa linear code of dimension k with s distinct weights. We now apply Lemma 3 to each possi-ble s , hence we construct codes of dimension k + 1 and s ∈ (cid:8) , . . . , k (cid:9) distinct weights.Now, we apply instead Lemma 4, and obtain codes with k + s distinct weights. Since s ∈ (cid:8) , . . . , k − (cid:9) , by Lemma 4 we obtain codes of dimension k + 1 corresponding tointegers in the set (cid:8) k + 1 , . . . , k +1 − (cid:9) . Combining the two results, we prove the exis-tence of codes of dimension k + 1 and number of distinct non-zero weights in the range (cid:8) , . . . , k , k + 1 , . . . , k +1 (cid:9) . Conclusions
We provided a combinatorial proof of the conjecture presented in [SZSC18] regarding themaximum number of distinct weights that a linear q -ary code can have. By using similarmethods, we were also able to prove the existence of binary linear codes with any numberof distinct weights. The general q -ary case is left here as a conjecture. Other than addressingthe general case, future directions of this research would be to establish new bounds on theminimum length of codes with a given number of non-zero weights. References [AN18] Tim L Alderson and Alessandro Neri,
Maximum weight spectrum codes , arXivpreprint arXiv:1803.04020 (2018).[HP10] W Cary Huffman and Vera Pless,
Fundamentals of error-correcting codes , Cambridgeuniversity press, 2010.[SZSC18] Minjia Shi, Hongwei Zhu, Patrick Sol´e, and G´erard D Cohen,
How many weights cana linear code have? , arXiv preprint arXiv:1802.00148 (2018)., arXiv preprint arXiv:1802.00148 (2018).