The Weight Distributions of a Class of Cyclic Codes with Three Nonzeros over F 3

—Cyclic codes have efﬁcient encoding and decoding algorithms. The decoding error probability and the undetected error probability are usually bounded by or given from the weight distributions of the codes. Most researches are about the determination of the weight distributions of cyclic codes with few nonzeros, by using quadratic form and exponential sum but limited to low moments. In this paper, we focus on the application of higher moments of the exponential sum to determine the weight distributions of a class of ternary cyclic codes with three nonzeros, combining with not only quadratic form but also MacWilliams’ identities. Another application of this paper is to emphasize the computer algebra system Magma for the investigation of the higher moments. In the end, the result is veriﬁed by one example using Matlab.

(a 0 , a 1 , . . . , a n−1 ) ∈ F m p with a 0 + a 1 x + · · · a n−1 x n−1 ∈ F p [x]/(x n − 1), any linear code C of length n over F p represents a subset of F p [x]/(x n −1) which is a principle ideal domain. The fact that the code is cyclic is equivalent to that the subset is an ideal. The unique monic polynomial g(x) of minimum degree in this subset is the generating polynomial of C, and it is a factor of x n − 1. When the ideal does not contain any smaller nonzero ideal, the corresponding cyclic code C is called a minimal or an irreducible code. For any v = (c 0 , c 1 , · · · , c n−1 ) ∈ C, the weight of v is wt(v) = #{c i = 0, i = 0, 1, . . . , n − 1}.
The weight enumerator of a code C is defined by where A i denotes the number of codewords with Hamming weight i. The sequence 1, A 1 , · · · , A n is called the weight distribution of the code, which is an important parameter of a linear block code. Assume that p = 3 and q = p m for an even integer m. Let π be a primitive element of F q . In this paper, Section II presents the basic notations and preliminaries about cyclic codes. Section III determines the weight distributions of a class of cyclic codes over F 3 with nonzeros π −2 , π −4 , π −10 , and they are verified by using Matlab. Note that the length of the cyclic code is l = q − 1 = 3 m − 1. Final conclusion is in Section IV. This paper is the counterpart of our another result in [15].

II. PRELIMINARIES
In this section, relevant knowledge from finite fields [13] is presented for our study of cyclic codes. It is about the calculations of exponential sums, the sizes of cyclotomic cosets and the ranks of certain quadratic forms. First, some known properties about the codeword weight are listed. Then Lemma 1, Lemma 2 and Lemma 3 are about the calculations of exponential sums. Finally, Lemma 4, Lemma 5 and Corollary 1 are about the ranks of relevant quadratic forms.
Here ∆ p denotes the Legendre symbol. Lemma 2 is from [14], Lemma 3 is from [15], also refer to [7] for the calculations of exponential sums that will be needed in the sequel.
Lemma 3: Let F α,...,γ (X) = XH α,...,γ X T be the quadratic form corresponding to f α,...,γ (x), see (4). If the rank r α,...,γ of the symmetric matrix H α,...,γ is odd, then the number of quadratic forms with exponential sum √ p * p m− rα,...,γ +1 2 equals the number of quadratic forms with exponential sum The cyclotomic coset containing s is defined to be D s = {s, sp, sp 2 , . . . , sp ms−1 } where m s is the smallest positive integer such that p ms · s ≡ s (mod p m − 1). In the following, Lemma 4 and Lemma 5 are from [14], also refer to [3] for the binary case of Lemma 4. Lemma 4: If m = 2t + 1 is odd, then for l i = 1 + p i , the cyclotomic coset D li has size If m = 2t + 2 is even, then for l i = 1 + p i , the cyclotomic coset D li has size corresponding to f ′ 2 (x) = α 0 x 2 + α 1 x p+1 + α 2 x p 2 +1 has five possible values: Note that in Section III, a nonzero solution of a equation system means that all the variable values are nonzero.

III. MAIN RESULTS
In this section, the main results of this paper are obtained, that is the weight distribution of the cyclic code C with nonzeros π 2 , π p+1 and π p 2 +1 for the case when m is even, here p = 3. For this, the first five moments of exponential sum S(α, β, γ) are computed in Subsections III-A, III-B, III-C, and the MacWlliams' identities are calculated in Subsection III-D.

