Computing models for quotients of modular curves

We describe an algorithm for computing a Q\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathbb {Q}}$$\end{document}-rational model for the quotient of a modular curve by an automorphism group, under mild assumptions on the curve and the automorphisms, by determining q-expansions for a basis of the corresponding space of cusp forms. We also give a moduli interpretation for general morphisms between modular curves.


Introduction
Consider a positive integer N and a subgroup G ⊂ GL 2 (Z/N Z). To the group G we can associate the modular curve X G , which parametrises pairs (E, φ) up to isomorphism, where E is an elliptic curve and φ is a "G-level structure" on E (see Definition 2.1). We present in this paper an algorithm (Algorithm 4.11) for computing a model for X G /Q in the case where det(G) = (Z/N Z) × , −I ∈ G and G is normalised by J := 1 0 0 −1 . This algorithm determines q-expansions of a basis for the corresponding space of cusp forms, from which the equations can be deduced via Galbraith's techniques [19] when the genus is at least 2. Moreover, we can explicitly describe (auto)morphisms of modular curves. For finite groups A of such automorphisms, we can also determine X G /A directly, without computing X G first. These morphisms include, but, more importantly, are not limited to, Atkin-Lehner involutions. This opens the way for the explicit computation of trees of arbitrary modular curves and their quotients. We have applied this in Sect. 5 to find models for three level 35 modular curves, as well as the j-map on one of them; this has contributed in [8] to a proof that all elliptic curves over quartic fields not containing √ 5 are modular.
The main step to understanding general morphisms between modular curves it to describe their moduli interpretation. We do this is Sect. 2, generalising a result of Bruin and Najman [9,Sect. 3] for X 0 (N ).
In Sect. 3, we develop the algorithm for computing q-expansions of a basis of cusp forms with respect to G, thus extending previous results dating back to Tingley [26], who in 1975 computed cusp forms on 0 (N ) for N prime. Tingley's results were improved to all N and optimised by Cremona [14], after which Stein [24] generalised this approach further to the spaces S k ( 0 (N ), ), where is a mod N Dirichlet character. The same approach, using modular symbols, does not simply carry over to general congruence subgroups. In Sect. 3.5, we describe the scaling issue that occurs, which we solve in subsequent sections using twist operators, an idea due originally to John Cremona, c.f. [4].
Despite the lack of a general algorithm, models for several more complicated modular curves have been found previously. We mention some of these, as well as their strong implications. Baran [6] found models for the curves X ns + (20) and X ns + (21), as well as for the isomorphic curves X ns + (13) and X s + (13) [7]. The determination of the integral points of these curves gave new solutions to the class number one problem, while the rational points on the level 13 curves shed light onto Serre's uniformity problem over Q (see also [22]).
Derickx et al. [16] used a planar model for X(b5, ns7) (defined in Sect. 5), to prove that all elliptic curves over cubic fields are modular. This planar model was derived from Le Hung's equations [21] for the curve as a fibred product X 0 (5) × X(1) X ns + (7). Furthermore, Banwait and Cremona [5] determined a model for the exceptional modular curve X S 4 (13) by instead computing pseudo-eigenvalues of Atkin-Lehner operators. This allowed them to study the failure of the local-to-global principle for the existence of -isogenies of elliptic curves over number fields. Simultaneously, Cremona and Banwait [4] found a model for the same curve X S 4 (13), as well as Baran's curves X ns + (13) and X s + (13) and equations describing the j-maps, using his method of modular symbols. This is not published, but available online as a Sage worksheet with annotations by Banwait and Cremona [4].
Given the desire for a more general algorithm for computing models of modular curves, it may not come as a surprise that, during the author's work on this project, three independent results of similar nature were published-at least in preprint. Brunault and Neururer [10] used Eisenstein series to find an algorithm for computing the spaces of modular forms M k ( , C) of arbitrary weight and congruence subgroup ⊂ SL 2 (Z). Zywina [27], on the other hand, generalised the work of Banwait and Cremona [5], using numerical approximation of pseudo-eigenvalues of Atkin-Lehner operators to determine q-expansions and models for modular curves. Finally, Assaf [1] recently generalised the 'classical' strategy of Cremona by defining and successfully utilising modular symbols and Hecke operators on general congruence subgroups to compute Fourier coefficients, at least at primes not dividing the level. Currently, as far as the author is aware, Assaf's algorithm is unable to determine the Fourier coefficients at primes dividing the level for congruence subgroups such as those in Sect. 5, which may complicate provable determination of equations satisfied by those modular forms. Zywina can determine all Fourier coefficients, and his method can in fact be used to find a model for X(b5, e7) (defined in Sect. 5), but not currently for its quotients.
Our approach instead generalises Cremona's work [4] on X S 4 (13). We can compute any Fourier coefficient for a basis of cusp forms for any congruence subgroup, without the need for numerical approximation. We have chosen this approach because it is a natural extension of the current methods for determining q-expansions of cusp forms on 0 (N ). This enables us to use the current packages for cusp forms in Sage, making the algorithm relatively easy to implement. Another forte of our approach is that we can directly compute quotients of modular curves by automorphisms. As far as the author is aware, there is currently no other algorithm available that can compute models for the modular curves in Sect. 5.
The Sage and Magma code used for the computations in Sect. 5 is publicly available at https://github.com/joshabox/modularcurvemodels. Given the existing comprehensive Magma implementations of Assaf [1] and Zywina [27], we have not implemented a general version of our algorithm, although parts of our implementation do work more generally. We note that it should certainly be possible to implement the algorithm; in particular, the examples computed in Sect. 5 do not appear to be in any subcategory of "easier cases". The pragmatic reader in search of a model for their modular curve is advised to try Zywina's code first.

