1 Introduction

Let \({\mathbb {F}}_q\) be a finite field with \(q\) elements and \(n\) a positive integer with \(\gcd (q, n)=1\). An \([n, k, d]\) linear code \({\mathcal {C}}\) is a \(k\)-dimensional subspace of \({\mathbb {F}}_q^n\) with the minimum distance \(d\). Furthermore, a cyclic code \({{\mathcal {C}}}\) of length \(n\) over \({\mathbb {F}}_q\) can be viewed as an ideal of \({\mathbb {F}}_q[x]/(x^n-1)\). Note that every ideal of \({\mathbb {F}}_q[x]/(x^n-1)\) is principal. There is a monic polynomial \(g(x)\) of the least degree such that \({{\mathcal {C}}}=\langle g(x) \rangle \) and \(g(x) \mid (x^n-1)\). Then \(g(x)\) is called the generator polynomial and \(h(x)=(x^n-1)/g(x)\) is called the check polynomial of the cyclic code \({{\mathcal {C}}}\). If \(h(x)\) is irreducible over \({\mathbb {F}}_q\), we call \({{\mathcal {C}}}\) the irreducible cyclic code.

Now we recall the definition of the complete weight enumerator of linear code [24, 25]. The complete weight enumerator of nonlinear codes can be defined in the same way. Suppose that the elements of \({\mathbb {F}}_q\) are \(\omega _0=0, \omega _1, \ldots , \omega _{q-1}\), which are listed in some fixed order. The composition of a vector \({\mathbf{v }}=(v_0, v_1, \ldots , v_{n-1}) \in {\mathbb {F}}_q^n\) is defined to be \(\text{ comp }({\mathbf{v }})=(t_0, t_1, \ldots , t_{q-1})\), where each \(t_i=t_i(\mathbf{v })\) is the number of components \(v_j (0 \le j \le n-1)\) of \(\mathbf{v }\) that are equal to \(\omega _i\). Clearly, we have

$$\begin{aligned} \sum _{i=0}^{q-1} t_i=n. \end{aligned}$$

Definition 1.1

Let \({{\mathcal {C}}}\) be an \([n,k]\) linear code over \({\mathbb {F}}_q\) and let \(A(t_0, t_1, \ldots , t_{q-1})\) be the number of codewords \(\mathbf{c } \in {{\mathcal {C}}}\) with \(\text{ comp }(\mathbf{c })=(t_0, t_1, \ldots , t_{q-1})\). Then the complete weight enumerator of \({{\mathcal {C}}}\) is the polynomial

$$\begin{aligned} W_{{{\mathcal {C}}}}(z_0, z_1, \ldots , z_{q-1})= & {} \sum _{\mathbf{c } \in {{\mathcal {C}}}}z_0^{t_0(\mathbf{c })}z_1^{t_1(\mathbf{c })} \cdots z_{q-1}^{t_{q-1}(\mathbf{c })} \\= & {} \sum _{(t_0, t_1, \ldots , t_{q-1}) \in B_n} A(t_0, t_1, \ldots , t_{q-1})z_0^{t_0}z_1^{t_1} \cdots z_{q-1}^{t_{q-1}}, \end{aligned}$$

where \(B_n=\left\{ (t_0, t_1, \ldots , t_{q-1}): 0 \le t_i \le n, \sum \limits _{i=0}^{q-1} t_i=n\right\} \).

For binary cyclic codes, the complete weight enumerators are just their Hamming weight enumerators. It is not difficult to see that the Hamming weight enumerators, which have been extensively investigated (see [8, 1113, 1921, 23, 26, 2832]), can follow from the complete weight enumerators. Moreover, the complete weight enumerators are applied to study the Walsh transform of monomial functions over finite fields [14] and compute the deception probabilities of certain authentication codes constructed from linear codes [7, 10]. Constant composition codes whose complete weight enumerators have one term have been intensively studied and some families of optimal constant composition codes were presented [4, 6, 9]. Hence it is interesting to determine the complete weight enumerators of linear codes.

The complete weight enumerators of Reed-Solomon codes were studied by Blake and Kith [3, 15]. Kuzmin and Nechaev [16, 17] presented the complete weight enumerators of the generalized Kerdock code and related linear codes over Galois rings. In this paper, we shall use Gauss sums to investigate the complete weight enumerators of cyclic codes and obtain their explicit values in some cases.

Suppose that \({\mathbb {F}}_q\) is a finite field and \(m\) is the order of \(q\) modulo \(n\). Let \({\mathbb {F}}_r\) be a finite field with \(r=q^m\) elements, \(\alpha \) be a primitive element of \({\mathbb {F}}_r\), \(\hbox {Tr}_{r/q}\) be the trace function from \({\mathbb {F}}_r\) onto \({\mathbb {F}}_q\), \(r-1=nN\) for two integers \(n, N \ge 1\), and \(\theta =\alpha ^N\). In this paper, we shall use Gauss sums to determine the complete weight enumerators of irreducible cyclic codes

