Quadratic and symmetric bilinear forms over finite fields and their association schemes

Let $\mathscr{Q}(m,q)$ and $\mathscr{S}(m,q)$ be the sets of quadratic forms and symmetric bilinear forms on an $m$-dimensional vector space over $\mathbb{F}_q$, respectively. The orbits of $\mathscr{Q}(m,q)$ and $\mathscr{S}(m,q)$ under a natural group action induce two translation association schemes, which are known to be dual to each other. We give explicit expressions for the eigenvalues of these association schemes in terms of linear combinations of generalised Krawtchouk polynomials, generalising earlier results for odd $q$ to the more difficult case when $q$ is even. We then study $d$-codes in these schemes, namely subsets $X$ of $\mathscr{Q}(m,q)$ or $\mathscr{S}(m,q)$ with the property that, for all distinct $A,B\in X$, the rank of $A-B$ is at least $d$. We prove tight bounds on the size of $d$-codes and show that, when these bounds hold with equality, the inner distributions of the subsets are often uniquely determined by their parameters. We also discuss connections to classical error-correcting codes and show how the Hamming distance distribution of large classes of codes over $\mathbb{F}_q$ can be determined from the results of this paper.


Introduction
Let q be a prime power and let V = V (m, q) be an m-dimensional F q -vector space. Let Q = Q(m, q) be the space of quadratic forms on V and let S = S (m, q) be the space of symmetric bilinear forms on V . These spaces are naturally equipped with a metric induced by the rank function. The main motivation for this paper is to study d-codes in Q and S , namely subsets X of Q or S such that, for all distinct A, B ∈ X, the rank of A − B is at least d. We are in particular interested in the largest cardinality of d-codes in Q and S and in the structure of such sets when this maximum is attained. One of the applications is that d-codes in Q can be used to construct optimal subcodes of the second-order generalised Reed-Muller code and our theory can be used to determine the Hamming distance distributions of such codes.
For odd q, most of the results in this paper have been obtained by the author in [21]. The new results of this paper concern the more difficult case that q is even, although whenever possible we aim for a unified treatment of the two cases. For even q, some partial results were obtained previously by the author in [20].
The main tool for studying subsets of Q and S is the beautiful theory of association schemes. It is known that Q(m, q) and S (m, q) carry the structure of a translation association scheme with 3m/2 classes. These have been studied by Wang, Wang, Ma, and Ma [25]. In particular the two schemes are dual to each other and, for odd q, they are isomorphic. Hence the association scheme on Q is self-dual

