Weight distribution of cyclic codes defined by quadratic forms and related curves

We consider cyclic codes $\mathcal{C}_\mathcal{L}$ associated to quadratic trace forms in $m$ variables $Q_R(x) = \operatorname{Tr}_{q^m/q}(xR(x))$ determined by a family $\mathcal{L}$ of $q$-linearized polynomials $R$ over $\mathbb{F}_{q^m}$, and three related codes $\mathcal{C}_{\mathcal{L},0}$, $\mathcal{C}_{\mathcal{L},1}$ and $\mathcal{C}_{\mathcal{L},2}$. We describe the spectra for all these codes when $\mathcal{L}$ is an even rank family, in terms of the distribution of ranks of the forms $Q_R$ in the family $\mathcal{L}$, and we also compute the complete weight enumerator for $\mathcal{C}_\mathcal{L}$. In particular, considering the family $\mathcal{L} = \langle x^{q^\ell} \rangle$, with $\ell$ fixed in $\mathbb{N}$, we give the weight distribution of four parametrized families of cyclic codes $\mathcal{C}_\ell$, $\mathcal{C}_{\ell,0}$, $\mathcal{C}_{\ell,1}$ and $\mathcal{C}_{\ell,2}$ over $\mathbb{F}_q$ with zeros $\{ \alpha^{-(q^\ell+1)} \}$, $\{ 1,\, \alpha^{-(q^\ell+1)} \}$, $\{ \alpha^{-1},\,\alpha^{-(q^\ell+1)} \}$ and $\{ 1,\,\alpha^{-1},\,\alpha^{-(q^\ell+1)}\}$ respectively, where $q = p^s$ with $p$ prime, $\alpha$ is a generator of $\mathbb{F}_{q^m}^*$ and $m/(m,\ell)$ is even. Finally, we give simple necessary and sufficient conditions for Artin-Schreier curves $y^p-y = xR(x) + \beta x$, $p$ prime, associated to polynomials $R \in \mathcal{L}$ to be optimal. We then obtain several maximal and minimal such curves in the case $\mathcal{L} = \langle x^{p^\ell}\rangle$ and $\mathcal{L} = \langle x^{p^\ell}, x^{p^{3\ell}} \rangle$.