Modular curves not of the standard type
In the literature, modular curves tend to be described as being determined by a level N ∈ Z >0 and a subgroup G ⊂ GL 2 (Z/N Z). This is a convenient point of view, since such modular curves have an interpretation as moduli spaces of elliptic curves with additional structure.
However, some modular curves do not fit in this framework. The curve X 0 (N )associated to the group B 0 (N ) ⊂ GL 2 (Z/N Z) of upper-triangular matrices-parametrises pairs (E, C) where E is an elliptic curves and C ⊂ E is a cyclic subgroup of order N . This curve admits a well-known involution, called the Atkin-Lehner involution w N , mapping such a pair (E, C) to (E/C, E[N ]/C). The quotient curve X 0 (N )/w N does not parametrise elliptic curves with additional structure, but rather certain pairs of elliptic curves with extra structure, and therefore the standard theory of "moduli problems" does not apply.
Nonetheless, X 0 (N )/w N does have a moduli interpretation, it is defined over Q, and it is a modular curve in the adelic sense: (X 0 (N )/w N ) C = GL + 2 (Q)\(GL 2 (A f ) × H)/U, where A f denotes the finite adèles, H is the complex upper half-plane and U is the compact open subgroup of GL 2 (A f ) generated by w N and the inverse image of G in GL 2 ( Z).
While Atkin-Lehner involutions may be well understood, more modular curves can arise in this way. Firstly, when h 2 | N for a non-trivial divisor h of 24, the normaliser of 0 (N ) in PGL 2 (Q) is generated by more than just the Atkin-Lehner involutions (see Lemma 3.2), giving rise to extra automorphisms on X 0 (N ) (not all defined over Q, however). When N ∈ {40, 48}, two such automorphisms were explicitly determined by Bruin and Najman [9]. When 9 | N , one normalising matrix is 1 1/3 0 1 , giving rise to an automorphism α 3 of order 3, defined over Q(ζ 3 ), such that the group α 3 generated by α 3 is Q-rational. In particular, this yields a "new" morphism of curves over Q, More types of examples occur on modular curves of mixed level by composing automorphisms. Denote by G(s3 + ) and G(ns3 + ) the normalisers in GL 2 (F 3 ) of split and non-split Cartan subgroups respectively. Then G(s3 + ) ⊂ G(ns3 + ) with index 2. Any matrix in G(ns3 + ) \ G(s3 + ) determines an involution φ 3 on X G(s3 + ) . On the level 15 modular curve X(b5, s3 + ), determined by the intersection of the inverse images of B 0 (5) and G(s3 + ) in GL 2 (Z/15Z), we then obtain an Atkin-Lehner involution w 5 as well as a lift ψ 3 of φ 3 . These involutions commute and give rise to another involution ψ 3 w 5 , and another modular curve X(b5, s3 + )/ψ 3 w 5 . In Sect. 5 we study a similar example, which the author stumbled upon "in nature" (see [8]). In order to understand such quotient curves, we first study the moduli interpretation of the automorphisms determined by such matrices.

Modular curves and their moduli interpretation
We use their moduli interpretation to define modular curves over more general base schemes. While we shall not need the description of modular curves as schemes over Z[1/N ] or Z[1/N, ζ N ] as defined below, this approach does help us decide the field over which modular curves and the Fourier coefficients of their cusp forms are defined. It moreover allows us to prove which morphisms are defined over this field. We give an overview of standard results from Deligne and Rapoport [15] and Katz and Mazur [20], which we attempt to describe as concretely as possible.
Let N ∈ Z ≥1 be an integer, and choose a primitive N th root of unity ζ N := e 2π i/N ∈ C. To define modular curves via their moduli interpretation, we need to consider arbitrary base schemes. Let S be a scheme over Z[1/N ]. An elliptic curve over S is a pair (E → S, O), where E → S is a proper smooth map, all of whose fibres are geometrically connected curves of genus 1, and O is a section of E → S. Then E/S obtains the structure of a commutative group scheme. On E/S, there is the Weil pairing ) is the multiplicative group scheme of N th roots of unity. To such an elliptic curve E/S, we can associate its (N )-structures, defined as the maps ) as effective Cartier divisors. (When S = Spec(K ) for a field K of characteristic coprime to N , this means that φ(0, 1) and φ(1, 0) form a basis.) Now suppose that g ∈ GL 2 (Z/N Z). Then g acts on (Z/N Z) 2 S by right-multiplication of row vectors, and this is compatible with the Weil pairing in the sense that We consider the functor mapping a scheme S to the isomorphism classes of pairs (E/S, φ), where E is an elliptic curve over S and φ is a (N )-structure on E/S. The Weil pairing defines a map of functors e N : F N → μ N , and we define the subfunctor F can N : Sch Z[ζ N ] → Set, mapping S to the set of pairs (E/S, φ) ∈ F N (S) such that e N (φ(1, 0), φ(0, 1)) = ζ N . This rigidifies the moduli problem. Now F can N admits a coarse moduli space Y (N )/Z[ζ N ], whose compactification X(N ) is smooth over Z[ζ N , 1/N ], as shown e.g. in [20,Chap. 9].
We now consider any subgroup G ⊂ GL 2 (Z/N Z). Its group of determinants det(G) acts on Z[ζ N ] by automorphisms via ζ N → ζ a N for a ∈ det(G). We obtain a fixed subring For schemes S/Z[ζ N ], the right-action of G on (Z/N Z) 2 S by rightmultiplication gives rise to a left-action on (N )-structures. For g ∈ G and a (N )structure φ, we denote this by g · φ, so that (g · φ)(a) = φ(a · g). Denote the G-equivalence class of the (N )-structure φ by [φ] G . Given a Z[ζ N ] det(G) -scheme S and an elliptic curve E/S, we can consider schemes T /S and their base-change T :

Definition 2.1 We define the functor
mapping a scheme S to the set of isomorphism classes of pairs (E/S, [φ] G ), where [φ] G is a G-equivalence class of (N )-structures on E T /T for some T /S, such that [φ] G is "defined over S". We define F can G as the subfunctor of those pairs (E/S, [φ] G ) where e N (φ(1, 0), φ(0, 1)) and ζ N have the same image in μ N /det(G)(S), or, more concretely, where As shown in [20,Chap. 9], F can G admits a coarse moduli scheme Y G /Z[1/N, ζ N ] det(G) , whose compactification X G is smooth. We call X G the modular curve associated to G.
Finally, we mention what it means for [φ] G to be "defined over S". Given an elliptic curve E/S, we consider the functor