Quadratic forms and symmetric bilinear forms
In this section we recall the definitions and basic properties of the association schemes of symmetric bilinear forms and quadratic forms from [25]. We refer to [5], [8], and [3] for more background on association schemes and to [18,Chapter 21] and [16,Chapter 30] for gentle introductions.
A (symmetric) association scheme with n classes is a pair (X , (R i )), where X is a finite set and R 0 , R 1 , . . . , R n are nonempty relations on X satisfying: (A1) {R 0 , R 1 , . . . , R n } is a partition of X × X and R 0 = {(x, x) : x ∈ X }; (A2) Each of the relations R i is symmetric; Algebraic Combinatorics, Vol. 3 #1 (2020) (A3) If (x, y) ∈ R k , then the number of z ∈ X such that (x, z) ∈ R i and (z, y) ∈ R j is a constant p k ij depending only on i, j, and k, but not on the particular choice of x and y. Let (X , (R i )) be a symmetric association scheme with n classes and let D i be the adjacency matrix of the graph (X , R i ). The vector space generated by D 0 , D 1 , . . . , D n over the real numbers has dimension n + 1 and is in fact an algebra, called the Bose-Mesner algebra of the association scheme. There exists another uniquely defined basis for this vector space, consisting of minimal idempotent matrices E 0 , E 1 , . . . , E n . We may write for some uniquely determined numbers P i (k) and Q k (i), called the P -numbers and the Q-numbers of (X , (R i )), respectively. Now let V = V (m, q) be an m-dimensional F q -vector space. We denote by Q = Q(m, q) the set of quadratic forms on V and by S = S (m, q) the set of symmetric bilinear forms on V . Notice that Q and S are themselves F q -vectors spaces of dimension m(m + 1)/2.
Let G = G(m, q) be the direct product F * q × GL m (F q ). Then G acts on Q by (g, Q) → Q g , where Q g is given by Q g (x) = aQ(Lx) and g = (a, L). The semidirect product Q G acts transitively on Q by The action of Q G extends to Q × Q componentwise and partitions Q × Q into orbits, which define the relations of a symmetric association scheme. Two pairs of quadratic forms (Q, Q ) and (R, R ) are in the same relation if and only if there is a g ∈ G such that (Q − Q ) g = R − R . This shows that the relation containing (Q, Q ) depends only on Q − Q , which is the defining property of a translation scheme [8,Chapter V].
The group G also acts on S by (g, S) → S g , where S g is given by S g (x, y) = aS(Lx, Ly) and g = (a, L). The semidirect product S G acts transitively on S by ((A, g), S) → S g + A.
Again, the action of S G extends to S ×S componentwise and so partitions S ×S into orbits, which define the relations of a symmetric association scheme. Two pairs of symmetric bilinear forms (S, S ) and (T, T ) are in the same relation if and only if there is a g ∈ G such that (S − S ) g = T − T , which again makes the association scheme a translation scheme.
When q is odd, every quadratic form Q ∈ Q gives rise to a symmetric bilinear form S ∈ S via (1) S(x, y) = Q(x + y) − Q(x) − Q(y), from which we can recover Q by Q(x) = 1 2 S(x, x). This shows that the association schemes on Q and S are isomorphic when q is odd. We shall see that this is not the case when q is even. Now let {α 1 , α 2 , . . . , α m } be a basis for V (m, q). For every quadratic form Q ∈ Q, there exist A ij ∈ F q such that We say that the right hand side is the coordinate representation of Q (with respect to the basis chosen). The matrix A = (A ij ) is only Algebraic Combinatorics, Vol. 3 #1 (2020) unique modulo the subgroup of m × m alternating matrices over F q . Accordingly we associate with Q the coset [A] of alternating matrices containing A.
Let {β 1 , β 2 , . . . , β m } be another basis for V (m, q). For every symmetric bilinear form S ∈ S we then have . Again, we refer to the right hand side as the coordinate representation of S. We associate with every symmetric bilinear form the corresponding m × m symmetric matrix B = (B ij ).
Let χ : F q → C * be a fixed nontrivial character of (F q , +). Hence, if q = p k for a prime p and an integer k, then χ(y) = ω Tr(θy) for some fixed θ ∈ F * q and some fixed primitive complex p-th root of unity ω. Here, Tr : F q → F p is the absolute trace function on F q defined by For Q ∈ Q and S ∈ S , write where [A] is the coset of alternating matrices associated with Q and B is the symmetric matrix associated with S and tr is the matrix trace. Note that Q, S is well defined since tr(CD) = 0 if C is alternating and D is symmetric. It is readily verified that · , S ranges through all characters of (Q, +) when S ranges over S and that Q, · ranges through all characters of (S , +) when Q ranges over Q. Notice that this correspondence depends on the choice of the bases.
The following duality result was observed in [25].
Proposition 2.1 shows that the association schemes on Q and S are dual to each other in the strong sense of [8,Definition 11].
In what follows, we shall describe the relations of Q and S explicitly. For a symmetric bilinear form S ∈ S , the radical is defined to be rad(S) = {x ∈ V : S(x, y) = 0 for every y ∈ V }.
The rank of S is the codimension of the radical and coincides with the rank of the symmetric matrix associated with S. For a quadratic form Q ∈ Q, let S Q (x, y) = Q(x + y) − Q(x) − Q(y) be the associated symmetric bilinear form, and define the radical of Q to be rad(Q) = {x ∈ rad(S Q ) : Q(x) = 0}. The rank of Q is defined to be the codimension of its radical.
The following result describes the orbits of the action of G on Q and was essentially obtained by Dickson [9].
Proposition 2.2. The action of G on Q(m, q) partitions Q(m, q) into 3m/2 + 1 orbits, one of them contains just the zero form. There is one orbit for each odd rank r and one representative is, in coordinate representation, Algebraic Combinatorics, Vol. 3 #1 (2020) There are two orbits for each nonzero even rank r and representatives from the two orbits are, in coordinate representation, where for q odd and α ∈ F * q is a fixed element satisfying Tr(α) = 1 (for even q) and β ∈ F * q is a fixed nonsquare in F * q (for odd q).
If Q belongs to an orbit corresponding to (4), then Q is called hyperbolic or of type 1 and if Q belongs to an orbit corresponding to (5), then Q is called elliptic or of type −1. By convention, the zero form is a hyperbolic quadratic form of rank 0. Let Q 2s+1 be the set of quadratic forms on V of rank 2s + 1 and let Q 2s,1 and Q 2s,−1 be the sets of hyperbolic and elliptic quadratic forms on V of rank 2s, respectively. Write and, for every i ∈ I, define the relations The nonempty relations are then precisely the relations of the association scheme of quadratic forms. It should be noted that, by joining the relations R 2s,1 , R 2s,−1 , and R 2s−1 in Q(m, q), we obtain an association scheme studied by Egawa [10]. As shown in [10], this association scheme has the same parameters as the association scheme of alternating bilinear forms on an (m + 1)-dimensional F q -vector space [7], which is reflected by (30) and (35) in the present paper. However, the determination of the P -and Q-numbers of our refined association scheme is considerably more difficult.
The following result describes the orbits of the action of G on S and was essentially obtained by Albert [1] (and, for odd q, also follows from Proposition 2.2 via (1)).
Proposition 2.3. The action of G on S (m, q) partitions S (m, q) into 3m/2 + 1 orbits, one of them contains just the zero form. There is one orbit for each odd rank r and one representative is, in coordinate representation, There are two orbits for each nonzero even rank r and representatives from the two orbits are, in coordinate representation, Algebraic Combinatorics, Vol. 3 #1 (2020) where S 0 = x r−1 y r + x r y r−1 + x r y r for even q, x r−1 y r−1 − βx r y r for odd q, and β is a fixed nonsquare of F * q (for odd q). Let S 2s+1 be the set of symmetric bilinear forms on V of rank 2s + 1 and let S 2s,1 and S 2s,−1 be the sets of symmetric bilinear forms on V of rank 2s corresponding to the orbits (7) and (8), respectively. Symmetric bilinear forms in S 2s,τ are said to be of type τ . For even q, it can be shown [1] that S 2s,1 contains precisely the alternating bilinear forms of rank 2s. For every i ∈ I, define the relations The nonempty relations are then precisely the relations of the association scheme of symmetric bilinear forms. Now write v i = |Q i | and µ i = |S i |, whose nonzero values are called the valencies of the association schemes on Q and S , respectively. The numbers v i have been determined by McEliece [19], following the work of Dickson [9]. Since the association schemes on Q and S are isomorphic for odd q, we have µ i = v i for odd q. For even q, the numbers µ i were determined by MacWilliams [17]. We summarise the results in the following form.
, where α τ = 1 2 (1 − τ ) for even q, 1 2 for odd q and β s = 1 for even q, 1 2 q s for odd q. We conclude this section by noting that our association scheme on S is slightly different from the association schemes on S in [25] and [21]. The difference is that in [25] and [21] the group G is just GL m (F q ), which increases the number of orbits from 3m/2 + 1 to 2m + 1 in the case that q is odd. Another difference to [21] is that the sets S 2s,1 and S 2s,−1 , and so also the relations R 2s,1 and R 2s,−1 on S , are interchanged when s is odd and q ≡ 3 (mod 4). where χ is the same nontrivial character as in (3). The Q-numbers and the P -numbers of the association scheme on Q are given by the character sums (see [8, Section V], for example)

