#### Abstract

Cyclic codes have efficient 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 forms and exponential sums but limited to low moments. In this paper, we focus on the application of higher moments of the exponential sums to determine the weight distributions of a class of ternary cyclic codes with three nonzeros, combining with not only quadratic forms 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 verified by one example using Matlab.

#### 1. Introduction

Cyclic codes have a lot of applications in communication system, storage system, and computers, and they have been studied for a long time [1, 2]. The decoding error probability and the undetected error probability are closely related to the weight distributions, for example, permutation decoding, majority decoding, locator decoding, decoding from the covering polynomials, and so on [3â€“6]. In general the weight distributions are complicated [7] and difficult to be determined. In fact, as shown in [8, 9], the problem of computing weight distribution of a cyclic code is connected with the evaluation of certain exponential sums, which are generally hard to be determined explicitly. For more researches, refer to [10â€“13] for the irreducible case, [14â€“17] for the reducible case, and [18â€“21] for recent studies. For related problems in the binary case with two nonzeros especially, refer to [22â€“24].

In this paper, we focus on the application of higher moments of the exponential sums to determine the weight distributions of a class of ternary cyclic codes with three nonzeros, combining with not only quadratic forms but also MacWilliamsâ€™ identities, with the help of the computer algebra system Magma.

Let be a prime. A linear code is a -dimensional subspace of with minimum (Hamming) distance . An linear code over is called cyclic if implies that where . By identifying the vector with any linear code of length over represents a subset of which is a principle ideal domain. The fact that the code is cyclic is equivalent to the fact that the subset is an ideal. The unique monic polynomial of minimum degree in this subset is the generating polynomial of , and it is a factor of . When the ideal does not contain any smaller nonzero ideal, the corresponding cyclic code is called a minimal or an irreducible code. For any , the weight of is .

The weight enumerator of a code is defined by where denotes the number of codewords with Hamming weight . The sequence is called the weight distribution of the code, which is an important parameter of a linear block code.

Assume that and for an even integer . Let be a primitive element of . In this paper, Section 2 presents the basic notations and preliminaries about cyclic codes. Section 3 determines the weight distributions of a class of cyclic codes over with nonzeros , , and , and they are verified by using Matlab. Note that the length of the cyclic code is . Final conclusion is in Section 4. This paper is the counterpart of our other result in [19].

#### 2. Preliminaries

In this section, relevant knowledge from finite fields [25] 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.

Let be an odd prime and let be a positive integer and is a primitive element of . Assume that the cyclic code over has length and nonconjugate nonzeros , where â€‰â€‰. Then the codewords in can be expressed by where â€‰â€‰ and is the trace mapping from to . Therefore the Hamming weight of the codeword is where ( is imaginary unit), ,â€‰â€‰, and .

For general functions of the form where , there are quadratic forms and corresponding symmetric matrices satisfying that . It is known that there exists such that where â€‰â€‰ and . Let (set for ).

Lemma 1 (Lemma 1, [15]). *(i) For the quadratic form ,
**
(ii) For , ifâ€‰â€‰ has solution , then
**
Otherwise .**Here denotes the Legendre symbol.*

References [26, Lemma 9] and [19, Lemma 3] are about the calculations of exponential sums that will be needed in the sequel. For more details, refer to [15].

The cyclotomic coset containing is defined to be where is the smallest positive integer such that . Reference [26, Lemma 10] is about the size of cyclotomic coset; also refer to [27] for the binary case.

For with corresponding quadratic form , where . Reference [19, Corollary 1] is about its rank for a special case.

Note that in Section 3, a nonzero solution of an equation system means that all the variable values are nonzero.

#### 3. Main Result

In this section, the main result of this paper is obtained; that is, the weight distribution of the cyclic code with nonzeros and for the case is even; here . For this, the first five moments of exponential sum are computed in Sections 3.1, 3.2, and 3.3, and the MacWlliamsâ€™ identities are calculated in Section 3.4.

##### 3.1. The First Three Moments of

For an odd prime and even integer , this subsection calculates the first three moments of the exponential sum (5); see Lemma 2 and its other form Lemma 3.

