EUROPEAN JOURNAL OF PURE AND APPLIED MATHEMATICS Vol. 13, No. 4, 2020, 873-892 ISSN 1307-5543 – www.ejpam.com Published by New York Business Global Self-orthogonal Codes over Fq + uFq and Fq + uFq + u2Fq Lucky Erap Galvez1,∗, Rowena Alma Betty1, Fidel Nemenzo1 1 Institute of Mathematics, University of the Philippines Diliman, Quezon City, Philippines Abstract. In this paper, we establish a mass formula for Euclidean and Hermitian self-orthogonal codes over the finite ring Fq + uFq, where Fq is the finite field of order q and u2 = 0. We also establish a mass formula for Euclidean self-orthogonal codes over the finite ring Fq + uFq + u2Fq, with u3 = 0 and characteristic of Fq is odd. These mass formulas are used to give a classification of Euclidean and Hermitian self-orthogonal codes over F2 + uF2 and F3 + uF3 of small lengths. 2020 Mathematics Subject Classifications: 94B05 Key Words and Phrases: Codes over rings, self-orthogonal codes, mass formula 1. Introduction Self-dual codes have rich mathematical theory and are of great interest to researchers because many of the best known codes are self-dual. A fundamental problem in coding theory is the classification of self-dual codes, that is, an enumeration of a complete set of representatives for the equivalence classes of self-dual codes. In the past years, self-dual codes over finite fields have been extensively studied and classified up to various lengths (see [8, 11]). Since the discovery in 1994 [7] that certain non-linear binary codes can be viewed as linear codes over the ring Z4, there has been much interest in the study of self-dual codes over various finite rings. A key problem is to establish an explicit formula for the number of distinct self-dual codes of length n over a ring R, given by∑ C |En| |Aut(C)| where C runs through the set of all inequivalent self-dual codes of length n over R, En is the full group of transformations allowed in defining the equivalence for code C and Aut(C) is the automorphism group. This is called the mass formula, and is an important computational tool for the classification of such codes. Mass formulas for self-dual codes ∗Corresponding author. DOI: https://doi.org/10.29020/nybg.ejpam.v13i4.3838 Email addresses: legalvez@math.upd.edu.ph (L. E. Galvez), rabetty@math.upd.edu.ph (R. A. Betty), fidel@math.upd.edu.ph (F. Nemenzo) https://www.ejpam.com 873 c© 2020 EJPAM All rights reserved. L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 874 over finite rings rings such as Z4 and Fq + uFq were given in [6], while [3] gave the mass formula for self-dual codes over Fq + uFq + u2Fq. In this paper, we focus on the more general mass formula for self-orthogonal codes, which will include the mass formula for self-dual codes as a special case. Mass formulas for self-orthogonal codes over Zp2 , where p is a prime, were given in [2], while the mass formula for even codes over Z8, i.e., self-orthogonal codes whose codewords have Euclidean weights divisible by 16, was computed in [1]. Codes over Fq + uFq and Fq + uFq + u2Fq have an invariant called type, denoted by {k0, k1} and {k0, k1, k2}, respectively, where k0, k1 and k2 are nonnegative integers. The type of a code is determined by its residue and torsion codes. To obtain the mass formula, we will determine the number of self-orthogonal codes of length n over Fq + uFq with given residue and torsion, and compute the number of self-orthogonal codes of length n over Fq + uFq + u2Fq, for odd q, with given u2-Residue and torsion. We also give a classification of Euclidean and Hermitian self-orthogonal codes over F2+uF2 and F3+uF3, up to some short lengths. 2. Codes over Fq + uFq We begin with some basic concepts about codes over rings. A linear code C of length n over a ring R is a submodule of the Rn module. A generator matrix for C is a matrix G ∈ Mk×n(R) whose rows generate the code. For a matrix G ∈ Mk×n(R), we denote by RkG the code {aG | a ∈ Rk} of length n over R. Let q be a power of a prime and Fq denote the finite field of q elements. Let R1 be the commutative ring Fq[u]/(u2) = Fq + uFq, where u2 = 0. This finite chain ring is a local ring with unique maximal ideal (u) and residue field Fq + uFq/(u) = Fq. Every code C of length n over R1 is permutation-equivalent to a code with the following generator matrix,[ Ik0 A+ uB 0 uD ] , (1) where Ik0 is the k0 × k0 identity matrix, A,B ∈Mk0×(n−k0)(Fq) and D ∈Mk1×(n−k0)(Fq). Such a code C is said to be of type {k0, k1}. The code C is said to be free if k1 = 0. The type is the analog of the dimension of a code over a finite field. Such a code C contains q2k0+k1 codewords. Let x = (x1, x2, . . . , xn) and y = (y1, y2, . . . , yn) be elements of Rn1 . Define the Eu- clidean inner product on Rn1 as 〈x, y〉E = ∑n i=1 xiyi. Now, let z = a+ ub ∈ R1 and define z = a−ub. The Hermitian inner product on Rn1 is defined as 〈x, y〉H = ∑n i=1 xiyi. The set C⊥ = {x ∈ Rn1 | 〈x, y〉 = 0 ∀y ∈ C} is called the Euclidean or Hermitian dual of C, depending on which inner product 〈x, y〉 is used. The code C is said to be Euclidean or Hermitian self-orthogonal if C ⊆ C⊥. If C = C⊥, then we say C is Euclidean or Hermitian self-dual. Let C be a code over R1. The code { v ∈ Fnq | ∃w ∈ Fnq , v + uw ∈ C } is called the residue code of C and is denoted by res(C). The code { v ∈ Fnq |uv ∈ C } is called the L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 875 torsion code of C and is denoted by tor(C). If C has generator matrix (1), then res(C) and tor(C) are [n, k0] and [n, k0 + k1] codes over Fq, with generator matrices [ Ik0 A ] and [ Ik0 A 0 D ] , respectively. Clearly, res(C) ⊆ tor(C) and |C| = q2k0+k1 = |res(C)||tor(C)|. The following lemma shows the relationship between the residue and torsion codes of a self-orthogonal code over R1. The proof is given in [6]. Lemma 1. Let C be a (Euclidean or Hermitian) self-orthogonal code over R1. Then (i) res(C) is self-orthogonal, i.e. res(C) ⊆ res(C)⊥; (ii) tor(C) ⊆ res(C)⊥. In particular, if C is (Euclidean or Hermitian) self-dual, tor(C) = res(C)⊥. 3. Codes over Fq + uFq with prescribed residue and torsion Let C1 be a code of length n over Fq with dimension k0 and generator matrix[ Ik0 A ] , (2) and C2 a code of length n over Fq of dimension k0 + k1 and has generator matrix[ Ik0 A 0 D ] , (3) where A ∈Mk0×(n−k0)(Fq), and D ∈Mk1×(n−k0)(Fq) is of full row rank. Lemma 2. If C is a code of length n over R1 with res(C) = C1 and tor(C) = C2, then there exists a matrix N ∈Mk0×(n−k0)(Fq) such that the matrix[ Ik0 A+ uN 0 uD ] (4) is a generator matrix of C. Such matrix N is unique if C is a free code. Proof. Since the residue and torsion codes of C are C1 and C2, respectively, then for some M1 ∈Mk0(Fq) and M2 ∈Mk0×(n−k0)(Fq), Rk0+k11 [ Ik0 + uM1 A+ uM2 0 uD ] ⊆ C. By an elementary row operation, L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 876 C ⊇ Rk0+k11 [ Ik0 − uM1 0 0 Ik1 ] [ Ik0 + uM1 A+ uM2 0 uD ] = Rk0+k11 [ Ik0 A+ u(M2 −M1A) 0 uD ] . Taking N = M2 −M1A, we have |C| ≥ ∣∣∣∣Rk0+k11 [ Ik0 A+ uN 0 uD ]∣∣∣∣ = q2k0+k1 = |C1| |C2| = |C| . Thus, C has a generator matrix (4). Suppose C is a free code and there exist N1, N2 ∈Mk0×(n−k0)(Fq) such that Rk01 [I A+ uN1] = Rk01 [I A+ uN2] . Then A+ uN1 ≡ A+ uN2 (u2), which implies that N1 ≡ N2 (u). � For the remainder of this section, assume that C1 ⊆ C2 ⊆ C⊥1 . Then Ik0 +AAT ≡ 0 (u), (5) DAT ≡ 0 (u). (6) It follows from (5) that A is of full row rank. Denote by Symk0(Fq) the set of k0×k0 symmetric matrices, Altk0(Fq) the set of k0×k0 alternating matrices, and Skewk0(Fq) the set of k0 × k0 skew-symmetric matrices over Fq. Lemma 3. Let A ∈Mm×n(Fq) where rank A = m. We define the mappings ΨA : Mm×n(Fq) −→ Mm(Fq) N 7−→ ANT +NAT , and ΦA : Mm×n(Fq) −→ Mm(Fq) N 7−→ ANT −NAT . Then ΨA (Mm×n(Fq)) = { Symm(Fq), if q is odd Altm(Fq), if q is even, and the image of the map ΦA is Skewm(Fq). L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 877 Proof. The image of ΨA was shown in [2]. Since rank A = m, A(Mn×m(Fq)) = Mm(Fq). Indeed, ΦA(Mk0×(n−k0)(Fq)) = { ANT −NAT | N ∈Mk0×(n−k0)(Fq) } = { S − ST | S ∈Mk0(Fq) } = Skewk0(Fq). � Lemma 4. The number of free Euclidean self-orthogonal codes over R1 with residue code C1 is qk0(2n−3k0+ε)/2, where ε = −1 if q is odd and ε = 1 if q is even. The number of free Hermitian self-orthogonal codes over R1 with residue code C1 is qk0(2n−3k0+1)/2. Proof. If C is a free code with residue code C1, then by Lemma 2, C has generator matrix [ Ik0 A+ uN ] , for some unique N ∈Mk0×(n−k0)(Fq). Observe that C is Euclidean self-orthogonal if and only if Ik0 +AAT + u(ANT +NAT ) ≡ 0 (u2). Hence, the number of free Euclidean self-orthogonal codes C with residue code C1 is∣∣{N ∈Mk0×(n−k0)|Ik0 +AAT + u(ANT +NAT ) ≡ 0 (u2)} ∣∣ . (7) By (5), we have ANT +NAT ≡ 0 (u).Therefore, (7) becomes ∣∣{N ∈Mk0×(n−k0)|AN T +NAT ≡ 0 (u) }∣∣ = |ker ΨA| = ∣∣Mk0×(n−k0) ∣∣ |Im ΨA| . Thus, we have |ker ΨA| = { q k0(2n−3k0−1) 2 , if q is odd q k0(2n−3k0+1) 2 , if q is even, by Lemma 3. Similarly, C is Hermitian self-orthogonal if and only if Ik0 +AAT + u(ANT −NAT ) ≡ 0 (u2). Hence, by (5) and Lemma 3, the number of free Hermitian self-orthogonal codes C with residue code C1 is∣∣{N ∈Mk0×(n−k0)|AN T −NAT ≡ 0 (u) }∣∣ = |ker ΦA| = q k0(2n−3k0+1) 2 . L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 878 � Define the sets X = { C | C ⊆ Rn1 , type {k0, 0}, C ⊆ C⊥, res(C) = C1 } and X ′ = { C ′ | C ′ ⊆ Rn1 , C ′ ⊆ C ′⊥, res(C ′) = C1, tor(C ′) = C2 } , where self-orthogonality is either in the Euclidean or Hermitian sense. Lemma 5. If C ′ ∈ X ′, then |{C ∈ X|C ⊆ C ′}| = qk0k1. Proof. By Lemma 2, C ′ has a generator matrix (4). Consider the map ψ : Mk0×k1(Fq) −→ { C ∈ X | C ⊆ C ′ } M 7−→ Rk01 [I A+ u(N +MD)] . Clearly, ψ is well-defined. We will show that ψ is bijective. If M1,M2 ∈Mk0×k1(Fq) such that ψ(M1) = ψ(M2), then Rk01 [Ik0 A+ u(N +M1D)] = Rk01 [Ik0 A+ u(N +M2D)] which means A + u(N + M1D) ≡ A + u(N + M2D) (u2). Therefore N + M1D ≡ N + M2D (u). Since D is of full row rank, we have M1 ≡M2 (u). Hence, ψ is injective. Suppose C ∈ X and C ⊆ C ′. By Lemma 2, C = Rk01 [Ik0 A+ uF ] , for some matrix F . The inclusion C ⊆ C ′ implies that A+ uF ≡ A+ u(N +MD) (u2) for some matrix M . So F ≡ N + MD (u), which shows that ψ is surjective, and hence, bijective. Therefore, ∣∣{C ∈ X|C ⊆ C ′}∣∣ = |Mk0×k1(Fq)| = qk0k1 . � Lemma 6. If C ∈ X, then there exists a unique code C ′ ∈ X ′ such that C ⊆ C ′. Proof. Since C ∈ X, C has a generator matrix [I A+ uN ] for some unique matrix N , by Lemma 2. Let C ′0 be a code with generator matrix[ Ik0 A+ uN 0 uD ] . The code C ′0 satisfies res(C ′0) = C1 and tor(C ′0) = C2. Clearly, C ⊆ C ′0. Since C ∈ X, (6) implies C ′0 is self-orthogonal and hence, C ′0 ∈ X ′. Suppose C ⊆ C ′ for some C ′ ∈ X ′. Because C ′ has torsion code C2, by Lemma 2, Rk11 [0 uD] ⊆ C ′ and so C ′0 ⊆ C ′. Note that |C ′0| = |C1| |C2| = q2k0+k1 = |C ′|. Hence, C ′0 = C ′. � Next, we count self-orthogonal codes C with given residue code and torsion code. L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 879 Theorem 1. Let C1 and C2 be codes of length n over Fq where C1 ⊆ C2 ⊆ C⊥1 . If dim C1 = k0 and dim C2 = k0 + k1, then (i) the number of Euclidean self-orthogonal codes C of length n over Fq + uFq with res(C) = C1 and tor(C) = C2 is qk0(2n−3k0−2k1+ε)/2, where ε = −1 if q is odd and ε = 1 if q is even, and (ii) the number of Hermitian self-orthogonal codes C of length n over Fq + uFq with res(C) = C1 and tor(C) = C2 is qk0(2n−3k0−2k1+1)/2. Proof. We may assume without loss of generality that C1 and C2 are codes with generator matrices (2) and (3), respectively. Then we have to compute |X ′|. By Lemma 5 and Lemma 6, we have qk0k1 ∣∣X ′∣∣ = ∑ C′∈X′ ∣∣{C ∈ X|C ⊆ C ′}∣∣ = ∑ C∈X ∣∣{C ′ ∈ X ′|C ⊆ C ′}∣∣ = ∑ C∈X 1 = |X| . The results follow from Lemma 4. � 4. Mass formula for self-orthogonal codes over Fq + uFq Let σq(n, k0) denote the number of distinct self-orthogonal codes over Fq of length n and dimension k0 (see [9, 10]). We define the Gaussian coefficient [ n k ] q for k ≤ n as [ n k ] q = (qn − 1)(qn − q) · · · (qn − qk−1) (qk − 1)(qk − q) · · · (qk − qk−1) , which gives the number of subspaces of dimension k contained in an n-dimensional vector space over Fq. We now have the following mass formula for self-orthogonal codes over R1. L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 880 Theorem 2. Let Mq(n, k0, k1)E and Mq(n, k0, k1)H denote the number of distinct Eu- clidean and Hermitian self-orthogonal codes of length n over Fq + uFq of type {k0, k1}, respectively. We have Mq(n, k0, k1)E = σq(n, k0) [ n− 2k0 k1 ] q qk0(2n−3k0−2k1+ε)/2 where ε = −1 if q is odd and ε = 1 if q is even, and Mq(n, k0, k1)H = σq(n, k0) [ n− 2k0 k1 ] q qk0(2n−3k0−2k1+1)/2. Proof. If C is a self-orthogonal code of length n over Fq +uFq of type {k0, k1}, then by setting C1 = res(C) and C2 = tor(C), we see that C1 and C2 satisfies Lemma 1. There are σq(n, k0) self-orthogonal codes C1 of length n over Fq. Given C1, there are [ n− 2k0 k1 ] q codes C2 such that C1 ⊆ C2 ⊆ C⊥1 . Then the result follows from Theorem 1. � We have the following mass formula for self-dual codes over R1 as a direct consequence of the previous theorem. Corollary 1. The number of distinct Euclidean self-dual codes of length n over Fq + uFq is given by ∑ 0≤k0≤bn2 c σq(n, k0)q k0(k0+ε)/2, (8) where ε = −1 if q is odd and ε = 1 if q is even, and the number of distinct Hermitian self-dual codes of length n over Fq + uFq is given by∑ 0≤k0≤bn2 c σq(n, k0)q k0(k0+1)/2. (9) Proof. Note that the number of distinct Euclidean self-dual codes and the number of distinct Hermitian self-dual codes of length n over Fq + uFq are given by∑ 0≤k0≤bn2 c Mq(n, k0, n− 2k0)E , and ∑ 0≤k0≤bn2 c Mq(n, k0, n− 2k0)H , respectively. � In [6, Theorem 3], Gaborit establishes the mass formula for Hermitian self-dual codes over Fq + uFq, but gives the formula for Euclidean self-dual codes instead. The formula (9) corrects this. Next, we establish another formula for the number of distinct Euclidean self-orthogonal codes when the given torsion is self-orthogonal. L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 881 Corollary 2. Suppose q is odd. The number of distinct Euclidean self-orthogonal codes of length n over Fq + uFq of type {k0, k1} with self-orthogonal torsion is M̃q(n, k0, k1)E = [ k0 + k1 k0 ] q σq(n, k0 + k1)q k0(2n−3k0−2k1−1)/2. Proof. Let C1 and C2 be self-orthogonal codes where dim C1 = k0, dim C2 = k0 + k1 and C1 ⊆ C2 . By Theorem 2, we have M̃q(n, k0, k1)E q −k0(2n−3k0−2k1−1)/2 = ∑ C2⊆C⊥2 |{C1 | C1 ⊆ C2}| = [ k0 + k1 k0 ] q ∣∣∣{C2 | C2 ⊆ C⊥2 }∣∣∣ = [ k0 + k1 k0 ] q σq(n, k0 + k1). � This corollary will be useful in our mass formula computations on later chapters. 5. Classification of self-orthogonal codes over Fq + uFq Using Theorem 2, we classify Euclidean and Hermitian self-orthogonal codes over F2 + uF2 and F3 + uF3, of given type for small lengths. Note that two codes over F2 + uF2 are equivalent if one can be obtained from the other by permuting the coordinates and (if necessary) multiplying certain coordinates by 1 + u. On the other hand, two Euclidean self-orthogonal codes over F3+uF3 are equivalent if one can be obtained from the other by permuting the coordinates and (if necessary) multiplying certain coordinates by 2, and two Hermitian self-orthogonal codes over F3 + uF3 are equivalent if one can be obtained from the other by permuting the coordinates and (if necessary) multiplying certain coordinates by r, where r ∈ {2, 1 + u, 1 + 2u, 2 + u, 2 + 2u}. To illustrate, we classify Euclidean self-orthogonal codes over F3 +uF3 of length 4 and type {2, 0}. Let C1 and C2 be inequivalent Euclidean self-orthogonal codes over F3 + uF3 of length 4 and type {2, 0} with generator matrices[ 1 0 2 2 0 1 2 1 ] and [ 1 0 2 + 2u 2 + u 0 1 2 + u 1 + u ] , respectively. The order of their automorphism groups are 48 and 24, respectively. Hence, 2∑ j=1 |E4| |Aut(Cj)| = 24 · 4! 48 + 24 · 4! 24 = 8 + 16 = 24. From Theorem 2, M3(4, 2, 0)E = σ3(4, 2) [ 4− 2 · 2 0 ] 3 32(8−6−0−1)/2 = 8 · 1 · 3 = 24. L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 882 Therefore, there are two Euclidean self-orthogonal codes of length 4 and type {2, 0} over F3 + uF3, up to equivalence. We note that Euclidean self-orthogonal and Hermitian self-orthogonal codes coincide over F2 + uF2, as well as in codes over F3 + uF3 of type {0, k1}. Table 1 gives the number of inequivalent Euclidean self-orthogonal codes over F2 + uF2 of lengths 2 up to 7, while Table 2 gives the number of inequivalent Euclidean and Hermitian self-orthogonal codes over F3+uF3 of lengths 2 up to 6, for each type. Note that the code of length 1 with generator matrix [u] is a Euclidean self-orthogonal and Hermitian self-orthogonal code over Fq+uFq. Therefore, there is a self-orthogonal code for any length n, since one can just form a direct sum of this length 1 code. Our classification of self- orthogonal codes over F2+uF2 agrees with the enumeration in [5] for self-dual codes (codes of type {k0, n− 2k0}) up to length n = 7. Generators and the order of the automorphism group of each code in Table 1 and Table 2 may be requested by the interested reader from the authors. All computer calculations in this paper were done with the help of Magma[4]. Table 1: The number of inequivalent self-orthogonal codes of lengths 2 ≤ n ≤ 7 over F2 + uF2 {n, k0, k1} Number of {n, k0, k1} Number of {n, k0, k1} Number of Codes Codes Codes {2, 1, 0} 1 {5, 2, 1} 2 {6, 0, 6} 1 {2, 0, 1} 2 {5, 0, 1} 5 {7, 1, 0} 12 {2, 0, 2} 1 {5, 0, 2} 10 {7, 1, 1} 54 {3, 1, 0} 2 {5, 0, 3} 10 {7, 1, 2} 100 {3, 1, 1} 1 {5, 0, 4} 5 {7, 1, 3} 73 {3, 0, 1} 3 {5, 0, 5} 1 {7, 1, 4} 24 {3, 0, 2} 3 {6, 1, 0} 9 {7, 1, 5} 3 {3, 0, 3} 1 {6, 1, 1} 29 {7, 2, 0} 43 {4, 1, 0} 4 {6, 1, 2} 36 {7, 2, 1} 74 {4, 1, 1} 5 {6, 1, 3} 16 {7, 2, 2} 40 {4, 1, 2} 2 {6, 1, 4} 3 {7, 2, 3} 5 {4, 2, 0} 2 {6, 2, 0} 19 {7, 3, 0} 22 {4, 0, 1} 4 {6, 2, 1} 18 {7, 3, 1} 5 {4, 0, 2} 6 {6, 2, 2} 5 {7, 0, 1} 7 {4, 0, 3} 4 {6, 3, 0} 4 {7, 0, 2} 23 {4, 0, 4} 1 {6, 0, 1} 6 {7, 0, 3} 43 {5, 1, 0} 6 {6, 0, 2} 16 {7, 0, 4} 43 {5, 1, 1} 13 {6, 0, 3} 22 {7, 0, 5} 23 {5, 1, 2} 10 {6, 0, 4} 16 {7, 0, 6} 7 {5, 1, 3} 2 {6, 0, 5} 6 {7, 0, 7} 1 {5, 2, 0} 6 L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 883 Table 2: The number of inequivalent Euclidean and Hermitian self-orthogonal codes of lengths 2 ≤ n ≤ 6 over F3 + uF3 {n, k0, k1} Number of Codes {n, k0, k1} Number of Codes Euclidean Hermitian Euclidean Hermitian {2, 1, 0} 0 0 {5, 2, 1} 2 1 {2, 0, 1} 2 2 {5, 0, 1} 5 5 {2, 0, 2} 1 1 {5, 0, 2} 12 12 {3, 1, 0} 2 1 {5, 0, 3} 12 12 {3, 1, 1} 1 1 {5, 0, 4} 5 5 {3, 0, 1} 3 3 {5, 0, 5} 1 1 {3, 0, 2} 3 3 {6, 1, 0} 12 5 {3, 0, 3} 1 1 {6, 1, 1} 57 27 {4, 1, 0} 4 2 {6, 1, 2} 64 34 {4, 1, 1} 6 4 {6, 1, 3} 20 13 {4, 1, 2} 1 1 {6, 1, 4} 2 2 {4, 2, 0} 2 1 {6, 2, 0} 22 8 {4, 0, 1} 4 4 {6, 2, 1} 18 9 {4, 0, 2} 7 7 {6, 2, 2} 4 3 {4, 0, 3} 4 4 {6, 3, 0} 0 0 {4, 0, 4} 1 1 {6, 0, 1} 6 6 {5, 1, 0} 6 3 {6, 0, 2} 20 20 {5, 1, 1} 19 11 {6, 0, 3} 31 31 {5, 1, 2} 10 7 {6, 0, 4} 20 20 {5, 1, 3} 1 1 {6, 0, 5} 6 6 {5, 2, 0} 4 2 {6, 0, 6} 1 1 6. Codes over Fq + uFq + u2Fq, where q is odd For the rest of this paper, let R2 be the commutative ring Fq[u]/(u3) = Fq+uFq+u2Fq, where u3 = 0 and q is odd. We will only consider Euclidean inner product. A code C of length n over R2 is permutation-equivalent to a code with generator matrix  Ik0 A0 B0 + uB1 + u2B2 0 uIk1 uD1 + u2D2 0 0 u2F2  (10) where F2 ∈Mk2×(n−k0−k1)(Fq) and A0, B0, B1, B2, D1, D2 are matrices of appropriate sizes over Fq. We define the torsion codes of C as follows: tor0(C) = {v ∈ Fnq | ∃w, z ∈ Fnq , v + uw + u2z ∈ C} and tori(C) = {v ∈ Fnq | uiv ∈ C}, for i = 1, 2. The code tor0(C) is also called the residue code of C. Observe that tor0(C) ⊆ tor1(C) ⊆ tor2(C). If C has generator matrix (10), then the residue code tor0(C) has dimension k0 and generator matrix [ Ik0 A0 B0 ] , (11) L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 884 tor1(C) has dimension k0 + k1 and generator matrix[ Ik0 A0 B0 0 Ik1 D1 ] (12) and tor2(C) has dimension k0 + k1 + k2 and generator matrix Ik0 A0 B0 0 Ik1 D1 0 0 F2  (13) where F2 is of full row rank. The code C is of type {k0, k1, k2} and |C| = |tor0(C)| |tor1(C)| |tor2(C)| = q3k0+2k1+k2 . Suppose C is self-orthogonal. Then Ik0 +A0A T 0 +B0B T 0 + u(B0B T 1 +B1B T 0 ) +u2(B0B T 2 +B1B T 1 +B2B T 0 ) ≡ 0 (u3) u(A0 +B0D T 1 ) + u2(B1D T 1 +B0D T 2 ) ≡ 0 (u3) u2(B0F T 2 ) ≡ 0 (u3) u2(Ik1 +D1D T 1 ) ≡ 0 (u3) which give the following: Ik0 +A0A T 0 +B0B T 0 ≡ 0 (u) (14) B0B T 1 +B1B T 0 ≡ 0 (u) (15) B0B T 2 +B1B T 1 +B2B T 0 ≡ 0 (u) (16) A0 +B0D T 1 ≡ 0 (u) (17) B1D T 1 +B0D T 2 ≡ 0 (u) (18) F2B T 0 ≡ 0 (u) (19) Ik1 +D1D T 1 ≡ 0 (u). (20) From (14), tor0(C) is self-orthogonal and by (14), (17) and (20), we have tor1(C) ⊆ tor1(C)⊥, that is, tor1(C) is self-orthogonal. Moreover, by (14), (17) and (19) we have tor0(C) ⊆ tor2(C)⊥. We will introduce another type of residue for a code over R2. Definition 1. Let C be a code over R2. The code over Fq + uFq obtained from C by reduction modulo u2 is called the u2-Residue of C and will be denoted by Res(C). L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 885 It is easy to see that a generator matrix for Res(C) is[ Ik0 A0 B0 + uB1 0 uIk1 uD1 ] . It is also clear that res(Res(C)) = tor0(C), tor(Res(C)) = tor1(C), and Res(C) is of type {k0, k1}. If C is self-orthogonal, by (14), (15) and (17) we have Res(C) ⊆ Res(C)⊥, that is, Res(C) is self-orthogonal of type {k0, k1}. Also, since tor(Res(C)) = tor1(C) ⊆ tor2(C) and tor2(C) ⊆ tor0(C)⊥ = res(Res(C))⊥, we have tor(Res(C)) ⊆ tor2(C) ⊆ res(Res(C))⊥ which gives the following lemma. Lemma 7. Let C be a self-orthogonal code over R2 of type {k0, k1, k2} and let C1 =Res(C) and C2 =tor2(C). Then (i) C1 ⊆ C⊥1 , (ii) tor(C1) ⊆ tor(C1) ⊥, and (iii) tor(C1) ⊆ C2 ⊆ res(C1) ⊥, dim C2 = k0 + k1 + k2. 7. Codes over Fq + uFq + u2Fq with prescribed u2-Residue and torsion For the rest of this chapter, we let C1 be a self-orthogonal code over R1 of type {k0, k1} such that tor(C1) is self-orthogonal. We assume without loss of generality that C1 has generator matrix G1 = [ Ik0 A0 B0 + uB1 0 uIk1 uD1 ] . Since C1 is self-orthogonal, we have Ik0 +A0A T 0 +B0B T 0 + u(A0A T 1 +A1A T 0 +B0B T 1 +B1B T 0 ) ≡ 0 (u2) u(A0 +B0D T 1 ) ≡ 0 (u2) which are equivalent to (14), (15) and (17). Moreover, since tor(C1) is self-orthogonal, we have Ik0 +A0A T 0 +B0B T 0 ≡ 0 (u) L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 886 A0 +B0D T 1 ≡ 0 (u) Ik1 +D1D T 1 ≡ 0 (u) which are equivalent to (14), (17) and (19). Now, notice that from (17), we have A0 ≡ −B0D T 1 (u). By (14), we have Ik0 +B0D T 1D1B T 0 +B0B T 0 ≡ 0 (u) Ik0 +B0 ( DT 1D1B + Ik0 ) BT 0 ≡ 0 (u) which implies B0 is of full row rank. We start by counting the number of self-orthogonal codes C of type {k0, k1, 0} such that Res(C) = C1. Similar to what we did in the previous chapter, we first exhibit the generator matrix of such code C. Lemma 8. If C is a code over R2 of type {k0, k1, 0} and Res(C) = C1, then there exist matrices N0 ∈Mk0×(n−k0−k1)(Fq) and N1 ∈Mk1×(n−k0−k1)(Fq) such that[ Ik0 A0 B0 + uB1 + u2N0 0 uIk1 uD1 + u2N1 ] (21) is a generator matrix for C. The matrices N0 and N1 are unique. Proof. If C is a code over R2 of type {k0, k1, 0} such that Res(C) = C1, then for some matrices M1,M2,M3,M4 and M5 over Fq of appropriate sizes, Rk0+k12 [ Ik0 + u2M1 A0 + u2M2 B0 + uB1 + u2M3 0 Ik1 + u2M4 D1 + u2M5 ] ⊆ C. Applying elementary row operations,[ Ik0 − u2M1 0 0 Ik1 − u2M4 ] [ Ik0 + u2M1 A0 + u2M2 B0 + uB1 + u2M3 0 Ik1 + u2M4 D1 + u2M5 ] = [ Ik0 A0 + u2(M2 −M1A0) B0 + uB1 + u2(M3 −M1B0) 0 Ik1 D1 + u2(M5 −M4D1) ] and[ Ik0 −u2(M2 −M1A0) 0 Ik1 ] [ Ik0 A0 + u2(M2 −M1A0) B0 + uB1 + u2(M3 −M1B0) 0 Ik1 D1 + u2(M5 −M4D1) ] = [ Ik0 A0 B0 + uB1 + u2(M3 −M1B0 −M2D1 +M1A0D1) 0 Ik1 D1 + u2(M5 −M4D1) ] . L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 887 Letting N0 = M3 −M1B0 −M2D1 +M1A0D1 N1 = M5 −M4D1, we have Rk0+k12 [ Ik0 A0 B0 + uB1 + u2N0 0 uIk1 uD1 + u2N1 ] ⊆ C. Therefore, |C| ≥ ∣∣∣∣Rk0+k12 [ Ik0 A0 B0 + uB1 + u2N0 0 uIk1 uD1 + u2N1 ]∣∣∣∣ = qk0+k1q2k0+k1 = q3k0+2k1 = |C| and hence, (21) is a generator matrix for C. Next, we show uniqueness of the matrices N0 and N1 over Fq. Suppose there exist matrices N ′0 ∈Mk0×(n−k0−k1)(Fq) and N ′1 ∈Mk1×(n−k0−k1)(Fq) such that Rk0+k12 [ Ik0 A0 B0 + uB1 + u2N ′0 0 uIk1 uD1 + u2N ′1 ] = Rk0+k12 [ Ik0 A0 B0 + uB1 + u2N0 0 uIk1 uD1 + u2N1. ] . This means that B0 + uB1 + u2N ′0 ≡ B0 + uB1 + u2N0 (u3) uD1 + u2N ′1 ≡ uD1 + u2N1 (u3) which imply that N ′0 ≡ N0 (u) N ′1 ≡ N1 (u) and hence, N0 and N1 are unique. � This shows that the number of self-orthogonal codes C over R2 of type {k0, k1, 0} with Res(C) = C1 is determined by the number of such matrices N0 and N1, which will be given in the next lemma. Lemma 9. The number of self-orthogonal codes C of type {k0, k1, 0} over R2 such that Res(C) = C1 is q(k0+k1)(n−k0−k1)−k0(k0+1)/2−k0k1 . L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 888 Proof. By Lemma 8, C has generator matrix[ Ik0 A0 B0 + uB1 + u2N0 0 uIk1 uD1 + u2N1 ] for some matrices N0, N1 over Fq. From this, C is self-orthogonal if and only if Ik0 +AAT0 +BBT 0 + u(B0B T 1 +B1B T 0 ) +u2(B1B T 1 +B0N T 0 +N0B T 0 ) ≡ 0 (u3) (22) u(A0 +B0D T 1 ) + u2(B1D T 1 +B0N T 1 ) ≡ 0 (u3). (23) We want to count the number of such matricesN0 andN1 satisfying the above equivalences. First, consider the map ΦB0 : Mk0×(n−k0−k1)(Fq) −→ Mk0(Fq) N0 7−→ B0N T 0 +N0B T 0 as defined in the previous chapter. By (14) and (15), (22) becomes B1B T 1 +B0N T 0 +N0B T 0 ≡ 0 (u). Hence, |{N0 ∈Mk0×(n−k0−k1)|N0 satisfies (22)}| = |{Φ−1B0 (−B1B T 1 )}| = |ker ΦB0 | = ∣∣Mk0×(n−k0−k1) ∣∣∣∣Symk0(Fq) ∣∣ = qk0(n−k0−k1)−k0(k0+1)/2. Define another map β : Mk1×(n−k0−k1)(Fq) −→ Mk0×k1(Fq) N1 7−→ B0N T 1 . This map is surjective because B0 is of full row rank. Therefore by (17), |{N1 ∈Mk1×(n−k0−k1)|N1 satisfies (23)}| = |{β−1(−B1D T 1 )}| = |ker β| = ∣∣Mk1×(n−k0−k1)(Fq) ∣∣ |Mk0×k1(Fq)| = qk1(n−k0−k1)−(k0k1). Finally, the number of self-orthogonal codes C of type {k0, k1, 0} over R2 such that Res(C) = C1 is the number of such matrices N0 satisfying (22) multiplied to the number of such matrices N1 satisfying (23) which is qk0(n−k0−k1)−k0(k0+1)/2qk1(n−k0−k1)−k0k1 . L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 889 The result follows by simplifying the above expression. � For the rest of this chapter, let C2 be a code over Fq with dimension k0 + k1 + k2 and has a generator matrix G2 =  Ik0 A0 B0 0 Ik1 D1 0 0 F2  where F2 is of full row rank. We assume that tor(C1) ⊆ C2 ⊆ res(C1) ⊥. Hence, Ik0 +A0A T 0 +B0B T 0 ≡ 0 (u) A0 +B0D T 1 ≡ 0 (u) F2B T 0 ≡ 0 (u) which are equivalent to (14), (17) and (19), respectively. Consider the following sets of codes over R2: Y = {C | C is self-orthogonal of type {k0, k1, 0},Res(C) = C1} ; Y ′ = { C ′ | C ′ is self-orthogonal,Res(C ′) = C1, tor2(C ′) = C2 } . Note that |Y | is already given in Lemma 9. Our next goal is to compute for |Y ′|. This will be done in the same way as in the previous chapter. Lemma 10. If C ∈ Y , then there exists a unique C ′ ∈ Y ′ such that C ⊆ C ′. Proof. Since C ∈ Y , C has generator matrix (21) for some matrices N0 and N1. Suppose C ⊆ C ′ for some C ′ ∈ Y ′ and there exists a code C ′′ with generator matrix Ik0 A0 B0 + uB1 + u2N0 0 uIk1 uD1 + u2N1 0 0 u2F2  . Clearly, C ⊆ C ′′. Note that C ′′ satisfies Res(C ′′) = C1 and tor2(C ′′) = C2. Using (19), we conclude that C ′′ is self-orthogonal. Hence, C ′′ ∈ Y ′. Next, notice that Rk22 [0 0 u2F2] ⊆ C ′. This, together with the fact that C ⊆ C ′, forces C ′′ ⊆ C ′. But |C ′′| = |C1||C2| = q2k0+k1qk0+k1+k2 = q3k0+2k1+k2 = |C ′| and therefore, C ′ = C ′′. � Lemma 11. Let C ′ ∈ Y ′. Then | {C ∈ Y | C ⊆ C ′} | = q(k0+k1)k2. L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 890 Proof. Let C ′ ∈ Y ′ whose generator matrix is Ik0 A0 B0 + uB1 + u2N0 0 uIk1 uD1 + u2N1 0 0 u2F2  . Define the map Ψ : Mk0×k2(Fq)×Mk1×k2(Fq) −→ {C ∈ Y | C ⊆ C ′} as Ψ ( M ′,M ′′ ) = Rk0+k12 [ Ik0 A0 B0 + uB1 + u2(N0 +M ′F2) 0 uIk1 uD1 + u2(N1 +M ′′F2) ] and claim that this map is bijective. Indeed, Ψ is injective because F2 is of full row rank. Now, suppose C ∈ Y such that C ⊆ C ′. Then by Lemma 8, C has generator matrix[ Ik0 A0 B0 + uB1 + u2F ′ 0 uIk1 uD1 + u2F ′′ ] for some matrices F ′ and F ′′. Since C ⊆ C ′, there exist matrices M ′ and M ′′ such that[ Ik0 A0 B0 + uB1 + u2F ′ 0 uIk1 uD1 + u2F ′′ ] ≡ [ Ik0 0 M ′ 0 Ik1 M ′′ ] Ik0 A0 B0 + uB1 + u2N0 0 uIk1 uD1 + u2N1 0 0 u2F2  (u3). Then we have F ′ = N0 + M ′F2 and F2 = N1 + M ′′F2, so Ψ is surjective and hence, bijective. Therefore, | { C ∈ Y | C ⊆ C ′ } | = |Mk0×k2(Fq)×Mk1×k2(Fq)| = qk0k2qk1k2 = q(k0+k1)k2 . � Given C1 and C2, we can now count the number of self-orthogonal codes over R2 having u2-Residue C1 and torsion C2. Theorem 3. Suppose C1 is a self-orthogonal code over Fq + uFq, where q is odd, of type {k0, k1} such that tor(C1) is self-orthogonal and C2 is a code over Fq of dimension k0 +k1 +k2 such that tor(C1) ⊆ C2 ⊆ res(C1) ⊥. Then the number of self-orthogonal codes C ′ of length n over Fq + uFq + u2Fq such that Res(C ′) = C1 and tor2(C ′) = C2 is qk0(2n−3k0−6k1−2k2−1)/2+k1(n−k1−k2). L.E. Galvez, R.A. Betty, F. Nemenzo / Eur. J. Pure Appl. Math, 13 (4) (2020), 873-892 891 Proof. Without loss of generality, we assume that C1 has generator matrix G1 and C2 has generator matrix G2. Then we compute for |Y ′|. By Lemma 10 and Lemma 11, we have q(k0+k1)k2 ∣∣Y ′∣∣ = ∑ C′∈Y ′ ∣∣{C ∈ X|C ⊆ C ′}∣∣ = ∑ C∈Y ∣∣{C ′ ∈ X ′|C ⊆ C ′}∣∣ = ∑ C∈Y 1 = |Y | . The results follow from Lemma 9. � 8. Mass formula for self-orthogonal codes over Fq + uFq + u2Fq, where q is odd We now have the following theorem. Theorem 4. Suppose q is odd. The number of distinct self-orthogonal codes over Fq + uFq + u2Fq of length n and type {k0, k1, k2}, denoted by MR2(n, k0, k1, k2) is[ n− 2k0 − k1 k2 ] q [ k0 + k1 k0 ] q σq(n, k0 + k1)q k0(2n−3k0−4k1−k2−1)+k1(n−k1−k2). Proof. If C is a self-orthogonal code of length n over Fq+uFq+u2Fq of type {k0, k1, k2}, then by setting C1 = Res(C) and C2 = tor2(C), we see that C1 and C2 satisfies (i)–(iii) of Lemma 7. The number of self-orthogonal codes with given u2-Residue C1 and torsion C2 is given in Theorem 3. The number of self-orthogonal codes C1 over Fq+uFq satisfying (i) and (ii) is given in Corollary 2. The number of codes C2 satisfying (iii) is [ n− 2k0 − k1 k2 ] q . The value of MR2(n, k0, k1, k2) is obtained by the product of these. � We now have the following mass formula for self-dual codes over R2 as a direct conse- quence of Theorem 4. Corollary 3. Suppose q is odd. The number of distinct self-dual codes of even length n over Fq + uFq + u2Fq is given by n 2∑ k0=0 MR2(n, k0, n 2 − k0, n 2 − k0). (24) Proof. By [3], we have k1 = k2 and n = 2(k0 + k1). The result follows from Theorem 4. � The formula (24) agrees with [3, Theorem 1]. REFERENCES 892 Acknowledgements The authors gratefully acknowledge the support of the University of the Philippines Office of the Vice President for Academic Affairs for this project. The authors also thank Dr. Markus Grassl for useful suggestions and the reviewers for their valuable comments. References [1] Koichi Betsumiya, Rowena Alma Betty, and Akihiro Munemasa. Mass formula for even codes over Z8. Lecture Notes in Computer Science, 5921:65–77, 2009. [2] Rowena Alma Betty and Akihiro Munemasa. Mass formula for self-orthogonal codes over Zp2 . Journal of Combinatorics, Information and System Sciences, 34:51–66, 2009. [3] Rowena Alma Betty, Trilbe Lizann Vasquez, and Fidel Nemenzo. Mass formula for self-dual codes over Fq+uFq+u2Fq. Journal of Applied Mathematics and Computing, 57:523–546, 2018. [4] Wieb Bosma, John Cannon, and Catherine Playoust. The magma algebra system I: The user language. Journal of Symbolic Computation, 24(3-4):235–265, 1997. [5] Steven Dougherty, Philippe Gaborit, Masaaki Harada, and Patrick Solé. Type II codes over F2 + uF2. IEEE Transactions on Information Theory, 45(1):32–45, 1999. [6] Philippe Gaborit. Mass formulas for self-dual codes over Z4 and Fq+uFq rings. IEEE Transactions on Information Theory, 42(4):1222–1228, 1996. [7] A Roger Hammons, P Vijay Kumar, A Robert Calderbank, Neil JA Sloane, and Patrick Solé. The z4-linearity of Kerdock, Preparata, Goethals, and related codes. IEEE Transactions on Information Theory, 40(2):301–319, 1994. [8] W Cary Huffman and Vera Pless. Fundamentals of error-correcting codes. Cambridge University Press, 2010. [9] Vera Pless. Number of isotropic subspaces in a finite geometry. Atti della ac- cademia nazionale dei lincei rendiconti-classe di scienze fisiche-matematiche & natu- rali, 39(6):418, 1965. [10] Vera Pless. On the uniqueness of the golay codes. Journal of Combinatorial theory, 5(3):215–228, 1968. [11] Eric M Rains and NJA Sloane. Self-dual codes, in Handbook of coding theory. Elsevier, Amsterdam, pages 177–294, 1998.