Computation of the Qand P -numbers
respectively, where k, i ∈ I. The Q-numbers Q i (k) and the P -numbers P k (i) of the association scheme on S satisfy In order to give explicit expressions for these numbers, it is convenient to use q 2 -analogs of binomial coefficients, which are defined by for integral n and k. These numbers satisfy the following identities We also need the following numbers, which can be derived from generalised Krawtchouk polynomials [7,6]. We define Theorem 3.1. The Q-numbers of the association scheme of quadratic forms Q(m, q) are as follows. We have Q 0,1 (i) = 1 and Q k (0, 1) = µ k for all i, k ∈ I and the other Q-numbers are given by where α and β r are given in Proposition 2.4.

Algebraic Combinatorics, Vol. 3 #1 (2020)
It is well known (and can be easily verified) that the P -numbers of Q can be computed from the Q-numbers of Q via Proposition 2.4 then shows that P i (k) = Q k (i) for odd q (as it should since the association scheme on Q is isomorphic to its dual in this case). For even q, the Pnumbers of Q are given in the following theorem.
Theorem 3.2. For even q, the P -numbers of the association scheme of quadratic forms Q(m, q) are as follows. We have P 0,1 (k) = 1 and P i (0, 1) = v i for all i, k ∈ I and the other P -numbers are given by In the remainder of this section, we shall prove Theorems 3.1 and 3.2. We begin with the following result, which is essentially known.
Proof. For odd q, the statement in the lemma can be deduced from [21, Lemma 6.3], so assume that q is even. Then S 2r,1 is the set of alternating bilinear forms of rank 2r on V . By Proposition 2.2, every quadratic form in Q 2s+1 can be represented by an m × m block diagonal matrix with the block (1) in the top left corner, followed by s copies of (14) 0 1 0 0 .
It can be shown using Proposition 2.2 that the quadratic form x 2 +xy +λy 2 in Q(2, q) is of type (−1) Tr(λ) . Hence a quadratic form in Q 2s,τ can be represented by the zero matrix or by an m × m block diagonal matrix with the block in the top left corner, followed by s − 1 copies of (14), where (−1) Tr(λ) = τ . It follows from these observations that, for k = (2r, 1) the character sums (10) have been evaluated by Delsarte and Goethals [7,Appendix], which gives In what follows we write, for every i ∈ I, Algebraic Combinatorics, Vol. 3 #1 (2020) We shall also write Q for S k whenever we need to indicate dependence on m.
We have the following recurrences for the Q-numbers.
Lemma 3.4. For k 1 and s 0, we have k−1 (2s, 1) and for k 1 and s 1, we have For odd q, the lemma can be deduced from [21, Lemma 6.1], so henceforth we assume that q is even.
To prove the identity (16), fix an integer s with 0 s (m − 1)/2 and let A be the m × m block diagonal matrix with the block (1) in the top left corner, followed by s copies of (14). Then A is a matrix of a quadratic form of rank 2s + 1. Let A be the (m − 1) × (m − 1) matrix obtained from A by deleting the first row and the first column. Then we have where χ is the nontrivial character of (F q , +) used to define the pairing in (3) and we write B as (18) is zero for a = 0, so assume that a = 0. Writing As a ranges over F * q and u ranges over F m−1 q and C ranges over S with the constraint a = 0. Therefore the sum (18) is We have for every a ∈ F * q , and Substitute everything into (18) to obtain the first identity (16) in the lemma.
To prove the identity (17), fix an integer s with 1 s m/2 and τ ∈ {−1, 1}. Let λ ∈ F q be such that (−1) Tr(λ) = τ and let A be the m × m block diagonal matrix with the block (15) in the top left corner, followed by s − 1 copies of (14). Then A is a matrix of a quadratic form of rank 2s and type τ . Let A be the (m − 1) × (m − 1) matrix obtained from A by deleting the first row and the first column. Then we have where we write B as (19) and where u = (u 1 , . . . , u m−1 ) T . We split the summation in (20) into two parts: the sum S 1 is over all B with a = 0 and the sum S 2 is over all B with a = 0. Similarly as in the proof of the first identity (16), we have For every a ∈ F * q , we have since the inner sum is zero, and similarly, by applying the substitution w = ay. The mapping is y → y 2 + y is 2-to-1 and its image is the set of elements in F q whose absolute trace is zero. Since χ is nontrivial, which equals q if a = 1/θ and equals zero otherwise. Substitute everything into (21) to obtain We complete the proof by showing that the sum S 2 , namely the summation in (20) over all B with a = 0, equals zero. Let A be the matrix obtained from A by deleting the first two rows and the first two columns. Then we have where we now write Henceforth we put a = 0. For b = 0, the summand in (22) equals zero, so we assume that b is nonzero and so E is invertible. Writing Then, arguing similarly as before, we obtain There exists an invertible matrix 2 × 2 matrix N over F q such that N E −1 N T is either the 2 × 2 identity matrix or depending on whether c = 0 or c = 0, respectively. It is readily verified that Therefore we have since the inner sum is zero. This completes the proof of the identity (17).
We shall now solve the recurrence relations in Lemma 3.4 using the initial values for µ k . These initial values follow immediately from (10).
Proposition 3.5. For k 1, the numbers Q k (2s + 1) for s 0 and the numbers Q k (2s, τ ) and s 1 satisfy Proof. For odd q, the statements in the lemma are given by [21,Lemma 6.2]. However we prove the lemma for odd and even q simultaneously. Write From (16) with s = 0 and the initial values (24) and (25) we have , which we can write as q 2r n r This latter expression equals q 2r F (m−1) r (0) (see [7] or [21], for example) and therefore (26) and (28) hold for s = 0. Using the initial value (23), we see that (28) also holds for r = 0. Now substitute (17) into (16) to obtain k−2 (2s − 1). Using (12), we verify by induction that (26) and (28) hold for all r, s 0. The identities (27) and (29) then follow (26) and (28) and the recurrence (17). Theorem 3.1 now follows directly from Propositions 3.5 and 3.3. We shall now determine the P -numbers of Q(m, q) for even q from the Q-numbers and thereby prove Theorem 3.2. We begin with stating the Q-numbers of Q(m, q) in the following alternative form.
We now use Proposition 3.6 to prove the following counterpart of Proposition 3.6 for the P -numbers.
Proof. We use the orthogonality relation [7, (17)], for example). This shows that the matrix Therefore, letting B ∈ S − r , we have by the orthogonality of characters. From the orthogonality relation (39) we then conclude that which, in view of the character sum representation (11) of the P -numbers, proves