Notation for modular curves
We define the congruence subgroup G associated to G ⊂ GL 2 (Z/N Z) to be the inverse image under SL 2 (Z) → SL 2 (Z/N Z) of G ∩ SL 2 (Z/N Z). For any ring R, we denote by P the image of ⊂ GL 2 (R) in PGL 2 (R). Recall that (Y G ) C G \H, where H is the upper half-plane and G acts by fractional linear transformations. When N = K · M, we denote by G K the image of G in GL 2 (Z/K Z).
By N G we denote the normaliser of P G in PGL + 2 (Q), where the superscript + means "with positive determinant", and by N G ⊂ N G the subgroup of those γ ∈ N G satisfying condition (2), to be defined in Proposition 2.3. We define the following subgroups of GL 2 (Z/N Z): We denote their congruence subgroups by 0 (N ), 1 (N ), 1 (N ), (N ) and (N ) respectively. Note that 1 (N ) = 1 (N ) and (N ) = (N ). The corresponding modular curves are denoted by X 0 (N ), X 1 (N ), X 1 (N ), X(N ) and X(N ). We also write X( G ) instead of X G and X( G ) instead of X G when G is clear from context. For positive integers K, M, we define X( 0 (M) ∩ 1 (K )), resp. X( 0 (M) ∩ 1 (K )), for the curve associated to the intersection of the inverse images of B 0 (M) and B 1 (K ), resp. B 0 (M) and B 1 (K ), in GL 2 (Z/lcm(K, M)Z). Similarly, define X( 0 (M) ∩ (K )) and X( 0 (M) ∩ (K )).

Morphisms between modular curves and their moduli interpretation
We first mention two kinds of trivial morphisms.
(M2) Consider any group G ⊂ GL 2 (Z/N Z) and an integer M. Define π : GL 2 (Z/MN Z) → GL 2 (Z/N Z). The multiplication-by-M map on NM-torsion of elliptic curves and the to-the-Mth-power map μ NM → μ N commute with respect to the Weil pairing by (1), and define an isomorphism of functors F can π −1 (G) → F can G . We conclude that X π −1 (G) = X G . By (M2), any morphism of modular curves can be viewed as a morphism between modular curves of the same level.

Example 2.2 When G ⊂ GL 2 (Z/N Z) and
⊂ det(G) is a subgroup, we can consider the subgroup H ⊂ G of elements g ∈ G with det(g) ∈ . Then G and H give rise to the same congruence subgroups, hence (X G ) C = (X H ) C . We obtain a morphism of curves Suppose that γ ∈ GL + 2 (Q) satisfies γ G γ −1 ⊂ H for some G, H ⊂ GL 2 (Z/N Z). Then γ defines a morphism (X G ) C → (X H ) C through its action as a fractional linear transformation on H. This is a morphism defined a priori over C. We investigate when this morphism is in fact defined over Z[ζ N ] det(G) . The following proposition generalises, and was inspired by, [9,Sect. 3].
Recall that we have a bijection G \H → F G (Spec(C)) given by and similarly for H. We check that the action of γ just defined corresponds under this bijection to the action of γ on H as a fractional linear transformation. So we consider ). First, we note that As det(γ ) = δ, we have τ Z⊕Z ⊂ 1 δ ((aτ +b)Z⊕(cτ +d)Z), and we obtain an isomorphism We obtain an automorphism of X G . However, this does not correspond to the action of γ on H by fractional linear transformations.
Instead, we can choose g ∈ G such that det(g) = det(γ ). Any lift of g −1 γ to SL 2 (Z) then normalises G and satisfies the conditions of Proposition 2.3. It determines the same morphism X G → X G as γ did.
Next, we lift automorphisms at level M to higher levels KM when K is coprime to M. This is important for understanding Atkin-Lehner operators at mixed level.

Lemma 2.7
Suppose that N = KM with gcd(K, M) = 1, and we have G K ⊂ GL 2 (Z/K Z) and G M , H M ⊂ GL 2 (Z/MZ). Consider γ ∈ GL 2 (Q) + with integral coefficients and determinant δ ∈ Z coprime to K , satisfying (2) of Proposition 2.3 for G M and H M . Consider also η ∈ GL 2 (Z/K Z) of determinant δ mod K normalising G K .
Then γ and η determine a morphism X G → X H such that the diagram commutes. This morphism depends only on γ and η(G K ∩ SL 2 (Z/K Z)) ⊂ GL 2 (Z/K Z).
Proof Recall from the proof of Proposition 2.3 that θ γ : X G M → X H M is only determined by its image γ in GL 2 (Z/δMZ). As gcd(K, Mδ) = 1, we can thus find α ∈ M 2 (Z) of det(α) = δ lifting both η and γ (and the image of α in M 2 (Z/δMK Z) is uniquely determined by γ and η). Denote by π : GL 2 (Z/δMZ) → GL 2 (Z/MZ) the natural map. Then α satisfies As gcd(Mδ, K ) = 1, we conclude that also αG ⊂ Hα, as desired. The commutativity of the diagram follows by construction. Finally, each β ∈ G K ∩ SL 2 (Z/K Z) can be lifted to β ∈ G K that is the identity mod δM, and therefore acts trivially on X G . The morphism determined by γ and η β is θ α • θ β = θ α .
Note that we do not assume in the lemma that η ∈ G K . However, if there exists η ∈ G K of determinant δ mod K , then the map X G → X H determined by γ and η is independent of the choice of η ∈ G K , and we call it the lift of X G M → X H M to X G → X H . When such η ∈ G K does not exist, the obtained map really depends on the choice of η. This distinction becomes apparent when considering the Atkin-Lehner morphisms on X 0 (KM) and X 1 (KM) determined by W M .

Definition 2.8 Consider again
, where π K and π M are defined as in Lemma 2.7. By Lemma 2.7, W M and η define an automorphism on X G , which we call an Atkin-Lehner morphism at M. When η ∈ G K , we call it the Atkin-Lehner involution at M and denote it by w M .
, where x, y, z, w ∈ Z satisfy det(W M (x, y, z, w)) = M. Its mod K reduction is in B 0 (K ), and moreover For K ∈ Z, we define The action of γ K on H often leads to interesting morphisms between modular curves.

