Counting generalized Reed-Solomon codes

In this article we count the number of [ n, k ] generalized Reed–Solomon (GRS) codes, including the codes coming from a non-degenerate conic plus nucleus. We compare our results with known formulae for the number of [ n, 3] MDS codes with n = 6 , 7 , 8 , 9.

GRS code over F q of length n ≤ q + 1 and dimension k is defined by some generator matrix, the columns of which are a set of n distinct points on a normal rational curve of degree k − 1 in P k−1 (F q ), the projective space of dimension k − 1 over F q . If q is a power of two, we define a GRS code of dimension 3 and length q + 2 by a generator matrix, the columns of which are a set of q + 2 distinct points on a non-degenerate conic plus its nucleus. For a definition of the nucleus of a conic, see [17,Def. 1.28] or [12] for more general ways to construct nuclei algebraically. Thus the dual of the GRS [q + 2, 3] code is MDS with parameters [n, k] = [q + 2, q − 1], and also considered to be of GRS type.
Since the GRS type is preserved under duality, codes and their duals are paired. Hence the number of codes of GRS type for [n, k] is the same for the dual parameters [n, n − k]. For dimensions k = 1 and k = n − 1 it is easy to see that any MDS code is a GRS code and that the number of such codes equals (q − 1) n−1 : for k = 1 the code is generated by a general vector of all non-zeros with first entry 1. For k = n − 1 the code is the dual of that code. For other values of k the number of [n, k] GRS codes appears not to be known, so in this paper we address this question and prove that for 4 ≤ k + 2 ≤ n ≤ q + 1 the number of generalized Reed-Solomon codes is (q − 1) n−1 (q − 2) · · · (q − n + 2) and that for q = 2 e , with e ≥ 3 the number of [q + 2, 3] GRS codes is We then compare the number of GRS codes with the number of MDS codes for small length and dimension three and observe some phenomena regarding the ratio between these numbers. Lastly, we give an explanation of these observations.
2 Counting GRS codes of length up to q + 1 The main theorem we wish to prove in this section is the following: Theorem 2.1 Let F q be the finite field with q elements and choose natural numbers k, n such that 4 ≤ k + 2 ≤ n ≤ q + 1. Then the number γ GRS (k, n) of distinct GRS codes over F q of length n and dimension k is equal to γ GRS (k, n) = (q − 1) n−1 · (q − 2) · · · (q − n + 2).
Our proof will use elements from group theory and finite geometry. While primarily working over F q , the finite field with q elements, several of the statements on group theory are valid more generally. Therefore throughout this section K denotes an arbitrary field. The notation K × denotes the multiplicative group of non-zero elements of K. Let c(t) denote the column vector (1, t, t 2 , . . . , t k−1 ) T if t = ∞ and let c(∞) = (0, 0, · · · , 0, 1) T . We consider k × n matrices that are the product of two matrices as follows: where t 1 , . . . , t n are n distinct points on P 1 = K ∪ {∞} and d i ∈ K × . Here t and d denote the tuples (t 1 , . . . , t n ) and (d 1 , . . . , d n ). Let S k,n denote the set of matrices of the form (1). We define an equivalence relation on S k,n as follows: In other words two matrices of the form (1) are equivalent if and only if they are row equivalent.
The following result is crucial: Theorem 2.2 If n ≥ k + 2, then each ∼-equivalence class in S k,n is in bijective correspondence with a group G which is a particular central extension of P GL 2 (K) by K × .
The group G equals π −1 (ρ (P GL 2 (K)) where π : GL 2 (K) → P GL 2 (K) is the natural quotient homomorphism, and where ρ : P GL 2 (K) → P GL k (K) is a homomorphism defined in (7). When K is the field F q , elements of S k,n correspond to generator matrices of q-ary GRS codes of length n and dimension k. It is also clear that: Moreover two elements of S k,n are in the same ∼ equivalence class if and only if they generate the same code. When K = F q , any central extension of P GL 2 (F q ) by F × q has cardinality |P GL 2 (F q )| · |F × q | = (q + 1)q(q − 1) 2 . Therefore Theorem 2.1 is a direct consequence of Theorem 2.2, which is why we now focus on proving the latter theorem.
We start with a lemma about the matrices G k (t, d). The proof is familiar in coding theory (at least when no t i = ∞) from the result that the dual of a GRS code is itself GRS. Lemma 2.3 For δ = (δ 1 , . . . , δ n ) as defined below, the rows of G n−k (t, δ) form a basis for the null space of G k (t, d).
Proof. First assume no t i = ∞. In this case the assertion about G n−k (t, δ) is equivalent to the assertion that i f (t i )d i δ i t j i = 0 for 0 ≤ j ≤ n − k − 1 for all polynomials f ∈ K[t] of degree at most k − 1. This in turn is equivalent to the fact that the coefficients of t for k ≤ ≤ n − 1 in the following Lagrange interpolation form of the polynomial f (t) vanish: In general, suppose t = ∞. Let G be the (k − 1) × (n − 1) matrix obtained by deleting the last row and the -th column of G k (t, d). Let G be the (n−k)×(n−1) matrix obtained by deleting the -th column of G n−k (t, d). It follows from the above discussion that the rows of G are in the null space of G . Already this implies that except the last row, the remaining rows of G n−k (t, δ) are in the null space of G k (t, d).
As regards the last row of G n−k (t, δ), the choice of δ made in the hypothesis ensures that this row is also in the null space of G k (t, d). Since the row space of G n−k (t, δ) and the null space of G k (t, d) are n − k dimensional, we have shown that the rows of G n−k (t, δ) form a basis for the null space of G k (t, d).
Next we recall the definition of a normal rational curve and we collect some properties of this curve that we will need. We use the notation [x 0 , x 1 , . . . , x k−1 ] for homogeneous coordinates of a point in P k−1 .
Definition 2.4 The normal rational curve C k is the image k (P 1 ) of the map k : In general, for any A ∈ P GL k (K), the image of A(C k ) is also called a normal rational curve. In the sequel, we abbreviate the term normal rational curve as NRC. Throughout this work, we make the assumption that k < |K|. Under this assumption, any NRC has at least k + 2 points.
We also need the intrinsic definition of a NRC.
is symmetric and multilinear in f 1 , . . . , f k−1 and hence defines a map V → Sym k−1 (V * ) * . The projectivization of this map is the (k − 1)-th Veronese embedding As pointed out in [14, p.25, p.101] this is the correct intrinsic description of the Veronese embedding in positive characteristic. In positive characteristic there is no natural isomorphism between (Sym k−1 (V * )) * and Sym k−1 (V ). There is a graded algebra analogous to the graded algebra Sym(V ) (and isomorphic to it in characteristic zero) known as the divided power algebra of V , whose k-th graded component is ( Corresponding to this basis of where δ ij is the Kronecker delta function). In terms of homogeneous coordinates with respect to the bases {e, f } and {b 1 , . . . , b k } the map η k is described by which is the same as (4).
where [h] denotes the class in P GL m (K) of h ∈ GL m (K). It follows from (5) and ). In other words: As an example, we see that for k = 2, and g = α β γ δ , Theorem 2.7 Let K be an arbitrary field. A collection of k + 2 points in general position in P k−1 lie on a unique NRC.
Here, general position means that no k points of P lie on any hyperplane of P k−1 . We provide a proof for arbitrary fields K using Lemma 2.3.
Proof. Up to a projective transformation, we can assume that the given collection P of k + 2 points is represented by the columns of the k × (k + 2) ma- . . , −v k , 1, 1), and t = (t 1 , t 2 , . . . , t k , 0, ∞), in other words: Clearly the rows of G 2 (t, d) form a basis for the null space of G. However, by Lemma 2.3, the rows of G 2 (t, d) also form a basis for the null space of G k (t, δ), where δ is related to d by (3). Since, the standard dot product on F k+2 q is non-degenerate, the subspace of F k+2 q orthogonal to the row space of G 2 (t, d) is the row space of G as well as the row space of G k (t, δ). It follows that there exists a non-singular matrix R such that G = RG k (t, δ). In other words the points of P lie on the NRC obtained by applying the projective transformation [R] to the standard NRC in P k−1 .
Next, we establish uniqueness: Suppose P lies on two NRCs. We may suppose that one of these is the standard NRC k (P 1 ). In other words there exist: R ∈ GL k (K), distinct elements T 1 , . . . , T k+2 ∈ K ∪ {∞}, distinct elements t 1 , . . . , t k+2 ∈ K ∪ {∞}, and D 1 , . . . , D k+2 ∈ K × such that: We must show T = t. Using (8), and the fact that P GL 2 (K) acts triply transitively on K ∪ {∞}, we may assume t i = T i for i = 1 . . . 3. By Lemma 2.3, there exists , the first three columns of G 2 (t, d ) are pairwise independent eigenvectors of R . So, there must be an eigenvalue of R with two independent eigenvectors, i.e. R is a scalar matrix, whence T = t.
Proof. Let P be a set of k + 2 points of C k , such that AP ⊂ C k . By Theorem 2.7, the unique NRC passing through AP is C k . Hence A(C k ) = C k i.e. A ∈ Aut(C k ). The next theorem states that the (linear) automorphism group of a NRC is isomorphic to P GL 2 (K). Remark: The NRC is the simplest case (dim(V ) = 2) of the Veronese embedding (5). We expect a similar result for the Veronese variety over an arbitrary field : Aut(η k (P m−1 )) = ρ (P GL m (K)). Usually, automorphism groups of such varieties are computed in literature only for algebraically closed K. However, for the Plücker embedding of the Grassmannian, orthogonal and symplectic grassmannians, the automorphism groups were determined by Chow for arbitrary fields K, from a combinatorial/incidence geometry viewpoint in the well known work [3]. We are not aware of any such results for the Veronese embedding. Therefore, we give a proof here which holds for arbitrary fields. For K = F q , this theorem can be found in e.g. [18,Thm. 6.32].
Proof. Let R ∈ GL k (K) such that π(R) ∈ Aut(C k ). Here π : GL k (K) → P GL k (K) is the quotient homomorphism. Let t 1 , t 2 , . . . , t k+2 be distinct elements of K ∪ {∞}. Let d i = 1 for i = 1 . . . k + 2. Since π(R) ∈ Aut(C k ), there exist T 1 , . . . , T k+2 ∈ K ∪ {∞}, and D 1 , . . . , D k+2 ∈ K × such that RG(t, d) = G(T, D) (this is the same as (9)). By Proposition 2.5, certainly ρ (P GL 2 (K)) ⊂ Aut(C k ). Therefore, as in the proof of Theorem 2.7 above, we may assume t i = T i for i = 1 . . . 3. The discussion following (9) in the proof of Theorem 2.7, shows that T = t. We must now show that R is a scalar matrix. Returning to the equation RG(t, d) = G(T, D), we see that the k + 2 columns of G k (t, d) are eigenvectors of R, any k of which are linearly independent. If λ 1 , . . . , λ k+2 are the corresponding eigenvalues, then it follows that the multiset formed by any k of these λ i equals the multiset of eigenvalues of R. In particular for each i satisfying 1 ≤ i ≤ k, we have: This is possible only if λ 1 = · · · = λ k , whence R is a scalar matrix.
We are finally ready to prove Theorem 2.2. Proof of Theorem 2.2.
Let G denote the inverse image of Aut(C k ) = ρ (P GL 2 (K)) under the canonical epimorphism π : GL k (K) → P GL k (K). We note that the group K × = ker(π) of scalar matrices is contained in the center of G. Therefore, G is a certain central extension of P GL 2 (K) ρ (P GL 2 (K)) by K × . We will prove that each ∼-equivalence class in S k,n is in bijective correspondence with G. Suppose R ∈ GL(k, F q ) satisfies R G k (t, d) = G k (τ, δ), for some G(t, d) and G(τ, δ). Since n ≥ k + 2, we can use Lemma 2.9 to conclude that [R] ∈Aut(C k ), i.e. R ∈ G.
It now suffices to prove that G acts freely on S k,n . Suppose R G(t, d) = G(t, d) where R ∈ G. By Theorem 2.10, there is a unique g ∈ P GL 2 (K) such that π(R) = ρ (π(g)). By Proposition 2.5, the Mobius transformation g(t) = γ+δt α+βt fixes n ≥ 3 points {[1, t i ] : i = 1 . . . n} of P 1 . Therefore, g (and hence [R] = ρ ([g])) is the identity transformation. It follows that R is a scalar matrix. The equation R G(t, d) = G(t, d) now implies R is the identity matrix.
A more general question is to compute the number γ(k, n) of distinct MDS codes of length n and dimension k over F q . When q is a prime, then n ≤ q + 1 and if n = q + 1, the codes are GRS [1,2]. But when q = 9, there is an example of a 10-arc which is not an NRC [8]. Surprisingly, it is possible to describe the asymptotic behaviour of the number of distinct MDS codes. More precisely, in [20] some results were obtained recently about the asymptotic behaviour of γ(k, n) where it was shown that: where δ = k(n − k), N = n k and a 2 = N k(n − k) k 2 − nk + n + 3 2(k + 1)(n − k + 1) In these asymptotic formulae, it is assumed that n and k are fixed, while q tends to infinity. We can use Theorem 2.1 to obtain a similar asymptotic formula for the number of GRS codes: Proposition 2.11 Let F q be the finite field with q elements and choose natural numbers k, n such that 4 ≤ k + 2 ≤ n ≤ q + 1. For fixed k and n and q tending to infinity, we have: Proof. On the one hand, it is easy to see that while on the other hand, where in both summations the variables i and j vary between 1 and n − 2. The coefficient of q n−3 is then easily determined, since The determination of the coefficient of q n−4 is somewhat more involved, but we have If we apply the well-known summation formulae for squares and cubes to this expression and simplify, we see that Since by Theorem 2.1 the number of distinct [n, k] GRS codes over F q is just the product of the left-hand sides in equations (12) and (13), we readily obtain the desired asymptotic formula by multiplying the right-hand sides occurring in these equations.