Kai-Uwe Schmidt
The other identities can be proved similarly. Let Q + s be the set of all quadratic forms in Q(m, q) of rank 2s or 2s + 1 and let S + r be the set of all symmetric matrices in S (m, q) of rank 2r or 2r + 1. From (31), (32), and (10) we see that Let B ∈ S + r . We then find that From (39) we conclude that which together with (11) proves (36).
We now complete the proof of Theorem 3.2, which gives explicit expressions for the P -numbers.
Proof of Theorem 3.2. The P -numbers of Q(m, q) are uniquely determined by Proposition 3.7. We therefore just need to verify that the P -numbers claimed in the theorem satisfy the equations in Proposition 3.7. The identities (36), (37), and (38) are trivially satisfied. The identity (35) is verified using (34) and For even m, this last identity can be proved directly using (12). For odd m, first apply (34) and then (12).

Subsets of quadratic and symmetric bilinear forms
4.1. Inner distributions, codes, and designs. In what follows, let X = X (m, q) be either Q(m, q) or S (m, q). Accordingly, for i ∈ I, let X i be either Q i or S i and let (R i ) be the corresponding relations on X defined in (6) and (9). Let X be a subset of X and associate with X the rational numbers so that a i is the average number of pairs in X ×X whose difference is contained in X i . The sequence of numbers (a i ) i∈I is called the inner distribution of X. Let Q k (i) be the Q-numbers of (X , (R i )). The dual inner distribution of X is the sequence of numbers (a k ) k∈I , where It is a well known fact of the general theory of association schemes that the numbers a k are nonnegative (see [8,Theorem 3], for example).
It is readily verified that the mapping ρ : X × X → Z, given by is a distance function on X . Accordingly, given an integer d satisfying 1 d m, we say that X is a d-code in X if rank(A−B) d for all distinct A, B ∈ X. Alternatively, writing we can define X to be a d-code if a i = 0 for each i ∈ I d−1 .
We say that X is a t-design if a k = 0 for each k ∈ I t .
A subset X of X is additive if X is a subgroup of (X , +). Note that the inner distribution (a i ) i∈I of an additive subset X of X satisfies The following MacWilliams-type identity is a special case of a general property of association schemes (see [8, Theorem 27], for example).
Theorem 4.1. Let X be an additive subset of X with inner distribution (a i ) i∈I and dual inner distribution (a k ) k∈I and let X • be its annihilator with inner distribution (a • k ) k∈I . Then we have |X|a • k = a k .