Example 2.10
Let p be a prime. The split Cartan subgroup of GL 2 (F p ) is the group G(sp) of diagonal matrices. We interpret this as a group of level p 2 by considering its inverse image in GL 2 (Z/p 2 Z). We then apply Proposition 2.3 with γ p to find a morphism . By considering the congruence subgroups, we see that φ must be an isomorphism. Or, alternatively, the inverse is defined by p · γ −1 p . On X 0 (p 2 ) we have the involution w p 2 defined by W p 2 , see Example 2.5. On X(sp) this corresponds under φ to the involution defined by the matrix i : . This matrix is in fact invertible mod p. Denote by G(sp + ) ⊂ GL 2 (F p ) the group generated by i and G(sp). This is the normaliser of G(sp), and it defines a modular curve X(sp + ), a degree 2 quotient of X(sp). We conclude that φ descends to an isomorphism X(sp + ) X 0 (p 2 )/w p 2 over Q, a fact also observed in [12, p. 555].

Example 2.11
Consider again a prime p, and positive integers b, a. Define c := max(a, b). As in the previous example, γ p a defines an isomorphism For any K, M ∈ Z ≥1 with L := gcd(K, M), we thus deduce from Lemma 2.7 that γ K defines an isomorphism of curves over Q(ζ K ).

The regular 1-forms on a modular curve
Let G be a subgroup of GL 2 (Z/N Z). From now on, we shall only be concerned with curves over fields, and denote by X G the modular curve associated to G, base changed to Q(ζ N ) det(G) . For γ ∈ SL 2 (Z/N Z), we see that any lift of γ to SL 2 (Z) acts on X(N ) as the automorphism θ γ , by Proposition 2.3. Next, consider a ∈ (Z/N Z) × and the matrix γ a := a 0 0 1 . As This similarly has a coarse moduli space X(N ) a /Q(ζ N ), which is the base change of X(N ) by Galois conjugation Then γ a does determine a morphism X(N ) → X(N ) a of curves over Q(ζ N ). Composing this map with base change by σ −1 a , we obtain a map of schemes θ a : X(N ) → X(N ), whose corresponding map on function fields is merely a morphism of Q(ζ N ) σ a -algebras.
Each function f ∈ Q(ζ N )( X(N )) has a Laurent series expansion around the infinity cusp (which is a Q(ζ N )-rational point). Denote by q N (τ ) = e 2π iτ /N a uniformiser at this cusp, and write the expansion of f in its completed local ring as f = n≥−m a n (f )q n N , where m ∈ Z >0 and each a n (f ) ∈ Q(ζ N ). As also shown by Shimura [23, Proposition 6.9], the maps just described yield a right action • of GL 2 (Z/N Z) on Q(ζ N )( X(N )) such that for each f = n≥−m a n q n N ∈ Q(ζ N )(X(N )): From now on, we suppose that G ⊂ GL 2 (Z/N Z) satisfies The first condition means we consider only curves defined over Q. Then, again by Shimura's work [23], the fixed field Q(ζ N )( X(N )) G defines an irreducible projective curve over Q, which is simply X G . We denote by S k ( , K ) the space of weight k cusp forms with respect to whose Fourier coefficients all lie in K .
The action of GL 2 (Z/N Z) on X(N ) gives rise to an action on its sheaf of regular 1-forms, which in turn corresponds to modular forms.
Here is the sheaf of regular 1-forms on X G .
Our strategy will be to compute a basis for S 2 ( (N ), Q(ζ N )) G and derive equations for X G by finding equations between these cusp forms, following Galbraith [19].

The conjugation trick
It will be useful to split the level N into two parts N = MK , where gcd(M, K ) = 1, such that the image of G in GL 2 (Z/MZ) is B 0 (M). Then by definition of B 0 (M). From now on, we think of G = 0 (M) ∩ G K as being a "level K congruence subgroup of 0 (M)", rather than a level N congruence subgroup of SL 2 (Z). When M > 1, the benefit of this is twofold: we will be able to consider more automorphisms on X G , and computations are faster.
A problem with computing fixed spaces of modular forms as above, is that no algorithm for computing spaces of the form S 2 ( 0 (M) ∩ (K ), Q(ζ K )) is currently implemented in a computer algebra system. We fix this by conjugating with γ K . The trick to studying modular forms on (K ), as used by Banwait and Cremona [5] and later by Zywina [27], is to notice that γ −1 K (K )γ K = 0 (K 2 ) ∩ 1 (K ). In fact, we already saw in Example 2.11 that γ K induces an isomorphism Efficient algorithms for computing spaces of cusp forms for 0 (MK 2 ) ∩ 1 (K ) using modular symbols have been implemented in Magma and Sage thanks to the work of Cremona [14] and Stein [24], amongst others.

Normalisers and statement of the main theorem
In this section, we explain for which elements A ∈ N G we can determine its action on X G explicitly. We would like to be able to act with such A on S 2 ( 0 (MK 2 ) ∩ 1 (K ), Q), as is the case for G.
In their famous paper, Conway and Norton [13, Sect. 3] mention the "curious fact" that the divisors h of 24 are exactly those positive integers satisfying that xy ≡ 1 mod h implies x ≡ y mod h. Equivalently, they are the integers h such that By Example 2.2, we find that X 0 (M) Q(ζ h ) = X B h 0 (M) . Similarly, we have (X G ) Q(ζ h ) = X G h . On X G h , the elements in N G h act by automorphisms. We restrict to those automorphisms which also act on X( 0 (M) ∩ (K )). We can now verify explicitly that Atkin-Lehner matrices, h T h and elements of 0 (M) satisfy condition (2) to define a morphism X H → X H . Here we note that any matrix in GL 2 (Z/K Z) normalises {I} = G(K ). To see that h T h satisfies (2), we crucially use that xy ≡ 1 mod h implies x ≡ y mod h.
Consider a subgroup A ⊂ (N 0 (M) ∩ N G h )/P G . By definition, this acts by automorphisms on X G h = (X G ) Q(ζ h ) . Moreover, by intersecting with N 0 (M) , we have ensured that A acts on X( 0 (M) ∩ (K )) over Q(ζ Kh ), just like G does, and we can treat A and G in a similar way. Taking A-invariants in Proposition 3.1 and applying (6) and (5), we obtain where α ∈ A and α ∈ SL 2 (Z/MK Z) act on cusp forms f by f → f [γ −1 K αγ K ], and matrices γ a = a 0 0 1 ∈ GL 2 (Z/MK Z) act on cusp forms by Galois conjugating Fourier coefficients by σ a (because γ a and γ K commute), c.f. Sect. 3.1. Remark 3.5 While we have restricted the allowed automorphisms by intersecting with N 0 (M) , we have not excluded the two natural subsets. Firstly, recall that any α ∈ N 0 (M) determines a morphism on X 0 (M) Q(ζ h ) . Because G K has surjective determinant and α has determinant coprime to K , we can by Lemma 2.7 extend this to a morphism on X G determined by a matrix in N 0 (M) ∩ N G h . The allowed automorphisms thus contain the Atkin-Lehner involutions and the morphisms determined by T h . We will see that J indeed normalises Atkin-Lehner operators. Secondly, any α ∈ SL 2 (Z/K Z) normalising G K determines an automorphism on X G K , after lifting α to SL 2 (Z). By lifting α to 0 (M), we obtain a morphism on X G determined by a matrix in N 0 (M) ∩ N G h .
We shall first find a way (Algorithm 4.11) to determine the fixed space S 2 ( 0 (MK 2 ) ∩ 1 (K ), Q(ζ Kh )) G ,A , after which we consider the action of matrices in G K with determinant unequal to 1 in Sect. 4.3.
Remark 3. 6 We have decided in the remainder of this article to work only with weight 2 cusp forms, but all computational arguments generalise in a straightforward way to arbitrary even weight.