A. The First Three Moments of S(α, β, γ)
For an odd prime p and even integer m, this subsection calculates the first three moments of the exponential sum S(α, β, γ) (equation (3)), see Lemma 8 and its another form Lemma 9, where the analysis of the third moment bases on the property of Lemma 7.
Lemma 6: (Theorem 6.26., [13]) Let f be a nondegenerate quadratic form over F q , q odd, in an even number n of indeterminates. Then for b ∈ F q the number of solutions of the equation f (x 1 , . . . , x n ) = b in F n q is η is the quadratic character of F q and ∆ = det(f ).
Lemma 7: Let p be an odd prime, q = p m and a ∈ F * q . Then the solutions of the following equation in F 2 have the form where s, t, θ ∈ F * q 2 and s 2 = a, t 2 = −1. Proof: First, it can be checked that the pairs x, y given by the lemma satisfy equation (8). Second, according to Lemma 6, the number of solutions of equation (8) Furthermore, when θ varies through the nonzero elements of F q 2 , (x, y) in (9) gives all the solutions of (8) in F 2 q 2 including those solutions in the subfield F 2 q . In fact, Lemma 8: Let p be an odd prime satisfying p ≡ 3 mod 4 and q = p m . Then there are the following results about the exponential sum S(α, β, γ) (equation (3)) corresponding to Proof: From definition, changing the order of summations, (i) can be calculated as follows α,β,γ∈Fq Tr γ x p 2 +1 +y p 2 +1 where M 2 is the number of solutions to the equation system If x, y = 0 satisfy the above system, then ( x y ) 2 = −1 and = 1, a contradiction. So, the only solution to above system is x = y = 0 and M 2 = 1.
As to (iii), we have where and T 3 is the number of solutions of To study equation system (13), consider the last two equations. Canceling y there is after simplification, it becomes From (14) it can be checked that x ∈ F p 3 . In the same way, it implies that y ∈ F p 3 . In this case, (x p 2 +1 + y p 2 +1 + 1) p = x p 3 +p + y p 3 +p + 1 = 0 ⇐⇒ x p+1 + y p+1 + 1 = 0, so only the first two equations of (13) are necessary to be considered.
The following paragraph of proof is similar to what has been done in [28]. For the first one of equation (13), by Lemma 7 there exist s, θ ∈ F p 6 such that x = 1 2 s(θ+θ −1 ) and y = 1 After simplification, the above equation becomes 1 2 Now, since x ∈ F p 3 , Combining the two results, we find that If θ 1 and θ 2 satisfy (15) and (16), we have ( θ1 θ2 ) p+1 = ( θ1 θ2 ) p 3 +1 = 1. Since gcd(p + 1, p 3 + 1) = p + 1, there exist integers a, b such that It is easy to check that p + 1 is a factor of p 6 − 1, so if there exist solutions, the number of solutions is p + 1. It can be checked that there exist solutions in F p of equation system (13). Finally, Using the following notations, Lemma 8 can be restated in Lemma 9 when m is even. Corresponding to Lemma 1 and Corollary 1, we introduce the following notations for convenience. Let Lemma 9: Let p be an odd prime satisfying p ≡ 3 mod 4, and q = p m where m is an even integer. Then the notations defined in (17) and (18) satisfy the following equations 2(n 1 + n 3 ) + n −1,0 + n 1,0 + n −1,2 + n 1,2 . Proof: Substituting the symbols of (17) and (18) to Lemma 8, we have the following four equations where the first one comes from the fact that there are p 3m − 1 elements in the set F 3 q \{(0, 0, 0)}. Also, note that S(α, β, γ) = p m when α = β = γ = 0.
Using n j = n ε,j = |N ε,j | for j = 1, 3, the result is obtained by simplification.

B. The Fourth Moment of S(α, β, γ)
For the fourth moment of S(α, β, γ) in the particular case of p = 3, there is the following result about the number of solutions of the equation system in Lemma 10, which is denoted by T 4 .
Corresponding to Lemma 8, the result of the fourth moment is provided in Lemma 12 by applying Lemma 11.
Lemma 12: Let p = 3 and q = p m . Then Corresponding to Lemma 9, Lemma 12 can be rewritten as the following corollary using the symbols of (17) and (18).
Corollary 2: Let p = 3 and q = p m where m is an even integer. Then For the fifth moment of S(α, β, γ), we need Magma [1] to find the number of solutions of the following equation system which is denoted by M 5 .
As in [2], the irreducible components corresponding to the projective variety defined by (21) are listed in Table I using Magma. It is easy to be verified that every block of Table  I contains a system of three equations (note that '= 0' is omitted), the solutions of which satisfy (21). Furthermore, the union of all the solutions in each block presents the solutions of (21) exactly. Those equation systems are circulant symmetric about the variables. In general, few works were provided to deal with the moments using five variables. But in this paper, Magma helps us on the reduction of such systems in Lemma 13, Lemma 14 and Corollary 3. For relevant knowledge of algebraic geometry, the reader is referred to [22].   Table I we find that at least one of the elements x, y, z, w, u is zero, and there are two cases to be considered.
• If only one of the five variables is zero, the number of such solutions is • If two variables are zero, the number of such solutions is Altogether, the number of solutions of equation system (21) is Applying Lemma 13, the result about the fifth moment of exponential sum S(α, β, γ) is obtained.