Subsets of symmetric bilinear forms.
In this section, we prove bounds on the size of d-codes in S . We begin with the following proposition.
The following theorem was obtained in [21] in the case that q is odd and in [20] in the case that q is even and d is odd. The case that q and d are even is new.

Moreover, in the case of odd d, equality occurs if and only if Z is a t-design for
Proof. As remarked above, the only new case arises when q is even. When q is odd, the theorem was proved in [21, Lemmas 3.5 and 3.6] using the identities for A s and C s in Proposition 4.2. Since these do not involve C r (which is the only quantity in the conclusion of Proposition 4.2 that crucially depends on the parity of q), the proofs of [21, Lemmas 3.5 and 3.6] carry over verbatim to the case that q is even.
We call a d-code Y in S (m, q) maximal if d is odd and equality holds in Theorem 4.3. We shall see in Section 5 that maximal d-codes in S exist for all possible parameters.
The situation for even d is somewhat mysterious. Theorem 4.3 gives bounds for the largest additive d-codes in S (m, q) in this case and there certainly exist d-codes that are larger than the largest possible additive d-code [22]. For example, the largest additive 2-code in S (3, 2) has 16 elements by Theorem 4.3, whereas the largest 2code in S (3, 2) has 22 elements [22]. In fact, this 2-code is essentially unique and can be constructed by taking the zero matrix together with all 21 nonalternating 3 × 3 symmetric matrices of rank 2. Moreover, [22] contains (not necessarily optimal) d-codes in S (m, q) for many small values of q, m, and even d, which are larger than the largest additive d-codes in S (m, q).
Algebraic Combinatorics, Vol. 3 #1 (2020) 4.3. Subsets of quadratic forms. In this section, we prove bounds on the size of d-codes in Q. We begin with the following counterpart of Proposition 4.2.
In the next theorem, we give bounds for d-codes in Q. Since the association schemes on Q(m, q) and S (m, q) are isomorphic for odd q, the statement of Theorem 4.3 still holds when Z is a d-code in Q(m, q) and q is odd. We therefore give bounds for d-codes in Q(m, q) only for even q.

Moreover, in the case of odd d, equality occurs if and only if Y is a t-design for
Proof. Let (a i ) i∈I be the inner distribution of Y . First assume that d is odd, say d = 2δ − 1. Let A s and A r be as defined in Proposition 4.4 and put n = (m + 1)/2 and c = q m(m+1)/(2n) .