The homology group
We work in the homology group, following Cremona's strategy [14]. More specifically, in this section, we follow unpublished work of Cremona (used in [4]) to describe a C-bilinear pairing between cusp forms and homology.
We consider any group G ⊂ GL 2 (Z/N Z) corresponding to a congruence subgroup := G of level N . We assume again that G is normalised by J = −1 0 0 1 . For the geometric curve (X G ) C , we then have the pairing between 1-forms and homology: Extending this to H 1 (X , R), the pairing becomes R-bilinear. As in Sect. 3.1, the action of J on H ⊂ C composed with complex conjugation determines an involution of R-algebras J * : C(X G ) → C(X G ), or equivalently an involution on the Weil restriction Res C/R (X G ) C .
Here z ∈ H is mapped to z * := −z = J (z), and f ∈ S 2 ( , C) to J * (f ) = f (z * ). We note that f → J * (f ) acts as complex conjugation on the Fourier coefficients of f , c.f. Sect. 3.1.
We similarly obtain an involution on H 1 (X , R). Denote by H 1 (X , R) + its +1-eigenspace. Then our pairing restricts to an exact duality of real vector spaces Finally, we extend the pairing C-linearly on both sides to obtain an exact C-bilinear pairing The pairing (8) identifies H C ( ) with the dual of S 2 ( , C). Subsequently, the Petersson inner product identifies S 2 ( , C) with its own dual. We thus obtain an isomorphism where the latter pair of brackets denotes the Petersson inner product. Our strategy for studying S 2 ( , C) is to study H C ( ) instead, and transform the results under this isomorphism. We note that the Petersson inner product is sesqui-linear in its second argument, whereas (8) is C-linear. This means that The great benefit of studying the homology group is that the action of N on H 1 (X( ), Z) can be computed explicitly when = 0 (K 2 M) ∩ 1 (K ), i.e. for each γ ∈ N one can find a matrix for this linear action on H 1 (X , C) in terms of an explicit basis. This uses a description of the homology group as modular symbols. For a detailed overview of these algorithms, we refer the reader to [14,24].
Thanks to these algorithms, when ⊃ 0 (MK 2 ) ∩ 1 (K ), one can compute H 1 (X , Q) as the subspace of H 1 (X 0 (MK 2 )∩ 1 (K ) , Q) fixed by with ease. The challenge is to relate this subspace H 1 (X , C) to q-expansions of modular forms under the isomorphism (9), as explained in the next Sect. 3.5.
In the remainder of this subsection, we consider any congruence subgroup normalised by J , but one may think of this as being 0 (MK 2 ) ∩ 1 (K ).
Recall that every U = a b c d ∈ GL + 2 (Q) acts on the complex upper half-plane by fractional linear transformations, giving rise to an action on meromorphic functions on H and on paths γ : [0, 1] → H: Definition 3. 7 We define the Hecke algebra T to be the C-algebra of C-valued functions on P \PGL + 2 (Q)/P , where the P denotes the image in PGL 2 (Q).
Each T ∈ T can be represented as a C-linear combination of double cosets P αP . Such a coset has a left-P action, and splits as a finite disjoint union P αP = P α i . This way, we obtain a Hecke operator T α = i [α i ], acting on (X ) C as a correspondence, and consequently on S 2 ( , C) and H 1 (X , C).
The following lemma, due to Cremona and used in [4], describes how these two actions interact with the pairing (8).

Lemma 3.8 Consider T ∈ T , and γ ∈ H C ( ) such that JT (γ ) = T (γ ) (i.e. T (γ ) remains in the +1-eigenspace)
. This is always the case when TJ = JT . Then for all f ∈ S 2 ( , C) we have where T * is the adjoint of T with respect to the Petersson inner product.
Proof By definition of the action, (f |U )(τ )dτ = f (U (τ ))dU (τ ) for each matrix U . Integrating this relation for each U in T gives us part (a), as long as T (γ ) ∈ H C ( ). Part