Remark 2.12
The first term q 2n−4 in the formula in Proposition 2.11 corresponds to the fact observed in [5] that the GRS codes form an algebraic subset of dimension 2n − 4 in the k(n − k) dimensional affine space.

Remark 2.13
Exploiting the structure of the coefficient of the asymptotic expansion of γ GRS (n, k), it is easy to ascertain that the coefficient of q 2n−4−i will be a polynomial in n (with rational coefficients) of degree 2i. Using this fact, one can easily determine further coefficients. For the interested reader we state the result one obtains when computing the coefficient a 2n−7 of q 2n−7 in the asymptotic expansion: Remark 2.14 We note that γ GRS (n, k) = γ(n, 2) for 4 ≤ n ≤ q + 1. To see this, we observe that γ GRS (n, k) is independent of k for 4 ≤ k +2 ≤ n ≤ q +1 by Theorem 2.1. Thus γ GRS (n, k) = γ GRS (n, 2) for 4 ≤ n ≤ q + 1. Any generator matrix for a 2-dimensional MDS code is clearly of the form G 2 (t, d) (see (1)), and hence every 2-dimensional MDS code is GRS. Thus γ GRS (n, 2) = γ(n, 2).
It is well known that for q even, there exist MDS codes of length q +2 and dimension 3. Such codes arise from combinatorial structures known as hyperovals, which we will define in a moment. First of all for a natural number n, one defines a (planar) n-arc to be a set of n mutually distinct points in the projective plane P 2 (F q ) with the property that no three points in the n-arc lie on a line. In case n = q + 1, such an n-arc is called an oval, while if n = q + 2 it is called a hyperoval. It is well known that n-arcs give rise to [n, 3] MDS codes. A generator matrix of a code can be obtained from an n-arc the following way: first one orders the projective points in the n-arc, then one chooses representatives in F 3 q of the projective points and finally one uses these n ordered elements from F 3 q as the columns of a generator matrix of a code. The resulting codes are easily seen to be [n, 3] MDS codes by the defining properties of an n-arc. Note that there exists a more general definition of arcs in P m (F q ), but in this article we will always assume that m = 2 and assume this implicitly when speaking about arcs.
In 1947 R.C. Bose proved that the maximal size of any arc in a projective plane of odd order q is q + 1, and if q is even the maximum may be q + 2, see pp. 149 in [4]. In odd characteristic, Segre (see Sections 173 and 174 in [22]) proved that any (q + 1)-arc, that is to say any oval, in fact consists of the q + 1 rational points lying on a non-degenerate conic. By slight abuse of terminology such ovals are simply called conics as well. In even characteristic the situation is different: not all ovals can be described as a conic, but other ovals exist. It is still true though that the q + 1 rational points on a non-degenerate conic form an oval. In even characteristic one type of hyperoval can be obtained by taking the q + 1 rational points on a conic and then adding the nucleus which is the common intersection point of all tangent lines of this conic [12,17]. We will use the word hyperconic for such a hyperoval. In general not all hyperovals can be described as a hyperconic, but for q = 2, q = 4 and q = 8, all hyperovals are known to be hyperconics (page 290 [22]). Note that if an n-arc is contained in a conic, the MDS code corresponding to this n-arc actually is a GRS code. Following this relation, we define by analogy the [q + 2, 3] MDS codes obtained from hyperconics to be GRS codes as well. From now on in this section, we will assume that q is even. Our goal is to count the number of distinct [q + 2, 3] GRS codes. Since any GRS code with parameters [q + 2, 3] corresponds to a hyperconic, we can obtain all of these codes by extending [q + 1, 3] GRS codes. Geometrically, this means that we simply are adding the nucleus to the conic. Conics and hyperconics play an important role in the theory of GRS codes. A generator matrix for a GRS code of length q + 1 can be obtained by putting the q + 1 points of a conic as columns of a matrix. Adding an additional "nucleus" column to, yields a generator matrix of a length q + 2 GRS code.
We are now ready to count the number of distinct [q + 2, 3] GRS codes: Theorem 3.1 Let q = 2 e for an integer e ≥ 3. The number of distinct GRS codes of length q + 2 and dimension 3 equals Proof. Since any GRS code with parameters [q + 2, 3] corresponds to a hyperconic, we can obtain these codes by extending [q + 1, 3] GRS codes. We already know from Theorem 2.1 that the number of distinct GRS codes of length q + 1 equals (q − 1) q (q − 2)!. Adding a"nucleus" column can be done in q + 2 distinct positions and also gives rise to an additional column multiplier, giving in total (q + 2)(q − 1) q+1 (q − 2)! GRS codes. By definition, all GRS codes of length q + 2 are obtained in this way. Some of these codes could in principle be the same, but if q > 4, the group acting on the conic plus nucleus hyperoval (a nonic in [10]), fixes the nucleus and is sharply 3-transitive on the remaining points. This means that all (q + 2)(q − 1) q+1 (q − 2)! GRS codes obtained above are distinct.
Remark 3.2 Theorem 3.1 does not cover the case that q = 4, as it was needed in the proof that q > 4. Indeed in case q = 4, the (linear) group of the conic plus nucleus is sharply 4-transitive on all the q + 2 = 6 points. The right formula for q = 4 is therefore given by Alternatively, in the next section we shall among others quote a known expression for the number of distinct [6,3] MDS codes. Combining this with Segre's observation that for q = 4 any hyperoval is a hyperconic, this expression will give the desired number 486 directly.