From Proposition 4.4 and (13) we obtain
Since A 0 = |Y | and A 0 = 1 and A s = 0 for 0 < s < δ, we obtain Since the numbers A r are nonnegative, the left-hand side is nonnegative, and therefore |Y | c n−δ+1 , as required. Moreover, this inequality is an equality if and only if A 1 = · · · = A n−δ+1 = 0, which is equivalent to Y being a t-design for t = 2(n − δ + 1). and find, similarly as above, Again, we have |Y | c n−δ+1 , which completes the proof.
We call a d-code Y in Q(m, q) maximal if equality holds in Theorem 4.5 or in Theorem 4.3, unless q is odd and d is even. We shall see in Section 5 that maximal d-codes in Q exist for all possible parameters.
An interesting situation, in particular from the coding-theoretic viewpoint of Section 6, occurs for d-codes in Q, when d and m are even and no difference between distinct elements is hyperbolic of rank d. We call such a set an elliptic d-code.

Moreover, equality occurs if and only if Y is a t-design for
Proof. Write δ = d/2 and n = m/2. Let (a i ) i∈I be the inner distribution of Y and let A s , A r , C s , and B r be as defined in Proposition 4.4. From Proposition 4.4 and (13) we obtain and therefore, since A s = C s = 0 for 0 < s < δ, We have since Y is an elliptic (2δ)-code. Since A 0 = C 0 = 1 and A 0 = |Y | and B 0 = |Y | + a 1 , we then obtain Since the left-hand side is nonnegative, we find that Moreover, equality occurs if and only if q δ A r +B r = 0 for all r satisfying 1 r n−δ, or equivalently if and only if Y is a t-design for t = m − d + 1.
Algebraic Combinatorics, Vol. 3 #1 (2020) We call an elliptic (2δ)-code Y in Q(2n, q) maximal if equality holds in Theorem 4.6. We shall see in Section 5 that maximal elliptic d-codes in Q(m, q) exist for all possible parameters. Z is a subset of S (m, q) such that the bound in Theorem 4.3 holds with equality, then in many cases [20] and [21] give explicit expressions for the inner distribution of Z. These results carry over to subsets of Q(m, q) in the case that q is odd.

Inner distributions of maximal codes. If
In this section we provide explicit expressions for the inner distributions of maximal d-codes in Q(m, q). We note that, once we know Proposition 4.4 for even q, the results in this section can be proved with methods that are very similar to those of [21,Section 3.3]. Hence the proofs in this section are sketched only.
Our first result holds for d-codes in Q(m, q), where d is odd.
where d is odd, then Theorems 4.3 and 4.5 imply that Y is a t-design for For odd q, the theorem is then [21, Theorem 3.9] and its proof relies just on Proposition 4.2. For even q, the proof is almost identical if we use Proposition 4.4 instead of Proposition 4.2.
The next result holds for maximal d-codes in Q(m, q) when q is even and d is even. In this case, the inner distribution is only partially determined. It is not clear whether there exist such d-codes with different inner distributions.
Algebraic Combinatorics, Vol. 3 #1 (2020) Theorem 4.8. If q is even and Y is a maximal (2δ)-code in Q(m, q), then its inner distribution (a i ) i∈I satisfies a 2s,1 + a 2s,−1 + a 2s+1 = n s Proof. Let B s and C r be defined as in Proposition 4.4, so that In particular B s = a 2s,1 + a 2s,−1 + a 2s+1 . If Y is a maximal (2δ)-code in Q(m, q), then we conclude from the proof of Theorem 4.5 that C r = 0 for all r satisfying 1 r n − δ + 1. This gives enough equations to solve for the numbers B s . The solution is given by [21,Lemma 3.8].
The final result of this section concerns maximal elliptic (2δ)-codes in Q(2n, q). Theorem 4.9. If Y is a maximal elliptic (2δ)-code in Q(2n, q), then its inner distribution (a i ) i∈I satisfies Proof. If Y is a maximal elliptic (2δ)-code in Q(2n, q), then by Theorem 4.6 we have |Y | = q 2n(n−δ+1/2) and Y is a (2n − 2δ + 1)-design. The proof is then identical to that of the first part of [21, Proposition 3.10].

Constructions
In this section we provide constructions of maximal d-codes in S (m, q) and Q(m, q) using field extensions of F q . Throughout this section we take V = F q m and use the relative trace function Tr m : F q m → F q , which is given by