Lemma 2 (see [19]). *Let be an odd prime satisfying and . Then there are the following results about the exponential sum (5) corresponding to :*(i)*,*(ii)*,*(iii)*.*

Corresponding to Lemma 1 and [19, Corollary 1], we introduce the following notations for convenience. Let where and . Denote . Let for , where is the imaginary unit. By [19, Lemma 3], set for , since is odd. Using those, Lemma 2 can be restated in Lemma 3 when is even.

Lemma 3. *Let be an odd prime satisfying , and , where is an even integer. Then the notations defined in (10) and (11) satisfy
*

*Proof. *Substituting the symbols of (10) and (11) to Lemma 2
where the first one comes from the fact that there are elements in the set . Also, note that when .

Using for , the result is obtained by simplification.

##### 3.2. The Fourth Moment of

For the fourth moment of in the particular case of , there is the following result about the number of solutions of the equation system: in Lemma 4, which is denoted by .

Lemma 4 (see [19]). *Let and . Then
*

Using Lemma 4 and in Lemma 2, is calculated in Lemma 5, where .

Lemma 5. *Let and . The number of solutions of the following equation system
**
is .*

Corresponding to Lemma 2, the result of the fourth moment is provided in Lemma 6 by applying Lemma 5.

Lemma 6. *Let and . Then
*

Corresponding to Lemma 3, Lemma 6 can be rewritten as the following corollary using the symbols of (10) and (11).

Corollary 7. *Let and , where is an even integer. Then
*

##### 3.3. The Fifth Moment of

For the fifth moment of , we need Magma [28] to find the number of solutions of the following equation system: which is denoted by .

The irreducible components corresponding to the projective variety defined by (19) are listed in Table 1 using Magma [28]. Every block of Table 1 contains a system of three equations (â€śâ€ť is omitted), the solutions of which satisfy (19). The union of all the solutions in each block presents the solutions of (19) exactly. Those equation systems are circulant symmetric about the variables. In general, few works are provided to deal with the moments using five variables. In this paper, Magma helps us on the reduction of such systems in Lemmas 8 and 9 and Corollary 10. For relevant knowledge of algebraic geometry, the reader is referred to [29].

Lemma 8. *Let and . Then
*

*Proof. *The number of nonzero solutions of is , where [19], and the number of nonzero elements in
is . From Lemma 5, the number of nonzero solutions of (16) is .

For the solutions of equation system (19), Table 1 shows that at least one of the elements is zero, and there are two cases to be considered.(i)If only one of the five variables is zero, the number of such solutions is .(ii)If two variables are zero, the number of such solutions is . Altogether, the number of solutions of equation system (19) is

Applying Lemma 8, the result about the fifth moment of exponential sum is obtained.

Lemma 9. *Let and . Then
*

Corollary 10. *Let and , where is an even integer. Then
*

##### 3.4. MacWilliamsâ€™ Identities

MacWilliamsâ€™ theorem is for the Hamming weight enumerators of linear codes over finite field [30] (we consider prime field ). Using this theorem, Lemma 12 is provided for the weight distribution using dual codeâ€™s first few weights of Lemma 11. The two identities in Lemma 12 will combine with previous identities in final result.

Let be the number of codewords of weight in a code with length and dimension , where . Let be the corresponding number in the dual code . Then where . Setting , (25) changes to Differentiating (26) with respect to , Setting , the first MacWilliamsâ€™ moment identity is obtained for Differentiating again, Substituting , the second MacWilliamsâ€™ moment identity is obtained: Differentiating for the third and fourth time, if , the fourth MacWilliamsâ€™ moment identity is

Lemma 11. *Let , . Let denote the cyclic code with nonzeros , , and ; the weights of the dual code satisfy the following:
*

*Proof. *Below, codewords are considered in the dual code. It is easy to see that and . For the codewords with weight two, if the components at the two positions have the same value, we find that . Let us consider the following equation system about the positions:
which should be satisfied by the coordinates of the codewords. For any , is the other corresponding coordinate. That is, .