A further investigation of GRS and MDS codes of dimension three
The formulae given in Theorems 2.1 and 3.1 can be tested by comparing them to other results regarding the number of arcs or equivalently MDS codes as given in [9,19]. There it is stated that γ(3, 6), the number of distinct [6,3] MDS codes over For q = 5, this formula combined with Theorem 2.1 implies that any [6,3] MDS code over F 5 is a GRS code, since there exist exactly 6144 distinct ones of either type. This is in accordance with the aforementioned result by Segre, that in odd characteristic any oval is a conic. For n = 7, 8, 9 there exist closed formulae for γ (3, n), the number of distinct [n, 3] MDS codes, as well [9,19,21]. To state these formulae, it is convenient to define the following functions: a(q) = 1 if q is a power of 2, and a(q) = 0 otherwise, b(q) = |{x ∈ F q | x 2 + x + 1 = 0}| c(q) = 1 if q is a power of 3, and c(q) = 0 otherwise, The number of distinct [7,3] MDS codes over F q is then given by [21]: The number of distinct [8,3] MDS codes over F q is given by [9]: −240(q 2 − 20q + 78)a(q) + 840b(q)).
The point of the observation is that it is somewhat unexpected that the ratio of the number of MDS and GRS codes is an integer in some cases. We will give an explanation of this in the following. For 3 ≤ n ≤ q + 2 let us denote by MDS(n) (resp. GRS(n)) the set of [n, 3] MDS codes (resp. GRS codes) over F q . We now define the following map: Definition 4.2 Let q = 2 e with e ≥ 3 and choose 1 ≤ r ≤ q + 1. Then we define the map P r : GRS(q + 2) → MDS(q + 2 − r) by putting for C ∈ GRS(q + 2) In words: P r punctures a code in the last r coordinates. The reason that we only consider this map for even q and for length q + 2 GRS codes, is that in all other cases, a punctured GRS code is a GRS code again. We will later see that this is not true in the case we are considering. First we collect some properties of the map P r in the following: Lemma 4.3 Suppose that q + 2 − r ≥ 7, then the map P r is a r!(q − 1) r to one map.
Proof. Let C ∈ GRS(q+2) and denote by G r denote a generator matrix of the code C r := P r (C). We wish to determine the number of possibilities for D ∈ GRS(q + 2) such that P r (D) = C r . Equivalently we wish to describe the codes D ∈ GRS(q + 2) that have a generator matrix of the form (G r B), with B a 3 × r matrix.
The q + 2 − r columns of G r give rise to q + 2 − r projective points in P 2 (F q ) lying on a hyperconic. We claim that this hyperconic is unique: indeed if two hyperconics have at least q + 2 − r points in common, then discarding the nuclei of these hyperconics, one obtains two conics having at least q − r points in common. Since by assumption q − r ≥ 5 these conics are identical by Theorem 2.7 applied to the case k = 3. This implies that the original hyperconics were identical as well.
This shows that if P r (D) = C r and D has generator matrix (G r B), then the set of r projective points that the columns of B give rise to, is uniquely determined. This leaves r!(q − 1) r possibilities for B, since each projective point has q − 1 representatives and the ordering of the r representatives as columns of B can be chosen freely.
An n-arc is called complete, if it cannot be extended to a (n + 1)-arc. If q is odd, it is for example known that no complete q-arcs exist [16]. Similarly if q is even, no complete (q + 1)-arcs exist [16,Ch.8]. The concept of completeness is instrumental in explaining Observation 4.1 and plays a role in the following: Lemma 4.4 Suppose that any hyperoval is a hyperconic and moreover that for n = q + 2 − r, . . . , q + 1 any n-arc can be extended to an (n + 1)-arc. Then the map P r is surjective.
Proof. From the assumptions, we see that any n-arc with q + 2 − r ≤ n ≤ q + 1 can be extended. Inductively, this means that any (q + 2 − r)-arc can be extended to a hyperoval, which in turn was assumed to be a hyperconic. This implies that any [q + 2 − r, 3] MDS code can be extended to a [q + 2, 3] GRS code. A direct consequence is that the map P r is surjective.
We are now ready to explain Observation 4.1.
Remark 4.6 As pointed out by the referee of this article, Table 1 demonstrates that for q = 9 and n = 8 the ratio between # MDS and # GRS is also an integer, namely 3. The referee asked us to provide a short explanation, which we do now: The non-GRS MDS codes come from a complete 8-arc, discovered by Hirschfeld. This 8-arc is unique when considered up to projectivities and has automorphism group isomorphic to D 4 [16,Ch.14]. An MDS code is obtained by choosing an ordering for the 8 points in the arc and by choosing representatives for these points. This gives a priori 8! · 8 7 non-GRS, MDS codes, but since the arc has an automorphism group of order 8, we actually find 7! · 8 7 distinct non-GRS, MDS codes. According to Theorem 2.1, the number of distinct [8,3] GRS codes over F 9 equals 7! · 8 7 /2. Hence there are twice as many non-GRS MDS codes as GRS codes in this setting.