Canonical representations.
In what follows we give canonical representations of quadratic forms Q and symmetric bilinear forms S on F q m and describe the pairing Q, S in terms of these representations.
Theorem 5.1. Let Q ∈ Q(m, q) be a quadratic form and let S ∈ S (m, q) be a symmetric bilinear form.
(1) If m is odd, say m = 2n − 1, then there exist unique f 0 , . . . , f n−1 ∈ F q m and g 0 , . . . , g n−1 ∈ F q m such that Q is given by Tr m (f i x q i +1 ) Algebraic Combinatorics, Vol. 3 #1 (2020) and S is given by Tr m (g i (xy q i + x q i y)).
Moreover, there are F q -bases for F q m such that with respect to these bases we have Tr m (f i g i ) .
(2) If m is even, say m = 2n, then there exist unique f 0 , . . . , f n−1 ∈ F q m and g 0 , . . . , g n−1 ∈ F q m and f n , g n ∈ F q n such that Q is given by Tr m (f i x q i +1 ) + Tr n (f n x q n +1 ) and S is given by Tr m (g i (xy q i + x q i y)) + Tr m (g n xy q n ).
Moreover, there are F q -bases for F q m such that with respect to these bases we have Tr m (f i g i ) + Tr n (f n g n ) .
To prove Theorem 5.1, we require some notation and a lemma. Given a linearised polynomial L ∈ F q m [X] of the form where P ∈ F m×m q is given by where the index is taken modulo m. We conclude that R = D L P T , as required.
We now prove Theorem 5.1. cases can be proved similarly, which we leave to the reader. This proves the existence and uniqueness of the f i 's and the g i 's. It remains to prove the expressions for the pairing Q, S . We present the proof only in the case that m is odd. Slight modifications also give a proof for even m. Let {α 1 , α 2 , . . . , α m } and {β 1 , β 2 , . . . , β m } be a pair of dual F q -bases for F q m , that is We use the former basis to associate cosets of alternating matrices with quadratic forms and the latter to associate symmetric matrices with symmetric bilinear forms. It will be convenient to define the m×m matrices U and V by U ij = α q j i and V ij = β q j i . Notice that the duality of the two involved bases implies U V T = I, and so U T V = I.
Define the linearised polynomials Then we have S(x, y) = Tr m (x(G 0 (y) + G 1 (y))) and so the matrix B of S is given by To associate cosets of alternating matrices with quadratic forms, we distinguish the cases that q is odd or even. For odd q, let A be the unique symmetric matrix associated with the quadratic form Q. From (2) we find that this matrix is given by Tr m (f i g i ), as required. For even q, let A be the unique upper triangular matrix associated with Q. From (2) we find that this matrix is given by A ii = Q(α i ) and A ij = Q(α i +α j )−Q(α i )−Q(α j ) for i < j. In fact, it is more convenient to work with a slightly different matrix of Q, namely A = A 0 + A 1 , where A 0 and A 1 are given by Algebraic Combinatorics, Vol. 3 #1 (2020) Notice that A − A is alternating, which is in fact the off-diagonal part of A 0 . Therefore A and A represent the same quadratic form. We have Using Lemma 5.2 we have Now define an inner product on alternating matrices in F m×m This inner product satisfies for every W ∈ F m×m q . Using this property and Lemma 5.2, we obtain Tr m (f i g i ).
Now, since A 0 is symmetric and B 1 is alternating, we have tr It remains to prove the claim. The required matrix E is given by E = V T A 1 V , and so for every i, we have using (42) where v i is the i-th column of V . Since V T U = I, we find that the main diagonal of E equals the main diagonal of D F2 , which is zero. This proves the claim.