q-expansions
A downside of using the homology group is that the pairing (8) is not defined explicitly in terms of q-expansions. It is therefore a priori not obvious what the q-expansion is of the cusp form mapped to a given element of H C ( ) under (9). When = 0 (MK 2 ) ∩ 1 (K ), the solution is to use Hecke operators and their common eigenvectors. Let f 1 , . . . , f n ∈ S 2 ( 0 (MK 2 ) ∩ 1 (K ), C) be the Hecke eigenforms. Their q-expansions (up to scaling) are determined by Hecke eigenvalues, and these Hecke eigenvalues can be computed for the corresponding Hecke eigenvectors μ 1 , . . . , μ n ∈ H C ( 0 (MK 2 ) ∩ 1 (K )) instead, by Lemma 3.8. This yields the q-expansions for a basis of S 2 ( 0 (MK 2 ) ∩ 1 (K ), C). This approach does not work for S 2 ( , C) when ⊃ 0 (MK 2 ∩ 1 (K ) and the subspace S 2 ( , C) ⊂ S 2 ( 0 (MK 2 ) ∩ 1 (K ), C) is not a direct sum of Hecke eigenspaces, the problem being that each μ i only corresponds to f i under (9) up to scaling. The scaling issue makes it hard to translate linear combinations of eigenforms under (9).
The aim for the remainder of this article is to present a solution to this problem. The crucial idea-due to Cremona (see [4])-is that we can find a q-expansion for the cusp form corresponding to a linear combination α 1 μ 1 + α 2 μ 2 when μ 2 is a twist of μ 1 . While two Hecke eigenvectors need not always be twists, we define in Sect. 4.1 the twist orbit space of μ 1 , and show that the action of preserves this space.

Operators on modular forms and modular symbols
In this subsection, we study the congruence subgroup 0 (MK 2 ) ∩ 1 (K ), where again N, M ∈ Z ≥1 (not necessarily coprime). We define N := K 2 M. Let D K be the group of Dirichlet characters on (Z/K Z) × . Then where N denotes the composition of (Z/N Z) × → (Z/K Z) × and , and S 2 (N, ) is the common eigenspace in S 2 ( 1 (N ), C) for the diamond operators d for gcd(d, N ) = 1 with eigenvalues (d) respectively. The diamond operators also act on modular symbols, and Stein [24] defines their eigenspaces H 1 (N, ) ⊂ H 1 (X 1 (N ) , C). We obtain a similar decomposition The diamond operators commute with J , and H 1 (N, ) + is identified with S 2 (N, ) under the isomorphism (9). Note here the complex conjugation of which occurs due to Lemma 3.8(b) since d * = d −1 for d coprime to N . Similarly, for primes p N , we have (see e.g. [17]) Definition 3.9 Let V be a representation of the Hecke algebra. A Hecke eigenspace of V is a simultaneous eigenspace for the Hecke operators T p and p , for all but finitely many primes p.
It is important to note that, even if f is of level N and L | N , then χ is considered as a mod L character in the definition of f |R χ (L); not as a mod N character. We saw in Corollary 3.3 that T 1 acts on X( 0 (M)∩ (K )) (and hence normalises 0 (M)∩ (K )). By (6), conjugation by γ K shows that T K = γ −1 K T 1 γ K normalises 0 (MK 2 ) ∩ 1 (K ) and acts on its spaces of cusp forms (with coefficients in Q(ζ K )) and homology; hence so does R χ (K ) for χ ∈ D K .
Proof For the first equality, we use that T * L = T −1 L and recall that the isomorphism (9) is C-linear in both arguments, to find that where we used Lemma 3.8(a) in the last equality.
Next, recall that . We thus find that as desired. Now repeat this with I · B d and Tr We define one final operator.
is a newform with a 1 (f ) = 1 and ψ is a character whose conductor is a power of q.
where Q is a power of q and g ∈ S 2 (QL, ψ 2 ) is the newform with a 1 (g) = 1.
Proof These are standard properties first proved by Atkin and Li [3]. The proof of (a) for modular forms is a matrix computation (see [3,Proposition 3.1]) and thus similarly true for modular symbols, with a complex conjugation bar to account for the change from left-action to right-action.
Parts (a) and (d) tell us exactly how R χ (L) acts on the set of Hecke eigenspaces. We extend part (f) to non-prime power conductors. Proof First, we note that We now write χ = p|K χ p as a product of characters of prime-power conductor. Then R χ = λ p|K R χ p for some λ ∈ Q by Lemma 3.15(b). We now repeatedly apply Lemma 3.15(f) to each R χ p , keeping in mind the displayed equation above.
Given f and χ, we note that a q-expansion for k can be computed explicitly from its Hecke eigenvalues using Lemma 3.15(d). For R χ and B d it is well-known how they act on q-expansions: f |B d (q) = f (q d ) and f |R χ = g(χ)f ⊗ χ, where g(χ) is the Gauss sum of χ . The above corollary allows us to determine how pr N /L acts on the q-expansions of twists of newforms.
For Q | N with gcd(Q, N /Q) = 1, we defined the Atkin-Lehner matrices W Q (x, y, z, w) in Example 2.9. Define the corresponding operators on cusp forms and homology by w Q (x, y, z, w). For simplicity of exposition, denote by w Q the Atkin-Lehner operator w Q (x, y, z, w), where x ≡ 1 mod N /Q and y ≡ 1 mod Q. We study how these interact with the Hecke operators, using classical properties due to Atkin and Li [3]. Then Proof These are analogues of standard results of Atkin and Li [3] for the corresponding action on modular forms. These are all based on matrix identities, and thus hold true on modular symbols for the same reason (and with appropriate complex conjugation bars to account for the change from left-action to right-action).

Twist orbit spaces
We consider again N = KM, h | 24 such that h 2 | M, and the congruence subgroup = G , where G has level N and G M = B 0 (M).
A crucial step in determining q-expansions for a basis of modular forms for 0 (N ) is to determine first the Hecke eigenforms. When N is prime, the Hecke algebra T 0 (N ) is generated by the Atkin-Lehner operator w N and the Hecke operators T p for primes p. The Hecke eigenforms thus generate 1-dimensional modules of the full Hecke algebra.
For 0 (MK 2 ) ∩ 1 (K ), however, this is not the case. Recall that T h normalises 0 (M) ∩ (K ). Hence T Kh = γ −1 K T h γ K normalises 0 (MK 2 ) ∩ 1 (K ), making the twist operators R χ (Kh), for χ ∈ D Kh , are all elements of the Hecke algebra. These twist operators do not act on the 1-dimensional spaces generated by the Hecke eigenforms, however. In this section, we define the notion of twist orbit spaces, and we show that these are modules for the following subalgebra.

Definition 4.1
We define the explicit Hecke algebra T M,K to be the sub-algebra of T 0 (MK 2 )∩ 1 (K ) generated by the T p -operators for p MK prime, the diamond operators d for d ∈ (Z/K Z) × , the Atkin-Lehner operators w m (x, y, z, w) for m | MK 2 such that gcd(MK 2 /m, m) = 1, and the twist operators R χ (Kh) for χ ∈ D Kh .

Remark 4.2
It is not unreasonable to expect that T M,K is the full Hecke algebra, as we have added to the Hecke operators all matrices that visibly normalise 0 (MK 2 ) ∩ 1 (K ), c.f. Lemma 3.2 and Corollary 4.5.
In the situation of our interest, some of the Atkin-Lehner operators coincide.
In other words, w Q (x, y, z, w) ∈ T M,K satisfies Jw Q (x, y, z, w)J = w Q (x, y, z, w).
Proof Simply multiply the matrices.
Define T := 1 1 0 1 and S := 0 1 −1 0 . In their studies of modular forms, Banwait and Cremona [5] and Zywina [27] made crucial use of the fact that SL 2 (Z) is generated by T and S, which satisfy γ −1 K T γ K = T K and γ −1 K Sγ K = W K 2 . A similar statement can be obtained for our "parent group" 0 (M). Proof Let T, γ 1 , . . . , γ n be a set of generators for 0 (M). We add γ 0 := 1 0 M 1 to this set. We note that Consider γ = a b cM d ∈ 0 (M). Then gcd(det(γ ), K ) = 1 implies that gcd(a, cM, K ) = 1. Therefore, given the finite set S of primes dividing K , we can choose k ∈ Z such that (ka + c)M is not divisible by any prime in S. So after replacing each γ i for i > 0 by γ k i 0 γ i for some k i ∈ Z, we may assume that the bottom left entry of each γ i (i ∈ {0, . . . , n}) is coprime to K .
Next, let γ = a b cM d be one of the γ i . We note that . As det (W m (a, b, c, d)) is coprime to K , the proof of the previous lemma allows us to find μ, ν ∈ 0 (M) such that μW m (a, b, c, d)ν is of the form Kmx y Mz Kmw . (When choosing the powers k, k of T to multiply with, these need to be chosen to be multiples of m, which is possible due to the Chinese Remainder Theorem.) Now conjugating with γ K and multiplying with K gives us W mK 2 (x, y, z, w), as desired.
Proof By Lemma 3.2, we may suppose γ is a generator of 0 (M), an Atkin-Lehner matrix, or T h . The result thus follows from the previous corollary and Lemma 3.15(e).
Finally, for χ ∈ D Kh , the operator R χ (Kh) maps a Hecke-J -eigenspace to the same Hecke-J -eigenspace as R χ does, and hence preserves O(μ) by definition.

Proposition 4.9
Suppose that f ∈ S 2 ( 0 (MK 2 )∩ 1 (K ), C) is a newform at a level dividing N and μ = γ f . Then a basis for O(μ) + is given by the elements where χ ∈ D Kh is even, R χ (μ) has new level L | N , and e divides N /L.
Proof Translate this statement to modular forms using (11) and Lemma 3.13, then apply Corollary 3.16 and the standard theory of old and new subspaces.
We note that each real twist orbit space contains an element μ = γ f , where f is a newform at a level dividing N , and thus has a basis of this form. In this case, denote by O + (f ) the analogue of O(μ) + under the isomorphism (9). We call this the real twist orbit space of f . We note that each eigenform f has Fourier coefficients defined over some number field. Denote by the subspace spanned by the real twist orbit spaces O(f σ ) + , where σ ∈ Gal(Q/Q).

Computing q-expansions
We consider again the set-up from the previous section. Now assume that JGJ = G, −I ∈ G and det(G) = (Z/N Z) × . Consider also a group A ⊂ (N 0 (M) ∩ N G h )/P such that J AJ = A. Here G h is the subgroup of G with determinant 1 mod h, and h is the largest divisor of 24 such that h 2 | M. Then the group F := P , A satisfies JFJ = F and F ⊂ N 0 (M) . (Technically, we should replace A by a set of lifts to N 0 (M) , but note that F is independent of the choices of lifts.) Also define V := H 1 (X 0 (MK 2 )∩ 1 (K ) , C) and and the superscript + denotes the J -invariant subspace. This means that V F,+ has a basis of elements of real twist orbit spaces. In order to determine q-expansions for a basis of S 2 ( , C) A , it thus suffices to be able to compute q-expansions for cusp forms in a fixed real twist orbit space. To this end, recall that we have a sesqui-linear isomorphism under which the operators correspond as follows: This means the following.
From the action of T p on newforms we can determine q-expansions of newforms. Moreover, we know how B e and R χ act on q-expansions, and by Corollary 3.16, we can also determine what pr N /L does to q-expansions. So, given a q-expansion for f in the above proposition, we can compute a q-expansion for g. This leads to the following algorithm. Steps: (1) Find a basis for H 1 ( 0 (MK 2 ) ∩ 1 (K ), Q) and determine the fixed subspace Output: A finite set of q-expansions a 1 q + a 2 q 2 + . . . + a prec+1 q prec+1 with each a i ∈ Q(ζ Kh ) + , corresponding to a basis for S 2 ( 0 (MK 2 ) ∩ 1 (K ), Q(ζ Kh ) + ) F . When A, and F are defined as at the start of this section, this space equals S 2 ( , Q(ζ Kh ) + ) A .
Proof The discussion at the start of this section shows that we indeed obtain a basis for the space S 2 ( 0 (MK 2 ) ∩ 1 (K ), Q) F . In (7) in Sect. 3.3, we saw that a basis of q-expansions with coefficients in Q(ζ Kh ) exists, and, as J normalises F , we can reduce further to Q(ζ Kh ) + .

The Q-rational structure
We continue the notation from the previous section. Assume also that A determines a Gal(Q/Q)-invariant automorphism group. Then we know that a model for X G /A over Q must exist. Given the modular forms in S 2 ( , Q(ζ Kh ) + ) A computed using Algorithm 4.11, we can compute some model for (X G /A) Q(ζ Kh ) + , but this model tends to be defined over Q(ζ Kh ) + rather than over Q. We want to compute the fixed space for the action of the remaining matrices in G ⊂ GL 2 (Z/N Z) of determinant unequal to 1, as defined in Sect. 3.1. This action on cusp forms is only Q-linear, as opposed to C-linear, which complicates matters: the pairing (8) between modular forms and modular symbols, being defined by integration, does not descend to a pairing between two Q-vector spaces.
We first prove a Sturm bound. For a curve X and a divisor D on X, denote by the sheaf of regular differential 1-forms, and by O X (D) the sheaf such that for each open U ⊂ X, the set O X (D)(U ) consists of those functions f in the function field of X satisfying div(f | U ) ≥ −D ∩ U .
Proof This is a standard argument. Let K be the canonical divisor. By assumption, ω yields a global section of the sheaf O X (kK − (k(2g − 2) + 1)x). This sheaf has degree kdeg(K ) − k(2g − 2) − 1 < 0, and therefore has no non-zero global sections. This composition yields a map V (f ) + ∩ S 2 ( G , Q(ζ K )) → V (f ) + ∩ S 2 ( G , Q(ζ K )) corresponding to the action of A on q-expansions. (7) For each V (f ) + , determine q-expansions of a basis for (V (f ) + ∩S 2 ( G , Q(ζ K ))) A,A 1 ,...,A n , up to the precision needed for the next step. (8) Use the q-expansions to determine equations for X G /A, as done by Galbraith [19].
Unless X G /A is hyperelliptic, this is done by computing homogeneous Q-rational polynomial equations satsified by the q-expansions, up to q prec . To show an equa-tion of degree d holds provably, we need prec > d(2g − 2) − (d − 1), where g = dim(S 2 ( G , Q(ζ K )) A ). For the details when X G /A is hyperelliptic, we refer to [19].
Output: A finite number of homogeneous polynomials over Q in g + 1 variables if X G /A is non-hyperelliptic, a single polynomial in 2 variables if X G /A is hyperelliptic.
Remark 4.14 By Petri's theorem (see [25]), the canonical image of a non-hyperelliptic curve of genus g ≥ 4 is an intersection of quadrics unless the curve is trigonal or (isomorphic to) a plane quintic. It thus often suffices to take prec > 4g − 5. In the trigonal and plane quintic cases, the canonical image is defined by equations of degree 4, while for genus 3 curves the canonical image is cut out by equations of degrees up to 3 (see [27,Lemma 7.1]). In every case, therefore, prec > 8g − 11 suffices.
Proof This algorithm computes the right object because S 2 ( G , Q(ζ K )) A,A 1 ,...,A n is equal to H 0 (X G /A, 1 ), as shown in Sect. 3.3. In Step (1), a basis over Q(ζ + K ) exists because A is Galois invariant. The crucial claim in Step (4) that B maps O(μ) G ,+ into O(μ) + requires proof. Since A ∈ G K and JAJ ∈ G K , we find that JAJA −1 ∈ G K ∩ SL 2 (Z/K Z). So JAJ and A, though different operators in general, have identical restriction to In particular, A acts maps the +-eigenspace H C ( 0 (MK 2 ) ∩ 1 (K )) G into the space H C ( 0 (MK 2 ) ∩ 1 (K )). Since γ d commutes with J (even as matrices), we conclude that B maps H C ( 0 (MK 2 ) ∩ 1 (K )) G into H C ( 0 (MK 2 ) ∩ 1 (K )). Because B ∈ 0 (M) moreover acts on twist orbit spaces, this proves the claim. Furthermore, γ d acts on V (f ) + , since for σ : Step (5) again relies on Propositions 4.8 and 4.10. Steps (6) and (7) are linear algebra computations, and for the details of Step (8) we refer to [19]. We recall that S 2k ( G , Q(ζ K )) A = H 0 (X/A, ⊗k ). The lower bound on prec follows from Lemma 4.12 by noting that the coefficient for q in the expansion of a product of d cusp forms is determined by the first − (d − 1) coefficients of each cusp form.

Remark 4.15
If α ∈ N G /P G commutes with each element of A, then α determines an automorphism of X G /A. If α also commutes with J , the action of α on each real twist orbit space can be determined explicitly, which can be translated into a matrix for the action of α on the basis of cusp forms found in Step (7). From this, we obtain the automorphism on X G /A determined by α explicitly. Moreover, having determined the q-expansions for generators of the function field of X G /A, we can determine maps to other modular curves, such as the j-map.
We note that the q-expansions computed in Step (7) still do not have Q-rational coefficients in general, but do satisfy rational equations. Ultimately, this is because the image of the infinity cusp on (a rational model for) X G /A is-in general-not a Q-rational point, so the expansion of a regular differential form at this cusp also tends to have non-rational coefficients.

The three curves
Consider the subgroup defined in [18,Proposition 9.1]. This is an index 2 subgroup of the normaliser G(ns7 + ) of a non-split Cartan subgroup of GL 2 (F 7 ). Also consider B 0 (5) ⊂ GL 2 (F 5 ), and let G(b5, e7) be the intersection of the inverse images of G(e7) and B 0 (5) in GL 2 (Z/35Z). We obtain a degree 2 map Every degree 2 map of curves is the quotient by an involution. Let us call this involution φ 7 : X(b5, e7) → X(b5, e7). This corresponds to the action of a matrix in G(ns7 + ) \ G(e7) (c.f. Example 2.6) and commutes with the Atkin-Lehner involution w 5 (defined in Definition 2.8, using any η ∈ G(e7) of determinant 5 mod 7). We thus obtain the following diagram of degree 2 maps between modular curves We note that φ 7 and w 5 represent the two subsets of allowed automorphisms described in Remark 3.5. We use Algorithm 4.13 to compute canonical models for the three modular curves in the middle row, as well as their maps to X(b5, ns7)/w 5 , and a basis for their global differential forms by means of modular forms. This has been used by the author in [8] as part of the proof that all elliptic curves over quartic fields not containing √ 5 are modular.

Finding generators
In [18], the group G(e7) was defined as (12) inside the normaliser of a non-split Cartan subgroup. Recall that these Cartan subgroups are only defined up to conjugacy. We work in the non-split Cartan subgroup G(ns7) := a 5b b a ∈ GL 2 (F 7 ) | a, b ∈ F 7 and its normaliser G(ns7 + ) generated by G(ns7) and 1 0 0 −1 . Note that 5 is a generator of F × 7 . In order to determine which subgroup of G(ns7 + ) corresponds to G(e7), we first find a choice-independent definition. Proof The group GL 2 (F 7 ) is a relatively small finite group, and we do these computations in Magma. For uniqueness, we can use any normaliser of a non-split Cartan G(ns7 + ), and we use the one defined above. To verify that G(e7) indeed satisfies these properties, we can work with the group defined in (12).
To this end, we first compute the fixed spaces S g 0 ,φ 7 , S g 0 ,w 5 and S g 0 ,w 5 ·φ 7 , after which we determine the Q-rational structure by considering C and J .
We verify correctness as follows. We compute that π has degree 6. The correct map π to X(ns7) also has degree 6. Viewing π, π as elements of the function field of X(b5, ns7), their difference π − π thus has polar degree at most 12. Hence a precision of 13 suffices.