$$\begin{aligned} {{\mathcal {C}}}=\big \{\mathbf{c }(a)=(\hbox {Tr}_{r/q}(a), \hbox {Tr}_{r/q}(a\theta ), \ldots , \hbox {Tr}_{r/q}\big (a\theta ^{n-1}\big ): a \in {\mathbb {F}}_r\big \}. \end{aligned}$$
(1.1)

By Delsarte’s theorem [6], the check polynomial of such cyclic code is the minimal polynomial of \(\theta ^{-1}\) over \({\mathbb {F}}_q\). When \(\gcd (n, q-1)=q-1 \text{ or } \frac{q-1}{2}\), we explicitly present the complete weight enumerators of some irreducible cyclic codes.

Suppose that \(\alpha _1\) and \(\alpha _2\) are two primitive elements of \({\mathbb {F}}_{q^{m_1}}\) and \({\mathbb {F}}_{q^{m_2}}\), respectively, where \(m_1\) and \(m_2\) are two distinct positive integers with \(\gcd (m_1,m_2)=\delta \). Let \(n= (q^{m_1}-1)(q^{m_2}-1)/(q^\delta -1)\) and \(\hbox {T}_i=\hbox {Tr}_{q^{m_i}/q}\) denote the trace function from \({\mathbb {F}}_{q^{m_i}}\) to \({\mathbb {F}}_q\) for \(i=1, 2\). Let \({{\mathcal {C}}}\) be a cyclic code with the check polynomial \(h_1(x)h_2(x)\), where \(h_i(x)\) are the minimal polynomials of \(\alpha _i^{-1}\) over \({\mathbb {F}}_q\) for \(i=1,2\). Then by Delsarte’s theorem [6] we have

$$\begin{aligned} {{\mathcal {C}}}=\big \{\mathbf{c }(a,b) : a \in {\mathbb {F}}_{q^{m_1}}, b \in {\mathbb {F}}_{q^{m_2}}\big \}, \end{aligned}$$
(1.2)

where

$$\begin{aligned} \mathbf{c }(a,b)=\big (\hbox {T}_1(a)+\hbox {T}_2(b), \hbox {T}_1(a\alpha _1)+\hbox {T}_2(b\alpha _2), \ldots , \hbox {T}_1\big (a\alpha _1^{n-1}\big )+\hbox {T}_2\big (b\alpha _2^{n-1}\big )\big ). \end{aligned}$$
(1.3)

The Hamming weight distribution of this cyclic code was presented in [18, 19] when \(\delta =1, 2\). In this paper, we also use Gauss sums to study the complete weight enumerator of such cyclic code defined by two finite fields. Furthermore, if \(\delta =1\), we give the explicit complete weight enumerators of these cyclic codes over \({\mathbb {F}}_3\) or \({\mathbb {F}}_4\) by using Gauss sums.

The rest of this paper is organized as follows. In Sect. 2, we introduce some results about Gauss sums. In Sect. 3, we investigate the complete weight enumerators of irreducible cyclic codes and explicitly present the complete weight enumerators when \(\gcd (n, q-1)=q-1 \text{ or } \frac{q-1}{2}\). In Sect. 4, we study the complete weight enumerators of a class of cyclic codes defined by two finite fields. Furthermore, if \(\gcd (m_1,m_2)=1\), we give the explicit complete weight enumerators of these cyclic codes over \({\mathbb {F}}_3\) or \({\mathbb {F}}_4\) by using Gauss sums. In Sect. 5, we conclude this paper.

For convenience, we introduce the following notations in this paper:

\({\mathbb {F}}_r\)

Finite field of \(r\) elements, and \(r=q^m\)

\(r-1=nN\)

Integer factorization of \(r-1\)

\(\alpha , \beta , \alpha _1, \alpha _2\)

Generators of \({\mathbb {F}}_r^*\), \({\mathbb {F}}_q^*\), \({\mathbb {F}}_{q^{m_1}}^*\), and \({\mathbb {F}}_{q^{m_2}}^*\), respectively

\(\hbox {Tr}_{r/q}\)

Trace function from \({\mathbb {F}}_r\) to \({\mathbb {F}}_q\)

\(\zeta _l=e^{\frac{2\pi \sqrt{-1}}{l}}\)

\(l\)-th primitive root of unity

\(\phi , \psi \)

Canonical additive characters of \({\mathbb {F}}_q\) and \({\mathbb {F}}_r\), respectively

\(\psi _1, \psi _2\)

Canonical additive characters of \({\mathbb {F}}_{q^{m_1}}\) and \({\mathbb {F}}_{q^{m_2}}\), respectively

\(\widehat{{\mathbb {F}}}_r^*\)

Multiplicative character group of \({\mathbb {F}}_r^*\)

\(G({\uplambda }), G({\uplambda }'), G({\uplambda }_1), G({\uplambda }_2)\)

Gauss sums over \({\mathbb {F}}_r\), \({\mathbb {F}}_q\), \({\mathbb {F}}_{q^{m_1}}\), and \({\mathbb {F}}_{q^{m_2}}\), respectively

\(\chi , \chi ', \chi _1, \chi _2\)

Generators of \(\widehat{{\mathbb {F}}}_r^*\), \(\widehat{{\mathbb {F}}}_q^*\), \(\widehat{{\mathbb {F}}}_{q^{m_1}}^*\), and \(\widehat{{\mathbb {F}}}_{q^{m_2}}^*\), respectively

2 Gauss sum

Let \({{\mathbb {F}}}_r\) be a finite field with \(r\) elements, where \(r\) is a power of a prime \(p\). The canonical additive character of the finite field \({{\mathbb {F}}}_r\) can be defined as follows:

$$\begin{aligned} \psi : {{\mathbb {F}}}_r \rightarrow {{\mathbb {C}}}^*, \psi (x)=\zeta _p^{\hbox {Tr}_{r/p}(x)}, \end{aligned}$$

where \(\zeta _p=e^{\frac{2\pi \sqrt{-1}}{p}}\) is a \(p\)-th primitive root of unity and \(\hbox {Tr}_{r/p}\) denotes the trace function from \({{\mathbb {F}}}_r\) to \({{\mathbb {F}}}_p\). The orthogonal property of additive characters which can be found in [22] is given by

$$\begin{aligned} \sum _{x \in {\mathbb {F}}_r} \psi (ax)=\left\{ \begin{array}{ll} r,\quad \text{ if } a=0; \\ 0,\quad \text{ if } a \in {{\mathbb {F}}}_r ^*. \end{array}\right. \end{aligned}$$

Let

$$\begin{aligned} {\uplambda }: {\mathbb {F}}_r^* \rightarrow {\mathbb {C}}^* \end{aligned}$$

be a multiplicative character of \({\mathbb {F}}_r^*\). Among the characters of \({\mathbb {F}}_r^*\) we have the trivial character \({\uplambda }_0\) defined by \({\uplambda }_0(x)=1\) for all \(x \in {\mathbb {F}}_r^*\). We also have the orthogonal property of multiplicative characters which can be given by

$$\begin{aligned} \sum _{x \in {\mathbb {F}}_r^*} {\uplambda }(x)=\left\{ \begin{array}{ll} r-1, &{}\quad \text{ if } {\uplambda }={\uplambda }_0; \\ 0, &{}\quad \text{ if } {\uplambda } \ne {\uplambda }_0. \end{array}\right. \end{aligned}$$

For the characters \({\uplambda }, {\uplambda }'\), we can define the multiplication by setting \({\uplambda }{\uplambda }'(x)={\uplambda }(x){\uplambda }'(x)\) for all \(x \in {\mathbb {F}}_r^*\). Let \(\overline{\uplambda }\) be the conjugate character of \({\uplambda }\) defined by \(\overline{{\uplambda }}(x)=\overline{{\uplambda }(x)}\), where \(\overline{{\uplambda }(x)}\) denotes the complex conjugate of \({\uplambda }(x)\). Then

$$\begin{aligned} {\uplambda } \overline{{\uplambda }}(x)={\uplambda }(x)\overline{{\uplambda }}(x)={\uplambda }(x)\overline{{\uplambda }(x)}=1, \end{aligned}$$

so \({\uplambda }^{-1}=\overline{\uplambda }\). Then the set \(\widehat{{\mathbb {F}}}_r^*\) of the characters of \({\mathbb {F}}_r^*\) forms a group with identity \({\uplambda }_0\) under such multiplication of characters. Furthermore, the multiplicative group \(\widehat{{\mathbb {F}}}_r^*\) is isomorphic to \({\mathbb {F}}_r^*\) [22]. Define a multiplicative character of \({\mathbb {F}}_r\) by

$$\begin{aligned} \chi (\alpha ^i)=\zeta _{r-1}^i, i=0, 1, \ldots , r-2, \end{aligned}$$

where \(\alpha \) is a generator of \({\mathbb {F}}_r^*\). Then \(\widehat{{\mathbb {F}}}_r^*=\langle \chi \rangle \).

Now we define the Gauss sum over \({\mathbb {F}}_r\) by

$$\begin{aligned} G({\uplambda })=\sum _{x \in {\mathbb {F}}_r^*} {\uplambda }(x) \psi (x). \end{aligned}$$

It is easy to see that \(G({\uplambda }_0)=-1\). Gauss sums can be viewed as the Fourier coefficients in the Fourier expansion of the restriction of \(\psi \) to \({\mathbb {F}}_r^*\) in terms of the multiplicative characters of \({\mathbb {F}}_r\), i.e.,

$$\begin{aligned} \psi (x)=\frac{1}{r-1} \sum _{{\uplambda } \in \widehat{{\mathbb {F}}}_r^*}G(\overline{\uplambda }) {\uplambda }(x), \text{ for } x \in {\mathbb {F}}_r^*. \end{aligned}$$
(2.1)

In general, the explicit determination of Gauss sums is a difficult problem. However, they can be explicitly evaluated in a few cases. For future use, we state some results about the Gauss sums. The quadratic Gauss sums are known and given in the following lemma.

Lemma 2.1

[2, 22] Suppose that \(r=p^s\) and \(\eta \) is a quadratic multiplicative character of \({\mathbb {F}}_r\), where \(p\) is an odd prime and \(s \ge 1\). Then

$$\begin{aligned} G(\eta )=\left\{ \begin{array}{ll} (-1)^{s-1} \sqrt{r}, &{}\quad \text{ if } p \equiv 1 \pmod 4, \\ (-1)^{s-1} (\sqrt{-1})^s \sqrt{r}, &{}\quad \text{ if } p \equiv 3 \pmod 4. \end{array}\right. \end{aligned}$$

We also state the Gauss sums in the semi-primitive case, where there exists an integer \(f\) such that \(p^f \equiv -1 \pmod N\) and \(N\) is the order of \({\uplambda }\) in \(\widehat{{\mathbb {F}}}_r^*\).

Lemma 2.2

[2, 8] Let \({\uplambda }\) be a multiplicative character of order \(N\) of \({\mathbb {F}}_r^*\), where \(N > 2\) is an integer. Assume that there exists a least positive integer \(f\) such that \(p^f \equiv -1\pmod N\). Let \(r=p^{2fs}\) for some positive integer \(s\). Then

$$\begin{aligned} G({\uplambda })=\left\{ \begin{array}{ll} (-1)^{s-1}\sqrt{r}, &{}\quad \text{ if } p=2; \\ (-1)^{s-1+\frac{s(p^f+1)}{N}} \sqrt{r}, &{}\quad \text{ if } p>2. \end{array}\right. \end{aligned}$$

Furthermore, for \(1 \le i \le N-1\), the Gauss sums \(G({\uplambda }^i)\) can be given by

$$\begin{aligned} G({\uplambda }^i)=\left\{ \begin{array}{ll} (-1)^i\sqrt{r}, &{}\quad \text{ if } N \text{ is } \text{ even },\ p, \ s \text{ and } \frac{p^f+1}{N} \text{ are } \text{ odd; } \\ (-1)^{s-1} \sqrt{r}, &{}\quad \text{ otherwise. } \end{array}\right. \end{aligned}$$

If \([({\mathbb {Z}}/ N {\mathbb {Z}})^* : \langle p \rangle ]=2\) and \(-1 \not \in \langle p \rangle \), which is the index \(2\) case, Gauss sums are explicitly determined [27] and one of the results is listed here.

Lemma 2.3

[8, 27] Let \(N \equiv 3 \pmod 4\) be a prime and \(N \ne 3\). Suppose that \(f:=\mathrm{ord}_N(p)=\frac{\Phi (N)}{2}\) and \(r=p^{fs}\) for some positive integer \(s\), where \(\Phi (N)\) denotes the number of integers \(k\) with \(1\le k\le N\) such that \(\gcd (k, N)=1\). Let \({\uplambda }\) be a multiplicative character of order \(N\) of \({\mathbb {F}}_r^*\). Then

$$\begin{aligned} G({\uplambda }^i)=(-1)^{s-1}p^{\frac{s(f-h)}{2}}\left( \frac{a+(\frac{i}{N})b\sqrt{-N}}{2}\right) ^s \end{aligned}$$

for \(1 \le i \le N-1\), where \((\frac{i}{N})\) denotes the Legendre symbol, \(h\) is the ideal class number of \({\mathbb {Q}}(\sqrt{-N})\), and \(a, b \in {\mathbb {Z}}\) are given by

$$\begin{aligned} \left\{ \begin{array}{ll} a^2+Nb^2=4p^h; \\ a \equiv -2p^{\frac{N-1+2h}{4}} \pmod N. \end{array}\right. \end{aligned}$$

3 Irreducible cyclic codes

In this section, we use Gauss sums to study the complete weight enumerators of irreducible cyclic codes

$$\begin{aligned} {{\mathcal {C}}}=\big \{\mathbf{c }(a)=(\hbox {Tr}_{r/q}(a), \hbox {Tr}_{r/q}(a\theta ), \ldots , \hbox {Tr}_{r/q}\big (a\theta ^{n-1}\big ): a \in {\mathbb {F}}_r\big \}. \end{aligned}$$

Moreover, if \(\gcd (n, q-1)= q-1 \text{ or } \frac{q-1}{2}\), then we explicitly present the complete weight enumerators of some irreducible cyclic codes.

For a codeword \(\mathbf{c }(a)\) and \(c \in {\mathbb {F}}_q\), let \(N(c)\) denote the number of components \(\hbox {Tr}_{r/q}(a\theta ^i)\) of \(\mathbf{c }(a)\) that are equal to \(c\), i.e.,

$$\begin{aligned} N(c)= & {} |\{0 \le i \le n-1: \hbox {Tr}_{r/q}(a\theta ^i)=c\}| \\= & {} |\{0 \le i \le n-1: \hbox {Tr}_{r/q}(a\theta ^i)-c=0\}|. \end{aligned}$$

Let \(\phi \) be the canonical additive character of \({\mathbb {F}}_q\). Then \(\psi =\phi \circ \hbox {Tr}_{r/q}\) is the canonical additive character of \({\mathbb {F}}_r\). By the orthogonal property of additive characters we have

$$\begin{aligned} N(c)= & {} \sum _{i=0}^{n-1} \frac{1}{q} \sum _{y \in {\mathbb {F}}_q} \phi (y (\hbox {Tr}_{r/q}(a\theta ^i)-c)) \nonumber \\= & {} \frac{1}{q} \sum _{y \in {\mathbb {F}}_q}\sum _{i=0}^{n-1}\psi (ya\alpha ^{Ni})\phi (-y c) \nonumber \\= & {} \frac{n}{q} +\frac{1}{q} \sum _{y \in {\mathbb {F}}_q^*}\sum _{i=0}^{n-1}\psi (ya\alpha ^{Ni})\phi (-y c). \end{aligned}$$
(3.1)

By (2.1), for \(ac \ne 0\), we have

$$\begin{aligned} N(c)= & {} \frac{n}{q} +\frac{1}{q} \sum _{y \in {\mathbb {F}}_q^*}\sum _{i=0}^{n-1}\frac{1}{r-1} \sum _{{\uplambda } \in \widehat{{\mathbb {F}}}_r^*} G(\overline{{\uplambda }}){\uplambda }(ya\alpha ^{Ni}) \frac{1}{q-1}\sum _{{\uplambda }' \in \widehat{{\mathbb {F}}}_q^*} G(\overline{{\uplambda }'}){\uplambda }'(-yc) \\= & {} \frac{n}{q} +\frac{1}{q(q-1)(r-1)}\sum _{\begin{array}{c} {\uplambda } \in \widehat{{\mathbb {F}}}_r^* \\ {\uplambda }' \in \widehat{{\mathbb {F}}}_q^* \end{array}} G(\overline{{\uplambda }}) G(\overline{{\uplambda }'}){\uplambda }(a){\uplambda }'(-c)\sum _{y \in {\mathbb {F}}_q^*}{\uplambda }(y){\uplambda }'(y)\sum _{i=0}^{n-1}{\uplambda }(\alpha ^{Ni}). \end{aligned}$$

Note that \(r-1=nN\) and

$$\begin{aligned} \sum _{i=0}^{n-1}{\uplambda }(\alpha ^{Ni}) = \left\{ \begin{array}{ll} n, &{} \text{ if } {\uplambda }^N=1; \\ 0, &{} \text{ otherwise. } \end{array}\right. \end{aligned}$$

Let \(\alpha \) and \(\beta =\alpha ^{\frac{r-1}{q-1}}\) be two primitive elements of \({\mathbb {F}}_r\) and \({\mathbb {F}}_q\), respectively. Define \(\chi (\alpha )=\zeta _{r-1}\) and \(\chi '(\beta )=\zeta _{q-1}\), we have \(\widehat{{\mathbb {F}}}_r^*=\langle \chi \rangle \), \(\widehat{{\mathbb {F}}}_q^*=\langle \chi ' \rangle \), and \({\uplambda }'=\chi '^j, j=0, 1, \ldots , q-2\). If \({\uplambda }^N=1\), then \({\uplambda }=\chi ^{ni}, i=0,1, \ldots , N-1\). It is easy to see that

$$\begin{aligned} \sum _{y \in {\mathbb {F}}_q^*}{\uplambda }(y){\uplambda }'(y)= & {} \sum _{k=0}^{q-2}(\chi ^{ni}(\beta )\chi '^j(\beta ))^k =\sum _{k=0}^{q-2}(\zeta _{q-1}^{\frac{r-1}{N} i+j})^k \\= & {} \left\{ \begin{array}{ll} q-1, &{} \text{ if } \frac{r-1}{N} i+j \equiv 0 \pmod {q-1}; \\ 0, &{} \text{ otherwise. } \end{array}\right. \end{aligned}$$

Denote \(S=\{(i,j): j \equiv -\frac{r-1}{N} i \pmod {q-1}, 0 \le i \le N-1, 0 \le j \le q-2\}\). Then \(|S|=N\) and we have

$$\begin{aligned} N(c)=\frac{n}{q} +\frac{1}{qN}\sum _{(i,j)\in S}G(\overline{\chi }^{ni}) G(\overline{\chi '}^j)\chi ^{ni}(a)\chi '^j(-c). \end{aligned}$$
(3.2)

Similarly, by (3.1) we have

$$\begin{aligned} N(0)=\frac{n}{q} +\frac{q-1}{qN} \sum _{i \in I}G(\overline{\chi }^{ni}) \chi ^{ni}(a), \end{aligned}$$
(3.3)

where \(I=\{i: \frac{r-1}{N} i \equiv 0 \pmod {q-1}, 0 \le i \le N-1\}\).

The explicit values of Gauss sums are necessary to determine the values of \(N(0)\) and \(N(c)\) when \((i, j) \in S\) and \(i \in I\). It is clear that there is a positive integer \(d\) such that \(\gcd (\frac{r-1}{N}, q-1)=\frac{q-1}{d}\). Then \((q-1) \mid \gcd (r-1, N(q-1))=\frac{(q-1)N}{d}\), so \(d \mid N\). Thus \(I=\{i=kd: 0 \le k \le \frac{N}{d} -1\}\) and \(|I|=\frac{N}{d}\). If \(\frac{r-1}{N} i+j \equiv 0 \pmod {q-1}\), then \(\frac{q-1}{d} \mid j\) and \(j=\frac{q-1}{d} k, 0 \le k \le d-1\). In the following, we consider two cases: (1) \(d=1\), i.e., \(N \mid \frac{r-1}{q-1}\); (2) \(d=2\).

3.1 The case: \(N \mid \frac{r-1}{q-1}\)

In this case, we can get a general formula on the values of \(N(c), c \in {\mathbb {F}}_q\).

Theorem 3.1

Let the notations be as above. If \(a \ne 0\) and \(N \mid \frac{r-1}{q-1}\), then we have

$$\begin{aligned} N(0)=\frac{r-q}{qN}+\frac{q-1}{qN}\sum _{i=1}^{N-1}G(\overline{\tau }^i)\tau ^i(a) \end{aligned}$$

and

$$\begin{aligned} N(c)=\frac{r}{qN}-\frac{1}{qN}\sum _{i=1}^{N-1}G(\overline{\tau }^i)\tau ^i(a) \end{aligned}$$

for \(c \ne 0\), where \(\tau =\chi ^n\).

Proof

If \(N \mid \frac{r-1}{q-1}\), then \((q-1) \mid \frac{r-1}{N}\). By \(j \equiv -\frac{r-1}{N} i \equiv 0 \pmod {q-1}\) and \(0 \le j \le q-2\), we have \(j=0\) and \(S=\{(i,0): 0 \le i \le N-1\}\). Then by (3.2) we have

$$\begin{aligned} N(c)= & {} \frac{n}{q} -\frac{1}{qN}\sum _{i=0}^{N-1}G(\overline{\chi }^{ni})\chi ^{ni}(a) \\= & {} \frac{n}{q} +\frac{1}{qN}-\frac{1}{qN}\sum _{i=1}^{N-1}G(\overline{\chi }^{ni})\chi ^{ni}(a) \\= & {} \frac{r}{qN}-\frac{1}{qN}\sum _{i=1}^{N-1}G(\overline{\tau }^i)\tau ^i(a), \end{aligned}$$

where \(\tau =\chi ^n\).

It is clear that \(I=\{i: 0 \le i \le N-1\}\) if \(N \mid \frac{r-1}{q-1}\). Then by (3.3) we have

$$\begin{aligned} N(0)= \frac{r-q}{qN}+\frac{q-1}{qN}\sum _{i=1}^{N-1}G(\overline{\tau }^i)\tau ^i(a). \end{aligned}$$

This completes the proof. \(\square \)

In the rest of this section, we always assume that the elements of \({\mathbb {F}}_q\) are \(\omega _0=0, \omega _1, \ldots , \omega _{q-1}\), which are listed in some fixed order. Let \(\text{ comp }(\mathbf{c })=(t_0, t_1, \ldots , t_{q-1})\) be the composition of a codeword \(\mathbf{c }=(c_0, c_1, \ldots , c_{n-1})\), where \(t_i=t_i(\mathbf{c })\) is the number of components \(c_j (0 \le j \le n-1)\) of \(\mathbf{c }\) that are equal to \(\omega _i\).

If \(N=1\), then by Theorem 3.1 we have

$$\begin{aligned} N(0)=\frac{r}{q}-1 \text{ and } N(c)=\frac{r}{q} \text{ for } c \ne 0, \end{aligned}$$

which conforms to the distribution property of \(m\)-sequence. As a direct consequence of Theorem 3.1, we get the following result.

Corollary 3.2

Let \(r=q^m\) and \(N=1\). Then the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

$$\begin{aligned} W_{{{\mathcal {C}}}}(z_0, z_1, z_2, \ldots , z_{q-1})=z_0^{r-1}+(r-1)z_0^{\frac{r}{q}-1}z_1^{\frac{r}{q}} z_2^{\frac{r}{q}} \cdots z_{q-1}^{\frac{r}{q}}. \end{aligned}$$

By Theorem 3.1 we can easily get the following theorem by using quadratic Gauss sums and we omit the proof here. In fact, the same result was presented in [1] for the case that \(q\) is a prime.

Theorem 3.3

Let \(r=q^m\), \(q=p^f\), and \(N=2\), where \(m>0\) is an even integer, \(p\) is an odd prime, and \(f\) is a positive integer. Then the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

$$\begin{aligned} W_{{{\mathcal {C}}}}(z_0, z_1, z_2, \ldots , z_{q-1})=z_0^{\frac{r-1}{2}}+\frac{r-1}{2} z_0^{A_0}z_1^{A_1} z_2^{A_1} \cdots z_{q-1}^{A_1}+\frac{r-1}{2} z_0^{B_0}z_1^{B_1} z_2^{B_1} \cdots z_{q-1}^{B_1}, \end{aligned}$$

where

$$\begin{aligned} A_0= & {} \frac{r-q}{2q}-\frac{q-1}{2q} \sqrt{r}, A_1=\frac{r}{2q}+\frac{1}{2q} \sqrt{r},\\ B_0= & {} \frac{r-q}{2q}+\frac{q-1}{2q} \sqrt{r}, B_1=\frac{r}{2q}-\frac{1}{2q} \sqrt{r}. \end{aligned}$$

Example 3.4

  1. (1)

    Let \(q=p=3\), \(m=4\), and \(N=2\). Then \(r=81\) and \(n=40\). Suppose that \(\alpha \) is a primitive element of \({\mathbb {F}}_{81}\) and \(\theta =\alpha ^2\). By Theorem 3.3, the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

    $$\begin{aligned} z_0^{40}+40z_0^{10}z_1^{15}z_2^{15}+40z_0^{16}z_1^{12}z_2^{12}, \end{aligned}$$

    which is consistent with numerical computation by Magma.

  2. (2)

    Let \(q=p=5\), \(m=2\), and \(N=2\). Then \(r=25\) and \(n=12\). Suppose that \(\alpha \) is a primitive element of \({\mathbb {F}}_{25}\) and \(\theta =\alpha ^2\). By Theorem 3.3, the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

    $$\begin{aligned} z_0^{12}+12z_1^3z_2^3z_3^3z_4^3+12z_0^4z_1^2z_2^2z_3^2z_4^2, \end{aligned}$$

    which is consistent with numerical computation by Magma.

Below we give the complete weight enumerators of the irreducible cyclic codes by using semi-primitive Gauss sums. In fact, the same result was presented in [1] for the case that \(q\) is a prime.

Theorem 3.5

Assume that there exists a least positive integer \(f\) such that \(p^f \equiv -1\pmod N\). Let \(r=q^m=p^{2fs}\) for some positive integer \(s\). If \(N \mid \frac{r-1}{q-1}\), then the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

$$\begin{aligned} z_0^{\frac{r-1}{N}}+\frac{r-1}{N} z_0^{A_0}z_1^{A_1} z_2^{A_1} \cdots z_{q-1}^{A_1}+\frac{(N-1)(r-1)}{N} z_0^{B_0}z_1^{B_1} z_2^{B_1} \cdots z_{q-1}^{B_1}, \end{aligned}$$

where \(A_0, A_1, B_0\) and \(B_1\) are given as follows.

  1. (1)

    If \(N\) is even, \(p, s\), and \(\frac{p^f+1}{N}\) are odd, we have

    $$\begin{aligned} A_0= & {} \frac{r-q+(q-1)(N-1)\sqrt{r}}{qN}, A_1=\frac{r-(N-1)\sqrt{r}}{qN},\\ B_0= & {} \frac{r-q-(q-1)\sqrt{r}}{qN}, B_1=\frac{r+\sqrt{r}}{qN}. \end{aligned}$$
  2. (2)

    Otherwise, we have

    $$\begin{aligned} A_0= & {} \frac{r-q+(-1)^{s-1}(q-1)(N-1)\sqrt{r}}{qN}, A_1=\frac{r-(-1)^{s-1}(N-1)\sqrt{r}}{qN},\\ B_0= & {} \frac{r-q-(-1)^{s-1}(q-1)\sqrt{r}}{qN}, B_1=\frac{r+(-1)^{s-1}\sqrt{r}}{qN}. \end{aligned}$$

Proof

If \(N\) is even, \(p, s\), and \(\frac{p^f+1}{N}\) are odd, then by Lemma 2.2 we have

$$\begin{aligned} G(\tau ^i)=(-1)^i\sqrt{r} \text{ for } 1 \le i \le N-1. \end{aligned}$$

Thus

$$\begin{aligned} \sum _{i=1}^{N-1}G(\overline{\tau }^i)\tau ^i(a)=\left\{ \begin{array}{ll} (N-1)\sqrt{r}, &{}\quad \text{ if } a \in \alpha ^{\frac{N}{2}} \langle \alpha ^N \rangle ; \\ -\sqrt{r}, &{}\quad \text{ otherwise. } \end{array}\right. \end{aligned}$$

By Theorem 3.1, we get the proof of (1).

In other cases, by Lemma 2.2 we have

$$\begin{aligned} G(\tau ^i)=(-1)^{s-1}\sqrt{r} \text{ for } 1 \le i \le N-1. \end{aligned}$$

Thus

$$\begin{aligned} \sum _{i=1}^{N-1}G(\overline{\tau }^i)\tau ^i(a)=\left\{ \begin{array}{ll} (-1)^{s-1}(N-1)\sqrt{r}, &{}\quad \text{ if } a \in \langle \alpha ^N \rangle ; \\ (-1)^s\sqrt{r}, &{}\quad \text{ otherwise. } \end{array}\right. \end{aligned}$$

By Theorem 3.1, we also get the proof of (2). \(\square \)

Example 3.6

  1. (1)

    Let \(q=p=3\), \(m=6\), and \(N=4\). Then \(r=729\), \(N \mid \frac{r-1}{q-1}\), and \(n=182\). Suppose that \(\alpha \) is a primitive element of \({\mathbb {F}}_{729}\) and \(\theta =\alpha ^4\). By Theorem 3.5, the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

    $$\begin{aligned} z_0^{182}+182z_0^{74}z_1^{54}z_2^{54}+546z_0^{56}z_1^{63}z_2^{63}, \end{aligned}$$

    which is consistent with numerical computation by Magma.

  2. (2)

    Let \(q=4, p=2\), \(m=4\), and \(N=5\). Then \(r=256\), \(N \mid \frac{r-1}{q-1}\), and \(n=51\). Suppose that \(\alpha \) is a primitive element of \({\mathbb {F}}_{256}\) and \(\theta =\alpha ^5\). By Theorem 3.5, the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

    $$\begin{aligned} z_0^{51}+51z_0^3z_1^{16}z_2^{16}z_3^{16}+204z_0^{15}z_1^{12}z_2^{12}z_3^{12}, \end{aligned}$$

    which is consistent with numerical computation by Magma.

Now we employ index \(2\) Gauss sums to present the complete weight enumerators of a class of irreducible cyclic codes. For convenience, we consider the case that \(N\) is a prime and \(r=q^m\), where \(m=\frac{N-1}{2}\). The general case can be similarly dealt with.

Theorem 3.7

Let \(N \equiv 3 \pmod 4\) and \(q\) be two distinct primes, where \(N \ne 3\). Suppose that \(m:=\mathrm{ord}_N(q)=\frac{\Phi (N)}{2}\). Let \(h\) be the ideal class number of \({\mathbb {Q}}(\sqrt{-N})\) and \(r=q^m\). If \(N \mid \frac{r-1}{q-1}\), then the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

$$\begin{aligned}&z_0^{\frac{r-1}{N}}+\frac{r-1}{N} z_0^{A_0}z_1^{A_1} z_2^{A_1} \cdots z_{q-1}^{A_1}+\frac{(N-1)(r-1)}{2N} z_0^{B_0}z_1^{B_1} z_2^{B_1} \cdots z_{q-1}^{B_1} \\&\quad +\,\frac{(N-1)(r-1)}{2N} z_0^{C_0}z_1^{C_1} z_2^{C_1} \cdots z_{q-1}^{C_1},\end{aligned}$$

where

$$\begin{aligned} A_0= & {} \frac{r-q}{qN}+\frac{\tilde{a}(N-1)(q-1)}{2qN}q^{\frac{m-h}{2}}, A_1=\frac{r}{qN}-\frac{\tilde{a}(N-1)}{2qN} q^{\frac{m-h}{2}},\\ B_0= & {} \frac{r-q}{qN}-\frac{(\tilde{a}+\tilde{b}N)(q-1)}{2qN}q^{\frac{m-h}{2}}, B_1=\frac{r}{qN}+\frac{\tilde{a}+\tilde{b}N}{2qN} q^{\frac{m-h}{2}},\\ C_0= & {} \frac{r-q}{qN}-\frac{(\tilde{a}-\tilde{b}N)(q-1)}{2qN}q^{\frac{m-h}{2}}, C_1=\frac{r}{qN}+\frac{\tilde{a}-\tilde{b}N}{2qN} q^{\frac{m-h}{2}}, \end{aligned}$$

and \(\tilde{a}, \tilde{b} \in {\mathbb {Z}}\) are determined by

$$\begin{aligned} \left\{ \begin{array}{ll} \tilde{a}^2+N\tilde{b}^2=4q^h; \\ \tilde{a} \equiv -2q^{\frac{N-1+2h}{4}} \pmod N. \end{array}\right. \end{aligned}$$

Proof

Note that \(\mathrm{ord}(\overline{\tau })=N\). Then by Lemma 2.3 we have

$$\begin{aligned} G(\overline{\tau }^i)=\frac{\tilde{a}+(\frac{i}{N})\tilde{b}\sqrt{-N}}{2} q^{\frac{m-h}{2}} \end{aligned}$$

for \(1 \le i \le N-1\), where \((\frac{i}{N})\) denotes the Legendre symbol, \(h\) is the ideal class number of \({\mathbb {Q}}(\sqrt{-N})\), and \(\tilde{a}, \tilde{b} \in {\mathbb {Z}}\) are given by

$$\begin{aligned} \left\{ \begin{array}{ll} \tilde{a}^2+N\tilde{b}^2=4q^h; \\ \tilde{a} \equiv -2q^{\frac{N-1+2h}{4}} \pmod N. \end{array}\right. \end{aligned}$$

Now we compute the sum

$$\begin{aligned} \sum _{i=1}^{N-1}G(\overline{\tau }^i)\tau ^i(a)=\sum _{i=1}^{N-1}\frac{\tilde{a}+(\frac{i}{N})\tilde{b}\sqrt{-N}}{2} q^{\frac{m-h}{2}}\tau ^i(a). \end{aligned}$$

If \(a \in \langle \alpha ^N \rangle \), then \(\tau ^i(a)=1\) for \(1 \le i \le N-1\). Thus

$$\begin{aligned} \sum _{i=1}^{N-1}G(\overline{\tau }^i)\tau ^i(a)=\frac{\tilde{a}}{2} (N-1)q^{\frac{m-h}{2}}+ \frac{\tilde{b}\sqrt{-N}}{2} q^{\frac{m-h}{2}}\sum _{i=1}^{N-1}\Big (\frac{i}{N}\Big ) =\frac{\tilde{a}}{2} (N-1)q^{\frac{m-h}{2}}. \end{aligned}$$

By Theorem 3.1, we have

$$\begin{aligned} N(0)=\frac{r-q}{qN}+\frac{\tilde{a}(N-1)(q-1)}{2qN}q^{\frac{m-h}{2}}=A_0 \end{aligned}$$

and

$$\begin{aligned} N(c)=\frac{r}{qN}-\frac{\tilde{a}(N-1)}{2qN} q^{\frac{m-h}{2}}=A_1 \end{aligned}$$

for \(c \ne 0\).

If \(a \in \alpha ^u \langle \alpha ^N \rangle \) for some \(u\), \(1 \le u \le N-1\), then \(\tau (a)=\zeta _N^u\). It is easy to see that

$$\begin{aligned} \sum _{i=1}^{N-1}G(\overline{\tau }^i)\tau ^i(a) \!=\! q^{\frac{m-h}{2}}\left( \frac{\tilde{a}+\tilde{b}\sqrt{-N}}{2} \sum _{\begin{array}{c} i=1 \\ (\frac{i}{N})=1 \end{array}}^{N-1}\tau ^i(a)\!+\! \frac{\tilde{a}-\tilde{b}\sqrt{-N}}{2} \sum _{\begin{array}{c} i=1 \\ (\frac{i}{N})=-1 \end{array}}^{N-1}\tau ^i(a)\right) .\qquad \quad \end{aligned}$$
(3.4)

Note that

$$\begin{aligned} \sum _{\begin{array}{c} i=1 \\ \left( \frac{i}{N}\right) =1 \end{array}}^{N-1}\tau ^i(a)= & {} \sum _{i=1}^{N-1}\frac{1+\left( \frac{i}{N}\right) }{2} \tau ^i(a) =\frac{1}{2}\left( \sum _{i=1}^{N-1}\zeta _N^{ui}+\sum _{i=1}^{N-1}\left( \frac{i}{N}\right) \zeta _N^{ui}\right) \nonumber \\= & {} \frac{1}{2}\left( -1+\Big (\frac{u}{N}\Big )\sqrt{-N}\right) , \end{aligned}$$
(3.5)

where the last equality follows from Lemma 2.1. Similarly, we have

$$\begin{aligned} \sum _{\begin{array}{c} i=1 \\ \left( \frac{i}{N}\right) =-1 \end{array}}^{N-1}\tau ^i(a)=\frac{1}{2}\left( -1-\left( \frac{u}{N}\right) \sqrt{-N}\right) . \end{aligned}$$
(3.6)

For \((\frac{u}{N})=1\), by (3.4)–(3.6) and Theorem 3.1, we have

$$\begin{aligned} N(0)=\frac{r-q}{qN}-\frac{(\tilde{a}+\tilde{b}N)(q-1)}{2qN}q^{\frac{m-h}{2}}=B_0 \end{aligned}$$

and

$$\begin{aligned} N(c)=\frac{r}{qN}+\frac{\tilde{a}+\tilde{b}N}{2qN} q^{\frac{m-h}{2}}=B_1 \end{aligned}$$

for \(c \ne 0\). Similarly, for \((\frac{u}{N})=-1\), we have

$$\begin{aligned} N(0)=\frac{r-q}{qN}-\frac{(\tilde{a}-\tilde{b}N)(q-1)}{2qN}q^{\frac{m-h}{2}}=C_0 \end{aligned}$$

and

$$\begin{aligned} N(c)=\frac{r}{qN}+\frac{\tilde{a}-\tilde{b}N}{2qN} q^{\frac{m-h}{2}}=C_1 \end{aligned}$$

for \(c \ne 0\). Then we can get the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) and this completes the proof. \(\square \)

Example 3.8

Let \(q=4\), \(N=7\), and \(m=3\). Then \(r=64\), \(N \mid \frac{r-1}{q-1}\), \(n=9\), \(h=1\), \(a=3\), and \(b=\pm 1\). Suppose that \(\alpha \) is a primitive element of \({\mathbb {F}}_{64}\) and \(\theta =\alpha ^7\). By Theorem 3.7, the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

$$\begin{aligned} z_0^9+9z_0^6z_1z_2z_3+27z_1^3z_2^3z_3^3+27z_o^3z_1^2z_2^2z_3^2, \end{aligned}$$

which is consistent with numerical computation by Magma.

3.2 The case: d=2

If \(\gcd (\frac{r-1}{N}, q-1)=\frac{q-1}{2}\), then by \(d \mid N\) we see that \(N\) is even. By \(\frac{r-1}{N} i+j \equiv 0 \pmod {q-1}\) and \(0 \le j \le q-2\), we have \(j=0, \frac{q-1}{2}\). Thus

$$\begin{aligned} S=\left\{ (2k,0), \left( 2k+1, \frac{q-1}{2}\right) : 0 \le k \le \frac{N}{2} -1\right\} . \end{aligned}$$

In this case, it is clear that \(I=\{i=2k: 0 \le k \le \frac{N}{2}-1\}\).

Below we mainly use quadratic Gauss sums to study a class of irreducible cyclic codes. In fact, for \(d=2\), the complete weight enumerators of more irreducible cyclic codes can be similarly determined by using semi-primitive Gauss sums and index \(2\) Gauss sums.

Theorem 3.9

Let \(r=q^m\), \(q=p^f\), and \(N=2\), where \(m>0\) is an odd integer, \(p\) is an odd prime, and \(f\) is a positive integer. Suppose that \({\mathbb {F}}_q^*=\langle \beta \rangle \), \(\omega _1, \ldots , \omega _{\frac{q-1}{2}} \in \langle \beta ^2 \rangle \), and \(\omega _{\frac{q+1}{2}}, \ldots , \omega _{q-1} \in \beta \langle \beta ^2 \rangle \). Then the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

$$\begin{aligned}&W_{{{\mathcal {C}}}}(z_0, z_1, z_2, \ldots , z_{q-1})=z_0^{\frac{r-1}{2}}+\frac{r-1}{2} z_0^Az_1^B z_2^B \cdots z_{\frac{q-1}{2}}^Bz_{\frac{q+1}{2}}^C \cdots z_{q-1}^C \\&\quad +\,\frac{r-1}{2} z_0^Az_1^C z_2^C \cdots z_{\frac{q-1}{2}}^Cz_{\frac{q+1}{2}}^B \cdots z_{q-1}^B,\end{aligned}$$

where

$$\begin{aligned} A=\frac{r-q}{2q}, B=\frac{r}{2q}+\frac{\sqrt{rq}}{2q}, C=\frac{r}{2q}-\frac{\sqrt{rq}}{2q}. \end{aligned}$$

Proof

If \(N=2\), \(m>0\) is an odd integer, and \(p\) is an odd prime, then \(d=2\), \(S=\{(0,0), (1, \frac{q-1}{2})\}\), and \(I=\{0\}\). By (3.2), (3.3), and Lemma 2.1, we can get the desired conclusions. \(\square \)

Example 3.10

  1. (1)

    Let \(q=p=3\), \(m=3\), and \(N=2\). Then \(r=27\) and \(n=13\). Suppose that \(\alpha \) is a primitive element of \({\mathbb {F}}_{27}\) and \(\theta =\alpha ^2\). By Theorem 3.9, the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

    $$\begin{aligned} z_0^{13}+13z_0^4z_1^6z_2^3+13z_0^4z_1^3z_2^6, \end{aligned}$$

    which is consistent with numerical computation by Magma.

  2. (2)

    Let \(q=p=5\), \(m=3\), and \(N=2\). Then \(r=125\) and \(n=62\). Suppose that \(\alpha \) is a primitive element of \({\mathbb {F}}_{125}\) and \(\theta =\alpha ^2\). By Theorem 3.9, the complete weight enumerator of the irreducible cyclic code \({{\mathcal {C}}}\) defined by (1.1) is

    $$\begin{aligned} z_0^{62}+62z_0^{12}z_1^{15}z_2^{15}z_3^{10}z_4^{10}+62z_0^{12}z_1^{10}z_2^{10}z_3^{15}z_4^{15}, \end{aligned}$$

    which is consistent with numerical computation by Magma.

4 Cyclic codes from two distinct fields

In this section, we use Gauss sums to study the complete weight enumerator of the cyclic code defined by (1.2) and (1.3). Furthermore, we give the explicit complete weight enumerators of these cyclic codes over \({\mathbb {F}}_3\) or \({\mathbb {F}}_4\) if \(\gcd (m_1, m_2)=1\).

For a codeword \(\mathbf{c }(a,b)\) of (1.3) and \(c \in {\mathbb {F}}_q\), let \(N(c)\) denote the number of components \(\hbox {T}_1(a\alpha _1^i)+\hbox {T}_2(b\alpha _2^i)\) of \(\mathbf{c }(a,b)\) that are equal to \(c\), i.e.,

$$\begin{aligned} N(c)= & {} |\{0 \le i \le n-1:\hbox {T}_1(a\alpha _1^i)+\hbox {T}_2(b\alpha _2^i)=c\}| \\= & {} |\{0 \le i \le n-1: \hbox {T}_1(a\alpha _1^i)+\hbox {T}_2(b\alpha _2^i)-c=0\}|, \end{aligned}$$

where \(n= (q^{m_1}-1)(q^{m_2}-1)/(q^\delta -1)\).

Let \(\phi \) be the canonical additive character of \({\mathbb {F}}_q\). Then \(\psi _i=\phi \circ \hbox {T}_i\) is the canonical additive character of \({\mathbb {F}}_{q^{m_i}}\) for \(i=1,2\). By the orthogonal property of additive characters we have

$$\begin{aligned} N(c)= & {} \sum _{i=0}^{n-1} \frac{1}{q} \sum _{y \in {\mathbb {F}}_q} \phi (y (\hbox {T}_1(a\alpha _1^i)+\hbox {T}_2(b\alpha _2^i)-c)) \nonumber \\= & {} \frac{n}{q} +\frac{1}{q} \sum _{y \in {\mathbb {F}}_q^*}\sum _{i=0}^{n-1}\psi _1(ya\alpha _1^i)\psi _2(yb\alpha _2^i)\phi (-y c). \end{aligned}$$
(4.1)

By (2.1), for \(a, b, c \ne 0\), we have

$$\begin{aligned} \Omega :&=\sum _{y \in {\mathbb {F}}_q^*}\sum _{i=0}^{n-1}\psi _1(ya\alpha _1^i)\psi _2(yb\alpha _2^i)\phi (-y c) \\&= \frac{1}{(q-1)(q^{m_1}-1)(q^{m_2}-1)}\sum _{y \in {\mathbb {F}}_q^*}\sum _{i=0}^{n-1} \sum _{{\uplambda }_1 \in \widehat{{\mathbb {F}}}_{q^{m_1}}^*}G(\overline{{\uplambda }_1}){\uplambda }_1(ya\alpha _1^i) \\&\quad \times \sum _{{\uplambda }_2 \in \widehat{{\mathbb {F}}}_{q^{m_2}}^*}G(\overline{{\uplambda }_2}){\uplambda }_2(yb\alpha _2^i) \sum _{{\uplambda }'\in \widehat{{\mathbb {F}}}_q^*}G(\overline{{\uplambda }'}){\uplambda }'(-yc). \end{aligned}$$

Let \(\Delta _1= \frac{q^{m_1}-1}{q^\delta -1}, \Delta _2= \frac{q^{m_2}-1}{q^\delta -1}\), and \(i=s(q^\delta -1)+t, s=0, 1, \ldots , \Delta _1\Delta _2-1, t=0, 1, \ldots , q^\delta -2\). Then we have

$$\begin{aligned} \Omega&= \frac{1}{(q-1)(q^{m_1}-1)(q^{m_2}-1)} \sum _{{\uplambda }_1 \in \widehat{{\mathbb {F}}}_{q^{m_1}}^*}\sum _{{\uplambda }_2 \in \widehat{{\mathbb {F}}}_{q^{m_2}}^*} \sum _{{\uplambda }'\in \widehat{{\mathbb {F}}}_q^*}G(\overline{{\uplambda }_1})G(\overline{{\uplambda }_2})G(\overline{{\uplambda }'}) \\&\quad \times \sum _{y \in {\mathbb {F}}_q^*}{\uplambda }_1(ya){\uplambda }_2(yb){\uplambda }'(-yc) \sum _{t=0}^{q^\delta -2}\sum _{s=0}^{\Delta _1\Delta _2-1} {\uplambda }_1(\alpha _1^{s(q^\delta -1)+t}) {\uplambda }_2(\alpha _2^{s(q^\delta -1)+t}) \\&= \frac{1}{(q-1)(q^{m_1}-1)(q^{m_2}-1)} \sum _{{\uplambda }_1 \in \widehat{{\mathbb {F}}}_{q^{m_1}}^*}\sum _{{\uplambda }_2 \in \widehat{{\mathbb {F}}}_{q^{m_2}}^*} \sum _{{\uplambda }'\in \widehat{{\mathbb {F}}}_q^*}G(\overline{{\uplambda }_1})G(\overline{{\uplambda }_2})G(\overline{{\uplambda }'}) \\&\quad \times \sum _{y \in {\mathbb {F}}_q^*}{\uplambda }_1(ya){\uplambda }_2(yb){\uplambda }'(-yc) \sum _{t=0}^{q^\delta -2}{\uplambda }_1(\alpha _1^t) {\uplambda }_2(\alpha _2^t) \sum _{s=0}^{\Delta _1\Delta _2-1} {\uplambda }_1(\alpha _1^{(q^\delta -1)s}) {\uplambda }_2(\alpha _2^{(q^\delta -1)s}). \end{aligned}$$

Since \(\gcd (m_1, m_2)=\delta \), we have \(\gcd (\Delta _1, \Delta _2)=1\). For any fixed \(u, v\) (\(u \in \{0, 1, \ldots , \Delta _1-1\}\), \(v \in \{0, 1, \ldots , \Delta _2-1\}\)), by Chinese Remainder Theorem, it is easy to see that there is a unique \(s\) (\(s \in \{0, 1, \ldots , \Delta _1\Delta _2-1\)}) satisfying

$$\begin{aligned} \left\{ \begin{array}{ll} s \equiv u \pmod {\Delta _1}; \\ s \equiv v \pmod {\Delta _2}. \end{array}\right. \end{aligned}$$

Thus we see that the inner sum

$$\begin{aligned}&\sum _{s=0}^{\Delta _1\Delta _2-1}{\uplambda }_1\left( \alpha _1^{\left( q^\delta -1\right) s}\right) {\uplambda }_2\left( \alpha _2^{\left( q^\delta -1\right) s}\right) =\sum _{u=0}^{\Delta _1-1}{\uplambda }_1\left( \alpha _1^{\left( q^\delta -1\right) u}\right) \sum _{v=0}^{\Delta _2-1}{\uplambda }_2\left( \alpha _2^{\left( q^\delta -1\right) v}\right) \\&\quad = \left\{ \begin{array}{ll}\frac{(q^{m_1}-1)(q^{m_2}-1)}{(q^\delta -1)^2}, &{} \text{ if } {\uplambda }_1^{q^\delta -1}=1 \text{ and } {\uplambda }_2^{q^\delta -1}=1; \\ 0, &{} \text{ otherwise. }\end{array}\right. \end{aligned}$$

Let \(\chi _1\) and \(\chi _2\) be two generators of \(\widehat{{\mathbb {F}}}_{q^{m_1}}^*\) and \(\widehat{{\mathbb {F}}}_{q^{m_2}}^*\) defined by \(\chi _1(\alpha _1)=\zeta _{q^{m_1}-1}\) and \(\chi _2(\alpha _2)=\zeta _{q^{m_2}-1}\), respectively. If \({\uplambda }_1^{q^\delta -1}=1\), \({\uplambda }_2^{q^\delta -1}=1\), then \({\uplambda }_1=\chi _1^{\Delta _1 i}\), \({\uplambda }_2=\chi _2^{\Delta _2 j}\), \(0\le i,j\le q^\delta -2\), where \(\Delta _1=\frac{q^{m_1}-1}{q^\delta -1}\), \(\Delta _2=\frac{q^{m_2}-1}{q^\delta -1}\). Thus we have

$$\begin{aligned} \Omega&= \frac{1}{(q-1)(q^\delta -1)^2} \sum _{i,j=0}^{q^\delta -2}\sum _{k=0}^{q-2}G(\overline{\chi _1}^{\Delta _1i})G(\overline{\chi _2}^{\Delta _2j}) G(\overline{\chi '}^k) \nonumber \\&\quad \times \sum _{y \in {\mathbb {F}}_q^*}\chi _1^{\Delta _1i}(ya)\chi _2^{\Delta _2j}(yb)\chi '^k(-yc) \sum _{t=0}^{q^\delta -2}\chi _1^{\Delta _1i}(\alpha _1^t)\chi _2^{\Delta _2j}(\alpha _2^t), \end{aligned}$$
(4.2)

where \(\chi '\) is a generator of \(\widehat{{\mathbb {F}}}_q^*\) defined by \(\chi '(\beta )=\zeta _{q-1}\). Note that \(\chi _1^{\Delta _1i}(\alpha _1)=\zeta _{q^\delta -1}^i\) and \(\chi _2^{\Delta _2i}(\alpha _2)=\zeta _{q^\delta -1}^j\). Then

$$\begin{aligned}&\sum _{t=0}^{q^\delta -2}(\chi _1^{\Delta _1i}(\alpha _1)\chi _2^{\Delta _2j}(\alpha _2))^t =\sum _{t=0}^{q^\delta -2}(\zeta _{q^\delta -1}^{i+j})^t \nonumber \\&\quad = \left\{ \begin{array}{ll} q^\delta -1, &{} \text{ if } i+j \equiv 0 \pmod {q^\delta -1}; \\ 0, &{} \text{ otherwise. } \end{array}\right. \end{aligned}$$
(4.3)

If \(i+j \equiv 0 \pmod {q^\delta -1}\), then by \(0 \le i,j \le q^\delta -2\) we get \(j=q^\delta -1-i\). By (4.2) and (4.3) we have

$$\begin{aligned} \Omega= & {} \frac{1}{(q-1)(q^\delta -1)} \sum _{i=0}^{q^\delta -2}\sum _{k=0}^{q-2}G(\overline{\chi _1}^{\Delta _1i})G(\chi _2^{\Delta _2i}) G(\overline{\chi '}^k) \chi _1^{\Delta _1i}(a)\overline{\chi _2}^{\Delta _2 i}(b)\chi '^k(-c)\nonumber \\&\times \sum _{y \in {\mathbb {F}}_q^*}\chi _1^{\Delta _1i}(y)\overline{\chi _2}^{\Delta _2 i}(y)\chi '^k(y), \end{aligned}$$
(4.4)

We easily see that \(\chi _1^{\Delta _1}(\beta )=\zeta _{q-1}^{\Delta _1}\), \(\chi _2^{\Delta _2}(\beta )=\zeta _{q-1}^{\Delta _2}\), and \(\chi '(\beta )=\zeta _{q-1}\), where \({\mathbb {F}}_q^*=\langle \beta \rangle \). Thus

$$\begin{aligned}&\sum _{y \in {\mathbb {F}}_q^*}\chi _1^{\Delta _1i}(y)\overline{\chi _2}^{\Delta _2i}(y)\chi '^k(y) =\sum _{v=0}^{q-2}\left( \chi _1^{\Delta _1i}(\beta )\overline{\chi _2}^{\Delta _2i}(\beta )\chi '^k(\beta )\right) ^v \\&\quad =\sum _{v=0}^{q-2}\left( \zeta _{q-1}^{\Delta _1i-\Delta _2i+k}\right) ^v=\sum _{v=0}^{q-2}\left( \zeta _{q-1}^{\frac{m_1}{\delta }i-\frac{m_2}{\delta }i+k}\right) ^v \\&\quad =\left\{ \begin{array}{ll} q-1, &{} \text{ if } \frac{m_1-m_2}{\delta }i+k \equiv 0 \pmod {q-1}; \\ 0, &{} \text{ otherwise. } \end{array}\right. \end{aligned}$$

Denote \(S=\{(i,k): \frac{m_1-m_2}{\delta }i+k \equiv 0 \pmod {q-1}, 0 \le i \le q^\delta -2, 0 \le k \le q-2\}\). Then by (4.4) we have

$$\begin{aligned} \Omega = \frac{1}{q^\delta -1} \sum _{(i,k) \in S}G(\overline{\chi _1}^{\Delta _1i})G(\chi _2^{\Delta _2i}) G(\overline{\chi '}^k) \chi _1^{\Delta _1i}(a)\overline{\chi _2}^{\Delta _2 i}(b)\chi '^k(-c) \end{aligned}$$

and

$$\begin{aligned} N(c)=\frac{n}{q}+\frac{1}{q(q^\delta -1)} \sum _{(i,k) \in S}G(\overline{\chi _1}^{\Delta _1i})G(\chi _2^{\Delta _2i}) G(\overline{\chi '}^k) \chi _1^{\Delta _1i}(a)\overline{\chi _2}^{\Delta _2 i}(b)\chi '^k(-c).\qquad \quad \end{aligned}$$
(4.5)

Similarly, for \(a, b \ne 0\), we have

$$\begin{aligned} N(0)=\frac{n}{q}+\frac{1}{q(q^\delta -1)} \sum _{i=0}^{q^\delta -2} G(\overline{\chi _1}^{\Delta _1i})G(\chi _2^{\Delta _2i}) \chi _1^{\Delta _1i}(a)\overline{\chi _2}^{\Delta _2 i}(b)\sum _{y \in {\mathbb {F}}_q^*}\chi _1^{\Delta _1i}(y)\overline{\chi _2}^{\Delta _2i}(y). \end{aligned}$$

It is easy to see that

$$\begin{aligned} \sum _{y \in {\mathbb {F}}_q^*}\chi _1^{\Delta _1i}(y)\overline{\chi _2}^{\Delta _2i}(y) =\left\{ \begin{array}{ll} q-1, &{} \text{ if } \frac{m_1-m_2}{\delta }i \equiv 0 \pmod {q-1}; \\ 0, &{} \text{ otherwise. } \end{array}\right. \end{aligned}$$

Denote \(I=\{i: \frac{m_1-m_2}{\delta }i \equiv 0 \pmod {q-1}, 0 \le i \le q^\delta -2\}\). Then

$$\begin{aligned} N(0)=\frac{n}{q}+\frac{q-1}{q(q^\delta -1)} \sum _{i \in I}G(\overline{\chi _1}^{\Delta _1i})G(\chi _2^{\Delta _2i}) \chi _1^{\Delta _1i}(a)\overline{\chi _2}^{\Delta _2 i}(b).\end{aligned}$$
(4.6)

Moreover, if \(a=0\) or \(b=0\), it is easy to present the exact values of \(N(0)\) and \(N(c)\) by Corollary 3.2. Then by (4.5) and (4.6) we get the following theorem.

Theorem 4.1

  1. (1)

    If \(a=0, b \ne 0\), then

    $$\begin{aligned} N(0)=(q^{m_2-1}-1)\frac{q^{m_1}-1}{q^\delta -1} \text{ and } N(c)=q^{m_2-1}\frac{q^{m_1}-1}{q^\delta -1} \text{ for } c \ne 0. \end{aligned}$$
  2. (2)

    If \(a \ne 0, b=0\), then

    $$\begin{aligned} N(0)=(q^{m_1-1}-1)\frac{q^{m_2}-1}{q^\delta -1} \text{ and } N(c)=q^{m_1-1}\frac{q^{m_2}-1}{q^\delta -1} \text{ for } c \ne 0. \end{aligned}$$
  3. (3)

    If \(a \ne 0, b \ne 0\), then

    $$\begin{aligned} N(0)=\frac{n}{q}+\frac{q-1}{q(q^\delta -1)} \sum _{i \in I}G(\overline{\chi _1}^{\Delta _1i})G(\chi _2^{\Delta _2i}) \chi _1^{\Delta _1i}(a)\overline{\chi _2}^{\Delta _2 i}(b) \end{aligned}$$

    and

    $$\begin{aligned} N(c)=\frac{n}{q}+\frac{1}{q(q^\delta -1)} \sum _{(i,j) \in S}G(\overline{\chi _1}^{\Delta _1i})G(\chi _2^{\Delta _2i}) G(\overline{\chi '}^j) \chi _1^{\Delta _1i}(a)\overline{\chi _2}^{\Delta _2 i}(b)\chi '^j(-c) \end{aligned}$$

    for \(c \ne 0\), where \(I=\{i: \frac{m_1-m_2}{\delta }i \equiv 0 \pmod {q-1}, 0 \le i \le q^\delta -2\}\) and \(S=\{(i,j): \frac{m_1-m_2}{\delta }i+j \equiv 0 \pmod {q-1}, 0 \le i \le q^\delta -2, 0 \le j \le q-2\}\).

It is clear that the complete weight enumerator of the cyclic code \({{\mathcal {C}}}\) involves the values of Gauss sums. Unfortunately, the exact values of Gauss sums remain open in most cases. Below we consider a class of ternary cyclic codes if \(\gcd (m_1, m_2)=1\) and present their explicit complete weight enumerators.

Theorem 4.2

Let the notations be as above, \(q=3\), and \(\gcd (m_1, m_2)=1\).

  1. (1)

    If   \(2 \not \mid (m_1-m_2)\), then the complete weight enumerator of the ternary cyclic code defined by (1.2) is

    $$\begin{aligned}&z_0^{\frac{(3^{m_1}-1)(3^{m_2}-1)}{2}}+ (3^{m_1}-1)z_0^{(3^{m_1-1}-1)\frac{3^{m_2}-1}{2}}z_1^{3^{m_1-1}\frac{3^{m_2}-1}{2}}z_2^{3^{m_1-1}\frac{3^{m_2}-1}{2}} \\&\quad +\,(3^{m_2}-1)z_0^{(3^{m_2-1}-1)\frac{3^{m_1}-1}{2}}z_1^{3^{m_2-1}\frac{3^{m_1}-1}{2}}z_2^{3^{m_2-1}\frac{3^{m_1}-1}{2}} \\&\quad +\, \frac{(3^{m_1}-1)(3^{m_2}-1)}{2}z_0^Az_1^Bz_2^C+\frac{(3^{m_1}-1)(3^{m_2}-1)}{2}z_0^Az_1^Cz_2^B, \end{aligned}$$

    where

    $$\begin{aligned} A= & {} \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}+1}{2},\\ B= & {} \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}-\frac{1}{2} (-3)^{\frac{m_1+m_2-1}{2}},\\ C= & {} \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}+\frac{1}{2} (-3)^{\frac{m_1+m_2-1}{2}}. \end{aligned}$$
  2. (2)

    If   \(2 \mid (m_1-m_2)\), then the complete weight enumerator of the ternary cyclic code defined by (1.2) is

    $$\begin{aligned}&z_0^{\frac{(3^{m_1}-1)(3^{m_2}-1)}{2}}+ (3^{m_1}-1)z_0^{(3^{m_1-1}-1)\frac{3^{m_2}-1}{2}}z_1^{3^{m_1-1}\frac{3^{m_2}-1}{2}}z_2^{3^{m_1-1}\frac{3^{m_2}-1}{2}} \\&\quad +\,(3^{m_2}-1)z_0^{(3^{m_2-1}-1)\frac{3^{m_1}-1}{2}}z_1^{3^{m_2-1}\frac{3^{m_1}-1}{2}}z_2^{3^{m_2-1}\frac{3^{m_1}-1}{2}} \\&\quad +\, \frac{(3^{m_1}-1)(3^{m_2}-1)}{2}z_0^{A-(-3)^{\frac{m_1+m_2-2}{2}}}z_1^Dz_2^D \\&\quad +\,\frac{(3^{m_1}-1)(3^{m_2}-1)}{2}z_0^{A+(-3)^{\frac{m_1+m_2-2}{2}}}z_1^Ez_2^E, \end{aligned}$$

    where

    $$\begin{aligned} D= & {} \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}+\frac{1}{2} (-3)^{\frac{m_1+m_2-2}{2}},\\ E= & {} \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}-\frac{1}{2} (-3)^{\frac{m_1+m_2-2}{2}}. \end{aligned}$$

Proof

If  \(q=3\) and \(\gcd (m_1, m_2)=1\), then \(\mathrm{ord}(\chi _1^{\Delta _1})=\mathrm{ord}(\chi _2^{\Delta _2})=2\). By Lemma 2.1 we have

$$\begin{aligned} G(\chi ')=\sqrt{-3}, G(\chi _1^{\Delta _1})=(-1)^{m_1-1} \sqrt{(-3)^{m_1}}, \text{ and } G(\chi _2^{\Delta _2})=(-1)^{m_2-1} \sqrt{(-3)^{m_2}}. \end{aligned}$$

(1) If  \(2 \not \mid (m_1-m_2)\), then

$$\begin{aligned} I=\{0\} \text{ and } S=\{(0,0), (1,1)\}. \end{aligned}$$

By Theorem 4.1 we have

$$\begin{aligned} N(0)=\frac{n}{3} +\frac{1}{3}=\frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}+1}{2}=A. \end{aligned}$$

Note that \(\chi '(-1)=-1\). Then

$$\begin{aligned} N(1)= & {} \frac{n}{3} +\frac{1}{6}(-1+(-1)^{m_1-1} \sqrt{(-3)^{m_1}}(-1)^{m_2-1} \sqrt{(-3)^{m_2}}\sqrt{-3} \chi _1^{\Delta _1}(a)\overline{\chi _2}^{\Delta _2}(b)(-1)) \\= & {} \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}-\frac{1}{2} (-3)^{\frac{m_1+m_2-1}{2}}\chi _1^{\Delta _1}(a)\overline{\chi _2}^{\Delta _2}(b) \\= & {} \left\{ \begin{array}{ll} \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}-\frac{1}{2} (-3)^{\frac{m_1+m_2-1}{2}}=B, &{} {\mathop { \text{ if } a \in \langle \alpha _1^2 \rangle , b \in \langle \alpha _2^2 \rangle \text{ or } }\limits _{a \in \alpha _1 \langle \alpha _1^2 \rangle , b \in \alpha _2 \langle \alpha _2^2 \rangle ;}} \\ \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}+\frac{1}{2} (-3)^{\frac{m_1+m_2-1}{2}}=C, &{} \text{ otherwise. } \end{array}\right. \end{aligned}$$

It is clear that \(\chi '(-2)=\chi '(1)=1\). Similarly, we have

$$\begin{aligned} N(2)=\left\{ \begin{array}{ll} \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}+\frac{1}{2} (-3)^{\frac{m_1+m_2-1}{2}}=C, &{} {\mathop { \text{ if } a \in \langle \alpha _1^2 \rangle , b \in \langle \alpha _2^2 \rangle \text{ or } }\limits _{a \in \alpha _1 \langle \alpha _1^2 \rangle , b \in \alpha _2 \langle \alpha _2^2 \rangle ;}} \\ \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}-\frac{1}{2} (-3)^{\frac{m_1+m_2-1}{2}}=B, &{} \text{ otherwise. } \end{array}\right. \end{aligned}$$

Then by Theorem 4.1, the complete weight enumerator of the ternary cyclic code defined by (1.2) is

$$\begin{aligned}&z_0^{\frac{(3^{m_1}-1)(3^{m_2}-1)}{2}}+ (3^{m_1}-1)z_0^{(3^{m_1-1}-1)\frac{3^{m_2}-1}{2}}z_1^{3^{m_1-1}\frac{3^{m_2}-1}{2}}z_2^{3^{m_1-1}\frac{3^{m_2}-1}{2}} \\&\quad +\,(3^{m_2}-1)z_0^{(3^{m_2-1}-1)\frac{3^{m_1}-1}{2}}z_1^{3^{m_2-1}\frac{3^{m_1}-1}{2}}z_2^{3^{m_2-1}\frac{3^{m_1}-1}{2}} \\&\quad +\, \frac{(3^{m_1}-1)(3^{m_2}-1)}{2}z_0^Az_1^Bz_2^C+\frac{(3^{m_1}-1)(3^{m_2}-1)}{2}z_0^Az_1^Cz_2^B. \end{aligned}$$

(1) If \(2 \mid (m_1-m_2)\), then

$$\begin{aligned} I=\{0, 1\} \text{ and } S=\{(0,0), (1,0)\}. \end{aligned}$$

By Theorem 4.1 we have

$$\begin{aligned} N(0)= & {} \frac{n}{3} +\frac{1}{3}(1+(-1)^{m_1-1} \sqrt{(-3)^{m_1}}(-1)^{m_2-1} \sqrt{(-3)^{m_2}} \chi _1^{\Delta _1}(a)\overline{\chi _2}^{\Delta _2}(b)) \\= & {} \frac{n}{3}+\frac{1}{3}+\frac{1}{3} (-3)^{\frac{m_1+m_2}{2}}\chi _1^{\Delta _1}(a)\overline{\chi _2}^{\Delta _2}(b) \\= & {} \left\{ \begin{array}{ll} A-(-3)^{\frac{m_1+m_2-2}{2}}, &{} {\mathop { \text{ if } a \in \langle \alpha _1^2 \rangle , b \in \langle \alpha _2^2 \rangle \text{ or } }\limits _{a \in \alpha _1 \langle \alpha _1^2 \rangle , b \in \alpha _2 \langle \alpha _2^2 \rangle ;}} \\ A+(-3)^{\frac{m_1+m_2-2}{2}}, &{} \text{ otherwise. } \end{array}\right. \end{aligned}$$

Similarly, we have

$$\begin{aligned} N(1)=N(2)=\left\{ \begin{array}{ll} \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}+\frac{1}{2} (-3)^{\frac{m_1+m_2-2}{2}}=D, &{} {\mathop { \text{ if } a \in \langle \alpha _1^2 \rangle , b \in \langle \alpha _2^2 \rangle \text{ or } }\limits _{a \in \alpha _1 \langle \alpha _1^2 \rangle , b \in \alpha _2 \langle \alpha _2^2 \rangle ;}} \\ \frac{3^{m_1+m_2-1}-3^{m_1-1}-3^{m_2-1}}{2}-\frac{1}{2} (-3)^{\frac{m_1+m_2-2}{2}}=E, &{} \text{ otherwise. } \end{array}\right. \end{aligned}$$

Then by Theorem 4.1, the complete weight enumerator of the ternary cyclic code defined by (1.2) is

$$\begin{aligned}&z_0^{\frac{(3^{m_1}-1)(3^{m_2}-1)}{2}}+ (3^{m_1}-1)z_0^{(3^{m_1-1}-1)\frac{3^{m_2}-1}{2}}z_1^{3^{m_1-1}\frac{3^{m_2}-1}{2}}z_2^{3^{m_1-1}\frac{3^{m_2}-1}{2}} \\&\quad +\,(3^{m_2}-1)z_0^{(3^{m_2-1}-1)\frac{3^{m_1}-1}{2}}z_1^{3^{m_2-1}\frac{3^{m_1}-1}{2}}z_2^{3^{m_2-1}\frac{3^{m_1}-1}{2}} \\&\quad +\, \frac{(3^{m_1}-1)(3^{m_2}-1)}{2}z_0^{A-(-3)^{\frac{m_1+m_2-2}{2}}}z_1^Dz_2^D \\&\quad +\,\frac{(3^{m_1}-1)(3^{m_2}-1)}{2}z_0^{A+(-3)^{\frac{m_1+m_2-2}{2}}}z_1^Ez_2^E. \end{aligned}$$

This completes the proof. \(\square \)

Example 4.3

  1. (1)

    Let \(q=3\), \(m_1=2\), and \(m_2=3\). Then \(n=104\) and \(2 \not \mid (m_1-m_2)\). Suppose that \(\alpha _1\) and \(\alpha _2\) are two primitive elements of \({\mathbb {F}}_9\) and \({\mathbb {F}}_{27}\), respectively. By Theorem 4.2, the complete weight enumerator of the ternary cyclic code defined by (1.2) is

    $$\begin{aligned} z_0^{104}+8z_0^{26}z_1^{39}z_2^{39}+26z_0^{32}z_1^{36}z_2^{36}+104z_0^{35}z_1^{30}z_2^{39}+104z_0^{35}z_1^{39}z_2^{30}, \end{aligned}$$

    which is consistent with numerical computation by Magma.

  2. (2)

    Let \(q=3\), \(m_1=3\), and \(m_2=5\). Then \(n=3146\) and \(2 \mid (m_1-m_2)\). Suppose that \(\alpha _1\) and \(\alpha _2\) are two primitive elements of \({\mathbb {F}}_{27}\) and \({\mathbb {F}}_{243}\), respectively. By Theorem 4.2, the complete weight enumerator of the ternary cyclic code defined by (1.2) is

    $$\begin{aligned}&z_0^{3146}+26z_0^{968}z_1^{1089}z_2^{1089}+242z_0^{1040}z_1^{1053}z_2^{1053}+3146z_0^{1076}z_1^{1035}z_2^{1035}\\&\qquad +\,3146z_0^{1022}z_1^{1062}z_2^{1062}, \end{aligned}$$

    which is consistent with numerical computation by Magma.

Now we consider a class of cyclic codes over \({\mathbb {F}}_4\) if \(\gcd (m_1, m_2)=1\) and present their explicit complete weight enumerators.

Theorem 4.4

Let the notations be as above, \(q=4\), and \(\gcd (m_1, m_2)=1\).

  1. (1)

    If \(3 \not \mid (m_1-m_2)\), then the complete weight enumerator of the ternary cyclic code defined by (1.2) is

    $$\begin{aligned}&z_0^{\frac{(4^{m_1}-1)(4^{m_2}-1)}{3}}+ (4^{m_1}-1)z_0^{(4^{m_1-1}-1)\frac{4^{m_2}-1}{3}}z_1^{4^{m_1-1}\frac{4^{m_2}-1}{3}}z_2^{4^{m_1-1} \frac{4^{m_2}-1}{3}}z_3^{4^{m_1-1}\frac{4^{m_2}-1}{3}} \\&\quad +\,(4^{m_2}-1)z_0^{(4^{m_2-1}-1)\frac{4^{m_1}-1}{3}}z_1^{4^{m_2-1}\frac{4^{m_1}-1}{3}} z_2^{4^{m_2-1}\frac{4^{m_1}-1}{3}}z_3^{4^{m_2-1}\frac{4^{m_1}-1}{3}} \\&\quad +\, \frac{(4^{m_1}-1)(4^{m_2}-1)}{3}z_0^Az_1^Bz_2^Cz_3^C+\frac{(4^{m_1}-1)(4^{m_2}-1)}{3}z_0^Az_1^Cz_2^Bz_3^C \\&\quad +\,\frac{(4^{m_1}-1)(4^{m_2}-1)}{3}z_0^Az_1^Cz_2^Cz_3^B, \end{aligned}$$

    where

    $$\begin{aligned} A= & {} \frac{4^{m_1+m_2-1}-4^{m_1-1}-4^{m_2-1}+1}{3},\\ B= & {} \frac{4^{m_1+m_2-1}-4^{m_1-1}-4^{m_2-1}}{3}+\frac{(-2)^{m_1+m_2}}{3},\\ C= & {} \frac{4^{m_1+m_2-1}-4^{m_1-1}-4^{m_2-1}}{3}+\frac{(-2)^{m_1+m_2-1}}{3}. \end{aligned}$$
  2. (2)

    If \(3 \mid (m_1-m_2)\), then the complete weight enumerator of the ternary cyclic code defined by (1.2) is

    $$\begin{aligned}&z_0^{\frac{(4^{m_1}-1)(4^{m_2}-1)}{3}}+ (4^{m_1}-1)z_0^{(4^{m_1-1}-1)\frac{4^{m_2}-1}{3}}z_1^{4^{m_1-1}\frac{4^{m_2}-1}{3}}z_2^{4^{m_1-1} \frac{4^{m_2}-1}{3}}z_3^{4^{m_1-1}\frac{4^{m_2}-1}{3}} \\&\quad +\,(4^{m_2}-1)z_0^{(4^{m_2-1}-1)\frac{4^{m_1}-1}{3}}z_1^{4^{m_2-1}\frac{4^{m_1}-1}{3}} z_2^{4^{m_2-1}\frac{4^{m_1}-1}{3}}z_3^{4^{m_2-1}\frac{4^{m_1}-1}{3}} \\&\quad +\, \frac{(4^{m_1}-1)(4^{m_2}-1)}{3}z_0^{A-(-2)^{m_1+m_2-1}}z_1^Dz_2^Dz_3^D\\&\quad +\,\frac{2(4^{m_1}-1)(4^{m_2}-1)}{3}z_0^{A-(-2)^{m_1+m_2-2}}z_1^Ez_2^Ez_3^E, \end{aligned}$$

    where

    $$\begin{aligned} D= & {} \frac{4^{m_1+m_2-1}-4^{m_1-1}-4^{m_2-1}}{3}+\frac{(-2)^{m_1+m_2-1}}{3},\\ E= & {} \frac{4^{m_1+m_2-1}-4^{m_1-1}-4^{m_2-1}}{3}+\frac{(-2)^{m_1+m_2-2}}{3}. \end{aligned}$$

Proof

It is very similar to the proof of Theorem 4.2. By Lemma 2.2, we can get the desired conclusions. \(\square \)

Example 4.5

  1. (1)

    Let \(q=4\), \(m_1=2\), and \(m_2=3\). Then \(n=315\) and \(3 \not \mid (m_1-m_2)\). Suppose that \(\alpha _1\) and \(\alpha _2\) are two primitive elements of \({\mathbb {F}}_{16}\) and \({\mathbb {F}}_{64}\), respectively. By Theorem 4.4, the complete weight enumerator of the cyclic code over \({\mathbb {F}}_4\) defined by (1.2) is

    $$\begin{aligned}&z_0^{315}+15z_0^{63}z_1^{84}z_2^{84}z_3^{84}+63z_0^{75}z_1^{80}z_2^{80}z_3^{80}+315z_0^{79}z_1^{68}z_2^{84}z_3^{84} \\&\quad +\,315z_0^{79}z_1^{84}z_2^{68}z_3^{84}+315z_0^{79}z_1^{84}z_2^{84}z_3^{68}, \end{aligned}$$

    which is consistent with numerical computation by Magma.

  2. (2)

    Let \(q=4\), \(m_1=2\), and \(m_2=5\). Then \(n=5115\) and \(3 \mid (m_1-m_2)\). Suppose that \(\alpha _1\) and \(\alpha _2\) are two primitive elements of \({\mathbb {F}}_{16}\) and \({\mathbb {F}}_{4^5}\), respectively. By Theorem 4.4, the complete weight enumerator of the cyclic code over \({\mathbb {F}}_4\) defined by (1.2) is

    $$\begin{aligned}&z_0^{5115}+15z_0^{1023}z_1^{1364}z_2^{1364}z_3^{1364}+1023z_0^{1275}z_1^{1280}z_2^{1280}z_3^{1280} \\&\quad +\,5115z_0^{1215}z_1^{1300}z_2^{1300}z_3^{1300}+10230z_0^{1311}z_1^{1268}z_2^{1268}z_3^{1268}, \end{aligned}$$

    which is consistent with numerical computation by Magma.

5 Concluding remarks

In this paper, we used Gauss sums to study the complete weight enumerators of irreducible cyclic codes and a class of cyclic codes from two distinct finite fields. The general formulas which involve Gauss sums were presented. Moreover, the explicit complete weight enumerators of some cyclic codes were given by using the known Gauss sums. In fact, by MacWilliams theorem for complete weight enumerators [24], we can get the complete weight enumerators of their dual codes.

The Hamming weight enumerators of cyclic codes have been extensively investigated by using Gauss periods and quadratic forms [11, 13, 26]. Based on these mathematical tools, we would like to determine the complete weight enumerators of more cyclic codes.