The constructions.
We now give constructions of maximal d-codes in S (m, q) and Q(m, q). We begin with recalling constructions from [20] and [21] of additive d-codes in S (m, q).
Then Z is an additive d-code in S (m, q) of size q m(m−d+2)/2 . In particular, Z is a maximal d-code in S (m, q) for odd m and is maximal among additive d-codes in S (m, q) for even m.
Whenever m−d is odd, Theorem 5.3 gives (d+2)-codes Z in S (m+1, q) for which equality holds in Theorem 4.3. Let W be an m-dimensional subspace of V (m + 1, q) and define the punctured set (with respect to W ) of Z to be where S| W is the restriction of S onto W . Then Z * is a d-code in S (m, q) for which again equality holds in Theorem 4.3. This shows that Z * is a maximal dcode in S (m, q) for odd d and is maximal among additive d-codes in S (m, q) for even d.
For odd q, Theorem 5.1 of course also gives corresponding sets of quadratic forms by associating a quadratic form Q with S via Q(x) = 1 2 S(x, x). It therefore remains to give constructions of maximal d-codes in Q(m, q) for even q. The following consequence of Theorems 5.1 and 5.3 gives a construction for d-codes in Q(m, q) when both m and d are odd (and where q can have either parity).
Then Y is additive and a maximal d-code in Q(m, q) of size q m(m−d+2)/2 .
Proof. It is plain that Y is additive and has size q m(m−d+2)/2 . From Theorems 5.1 and 5.3 we find that the annihilator of Y • of Y is a maximal (m − d + 3)-code in S (m, q). Theorem 4.3 implies that Y • is a (d − 1)-design and Theorem 4.1 then implies that Y is a d-code. From Theorem 4.5 we find hat Y is maximal.
Whenever d is odd and m is even, Theorem 5.4 gives maximal (d + 2)-codes Y in Q(m + 1, q). In fact, Theorem 4.5 implies that Y is also a maximal (d + 1)-code in Q(m + 1, q). Let W be an m-dimensional subspace of V (m + 1, q) and define the punctured set (with respect to W ) of Y to be where Q| W is the restriction of Q onto W . Then Y * is a maximal d-code in Q(m, q). This leaves the case that m and d are both even. In this case we have the following construction, which identifies V with F q m−1 × F q and is essentially contained in [7].
Algebraic Combinatorics, Vol. 3 #1 (2020) Theorem 5.5. Let q be even, let m and d be even integers satisfying 1 d m, and let Y be the subset of Q(m, q) formed by the quadratic forms Proof. The quadratic form Q polarises to the bilinear form It is known [7,Theorem 9] that the difference between two such forms for distinct (f 0 , f 1 , . . . , f (m−d)/2 ) has rank at least d. Therefore Y is a d-code in Q(m, q) of size q (m−1)(m−d+2)/2 , hence a maximal d-code in Q(m, q) by Theorem 4.5.
We close this section by giving a construction for maximal elliptic d-codes in Q(m, q).
Theorem 5.6. Let m be even and write m = 2n. Let δ be an integer satisfying 1 δ n and let Y be the subset of Q(m, q) formed by the quadratic forms Then Y is a maximal elliptic (2δ)-code in Q(m, q) of size q m(n−δ+1/2) .
Proof. It is plain that Y is additive. A straightforward computation gives Since L(x q 2n−δ ) is induced by a polynomial of degree at most 2n − 2δ, we find that Q has rank at least 2δ, unless f δ = · · · = f n = 0. Hence Y is (2δ)-code of size q m(n−δ+1/2) . Let (a i ) i∈I be the inner distribution of Y and let A s , A r , C s , and B r be as defined in Proposition 4.4. By Theorems 5.1 and 5.3, the annihilator Y • of Y is a (2n − 2δ + 2)code in S (m, q). Thus Theorem 4.1 implies that A r = B r = 0 for all r satisfying 1 r n − δ. As in the proof of Theorem 4.6, we find that n δ (q δ A 0 + B 0 ) = q (m+1)(n−δ) q δ n δ (A 0 + q δ C 0 ) + A δ + q δ C δ .

Applications to classical coding theory
In this section we construct classical error-correcting codes over finite fields from subsets of Q(m, q), extending results from [21] for odd q.
A code over F q of length n is a subset of F n q ; such a code is additive if it is a subgroup of (F n q , +). The (Hamming) weight of c ∈ F n q , denoted by wt(c), is the number of nonzero entries in c. This weight induces a distance on F n q and the smallest distance between two distinct elements of a code C is called the minimum distance of C. We associate with a code C the polynomials and which are called the weight enumerator and the distance enumerator of C, respectively. Note that, if C is additive, then its weight enumerator coincides with its distance enumerator.
As usual, we let V = V (m, q) be an m-dimensional F q -vector space and Q(m, q) the set of quadratic forms on V . Since for every quadratic form Q : V → F q we have Q(0) = 0, we shall identify functions from V to F q with vectors F V * q , where Let R q (1, m) * be the set of all q m+1 affine functions from V to F q . This code has length q m − 1 and is the punctured version of the generalised first-order Reed-Muller code R q (1, m) of length q m . If we identify V with F q m , then R q (1, m) * consists of the functions F q m → F q x → Tr m (ax) + c, a ∈ F q m , c ∈ F q .
We shall associate codes with subsets Y of Q(m, q) by taking cosets of R q (1, m) * with coset representatives from Y . Care must be taken in the case that q = 2 since x 2 = x for all x ∈ F 2 , which implies that every quadratic form in Q(m, 2) of rank 1 is in fact also a linear function. Accordingly, we define a subset Y of Q(m, q) to be nondegenerate if q > 2 or if q = 2 and Y contains no forms of rank 1. For every nondegenerate subset Y of Q(m, q), we define the code C(Y ) of size q m+1 |Y | by If Y equals Q(m, q), then C(Y ) is the punctured version R q (2, m) * of the generalised second-order Reed-Muller code R q (2, m) of length q m .
Berlekamp [4] and Kasami [14] studied cyclic codes of the form C(Y ) and related codes for other specific subsets Y of Q(m, 2). They determined the distance enumerators of such codes using methods that are completely different from our methods. Many of these results can be recovered and generalised to q > 2 using Theorems 4.7 and 4.9 together with Theorem 6.2 or some suitable modification.
For q = 2, the extended version of C(Y ) is known as the Delsarte-Goethals code and for 2δ = m it is known as the Kerdock code [18,Ch. 15].