Introduction
Let q = p s , with p prime. A linear code C of length n over F q is a subspace of F n q of dimension k. If C has minimal distance d = min{d(c, c ′ ) : c, c ′ ∈ C, c = c ′ }, where d(·, ·) is the Hamming distance in F n q , then C is called an [n, k, d]-code. One of the most important families of codes are the cyclic ones. A code is cyclic if given a codeword c = (c 1 , . . . , c n ) ∈ C the cyclic shift s(c) = (c n , c 1 , . . . , c n−1 ) is also in C. The weight of c ∈ C is w(c) = #{0 ≤ i ≤ n : c i = 0}; that is, the number of non-zero coordinates of c. For 0 ≤ i ≤ n the numbers A i = #{c ∈ C : w(c) = i} are called the frequencies and the sequence Spec(C) = (A 0 , A 1 , . . . , A n ) is called the weight distribution or the spectrum of C. A good reference for general coding theory is the book [7].
Fix α a generator of F * q m . Consider h(x) = h 1 (x) · · · h t (x) ∈ F q [x] where h j (x) are different irreducible polynomials over F q . For each j = 1, . . . , t, let g j = α −s j be a root of h j (x), n j be the order of g j and m j be the minimum positive integer such that q m j ≡ 1 (mod n j ). Then, deg(h j (x)) = m j for all j. Put n = q m −1 δ where δ = gcd(q m − 1, s 1 , . . . , s t ). Then, by Delsarte's Theorem of trace and duals ( [2]), the q-ary code C = {c(a 1 , . . . , a t ) : a j ∈ F q m j } with Tr q m j /q (a j ), Tr q m j /q (a j g j ), . . . , Tr q m j /q (a j g n−1 where Tr q m j /q is the trace function from F q m j to F q , is an [n, k]-cyclic code with check polynomial h(x) and dimension k = m 1 + · · · + m t .
The computation of the spectra of cyclic codes is in general a difficult task. The recent survey [3] of Dinh, Li and Yue shows the progress made on this problem in the last 20 years using different techniques: exponential sums, special nonlinear functions over finite fields, quadratic forms, Hermitian forms graphs, Cayley graphs, Gauss and Kloosterman sums. In [5], Feng and Luo computed the weight distribution of the cyclic code of length n = p m −1 with zeros {α −1 , α −(p ℓ +1) }, where α is a generator of F * p m , ℓ ≥ 0 and m/(m, ℓ) odd, by using a perfect nonlinear function. In another work ( [4]), they used quadratic forms to calculate the weight distribution of the cyclic codes with zeros {α −2 , α −(p ℓ +1) } and {α −1 , α −2 , α −(p ℓ +1) }, respectively, when p is an odd prime and (m, ℓ) = 1. These methods were used by other authors to calculate the spectra of other cyclic codes over F p when p is an odd prime. All these results are summarized in Theorem 2.4 in [3].
We now give a brief summary of the results in the paper. In Section 2 we recall quadratic forms Q in m variables over finite fields and their absolute invariants: the rank and the type. We define certain exponential sums S Q,b (β) and compute their values and distributions (Lemma 2.2). We then consider the particular quadratic form Q γ,ℓ (x) = Tr q m /q (γx q ℓ +1 ), with γ ∈ F q , ℓ ∈ N. We recall the distribution of rank and types given by Klapper in [8] and [9]. These facts will be later used (Sections [3][4][5] to compute the spectra of some families of cyclic codes.
In the next section, we consider cyclic codes defined by general quadratics forms determined by q-linearized polynomials and compute their spectra in some cases. More precisely, we consider , the associated code C L = {(Tr q m /q (xR(x))) x∈F * q m : R ∈ L} and three related codes C L,0 , C L,1 and C L,2 (see (3.2)). If L is an even rank family (see Definition 3.1) we give the weight distributions of C L , C L,0 , C L,1 and C L,2 (see Theorems 3.3 and 3.4 and Tables 1 to 4). In Proposition 3.7, we also give the complete weight enumerator of C L .
In the next sections we consider two particular even rank families: L = x q ℓ and L = x q ℓ , x q 3ℓ , with ℓ ∈ N. In Section 4, we compute the spectrum of the code C ℓ defined by the family of quadratic forms Q γ,ℓ = Tr q m /q (γx q ℓ +1 ), γ ∈ F q m , and the spectra of the related codes C ℓ,0 , C ℓ,1 and C ℓ,2 (see Theorems 4.1 and 4.4 and Tables 5-8). As a consequence, C ℓ turns out to be a 2-weight code. The complete weight enumerator of C ℓ is given in Corollary 4.2. In Section 5 we obtain similar results for the codes C ℓ,3ℓ , C ℓ,3ℓ,0 , C ℓ,3ℓ,1 and C ℓ,3ℓ,2 (see Theorem 5.2 and Tables 9 and 10).
In the last section, we consider Artin-Schreier curves of the form where p is prime, β ∈ F p m and R is a p-linearized polynomial over F p m . In Proposition 6.1 we give simple necessary and sufficient conditions for these curves to be optimal, that is curves attaining the equality in the Hasse-Weil bound, in terms of the degree of R and the rank r of the associated quadratic form Q R (x) = Tr p m /p (xR(x)). We then show in Theorem 6.3 that there are several maximal and minimal curves in the family In the binary case p = 2, Van der Geer and Van der Vlugt have found the same curves for ℓ = 1 and β = 0 (see [12]). Thus, we extend their result for any p, ℓ and β. We also show the existence of optimal curves of the form

Quadratic forms over finite fields and exponential sums
A quadratic form in F q m is an homogeneous polynomial q(x) in F q m [x] of degree 2. We want to consider more general functions. Any function Q : F q m → F q can be identified with a polynomial of m variables over F q via an isomorphism F q m ≃ F m q of F q -vector spaces. Such Q is said to be a quadratic form if the corresponding polynomial is homogeneous of degree 2. The rank of Q, is the minimum number r of variables needed to represent Q as a polynomial in several variables. Alternatively, the rank of Q can be computed as the codimension of the F q -vector space Fix Q a quadratic form from F q m to F q . It will be convenient to consider, for each β ∈ F q m and ξ ∈ F q , the number It is a classic result that quadratic forms over finite fields are classified in three different equivalent classes. This classification depends on the parity of the characteristic (see for instance [10]). But in both characteristics (even or odd), there are 2 classes with even rank (usually called type 1 and 3) and one of odd rank. For even rank, we will use the notation and call this sign the type of Q. The number N Q (ξ) does not depend on the characteristic and it is given by where ν(0) = q − 1 and ν(z) = 1 if z ∈ F * q (see [10]). From the works [8], [9] of Klapper we also know the distribution of these numbers N Q,β (ξ), which are given as follows.
Lemma 2.1. Let Q be a quadratic form of m variables over F q of even rank r. Then, for all ξ ∈ F q , there are q m − q r elements β ∈ F q m such that N Q,β (ξ) = q m−1 and q r−1 + ε Q ν(c) q Given a quadratic form Q, we can define the exponential sums Tr q/p( a(Q(x)+Tr q m /q (βx)+b)) p where ζ p = e 2πi p and put S Q (β) = S Q,0 (β). We now give the values of S Q,b (β) and their distributions.
Lemma 2.2. Let Q(x) be a quadratic form over F q of even rank r. Then, The result now follows from Lemma 2.1.
The quadratic form Tr q m /q (γx q ℓ +1 ). A whole family of quadratic forms over F q in m variables are given by where R(x) is a q-linearized polynomial over F q . We are interested in the simplest case, when (2.6) Q γ,ℓ (x) = Tr q m /q (γx q ℓ +1 ).
The next theorems, due to Klapper, give the distribution of ranks and types of the family of quadratics forms {Q γ,ℓ (x) = Tr q m /q (γx q ℓ +1 ) : γ ∈ F q m , ℓ ∈ N}.
For q odd, consider the following sets of integers Theorem 2.4 (odd characteristic ([9])). Let q be a power of an odd prime p and let m, ℓ be non negative integers. Put γ = α t with α a primitive element in F q m . Then, we have: (a) If ε ℓ = 1 and t ∈ X q,m (ℓ) then Q γ,ℓ is of type −1 and has rank m − 2(m, ℓ). (b) If ε ℓ = 1 and t / ∈ X q,m (ℓ) then Q γ,ℓ is of type 1 and has rank m. (c) If m ℓ is even, ε ℓ = −1 and t ∈ Y q,m (ℓ) then Q γ,ℓ is of type 1 and has rank m − 2(m, ℓ). (d) If m ℓ is even, ε ℓ = −1 and t / ∈ Y q,m (ℓ) then Q γ,ℓ is of type −1 and has rank m.
We will need the following result whose proof is elementary.

Weight distribution of cyclic codes defined by trace forms
for some non-negative integers ℓ 1 , . . . , ℓ s with ℓ i = ℓ j for i = j. Define the q-ary code : R ∈ L ⊂ F n q with length n = q m − 1 and the related codes All of these codes are cyclic since one can check that their words have the form (1.1). In our case, this can be seen directly. If α is a primitive element of F q m then The cyclic shift s( is in C L and the code is cyclic. Similarly for the other codes. of q-linearized polynomials has the even rank property or is an even rank family if the quadratic form Q R (x) = Tr q m /q (xR(x)) has even rank for any R ∈ L.
Let L be an even rank family of q-linearized polynomials. Then, Q R (x) = Tr q/p (xR(x)) has constant type in the family; that is Q R (x) is of type 1 or of type −1 for every R ∈ L. Therefore, given r a non-negative integer, we can define We have K 0 = {0} and K r = K r,1 ⊔ K r,2 for r > 0, and we denote their cardinalities by Note that M 0 = 1 and M r = M r,1 + M r,2 for r > 0. Finally, we denote the set of ranks in L by For any positive integer r, we define the set We now restate Lemma 2.1 in [14] in more generality and give a proof for completness. We will need it to calculate the dimensions of the four families of codes considered in this section.

Lemma 3.2. Let m be a positive even integer and let
Proof. For (a) it is enough to show that q s (q ℓ 1 + 1) ≡ q ℓ 2 + 1 (mod q m − 1) and q s ≡ q ℓ + 1 (mod q m − 1) for 1 ≤ s ≤ m − 1 and ℓ, ℓ 1 , ℓ 2 < m 2 with ℓ 1 = ℓ 2 . We will show the first statement. Suppose that there is some s ∈ {1, . . . , m} such that q s (q ℓ 1 + 1) ≡ q ℓ 2 + 1 (mod q m − 1). Then, If s + ℓ 1 < m then q s+ℓ 1 + q s = q ℓ 2 + 1 as integers. The uniqueness of the q-ary expansion of integers implies that s + ℓ 1 = ℓ 2 and s = 0, which cannot happen. Now, if s + ℓ 1 > m then s > m 2 since by hypothesis ℓ 1 < m 2 , and hence there exists a positive integer t < m 2 such that s = m − t. Notice that ℓ 1 > t and 0 < ℓ 1 − t < m 2 , thus q s+ℓ 1 + q s ≡ q ℓ 1 −t + q s (mod q m − 1) and hence Since all the powers are less than m, we obtain q ℓ 1 −t + q s = q ℓ 2 + 1 as integers, by unicity of q-ary expansion we obtain that s = ℓ 2 and ℓ 1 − t = 0 which cannot occur. Therefore, In a similar way, it can be shown that α −1 and α −u are not conjugated for all u ∈ [ m 2 ] q . The item (b) can be proved by a similar argument as in (a).
We are now in a position to give the weight distribution of the four codes considered. We give the spectra in two theorems. Theorem 3.3. Let q be a prime power, m a non-negative integer and L = x q ℓ 1 , x q ℓ 2 , . . . , x q ℓs an ideal in F q m [x] such that 1 ≤ ℓ 1 < ℓ 2 < · · · < ℓ s < m 2 . If L is an even rank family then the dimensions of the cyclic codes C L and C L,0 are ms and ms + 1 respectively and their spectra are given by Tables 1 and 2 below.
If Q R has rank r and type ε R then From these facts, using the numbers M r , M r i and the set R L , we obtain the weights and frequencies given in Tables 1 and 2, and the result thus follows.
Let us consider the polynomials h(x) = s j=1 h ℓ j (x),where h ℓ j (x) are the minimal polynomials of α −(q ℓ j +1) over F q with α a primitive element of F q m and j = 1, . . . , s. By Delsarte's Theorem, if n = q m −1 δ with δ = gcd(q m − 1, q ℓ 1 + 1, . . . , q ℓs + 1) then h(x) is the check polynomial of the cyclic code Since the dimension of a cyclic code is given by the degree of its check polynomial, we have dim C * L = deg h(x) It is known, by general theory of finite fields, that the degree of the minimal polynomial over F q of an element u ∈ F q is given by the size of its cyclotomic coset, and this size coincides with the minimum 1 ≤ m u ≤ m such that q mu u ≡ u (mod q m − 1). By Lemma 3.2, all of the elements in L are not conjugated to each other and deg h ℓ j (x) = m for j = 1, . . . , s. Hence deg h(x) = sm and thus dim C * L = sm. On the other hand, if R(x) = s j=1 a j x q ℓ j ∈ L, by linearity of the trace function we have that Tr q m /q (a j α i(q ℓ j +1) ) Tr q m /q (a j g i j ) Notice that if n = q m −1 δ as before, by modularity we get Tr q m /q (a j g i j )) tn i=(t−1)n+1 for every 1 ≤ t ≤ δ. Thus, denoting c = c(a 1 , . . . , a s ) ∈ C L , by (3.8) we have that c R = c | · · · | c δ-times. Hence all the words in C L are obtained by δ-concatenation of the words of the cyclic code C * L , this implies that the dimension of these codes are the same. Therefore dim C L = dim C * L = sm. The same argument shows that dim C L,0 = sm + 1.
Theorem 3.4. Let q be a prime power, m a non-negative integer and L = x q ℓ 1 , x q ℓ 2 , . . . , x q ℓs an ideal in F q m [x] such that 1 ≤ ℓ 1 < ℓ 2 < · · · < ℓ s < m 2 . If L is an even rank family, then the dimensions of the cyclic codes C L,1 and C L,2 are m(s + 1) and m(s + 1) + 1 respectively and their spectra are given by Tables 3 and 4 below. Table 3. Weight distribution of C L,1 (r ∈ R L , i = 1, 2).
Proof. The dimensions of C L,1 and C L,2 can be obtained in the same way as in Theorem 3.3 using Lemma 3.2. Now, let R ∈ L and suppose the quadratic form Q R has rank r and type ε R . Let's see the weights of the words of C L,1 . By the orthogonality property of the characters of F q , we have that , where S Q R is the exponential sum (2.4), with b = 0. In the same way, when b = 0, we get . Notice that if R = 0, then Q R = 0 and, for all β = 0, we have w(c 0 (β)) = q m − q m−1 . If R and β are zeros, then w(c 0,b (0)) = q m − 1 if b = 0. When b = 0 we will denote c R (β) = c R,0 (β). Now, let K r,1 and K r,2 be as in (3.3).
The complete weight enumerator of C is the polynomial Lemma 3.6. Let C be a linear code of length n over F q such that t i (c) = t j (c) for all i, j > 0 and c ∈ C. Then, if A ℓ = #{c ∈ C : w(c) = ℓ}, we have that Proof. Let c = (c 0 , . . . , c n−1 ) ∈ C. Since t i (c) = t j (c) for i, j > 0 and q−1 i=0 t i = n, we have that t i = n−t 0 q−1 . On the other hand, since w(c) = n − #{0 ≤ j ≤ n − 1 : c j = 0} = n − t 0 , we have that t 0 = n − w(c), and thus t 1 = w(c) q−1 (note that C has to be necessarily (q − 1)-divisible). Therefore, we have that A(t 0 , . . . , t q−1 ) = A w(c) if t 0 = n − w(c) for some c ∈ C and t i = t j for all i, j > 0, and A(t 0 , . . . , t q−1 ) = 0 otherwise.
As a direct consequence of the lemma, we obtain the complete weight enumerator of C L .
Proposition 3.7. Let q be a prime power, m a non-negative integer and L = x q ℓ 1 , x q ℓ 2 , . . . , x q ℓs an ideal in F q m [x] such that 1 ≤ ℓ 1 < ℓ 2 < · · · < ℓ s < m 2 . If L is an even rank family then the complete weight enumerator of C L is given by where M r,i and R L are as in (3.4) and (3.5) and

The codes associated to x q ℓ +1
Here, we consider the codes C L , C L,0 , C L,1 and C L,2 from the previous section but in the particular case of L = x qℓ , that we denote by C ℓ , C ℓ,0 , C ℓ,1 and C ℓ,2 . We will compute the spectra of these codes using Theorems 3.3 and 3.4 and Tables 1-4, but we explicitly compute the rank distribution in L and their associated numbers M r,i .
The codes C ℓ and C ℓ,0 . Consider the irreducible cyclic code C ℓ and the code C ℓ,0 over F q , with check polynomial h ℓ (x) and h ℓ (x)(x − 1), respectively, where h ℓ is the minimal polynomial of α −(q ℓ +1) , with α a primitive element. By Delsarte's Theorem these codes can be described by Note that c 0 (γ) = c(γ) and that C ℓ ⊂ C ℓ,0 . Now we give the parameters and the spectra of these codes.
if 1 2 m ℓ odd. The weight distributions of C ℓ and C ℓ,0 are given by Tables 5 and 6 below.
Proof. Let us begin by computing the length n of these codes. Since m ℓ is even, by Lemma 2.5 we have that n = q m −1 q (m,ℓ) +1 . Thus q (m,ℓ) + 1 | q m − 1 and by Lemma 2.6 we have n = M or n = M 1 = M 2 in even or odd characteristic respectively, where M , M 1 and M 2 are the cardinalities of the sets S q,m (ℓ), X q,m (ℓ) and Y q,m (ℓ) defined in (2.7) and (2.8). Notice that in this case q m − 1 − M = nq (m,ℓ) in even characteristic and Notice that the codes C L ℓ and C L ℓ ,0 as in (3.1), are obtained from (q m − 1, q ℓ + 1)-copies of the codes C ℓ and C ℓ,0 in (4.1), respectively. In terms of weights, this mean that .    9,37] respectively, with weight enumerators given by W C ℓ (x) = 1 + 170x 120 + 85x 144 and W C ℓ,0 (x) = 1 + 85x 37 + 170x 40 + 170x 45 + 85x 48 + x 85 .

By
The codes C ℓ,1 and C ℓ,2 . Consider the codes C ℓ,1 and C ℓ,2 over F q , with check polynomials h ℓ (x)h 1 (x) and h ℓ (x)h 1 (x)(x − 1), respectively. Here, h ℓ and h 1 (x) are the minimal polynomials of α −(q ℓ +1) and α −1 respectively, where α is a primitive element of F q m . By Delsarte's Theorem, these codes are given by As before, for m, ℓ positive integers such that m/(m, ℓ) even we denote n = q m −1 q (m,ℓ) +1 . We now give the parameters and the spectra of these codes.
Theorem 4.4. Let q be a prime power and m, ℓ positive integers such that m ℓ is even. Then, The weight distributions of the codes C ℓ,1 and C ℓ,2 are given by Tables 7 and 8 below.     Table 8. Weight distribution of C ℓ,2 . Proof. Note that C ℓ,1 = C L ℓ ,1 and C ℓ,2 = C L ℓ ,2 with L ℓ = x q ℓ where C L ℓ ,1 , C L ℓ ,2 are the codes defined in (3.2). Then, by Theorem 3.4, it is enough to compute the numbers M r,1 , M r,2 and the set R L ℓ . They have been calculated in the proof of the Theorem 4.1. Therefore, the Tables 7 and  8 give us the spectra of the codes C ℓ,1 and C ℓ,2 as we wanted. Remark 4.6. (i) From Tables 5-8 we see that C ℓ is a 2-weight code, C ℓ,0 and C ℓ,1 are 5-weight codes and C ℓ,2 is an 11-weight code. Also, one checks that C ℓ is q (ii) In the binary case (i.e. q = 2), the codes C L,0 and C L,2 have symmetric spectrum, that is A i = A n−i for every i, since the word 11 · · · 11 is in these codes (there is a weight w = n).
Remark 4.7. It can be shown, via Pless power moments, that if q = 2 and (m, ℓ) = 1 the dual code of C ℓ,1 is optimal in the sense that its minimal distance is maximum in the class of cyclic codes with generator polynomial m α (x)m α t (x) over F 2 . This condition of optimality is equivalent to the function f (x) = x t defined over F 2 m being an APN function (see [1]). In our case, f ℓ (x) = x 2 ℓ +1 with (m, ℓ) = 1, is a well-known APN function, namely the Kasami-Gold function.

Codes associated to L ℓ,3ℓ
In this section we consider the codes C L , C L,0 , C L,1 and C L,2 associated to the family of plinearized polynomials where p is an odd prime and m ℓ = m/(m, ℓ) even. The next theorem summarizes, in our notation, the results proved in [13]. Theorem 5.1 ([13]). Let p be an odd prime and let m, ℓ be non-negative integers such that m ℓ = m/(m, ℓ) is even with m > 6ℓ and denote δ = (m, ℓ). Then, L ℓ,3ℓ is an even rank family with R L ℓ,3ℓ = {m, m − 2δ, m − 4δ, m − 6δ} (see (3.5)). Moreover, the numbers M r,i , as defined in (3.4), have the following expressions: In [13], the distribution of ranks and types given in the previous theorem was used to calculate the spectra of the codes C L and C L,1 with L = L ℓ,3ℓ . Fortunately, this information is enough to calculate the spectra of C L,0 and C L,2 also, which follows directly from Theorems 3.3, 3.4 and 5.1.
The weight distributions of the codes C L ℓ,3ℓ ,0 and C L ℓ,3ℓ ,2 are given by Tables 9 and 10 below.
Remark 5.3. The weight distributions of C L ℓ,3ℓ and C L ℓ,3ℓ ,1 are determined by those of C L ℓ,3ℓ ,0 and C L ℓ,3ℓ ,2 , respectively. More precisely, the weight distribution of C L ℓ,3ℓ is given by the first 5 rows of Table 9, and the spectrum of C L ℓ,3ℓ ,1 is given by the first 10 rows of Table 10. Therefore, C L ℓ,3ℓ is a 4-weight code, C L ℓ,3ℓ ,0 and C L ℓ,3ℓ ,1 are 9-weight codes and C L ℓ,3ℓ ,2 is a 19-weight code.
As a direct consequence of Proposition 3.7 we obtain the following.
Corollary 5.4. Under the hypothesis of Theorem 5.2, the complete weight enumerator of C L ℓ,3ℓ is given by where, for each i = 0, . . . , 3, the numbers F i are given in (5.1) and Proof. By the previous remark, the weight enumerator of C is Thus, by Proposition 3.7, we have W C (z 0 , z 1 , . . . , z p−1 ) = z p m −1 From these identities and (5.2) we get the desired expressions for a i and b i , and thus the result follows.

Optimal curves
Fix q = p m with p prime. In this section we will consider Artin-Schreier curves of the form where R(x) is any p-linearized polynomial over F q and β ∈ F q . A good treatment of Artin-Schreier curves can be found in Chapter 3 by Gneri-zbudak in [6]. They are associated to the codes C L, * studied in Sections 3-5 which are defined by quadratic forms Q R (x) = Tr p m /p (xR(x)), or similar ones, of Section 2. Given a family L of p-linearized polynomials, we define the family of curves C R,β as in (6.1).
We begin by showing necessary and sufficient conditions for the family L to contain optimal curves (maximal or minimal); that is, curves attaining equality in the Hasse-Weil bound (see Theorem 5.2.3 in [11]) Proposition 6.1. Assume L is an even rank family of p-linearized polynomials over F p m . Let R ∈ L and let r be the rank of the quadratic form Q R (x) = Tr p m /p (xR(x)) and v = v p (deg R) be the p-adic value of deg R. Then, the family Γ L in (6.2) contains optimal curves, both maximal and minimal, if and only if there is some R ∈ L with v = m−r 2 . In this case we have: (i) If p is odd, the curve C R,β ∈ Γ L is maximal (resp. minimal) if and only if the codeword c R (β) = (Tr p m /p (xR(x) + βx)) x∈F * p m in C L,1 has weight w(c R (β)) = w 2,1 (resp. w 2,2 ) as in Table 3.
Proof. Consider the cyclic code C L,1 = {c R (β) = (Tr p m /p (xR(x) + βx)) x∈F * p m : R ∈ L, β ∈ F p m } as in (3.2). The weight of the codeword c R (β) is related to the number of F p m -rational points of the curve C R,β given in (6.1). In fact, by Hilbert's Theorem 90 we have Tr p m /p (xR(x) + βx) = 0 ⇔ y p − y = xR(x) + βx for some y ∈ F p m .
To find maximal or minimal curves we need to ensure equality in the above inequalities; that is, by (6.3) and (6.4) we want that p m+1 − p w(c R (β)) = p m ± (p − 1)p v+ m 2 , where the sign + (resp. −) corresponds to a maximal (resp. minimal) curve. Looking at Table 3 with q = p, we check that this could only happen if and only if v = m−r 2 and the weight w(c R (β)) is w 2,1 (resp. w 2,2 ) for a maximal (resp. minimal) curve. Because of the presence of the factors p−1 in the weights, additional curves appear in the case p = 2. They correspond to w(c R (β)) = w 3,2 (resp. w 3,1 ) for a maximal (resp. minimal) curve. Since the type of the quadratic form is fixed, only one of the two kind of maximal (or minimal) curves can appear if p = 2.
We begin by computing the F p m -rational points of the curves in the first family {C γ,β }. Proposition 6.2. Let m and ℓ be positive integers such that m ℓ is even and let p a prime number. Consider the curve C γ,β as in (6.5) with γ ∈ F * p m and β ∈ F p m . Fix γ = α t and put ε ℓ = (−1) is maximal in F 3 8 = F 6561 and minimal in F 3 10 = F 59049 for at least one γ 1 , γ 2 , β in the corresponding field. Similarly, y 5 − y = γ 1 x 125 + γ 2 x 6 + βx is maximal in F 5 8 = F 390625 and minimal in F 5 10 = F 9765625 for some elements γ 1 , γ 2 , β in the ground field.