As to weight-three codewords, there are two cases to be considered. (i)If all the values corresponding to the three coordinates of the codewords are the same, then study the solutions of the following equation system:
From the first two equations of (34), we find that contradicting the fact that should be different.(ii)If one value is different from the other two, consider
Solving the above system, we have contradicting the fact that the coordinates should be different from .Combing the above two cases, .

Now, let us consider the number of codewords with weight four in three cases.*Case I*. At the four positions, the components have the same value. According to the proof of Lemma 8, the number of nonzero solutions of equation system (16) is . For a solution of (16), if two of them are equal, for example, , then (16) becomes
Solving the above system, it can be found that or is zero, so the number of nonzero solutions of (36) is . Then all those nonzero solutions of (16) correspond to the codewords, where solutions correspond to a four-tuple and each tuple corresponds to two codewords. Therefore, there are codewords. *Case II*. One value at the four nonzero positions is different from the other three values. Consider the solutions of the following system:
Using Mamga [28], the irreducible components of the projective variety defined by (37) are provided by the polynomials listed in Table 2. It is easy to see that at least one of is zero, so the solutions can not correspond to codewords. *Case III*. Two values at the coordinates are the same. Let us consider
Again the irreducible components are presented in Table 3, by which only the cases , , and , are the possible solutions which can correspond to codewords since coordinates should be different. The number of such solutions is which corresponds to codewords, since every four-tuple corresponds to solutions of (38). In fact, if is a weight-four codeword with nonzero positions and values , then , , and can all represent weight-four codewords.

Combing the above three cases,
The result of the lemma is obtained.

Lemma 12. *Let , , where is an even integer. The notations defined in (10) and (11) satisfy
**
where
**
and are defined in Lemma 11.*

*Proof. *Define the following notations for simplification:
The use of MacWilliamsâ€™ identities in the following paragraphs implies the condition ; refer to [26, Lemma 10]. By (4) and [26, Lemma 9], has seven possible nonzero weights:
With the above notations, the first four moments of codeword weights can be computed:
From (30), (44), and (45) we have
and the first one of (40) is obtained after simplification.

According to the MacWilliamsâ€™ fourth moment identity (31), (44), (45), (46), and (47),
and the second one of (40) is obtained after simplification.

##### 3.5. Weight Distribution of

In this subsection, the parameters defined in (10) and (11) are calculated in Lemma 13, and the weight distribution of the cyclic code is determined in Theorem 15.

Lemma 13. *Let , where is an even integer. The notations defined in (10) and (11) satisfy
**
where
**
and are defined in Lemma 12.*

*Proof. *From Lemma 3, Corollaries 7 and 10, and Lemma 12, the following equations hold:
Solving the above equation system, the result is obtained.

Lemma 14. *Let , , where is an even integer. The number of solutions of the equation system
**
is
*

*Proof. *The sixth moment of exponential sum satisfies
where is the number of solutions of (53). Solving the above equation for , the result is obtained.

Equation (53) considers the case for variables. Using the seventh moment of , the number of solutions can be calculated when there are variables and so forth.

Theorem 15. *Let , , where is an even integer. The cyclic code with nonzeros and has seven nonzero weights:
**
where is a primitive element of the finite field .*

It is interesting to consider the symmetric property about the weights of the cyclic code . If there is a weight of the form â€‰â€‰, then there is a weight of the form . It seems that the weights are symmetric about the value which is also a weight of . This phenomenon may be explained by the fact that, for symmetric matrices with corresponding quadratic residue , there are symmetric matrices with corresponding nonresidue (Lemma 1). As the following example illustrates, in general the higher the value the less the number of corresponding weights.

*Example 16. *Let , , where . The cyclic code has nonzeros , , and , where is a primitive element of the finite field . Using Theorem 15, it has seven nonzero weights:
which are verified by using Matlab.

#### 4. Conclusion

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

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgments

This work was supported in part by the National Basic Research Program of China under Grants 2013CB338004 and 2012CB316100 and the National Natural Science Foundation of China under Grant 61271222.