D. MacWilliams' Identities
MacWilliams' theorem is for Hamming weight enumerators of linear codes over finite field F p [18]. Using this theorem, Lemma 16 is provided for the weight distribution using dual code's weight distribution of Lemma 15. The two identities in Lemma 16 will combine with previous identities in final result.
Let A i be the number of codewords of weight i in a code C with length l and dimension k where 0 ≤ i ≤ l. Let A ′ i be the corresponding number in the dual code C ⊥ . Then where After differentiating (23) with respect to y, we have Setting y = 1, the first MacWilliams' moment identity is obtained for l ≥ 2 Substituting y = 1, the second MacWilliams' moment identity is obtained Differentiating for the third and fourth time, Lemma 15: Let p = 3, q = p m . Let C denote the cyclic code with nonzeros π −2 , π −(p+1) and π −(p 2 +1) , the weights of the dual code C ⊥ satisfy the following Proof: Below, codewords are considered in the dual code. Easy to see that A ′ 0 = 1 and A ′ 1 = 0. For the codewords with weight two, if the components at the two positions have the same value, by equation (10) we find that M ′ 2 = 0. Let's consider the following equation system about the positions which should be satisfied by the coordinates of the codewords. It can be checked that for any y ∈ F * q , x = −y is the other corresponding coordinate. That is A ′ 2 = p m − 1. As to weight-three codewords, there are two cases to be considered.
(i) If all the values corresponding to the three coordinates of the codeword are the same, it is necessary to study the solutions of the following equation system which should be satisfied by the coordinates of the codewords. From the first two equations of (26), we find that x 2 = y 2 = 1 contradicting the fact that x, y, 1 should be different.
(ii) If one value is different from the other two values at the three coordinates, consider Solving the above system, we have x = 0 contradicting the fact that the coordinates should be different from 0. Combing the above two cases, A ′ 3 = 0. Now, let's consider the number of codewords with weight four in three cases.
(i) Case I: at the four positions, the components have the same value. According to the proof of Lemma 13, we know that the number of nonzero solutions of equation system (20) is . For a solution (x, y, z, w) of (20), if two of them are equal, e.g., z = w = v, then (20) becomes Solving the above system, it can be found that x or y is zero, so the number of nonzero solutions of (28) is 0. Then all those M ′ 4 nonzero solutions of (20) correspond to the codewords where 24 = 4! solutions correspond to a four-tuple and each tuple corresponds to two codewords. Therefore, there are 2 · (29) Using Mamga [1], the irreducible components of the projective variety corresponding to (29) are provided by the polynomials listed in Table II. Easy to see that at least one of x, y, z, w is zero, so the solutions can not correspond to codewords. (iii) Case III, two values at the coordinates are the same.

E. Weight Distribution of C
In this subsection, the parameters defined in equations (17) and (18) are calculated in Lemma 17, and the weight distribution of the cyclic code C is determined in Theorem 1.
Lemma 17: Let p = 3, q = p m where m ≥ 6 is an even integer. The notations defined in equations (17) and (18) satisfy the following equations and a, b are defined in Lemma 16 which needs m ≥ 6.
Solving the above equation system, the result is obtained.
It is interesting to note about the weights of the cyclic code C. If there is a weight of the form p m−1 (p − 1) + . So, it seemed as if the weights are symmetric about the value p m−1 (p−1) which is also a weight of C. As the following example illustrates, in general the higher the value i the less number of corresponding weights. This phenomenon may be explained to the fact that the linear part in the exponential position of the parameter ζ acts as a center role in the formation of the weights.

IV. CONCLUSION
Since the weight distributions played an important role in the application of cyclic codes, this paper focuses on the determination of a class of cyclic codes with three nonzeros. Relevant results received a lot of attention by using methods with lower moments of exponential sum. Here we try to apply higher moments to deal with the problem.