1 Introduction

Consider a positive integer N and a subgroup \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\). To the group G we can associate the modular curve \(X_G\), which parametrises pairs \((E,\phi )\) up to isomorphism, where E is an elliptic curve and \(\phi \) 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/{\mathbb {Q}}\) in the case where \(\mathrm {det}(G)=({\mathbb {Z}}/N{\mathbb {Z}})^{\times }\), \(-I\in G\) and G is normalised by \(J:=\begin{pmatrix} 1&{}\quad 0\\ 0&{}\quad -1\end{pmatrix}\). 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 \(\mathcal {A}\) of such automorphisms, we can also determine \(X_G/\mathcal {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 \(\sqrt{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 \(\Gamma _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(\Gamma _0(N),\epsilon )\), where \(\epsilon \) 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_{\mathrm {ns}^+}(20)\) and \(X_{\mathrm {ns}^+}(21)\), as well as for the isomorphic curves \(X_{\mathrm {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 \({\mathbb {Q}}\) (see also [22]).

Derickx et al. [16] used a planar model for \(X(\mathrm {b}5,\mathrm {ns}7)\) (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)\times _{X(1)}X_{\mathrm {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 \(\ell \)-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_{\mathrm {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(\Gamma ,{\mathbb {C}})\) of arbitrary weight and congruence subgroup \(\Gamma \subset \mathrm {SL}_2({\mathbb {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(\mathrm {b}5,\mathrm {e}7)\) (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 \(\Gamma _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.

2 Morphisms between modular curves

2.1 Modular curves not of the standard type

In the literature, modular curves tend to be described as being determined by a level \(N\in {\mathbb {Z}}_{>0}\) and a subgroup \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {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)\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) of upper-triangular matrices—parametrises pairs (EC) where E is an elliptic curves and \(C\subset 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 (EC) to (E/CE[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 \({\mathbb {Q}}\), and it is a modular curve in the adelic sense: \((X_0(N)/w_N)_{{\mathbb {C}}}=\mathrm {GL}_2^+({\mathbb {Q}})\backslash (\mathrm {GL}_2({\mathbb {A}}_f)\times \mathcal {H})/U\), where \({\mathbb {A}}_f\) denotes the finite adèles, \(\mathcal {H}\) is the complex upper half-plane and U is the compact open subgroup of \(\mathrm {GL}_2({\mathbb {A}}_f)\) generated by \(w_N\) and the inverse image of G in \(\mathrm {GL}_2({\widehat{{\mathbb {Z}}}})\).

While Atkin–Lehner involutions may be well understood, more modular curves can arise in this way. Firstly, when \(h^2\mid N\) for a non-trivial divisor h of 24, the normaliser of \(\Gamma _0(N)\) in \(\mathrm {PGL}_2({\mathbb {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 \({\mathbb {Q}}\), however). When \(N\in \{40,48\}\), two such automorphisms were explicitly determined by Bruin and Najman [9]. When \(9\mid N\), one normalising matrix is \(\begin{pmatrix} 1 &{}\quad 1/3 \\ 0 &{}\quad 1\end{pmatrix}\), giving rise to an automorphism \(\alpha _3\) of order 3, defined over \({\mathbb {Q}}(\zeta _3)\), such that the group \(\langle \alpha _3\rangle \) generated by \(\alpha _3\) is \({\mathbb {Q}}\)-rational. In particular, this yields a “new” morphism of curves over \({\mathbb {Q}}\), \(X_0(N)\rightarrow X_0(N)/\langle \alpha _3\rangle \).

More types of examples occur on modular curves of mixed level by composing automorphisms. Denote by \(G(\mathrm {s}3^+)\) and \(G(\mathrm {ns}3^+)\) the normalisers in \(\mathrm {GL}_2({\mathbb {F}}_3)\) of split and non-split Cartan subgroups respectively. Then \(G(\mathrm {s}3^+)\subset G(\mathrm {ns}3^+)\) with index 2. Any matrix in \(G(\mathrm {ns}3^+)\setminus G(\mathrm {s}3^+)\) determines an involution \(\phi _3\) on \(X_{G(\mathrm {s}3^+)}\). On the level 15 modular curve \(X(\mathrm {b}5,\mathrm {s}3^+)\), determined by the intersection of the inverse images of \(B_0(5)\) and \(G(\mathrm {s}3^+)\) in \(\mathrm {GL}_2({\mathbb {Z}}/15{\mathbb {Z}})\), we then obtain an Atkin–Lehner involution \(w_5\) as well as a lift \(\psi _3\) of \(\phi _3\). These involutions commute and give rise to another involution \(\psi _3w_5\), and another modular curve \(X(\mathrm {b}5,\mathrm {s}3^+)/\psi _3w_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.

2.2 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 \({\mathbb {Z}}[1/N]\) or \({\mathbb {Z}}[1/N,\zeta _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\in {\mathbb {Z}}_{\ge 1}\) be an integer, and choose a primitive Nth root of unity \(\zeta _N:=e^{2\pi i/N}\in {\mathbb {C}}\). To define modular curves via their moduli interpretation, we need to consider arbitrary base schemes. Let S be a scheme over \({\mathbb {Z}}[1/N]\). An elliptic curve over S is a pair \((E\rightarrow S,O)\), where \(E\rightarrow S\) is a proper smooth map, all of whose fibres are geometrically connected curves of genus 1, and O is a section of \(E\rightarrow S\). Then E/S obtains the structure of a commutative group scheme. On E/S, there is the Weil pairing

$$\begin{aligned} e_N:\;\;E[N](S)\times E[N](S) \rightarrow \mathbf {\mu }_N(S),\;\; (P,Q)\mapsto e_N(P,Q), \end{aligned}$$

where \(\mu _N=\mathrm {Spec}({\mathbb {Z}}[X]/(X^N-1))\) is the multiplicative group scheme of Nth roots of unity. To such an elliptic curve E/S, we can associate its \(\Gamma (N)\)-structures, defined as the maps

$$\begin{aligned} \phi :\; ({\mathbb {Z}}/N{\mathbb {Z}})_S^2\rightarrow E[N](S), \end{aligned}$$

such that \(E[N]=\sum _{(a,b)\in {\mathbb {Z}}/N{\mathbb {Z}}^2}\phi (a,b)\) as effective Cartier divisors. (When \(S=\mathrm {Spec}(K)\) for a field K of characteristic coprime to N, this means that \(\phi (0,1)\) and \(\phi (1,0)\) form a basis.) Now suppose that \(g\in \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\). Then g acts on \(({\mathbb {Z}}/N{\mathbb {Z}})_S^2\) by right-multiplication of row vectors, and this is compatible with the Weil pairing in the sense that

$$\begin{aligned} e_N(\phi (a,b),\phi (c,d)) =e_N(\phi (1,0),\phi (0,1))^{\mathrm {deg}(g)} \text { for each } g= \begin{pmatrix} a &{}\quad b \\ c &{}\quad d \end{pmatrix} \in \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}}).\nonumber \\ \end{aligned}$$
(1)

We consider the functor

$$\begin{aligned} \mathcal {F}_N:\;\mathrm {\underline{Sch}}_{{\mathbb {Z}}[\zeta _N]}\rightarrow \mathrm {\underline{Set}},\;\; S\mapsto \{(E/S,\phi )\}, \end{aligned}$$

mapping a scheme S to the isomorphism classes of pairs \((E/S,\phi )\), where E is an elliptic curve over S and \(\phi \) is a \(\Gamma (N)\)-structure on E/S. The Weil pairing defines a map of functors \(e_N:\; \mathcal {F}_N\rightarrow \mu _N\), and we define the subfunctor \( \mathcal {F}_N^{\mathrm {can}}:\;\mathrm {\underline{Sch}}_{{\mathbb {Z}}[\zeta _N]}\rightarrow \mathrm {\underline{Set}} \), mapping S to the set of pairs \((E/S,\phi )\in \mathcal {F}_N(S)\) such that \(e_N(\phi (1,0),\phi (0,1))=\zeta _N\). This rigidifies the moduli problem. Now \(\mathcal {F}_N^{\mathrm {can}}\) admits a coarse moduli space \(Y(N)/{\mathbb {Z}}[\zeta _N]\), whose compactification X(N) is smooth over \({\mathbb {Z}}[\zeta _N,1/N]\), as shown e.g. in [20, Chap. 9].

We now consider any subgroup \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\). Its group of determinants \(\mathrm {det}(G)\) acts on \({\mathbb {Z}}[\zeta _N]\) by automorphisms via \(\zeta _N\mapsto \zeta _N^a\) for \(a\in \mathrm {det}(G)\). We obtain a fixed subring \({\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}\subset {\mathbb {Z}}[\zeta _N]\). For schemes \(S/{\mathbb {Z}}[\zeta _N]\), the right-action of G on \(({\mathbb {Z}}/N{\mathbb {Z}})_S^2\) by right-multiplication gives rise to a left-action on \(\Gamma (N)\)-structures. For \(g\in G\) and a \(\Gamma (N)\)-structure \(\phi \), we denote this by \(g\cdot \phi \), so that \((g\cdot \phi )(a)=\phi (a\cdot g)\). Denote the G-equivalence class of the \(\Gamma (N)\)-structure \(\phi \) by \([\phi ]_G\).

Given a \({\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}\)-scheme S and an elliptic curve E/S, we can consider schemes T/S and their base-change \(T':=T\times _{{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}}{\mathbb {Z}}[\zeta _N]\).

Definition 2.1

We define the functor

$$\begin{aligned} \mathcal {F}_G:\;\mathrm {\underline{Sch}}_{{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}}\rightarrow \mathrm {\underline{Set}},\;\; S\mapsto \{(E/S,[\phi ]_G\}, \end{aligned}$$

mapping a scheme S to the set of isomorphism classes of pairs \((E/S,[\phi ]_G)\), where \([\phi ]_G\) is a G-equivalence class of \(\Gamma (N)\)-structures on \(E_{T'}/T'\) for some T/S, such that \([\phi ]_G\) is “defined over S”. We define \(\mathcal {F}_G^{\mathrm {can}}\) as the subfunctor of those pairs \((E/S,[\phi ]_G)\) where \(e_N(\phi (1,0),\phi (0,1))\) and \(\zeta _N\) have the same image in \(\mu _N/\mathrm {det}(G)(S)\), or, more concretely, where

$$\begin{aligned} e_N(\phi (1,0),\phi (0,1))=\zeta _N^a \text { for some } a\in \mathrm {det}(G). \end{aligned}$$

As shown in [20, Chap. 9], \(\mathcal {F}_G^{\mathrm {can}}\) admits a coarse moduli scheme \(Y_G/{\mathbb {Z}}[1/N,\zeta _N]^{\mathrm {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 \([\phi ]_G\) to be “defined over S”. Given an elliptic curve E/S, we consider the functor

$$\begin{aligned} (\mathcal {F}_N)_{E/S}:\;\; \underline{\mathrm {Sch}}_{S}\longrightarrow \underline{\mathrm {Set}},\;\; T\mapsto \{\Gamma (N)\text {-structures on } E_T/T\}. \end{aligned}$$

This functor is represented by an S-scheme \(\mathcal {M}_{E/S}\), meaning that we have bijections \(\mathcal {M}_{E/S}(T)\longleftrightarrow (\mathcal {F}_N)_{E/S}(T)\), functorially in T. Now G acts on \(\mathcal {M}_{E/S}\), and we say that \([\phi ]_G\) is defined over S, when the image of \(\phi \) in the \(T'\)-points \((\mathcal {M}_{E/S}/G)(T')\) of the quotient scheme is in fact in \((\mathcal {M}_{E/S}/G)(S)\).

2.3 Notation for modular curves

We define the congruence subgroup \(\Gamma _G\) associated to \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) to be the inverse image under \(\mathrm {SL}_2({\mathbb {Z}})\rightarrow \mathrm {SL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) of \(G\cap \mathrm {SL}_2({\mathbb {Z}}/N{\mathbb {Z}})\). For any ring R, we denote by \(\mathrm {P}\Gamma \) the image of \(\Gamma \subset \mathrm {GL}_2(R)\) in \(\mathrm {PGL}_2(R)\). Recall that \((Y_G)_{{\mathbb {C}}}\simeq \Gamma _G\backslash \mathcal {H}\), where \(\mathcal {H}\) is the upper half-plane and \(\Gamma _G\) acts by fractional linear transformations. When \(N=K\cdot M\), we denote by \(G_K\) the image of G in \(\mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\).

By \(\mathcal {N}_{\Gamma _G}\) we denote the normaliser of \(\mathrm {P}\Gamma _G\) in \(\mathrm {PGL}_2^+({\mathbb {Q}})\), where the superscript \(+\) means “with positive determinant”, and by \(\mathcal {N}_G\subset \mathcal {N}_{\Gamma _G}\) the subgroup of those \(\gamma \in \mathcal {N}_{\Gamma _G}\) satisfying condition (2), to be defined in Proposition 2.3. We define the following subgroups of \(\mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\):

$$\begin{aligned} B_0(N):= & {} \begin{pmatrix} * &{}\quad * \\ 0 &{}\quad *\end{pmatrix},\;\;B_1(N):=\begin{pmatrix} * &{}\quad * \\ 0 &{}\quad 1 \end{pmatrix},\;\; {\widetilde{B}}_1(N):=\begin{pmatrix} 1 &{}\quad * \\ 0 &{}\quad 1 \end{pmatrix},\\ G(N):= & {} \begin{pmatrix} *&{}\quad 0 \\ 0 &{}\quad 1 \end{pmatrix},\;\; {\widetilde{G}}(N):=\left\{ I\right\} . \end{aligned}$$

We denote their congruence subgroups by \(\Gamma _0(N)\), \(\Gamma _1(N)\), \({\widetilde{\Gamma }}_1(N)\), \(\Gamma (N)\) and \({\widetilde{\Gamma }}(N)\) respectively. Note that \({\widetilde{\Gamma }}_1(N)=\Gamma _1(N)\) and \({\widetilde{\Gamma }}(N)=\Gamma (N)\). The corresponding modular curves are denoted by \(X_0(N)\), \(X_1(N)\), \({\widetilde{X}}_1(N)\), X(N) and \({\widetilde{X}}(N)\).

We also write \(X(\Gamma _G)\) instead of \(X_G\) and \({\widetilde{X}}(\Gamma _G)\) instead of \(X_{{\widetilde{G}}}\) when G is clear from context. For positive integers KM, we define \(X(\Gamma _0(M)\cap \Gamma _1(K))\), resp. \({\widetilde{X}}(\Gamma _0(M)\cap \Gamma _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 \({\widetilde{B}}_1(K)\), in \(\mathrm {GL}_2({\mathbb {Z}}/\mathrm {lcm}(K,M){\mathbb {Z}})\). Similarly, define \(X(\Gamma _0(M)\cap \Gamma (K))\) and \({\widetilde{X}}(\Gamma _0(M)\cap \Gamma (K))\).

The curves \({\widetilde{X}}(\Gamma _0(M)\cap \Gamma (K))\) and \({\widetilde{X}}(\Gamma _0(M)\cap \Gamma _1(K))\) will be the protagonists of our story.

2.4 Morphisms between modular curves and their moduli interpretation

We first mention two kinds of trivial morphisms.

  1. (M1)

    When \(G\subset H\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\), denote by \(\mathcal {F}_H^{\mathrm {can}}|_{\mathrm {\underline{Sch}}_{{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}}}\) the restriction of \(\mathcal {F}_H^{\mathrm {can}}\) to \(\underline{\mathrm {Sch}}_{{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}}\). We obtain a forgetful map of functors \(\mathcal {F}_G^{\mathrm {can}}\rightarrow \mathcal {F}_H^{\mathrm {can}}|_{\mathrm {\underline{Sch}}_{{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}}}\) yielding a quotient morphism \(X_G\rightarrow X_H\times _{{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(H)}}{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}\).

  2. (M2)

    Consider any group \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) and an integer M. Define \(\pi : \; \mathrm {GL}_2({\mathbb {Z}}/MN{\mathbb {Z}})\rightarrow \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\). The multiplication-by-M map on NM-torsion of elliptic curves and the to-the-Mth-power map \(\mu _{NM}\rightarrow \mu _N\) commute with respect to the Weil pairing by (1), and define an isomorphism of functors \(\mathcal {F}_{\pi ^{-1}(G)}^{\mathrm {can}}\rightarrow \mathcal {F}_G^{\mathrm {can}}\). We conclude that \(X_{\pi ^{-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\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) and \(\Delta \subset \mathrm {det}(G)\) is a subgroup, we can consider the subgroup \(H\subset G\) of elements \(g\in G\) with \(\mathrm {det}(g)\in \Delta \). Then G and H give rise to the same congruence subgroups, hence \((X_G)_{{\mathbb {C}}}=(X_H)_{{\mathbb {C}}}\). We obtain a morphism of curves \((X_H)_{{\mathbb {Q}}(\zeta _N)^{\mathrm {det}(H)}}\rightarrow (X_G)_{{\mathbb {Q}}(\zeta _N)^{\mathrm {det}(H)}}\) of the form (M1), which must be an isomorphism. For example, \({\widetilde{X}}(\Gamma _0(M)\cap \Gamma _1(K))_{{\mathbb {Q}}(\zeta _K)}=X(\Gamma _0(M)\cap \Gamma _1(K))_{{\mathbb {Q}}(\zeta _K)}\) and \({\widetilde{X}}(\Gamma _0(M)\cap \Gamma (K))_{{\mathbb {Q}}(\zeta _K)}=X(\Gamma _0(M)\cap \Gamma (K))_{{\mathbb {Q}}(\zeta _K)}\).

Suppose that \(\gamma \in \mathrm {GL}_2^+({\mathbb {Q}})\) satisfies \(\gamma \Gamma _G\gamma ^{-1}\subset \Gamma _H\) for some \(G,H\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\). Then \(\gamma \) defines a morphism \((X_G)_{{\mathbb {C}}}\rightarrow (X_{H})_{{\mathbb {C}}}\) through its action as a fractional linear transformation on \(\mathcal {H}\). This is a morphism defined a priori over \({\mathbb {C}}\). We investigate when this morphism is in fact defined over \({\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}\). The following proposition generalises, and was inspired by, [9, Sect. 3].

Proposition 2.3

Suppose that \(G,H\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) and consider \(\gamma \in \mathrm {GL}_2^+({\mathbb {Q}})\). Assume (after scaling) that \(\gamma \) has integral coefficients, with . Denote by \(\pi : \; \mathrm {GL}_2({\mathbb {Z}}/N\delta {\mathbb {Z}})\rightarrow \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) the reduction map. If

$$\begin{aligned} \gamma \pi ^{-1}(G) \subset \pi ^{-1}(H)\gamma \end{aligned}$$
(2)

then \(\mathrm {det}(G)\subset \mathrm {det}(H)\) and \(\gamma \) determines a morphism \(\theta _{\gamma }: X_G\rightarrow X_H\times _{{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(H)}} {\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}\).

Moreover, \(\gamma \Gamma _G\gamma ^{-1} \subset \Gamma _H\) and \((\theta _{\gamma })_{{\mathbb {C}}}:\; (X_G)_{{\mathbb {C}}}\rightarrow (X_H)_{{\mathbb {C}}}\) corresponds to the action of \(\gamma \) on \(\Gamma _G\backslash \mathcal {H}\) followed by projection onto \(\Gamma _H\backslash \mathcal {H}\) .

Proof

We shall replace G by \(\pi ^{-1}(G)\) and construct a morphism \(\mathcal {F}^{\mathrm {can}}_{\pi ^{-1}(G)}\rightarrow \mathcal {F}^{\mathrm {can}}_H|_{{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}}\). We first unravel formalities to make concrete what this means. The functor \(\mathcal {F}^{\mathrm {can}}_G\) is the functor associated to the “moduli problem” \(([\Gamma (N)]/G)^{\mathrm {can}}\), as defined in [20, 9.4]. There are two constructions at work here: the quotient by G (see [20, Chap. 7]), and the \(\mathrm {can}\)-construction (see [20, Chap. 9]). It follows from (M2), [20, Corollary 9.1.9] and [20, Theorem 7.1.3] that it suffices to define a \((\pi ^{-1}G,H)\)-equivariant map \(\alpha :\mathcal {F}_{N\delta }\rightarrow \mathcal {F}_N\) given by

$$\begin{aligned} \alpha :\; (E/S,\phi : ({\mathbb {Z}}/N\delta {\mathbb {Z}})_S\rightarrow E[N\delta ])\mapsto (E_{\gamma }/S,\phi _{\gamma }: ({\mathbb {Z}}/N{\mathbb {Z}})_S\rightarrow E_{\gamma }[N]) \end{aligned}$$

that gives rise to a commutative diagram

figure a

where the bottom map is defined by \(\zeta _{N\delta }\mapsto \zeta _N=\zeta _{N\delta }^{\delta }\). By \((\pi ^{-1}G,H)\)-equivariant we mean that \(E_{\gamma }/S\) depends only on \([\phi ]_{\pi ^{-1}(G)}\), and moreover for each \((E,\phi )\in \mathcal {F}_{N\delta }\) and each \(g\in \pi ^{-1}(G)\) there exists \(h\in H\) such that \((g\cdot \phi )_{\gamma }=h\cdot \phi _{\gamma }\) and \(e_N(\alpha (E/S,\phi ))^{\mathrm {det}(h)}=e_{N\delta }(E/S,\phi )^{\delta \mathrm {det}(g)}\).

So we consider E/S and a \(\Gamma (N\delta )\)-structure \(\phi :\; ({\mathbb {Z}}/N\delta {\mathbb {Z}})_S^2\rightarrow E[N\delta ]\).

For \(M\in {\mathbb {Z}}_{\ge 1}\), denote by \(\mathrm {Im}_M(\gamma )\) the image of the action of \(\gamma \) on \(({\mathbb {Z}}/M{\mathbb {Z}})_S^2\) by right-multiplication. We then define . Due to (2), the subgroup \(C_{\gamma }\) depends only on \([\phi ]_{\pi ^{-1}(G)}\). The size of \(C_{\gamma }(S)\) is \(\delta \). We define , and note that \(E_{\gamma }[N]=[N]^{-1}C_{\gamma }/C_{\gamma }\), where [N] denotes multiplication-by-N on E. Next, we define the map

figure b

map denoted by \({\overline{\gamma }}\) is given by \((1,0)\mapsto (a,b)\) and \((0,1)\mapsto (c,d)\), while the map denoted by \({\overline{\phi }}\) is determined by \(\phi \).

Now consider \(g\in \pi ^{-1}(G)\). By (2), we find \(h\in \pi ^{-1}(H)\) such that \( h\gamma =\gamma g\). For a matrix \(\eta \), denote by \(m_{\eta }\) the right-multiplication map by \(\eta \). Then

$$\begin{aligned} {\overline{\phi }}\circ m_g \circ m_{{\overline{\gamma }}} = {\overline{\phi }}\circ m_{{\overline{\gamma }}g}={\overline{\phi }}\circ m_{{\overline{\gamma }}}\circ m_{\pi (h)} \end{aligned}$$

so that indeed \((g\cdot \phi )_{\gamma }=\pi (h)\cdot \phi _{\gamma }\), as desired. The standard properties of the Weil pairing under isogenies show that

$$\begin{aligned} e_N(\phi _{\gamma }(1,0),\phi _{\gamma }(0,1))=e_{N\delta }(\phi (1,0),\phi (0,1))^{\delta }, \end{aligned}$$

leaving us to show only that \(\mathrm {det}(g)\equiv \mathrm {det}(h) \text { mod }N\). For this, we note that from the matrix \(\gamma \) of determinant \(\delta \), we have constructed an invertible linear map \({\overline{\gamma }}:\; ({\mathbb {Z}}/N{\mathbb {Z}})^2_S\rightarrow \mathrm {Im}_{N\delta }(\gamma )/N\mathrm {Im}_{N\delta }(\gamma )\), and \(m_{{\overline{\gamma }}}\circ m_{\pi (h)} = m_{g}\circ m_{{\overline{\gamma }}}\) thus implies \(\mathrm {det}(h)\equiv \mathrm {det}(g)\text { mod }N\). It follows that \(\gamma \) indeed determines a morphism of functors \(\mathcal {F}_{\pi ^{-1}(G)}^{\mathrm {can}}\rightarrow \mathcal {F}_H^{\mathrm {can}}|_{{\mathbb {Z}}[\zeta _N]^{\mathrm {det}(G)}}\), and thus of their compactified coarse moduli spaces.

Next, we consider \(S=\mathrm {Spec}({\mathbb {C}})\). We start by showing that \(\gamma \Gamma _G\gamma ^{-1}\subset \Gamma _H\). By (2), for each \(s\in \Gamma _G\) there exists \(s'\in \Gamma _H\) such that \(s'\gamma \equiv \gamma s \text { mod }N\delta \). Then \(s'\gamma -\gamma s\) has all entries divisible by \(\mathrm {det}(\gamma )\), and consequently \(\gamma s \gamma ^{-1}\in \mathrm {SL}_2({\mathbb {Z}})\). Hence \(u=\gamma s\gamma ^{-1}(s')^{-1}\) is in \(\mathrm {SL}_2({\mathbb {Z}})\) and reduces to the identity mod N, so \(u\in \Gamma _H\). We conclude that \(\gamma s \gamma ^{-1} = us' \in \Gamma _H\), as desired.

Recall that we have a bijection \(\Gamma _G\backslash \mathcal {H}\rightarrow \mathcal {F}_G(\mathrm {Spec}({\mathbb {C}}))\) given by

$$\begin{aligned} \Gamma _G\tau \mapsto (E_{\tau },[\phi _{\tau }]_G),\quad E_{\tau }=\frac{{\mathbb {C}}}{\tau {\mathbb {Z}}\oplus {\mathbb {Z}}},\quad \phi _{\tau }(1,0)=\frac{\tau }{N},\quad \phi _{\tau }(0,1)=\frac{1}{N}, \end{aligned}$$

and similarly for H. We check that the action of \(\gamma \) just defined corresponds under this bijection to the action of \(\gamma \) on \(\mathcal {H}\) as a fractional linear transformation. So we consider \(\tau \in \mathcal {H}\) and \((E_{\tau },[\phi _{\tau }]_G)\in \mathcal {F}_G(\mathrm {Spec}({\mathbb {C}}))\). First, we note that

$$\begin{aligned} C_{\gamma }=\left\langle \frac{a\tau }{\delta }+\frac{b}{\delta },\frac{c\tau }{\delta }+\frac{d}{\delta }\right\rangle . \end{aligned}$$

As \(\mathrm {det}(\gamma )=\delta \), we have \(\tau {\mathbb {Z}}\oplus {\mathbb {Z}}\subset \frac{1}{\delta }((a\tau +b){\mathbb {Z}}\oplus (c\tau +d){\mathbb {Z}})\), and we obtain an isomorphism

$$\begin{aligned} \beta :\; E_{\tau }/C_{\gamma }={\mathbb {C}}/\left( \left( \frac{a\tau }{\delta }+\frac{b}{\delta }\right) {\mathbb {Z}}\oplus \left( \frac{c\tau }{\delta }+\frac{d}{\delta }\right) {\mathbb {Z}}\right) \longrightarrow E_{\gamma (\tau )}, \end{aligned}$$
(4)

defined by \(z\mapsto \delta \cdot z /(c\tau +d)\). Finally, (1, 0) transforms under \(\beta \circ (\phi _{\tau })_{\gamma }\) as follows:

$$\begin{aligned} \beta \circ (\phi _{\tau })_{\gamma }:\; (1,0)\mapsto (a,b)\mapsto \frac{a\tau }{N\delta }+\frac{b}{N\delta }\mapsto \frac{\gamma (\tau )}{N} \end{aligned}$$

and similarly it maps (0, 1) to 1/N, so that indeed \((E_{\tau },[\phi _{\tau }]_G)\) is mapped to \((E_{\gamma (\tau )},[\phi _{\gamma (\tau )}]_H)\). \(\square \)

Remark 2.4

Suppose that \(\gamma \in \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) normalises \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\). Then the prescription \((E/S,[\phi ]_G)\mapsto (E/S,[\gamma \cdot \phi ]_G)\) determines a morphism of functors \(\mathcal {F}_G\rightarrow \mathcal {F}_G\), and if moreover \(\mathrm {det}(\gamma )\in \mathrm {det}(G)\), this specialises to a map \(\mathcal {F}_G^{\mathrm {can}}\rightarrow \mathcal {F}_G^{\mathrm {can}}\). We obtain an automorphism of \(X_G\). However, this does not correspond to the action of \(\gamma \) on \(\mathcal {H}\) by fractional linear transformations.

Instead, we can choose \(g\in G\) such that \(\mathrm {det}(g)=\mathrm {det}(\gamma )\). Any lift of \(g^{-1}\gamma \) to \(\mathrm {SL}_2({\mathbb {Z}})\) then normalises \(\Gamma _G\) and satisfies the conditions of Proposition 2.3. It determines the same morphism \(X_G\rightarrow X_G\) as \(\gamma \) did.

Example 2.5

We consider the curve \(X_0(N)/{\mathbb {Z}}[1/N]\). It is well-known that \(W_N=\begin{pmatrix} 0 &{}\quad -1\\ N &{}\quad 0\end{pmatrix}\) normalises \(\Gamma _0(N)\) and \(\Gamma _1(N)\). Here we have \(\delta =N\) and \(\mathrm {det}(G)=({\mathbb {Z}}/N{\mathbb {Z}})^{\times }\). We verify that

$$\begin{aligned} W_N\pi ^{-1}(B_0(N))=\left\{ \begin{pmatrix} Na &{}\quad b\\ Nc&{}\quad Nd\end{pmatrix} \in M_2({\mathbb {Z}}/N^2{\mathbb {Z}})\mid b,c\in ({\mathbb {Z}}/N^2{\mathbb {Z}})^{\times }\right\} = \pi ^{-1}(B_0(N))W_N, \end{aligned}$$

so that \(W_N\) indeed defines a morphism of \({\mathbb {Z}}[1/N]\)-schemes \(X_0(N)\rightarrow X_0(N)\). We similarly find that \(W_N\) defines a morphism of \({\mathbb {Z}}[1/N,\zeta _N]\)-schemes \({\widetilde{X}}_1(N)\rightarrow {\widetilde{X}}_1(N)\).

Example 2.6

Remark 2.4 actually helps us find examples. This situation occurs when we have two groups \(G_1\subset G_2\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) such that \(G_1\) is normal in \(G_2\) and \(\mathrm {det}(G_1)=\mathrm {det}(G_2)\). Any lift \(\gamma \in \Gamma _{G_2}\setminus \Gamma _{G_1}\) then determines an automorphism \(\theta _{\gamma }\) on \(X_{G_1}\).

A concrete example of this is \(B_1(N)\subset B_0(N)\).

Other examples occur when \([\Gamma _{G_1}:\Gamma _{G_2}]=2\) and \(\mathrm {det}(G_1)=\mathrm {det}(G_2)\). Then also \([G_1:G_2]=2\), so that \(G_2\) is normal in \(G_1\). Then \(\theta _{\gamma }\) (for any \(\gamma \in \Gamma _{G_2}\setminus \Gamma _{G_1}\)) is the involution on \(X_{G_1}\) such that \(X_{G_1}/\theta _{\gamma } = X_{G_2}\).

Examples of this are \(B_0(4)\subset \pi ^{-1}(B_0(2))\), where \(\pi : \mathrm {GL}_2({\mathbb {Z}}/4{\mathbb {Z}})\rightarrow \mathrm {GL}_2({\mathbb {Z}}/2{\mathbb {Z}})\), \(G(\mathrm {s}3^+)\subset G(\mathrm {ns}3^+)\) (the normalisers of split and non-split Cartan subgroups in \(\mathrm {GL}_2({\mathbb {F}}_3)\) respectively), and the inclusion \(G(\mathrm {e7})\subset G(\mathrm {ns}7^+)\) described in Sect. 5.

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 \(\mathrm {gcd}(K,M)=1\), and we have \(G_K\subset \mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) and \(G_M,H_M\subset \mathrm {GL}_2({\mathbb {Z}}/M{\mathbb {Z}})\). Consider \(\gamma \in \mathrm {GL}_2({\mathbb {Q}})^+\) with integral coefficients and determinant \(\delta \in {\mathbb {Z}}\) coprime to K, satisfying (2) of Proposition 2.3 for \(G_M\) and \(H_M\). Consider also \(\eta \in \mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) of determinant \(\delta \text { mod }K\) normalising \(G_K\).

Define \(G=\pi _K^{-1}(G_K)\cap \pi _M^{-1}(G_M)\) and \(H=\pi _K^{-1}(G_K)\cap \pi _M^{-1}(H_M)\), where \(\pi _K:\mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\rightarrow \mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) and \(\pi _M: \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\rightarrow \mathrm {GL}_2({\mathbb {Z}}/M{\mathbb {Z}})\).

Then \(\gamma \) and \(\eta \) determine a morphism \(X_G\rightarrow X_H\) such that the diagram

figure c

commutes. This morphism depends only on \(\gamma \) and \(\eta (G_K\cap \mathrm {SL}_2({\mathbb {Z}}/K{\mathbb {Z}}))\subset \mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\).

Proof

Recall from the proof of Proposition 2.3 that \(\theta _{\gamma }: X_{G_M}\rightarrow X_{H_M}\) is only determined by its image \({\overline{\gamma }}\) in \(\mathrm {GL}_2({\mathbb {Z}}/\delta M{\mathbb {Z}})\). As \(\mathrm {gcd}(K,M\delta )=1\), we can thus find \(\alpha \in M_2({\mathbb {Z}})\) of \(\mathrm {det}(\alpha )=\delta \) lifting both \(\eta \) and \({\overline{\gamma }}\) (and the image of \(\alpha \) in \(M_2({\mathbb {Z}}/\delta MK{\mathbb {Z}})\) is uniquely determined by \({\overline{\gamma }}\) and \(\eta \)). Denote by \(\pi :\mathrm {GL}_2({\mathbb {Z}}/\delta M{\mathbb {Z}})\rightarrow \mathrm {GL}_2({\mathbb {Z}}/M{\mathbb {Z}})\) the natural map. Then \(\alpha \) satisfies \(\alpha \pi ^{-1}(G_M)\subset \pi ^{-1}(H_M)\alpha \) and \(\alpha G_K=G_K\alpha \). As \(\mathrm {gcd}(M\delta ,K)=1\), we conclude that also \(\alpha G\subset H\alpha \), as desired. The commutativity of the diagram follows by construction. Finally, each \({\widetilde{\beta }}\in G_K\cap \mathrm {SL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) can be lifted to \(\beta \in \Gamma _{G_K}\) that is the identity mod \(\delta M\), and therefore acts trivially on \(X_G\). The morphism determined by \(\gamma \) and \(\eta {\widetilde{\beta }}\) is \(\theta _{\alpha }\circ \theta _{\beta }=\theta _{\alpha }\). \(\square \)

Note that we do not assume in the lemma that \(\eta \in G_K\). However, if there exists \(\eta \in G_K\) of determinant \(\delta \text { mod }K\), then the map \(X_G\rightarrow X_H\) determined by \(\gamma \) and \(\eta \) is independent of the choice of \(\eta \in G_K\), and we call it the lift of \(X_{G_M}\rightarrow X_{H_M}\) to \(X_G\rightarrow X_H\). When such \(\eta \in G_K\) does not exist, the obtained map really depends on the choice of \(\eta \). This distinction becomes apparent when considering the Atkin–Lehner morphisms on \(X_0(KM)\) and \({\widetilde{X}}_1(KM)\) determined by \(W_M\).

Definition 2.8

Consider again \(N=KM\) with \(\mathrm {gcd}(M,K)=1\), and a group \(G_K\subset \mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) which is normalised by \(\eta \in \mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) with \(\mathrm {det}(\eta )=M\text { mod }K\). Consider \(G:=\pi _K^{-1}(G_K)\cap \pi _M^{-1}(B_0(M))\subset \mathrm {GL}_2({\mathbb {Z}}/KM{\mathbb {Z}})\) or \(G:=\pi _K^{-1}(G_K)\cap \pi _M^{-1}({\widetilde{B}}_1(M))\), where \(\pi _K\) and \(\pi _M\) are defined as in Lemma 2.7. By Lemma 2.7, \(W_M\) and \(\eta \) define an automorphism on \(X_G\), which we call an Atkin–Lehner morphism at M. When \(\eta \in G_K\), we call it the Atkin–Lehner involution at M and denote it by \(w_M\).

Example 2.9

For coprime integers K, M, define \(W_M(x,y,z,w):=\begin{pmatrix} Mx &{}\quad y \\ MKz &{}\quad Mw \end{pmatrix}\), where \(x,y,z,w\in {\mathbb {Z}}\) satisfy \(\mathrm {det}(W_M(x,y,z,w))=M\). Its mod K reduction is in \(B_0(K)\), and moreover

$$\begin{aligned} W_M(x,y,z,w)=\begin{pmatrix} -y &{}\quad x \\ -Mw &{}\quad zK\end{pmatrix}\begin{pmatrix} 0 &{}\quad -1 \\ M &{}\quad 0\end{pmatrix}, \end{aligned}$$

so its reduction mod \(M^2\) is \(\gamma W_M\), where \(\gamma \in \mathrm {GL}_2({\mathbb {Z}}/M^2{\mathbb {Z}})\) reduces into \(B_0(M)\) mod M. So indeed \(W_M(x,y,z,w)\) defines the Atkin–Lehner involution \(w_M\) on \(X_0(KM)\) (which is independent of the choice of \(x,y,z,w\in {\mathbb {Z}}\)), and an Atkin–Lehner morphism \(w_M(x,y,z,w)\) on \({\widetilde{X}}_1(KM)\) because \(B_0(K)\) normalises \({\widetilde{B}}_1(K)\) (dependent on the choice of \(x,y,z,w\in {\mathbb {Z}}\)).

For \(K\in {\mathbb {Z}}\), we define

$$\begin{aligned} \gamma _K:=\begin{pmatrix} K &{}\quad 0 \\ 0 &{}\quad 1\end{pmatrix}. \end{aligned}$$

The action of \(\gamma _K\) on \(\mathcal {H}\) often leads to interesting morphisms between modular curves.

Example 2.10

Let p be a prime. The split Cartan subgroup of \(\mathrm {GL}_2({\mathbb {F}}_p)\) is the group \(G(\mathrm {s}p)\) of diagonal matrices. We interpret this as a group of level \(p^2\) by considering its inverse image in \(\mathrm {GL}_2({\mathbb {Z}}/p^2{\mathbb {Z}})\). We then apply Proposition 2.3 with \(\gamma _p\) to find a morphism

$$\begin{aligned} \phi :\;X_0(p^2)\longrightarrow X(\mathrm {s}p) \end{aligned}$$

defined over \({\mathbb {Q}}\), where \(X(\mathrm {s}p):=X_{G(\mathrm {s}p)}\). By considering the congruence subgroups, we see that \(\phi \) must be an isomorphism. Or, alternatively, the inverse is defined by \(p\cdot \gamma _p^{-1}\).

On \(X_0(p^2)\) we have the involution \(w_{p^2}\) defined by \(W_{p^2}\), see Example 2.5. On \(X(\mathrm {s}p)\) this corresponds under \(\phi \) to the involution defined by the matrix \(i:=\frac{1}{p}\gamma _p W_{p^2}\gamma _p^{-1}=\begin{pmatrix} 0 &{}\quad 1 \\ -1 &{}\quad 0\end{pmatrix}\). This matrix is in fact invertible mod p. Denote by \(G(\mathrm {s}p^+)\subset \mathrm {GL}_2({\mathbb {F}}_p)\) the group generated by i and \(G(\mathrm {s}p)\). This is the normaliser of \(G(\mathrm {s}p)\), and it defines a modular curve \(X(\mathrm {s}p^+)\), a degree 2 quotient of \(X(\mathrm {s}p)\). We conclude that \(\phi \) descends to an isomorphism \(X(\mathrm {s}p^+)\simeq X_0(p^2)/w_{p^2}\) over \({\mathbb {Q}}\), a fact also observed in [12, p. 555].

Example 2.11

Consider again a prime p, and positive integers ba. Define \(c:=\mathrm {max}(a,b)\). As in the previous example, \(\gamma _{p^a}\) defines an isomorphism

$$\begin{aligned} {\widetilde{X}}(\Gamma _0(p^b)\cap \Gamma (p^a))\simeq {\widetilde{X}}(\Gamma _0(p^{c+a})\cap \Gamma _1(p^a)). \end{aligned}$$

For any \(K,M\in {\mathbb {Z}}_{\ge 1}\) with \(L:=\mathrm {gcd}(K,M)\), we thus deduce from Lemma 2.7 that \(\gamma _K\) defines an isomorphism

$$\begin{aligned} {\widetilde{X}}( \Gamma _0(M)\cap \Gamma (K))\simeq {\widetilde{X}}(\Gamma _0(MK^2/L)\cap \Gamma _1(K)) \end{aligned}$$

of curves over \({\mathbb {Q}}(\zeta _K)\).

3 Operators on spaces of cusp forms

3.1 The regular 1-forms on a modular curve

Let G be a subgroup of \(\mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {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 \({\mathbb {Q}}(\zeta _N)^{\mathrm {det}(G)}\).

For \(\gamma \in \mathrm {SL}_2({\mathbb {Z}}/N{\mathbb {Z}})\), we see that any lift of \(\gamma \) to \(\mathrm {SL}_2({\mathbb {Z}})\) acts on X(N) as the automorphism \(\theta _{\gamma }\), by Proposition 2.3. Next, consider \(a\in ({\mathbb {Z}}/N{\mathbb {Z}})^{\times }\) and the matrix \(\gamma _a:=\begin{pmatrix} a &{}\quad 0 \\ 0 &{}\quad 1\end{pmatrix}\). As in Remark 2.4, the prescription \((E/S,\phi )\mapsto (E/S,\phi \circ \gamma _a)\) determines a morphism of functors \(\mathcal {F}_N\rightarrow \mathcal {F}_N\). However, unless \(a=1\), we have \(\mathrm {det}(\gamma _a)\notin \mathrm {det}(\{1\})\) so that \(\gamma _a\) does not determine a morphism \(\mathcal {F}_N^{\mathrm {can}}\rightarrow \mathcal {F}_N^{\mathrm {can}}\). Define the functor \(\mathcal {F}_N^{\mathrm {can},a}\) by instead mapping a scheme S to those pairs \((E/S,\phi )\), where \(e_N(\phi )=\zeta _N^a\). This similarly has a coarse moduli space \({\widetilde{X}}(N)^a/{\mathbb {Q}}(\zeta _N)\), which is the base change of \({\widetilde{X}}(N)\) by Galois conjugation \(\sigma _a:{\mathbb {Q}}(\zeta _N)\rightarrow {\mathbb {Q}}(\zeta _N),\;\zeta _N\mapsto \zeta _N^a\). Then \(\gamma _a\) does determine a morphism \({\widetilde{X}}(N)\rightarrow {\widetilde{X}}(N)^a\) of curves over \({\mathbb {Q}}(\zeta _N)\). Composing this map with base change by \(\sigma _a^{-1}\), we obtain a map of schemes \(\theta _{a}:\;X(N)\rightarrow X(N)\), whose corresponding map on function fields is merely a morphism of \({\mathbb {Q}}(\zeta _N)^{\langle \sigma _a\rangle }\)-algebras.

Each function \(f\in {\mathbb {Q}}(\zeta _N)({\widetilde{X}}(N))\) has a Laurent series expansion around the infinity cusp (which is a \({\mathbb {Q}}(\zeta _N)\)-rational point). Denote by \(q_N(\tau )=e^{2\pi i \tau /N}\) a uniformiser at this cusp, and write the expansion of f in its completed local ring as \(f=\sum _{n\ge -m} a_n(f) q_N^n\), where \(m\in {\mathbb {Z}}_{>0}\) and each \(a_n(f)\in {\mathbb {Q}}(\zeta _N)\). As also shown by Shimura [23, Proposition 6.9], the maps just described yield a right action \(\circ \) of \(\mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) on \({\mathbb {Q}}(\zeta _N)({\widetilde{X}}(N))\) such that for each \(f=\sum _{n\ge -m} a_n q_N^n\in {\mathbb {Q}}(\zeta _N)(X(N))\):

  1. (i)

    for each \(\gamma \in \mathrm {SL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) we have \(f\circ \gamma = \theta _{{\widetilde{\gamma }}}^*(f)\), where \({\widetilde{\gamma }}\) is a lift of \(\gamma \) to \(\mathrm {SL}_2({\mathbb {Z}})\), and

  2. (ii)

    \(f\circ \gamma _a=\theta _a^*(f)=\sum _{n\ge -m} \sigma _a(a_n)q_N^n\).

From now on, we suppose that \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) satisfies

$$\begin{aligned} \mathrm {det}(G)=({\mathbb {Z}}/N{\mathbb {Z}})^{\times } \text { and }-I\in G. \end{aligned}$$

The first condition means we consider only curves defined over \({\mathbb {Q}}\). Then, again by Shimura’s work [23], the fixed field \({\mathbb {Q}}(\zeta _N)({\widetilde{X}}(N))^{G}\) defines an irreducible projective curve over \({\mathbb {Q}}\), which is simply \(X_G\).

We denote by \(S_k(\Gamma ,K)\) the space of weight k cusp forms with respect to \(\Gamma \) whose Fourier coefficients all lie in K.

The action of \(\mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) on \({\widetilde{X}}(N)\) gives rise to an action on its sheaf of regular 1-forms, which in turn corresponds to modular forms.

Proposition 3.1

The map \(f\mapsto f(q_N) (\mathrm {d}q_N)/q_N\) defines an isomorphism

$$\begin{aligned} S_{2}(\Gamma (N),{\mathbb {Q}}(\zeta _N))^G \simeq H^0(X_G,\Omega ). \end{aligned}$$

Here \(\Omega \) is the sheaf of regular 1-forms on \(X_G\).

Proof

By definition of \(S_2(\Gamma (N),{\mathbb {Q}}(\zeta _N))\), the map \(S_2(\Gamma (N),{\mathbb {Q}}(\zeta _N))\rightarrow H^0(X(N),\Omega _{X(N)})\) is well-defined, an isomorphism and G-equivariant. We then take G-invariants, and note that \(H^0(X_G,\Omega )=H^0(X(N),\Omega )^G\) because \({\mathbb {Q}}(X_G)={\mathbb {Q}}(\zeta _N)({\widetilde{X}}(N))^G\). For more details, see [27, Lemma 6.5]. \(\square \)

Our strategy will be to compute a basis for \(S_{2}(\Gamma (N),{\mathbb {Q}}(\zeta _N))^G\) and derive equations for \(X_G\) by finding equations between these cusp forms, following Galbraith [19].

3.2 The conjugation trick

It will be useful to split the level N into two parts \(N=MK\), where \(\mathrm {gcd}(M,K)=1\), such that the image of G in \(\mathrm {GL}_2({\mathbb {Z}}/M{\mathbb {Z}})\) is \(B_0(M)\). Then

$$\begin{aligned} S_{2}(\Gamma (N),{\mathbb {Q}}(\zeta _N))^{G}=S_{2}(\Gamma _0(M)\cap \Gamma (K),{\mathbb {Q}}(\zeta _K))^{G}, \end{aligned}$$
(5)

by definition of \(B_0(M)\).

From now on, we think of \(\Gamma _G=\Gamma _0(M)\cap \Gamma _{G_K}\) as being a “level K congruence subgroup of \(\Gamma _0(M)\)”, rather than a level N congruence subgroup of \(\mathrm {SL}_2({\mathbb {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}(\Gamma _0(M)\cap \Gamma (K),{\mathbb {Q}}(\zeta _K))\) is currently implemented in a computer algebra system. We fix this by conjugating with \(\gamma _K\). The trick to studying modular forms on \(\Gamma (K)\), as used by Banwait and Cremona [5] and later by Zywina [27], is to notice that \( \gamma _K^{-1}\Gamma (K)\gamma _K = \Gamma _0(K^2)\cap \Gamma _1(K). \) In fact, we already saw in Example 2.11 that \(\gamma _K\) induces an isomorphism

$$\begin{aligned} {\widetilde{X}}(\Gamma _0(M)\cap \Gamma (K))\simeq {\widetilde{X}}(\Gamma _0(MK^2)\cap \Gamma _1(K)). \end{aligned}$$
(6)

Efficient algorithms for computing spaces of cusp forms for \(\Gamma _0(MK^2)\cap \Gamma _1(K)\) using modular symbols have been implemented in Magma and Sage thanks to the work of Cremona [14] and Stein [24], amongst others.

3.3 Normalisers and statement of the main theorem

In this section, we explain for which elements \(A\in \mathcal {N}_{\Gamma _G}\) we can determine its action on \(X_G\) explicitly. We would like to be able to act with such A on \(S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\overline{{\mathbb {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\equiv 1 \text { mod }h\) implies \(x\equiv y \text { mod }h\). Equivalently, they are the integers h such that

$$\begin{aligned} {\widetilde{T}}_h:=\begin{pmatrix} 1 &{}\quad 1/h \\ 0 &{}\quad 1\end{pmatrix} \end{aligned}$$

normalises \(\Gamma _0(h^2)\).

Lemma 3.2

The normaliser of \(\Gamma _0(M)\) in \(\mathrm {PSL}_2({\mathbb {R}})\) is generated by \(\Gamma _0(M)\) itself, the Atkin–Lehner matrices \(W_m(x,y,z,w)\) for \(m\mid M\) with \(\mathrm {gcd}(M/m,m)=1\), and \({\widetilde{T}}_h\), where h is the largest divisor of 24 such that \(h^2\mid M\).

This lemma is originally due to Atkin and Lehner [2]; see [13, Sect. 3] for an elegant proof. While the Atkin–Lehner matrices act on \(X_0(M)\) over \({\mathbb {Q}}\), the matrix \({\widetilde{T}}_h\) determines an automorphism on \(X_0(M)\) defined over \({\mathbb {Q}}(\zeta _h)\). When h divides M and \(H\subset \mathrm {GL}_2({\mathbb {Z}}/M{\mathbb {Z}})\) is a subgroup, define

$$\begin{aligned} H^h:=\{M\in H \mid \mathrm {det}(M)\equiv 1 \text { mod }h\}. \end{aligned}$$

By Example 2.2, we find that \(X_0(M)_{{\mathbb {Q}}(\zeta _h)}=X_{B_0^h(M)}\). Similarly, we have \((X_G)_{{\mathbb {Q}}(\zeta _h)}=X_{G^h}\). On \(X_{G^h}\), the elements in \(\mathcal {N}_{G^h}\) act by automorphisms. We restrict to those automorphisms which also act on \(X(\Gamma _0(M)\cap \Gamma (K))\).

Corollary 3.3

Let h be the largest divisor of 24 such that \(h^2\mid M\). The normaliser \(\mathcal {N}_{\Gamma _0(M)}\) acts by automorphisms on \(X(\Gamma _0(M)\cap \Gamma (K))_{{\mathbb {Q}}(\zeta _{Kh})}\).

Proof

In view of Example 2.2, it suffices to show that \(\mathcal {N}_{\Gamma _0(M)}\) acts by automorphisms on \(X_H\), where \(H\subset \mathrm {GL}_2({\mathbb {Z}}/MK{\mathbb {Z}})\) is the intersection of the inverse images of \({\widetilde{G}}(K)=\{I\}\subset \mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) and \(B_0(M)^h\subset \mathrm {GL}_2({\mathbb {Z}}/M{\mathbb {Z}})\). Note that \(X_H\) is defined over \({\mathbb {Q}}(\zeta _{Kh})\). We can now verify explicitly that Atkin–Lehner matrices, \(h{\widetilde{T}}_h\) and elements of \(\Gamma _0(M)\) satisfy condition (2) to define a morphism \(X_H\rightarrow X_H\). Here we note that any matrix in \(\mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) normalises \(\{I\}={\widetilde{G}}(K)\). To see that \(h{\widetilde{T}}_h\) satisfies (2), we crucially use that \(xy\equiv 1 \text { mod }h\) implies \(x\equiv y\text { mod }h\). \(\square \)

Consider a subgroup \(\mathcal {A}\subset (\mathcal {N}_{\Gamma _0(M)}\cap \mathcal {N}_{G^h})/\mathrm {P}\Gamma _G\). By definition, this acts by automorphisms on \(X_{G^h}=(X_G)_{{\mathbb {Q}}(\zeta _h)}\). Moreover, by intersecting with \(\mathcal {N}_{\Gamma _0(M)}\), we have ensured that \(\mathcal {A}\) acts on \(X(\Gamma _0(M)\cap \Gamma (K))\) over \({\mathbb {Q}}(\zeta _{Kh})\), just like G does, and we can treat \(\mathcal {A}\) and G in a similar way. Taking \(\mathcal {A}\)-invariants in Proposition 3.1 and applying (6) and (5), we obtain

$$\begin{aligned} H^0((X_G/\mathcal {A})_{{\mathbb {Q}}(\zeta _h)},\Omega )=S_{2}(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {Q}}(\zeta _{Kh}))^{G,\mathcal {A}}, \end{aligned}$$
(7)

where \(\alpha \in \mathcal {A}\) and \(\alpha \in \mathrm {SL}_2({\mathbb {Z}}/MK{\mathbb {Z}})\) act on cusp forms f by \(f\mapsto f[\gamma _K^{-1}\alpha \gamma _K]\), and matrices \(\gamma _a=\begin{pmatrix} a &{}\quad 0 \\ 0 &{}\quad 1\end{pmatrix}\in \mathrm {GL}_2({\mathbb {Z}}/MK{\mathbb {Z}})\) act on cusp forms by Galois conjugating Fourier coefficients by \(\sigma _a\) (because \(\gamma _a\) and \(\gamma _K\) commute), c.f. Sect. 3.1.

Theorem 3.4

Suppose that M and K are coprime integers, \(G\subset \mathrm {GL}_2({\mathbb {Z}}/MK{\mathbb {Z}})\) satisfies \(-I\in G\), \(\mathrm {det}(G)=({\mathbb {Z}}/MK{\mathbb {Z}})^{\times }\), \(JGJ=G\), and \(G_M=B_0(M)\). Let h be the largest divisor of 24 such that \(h^2\mid M\). Consider a finite subgroup \(\mathcal {A}\subset (\mathcal {N}_{\Gamma _0(M)}\cap \mathcal {N}_{G^h})/\mathrm {P}\Gamma _G\), normalised by J and determining a \(\mathrm {Gal}({\overline{{\mathbb {Q}}}}/{\mathbb {Q}})\)-invariant subgroup of \(\mathrm {Aut}_{{\overline{{\mathbb {Q}}}}}(X_G)\). Then Algorithm 4.13 is a terminating algorithm for computing a model for the curve \(X_G/\mathcal {A}\) over \({\mathbb {Q}}\), provided it has genus \(g\ge 2\).

Remark 3.5

While we have restricted the allowed automorphisms by intersecting with \(\mathcal {N}_{\Gamma _0(M)}\), we have not excluded the two natural subsets. Firstly, recall that any \(\alpha \in \mathcal {N}_{\Gamma _0(M)}\) determines a morphism on \(X_0(M)_{{\mathbb {Q}}(\zeta _h)}\). Because \(G_K\) has surjective determinant and \(\alpha \) has determinant coprime to K, we can by Lemma 2.7 extend this to a morphism on \(X_G\) determined by a matrix in \(\mathcal {N}_{\Gamma _0(M)}\cap \mathcal {N}_{G^h}\). The allowed automorphisms thus contain the Atkin–Lehner involutions and the morphisms determined by \({\widetilde{T}}_h\). We will see that J indeed normalises Atkin–Lehner operators. Secondly, any \(\alpha \in \mathrm {SL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) normalising \(G_K\) determines an automorphism on \(X_{G_K}\), after lifting \(\alpha \) to \(\mathrm {SL}_2({\mathbb {Z}})\). By lifting \(\alpha \) to \(\Gamma _0(M)\), we obtain a morphism on \(X_G\) determined by a matrix in \(\mathcal {N}_{\Gamma _0(M)}\cap \mathcal {N}_{G^h}\).

We shall first find a way (Algorithm 4.11) to determine the fixed space \(S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {Q}}(\zeta _{Kh}))^{\langle \Gamma _G,\mathcal {A}\rangle }\), 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.

3.4 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 \({\mathbb {C}}\)-bilinear pairing between cusp forms and homology.

We consider any group \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) corresponding to a congruence subgroup \(\Gamma :=\Gamma _G\) of level N. We assume again that G is normalised by \( J=\begin{pmatrix} -1 &{}\quad 0 \\ 0 &{}\quad 1\end{pmatrix}. \) For the geometric curve \((X_G)_{{\mathbb {C}}}\), we then have the pairing between 1-forms and homology:

$$\begin{aligned} S_2(\Gamma ,{\mathbb {C}})\times H_1(X_G,{\mathbb {Z}}) \rightarrow {\mathbb {C}},\;\; \langle f,\gamma \rangle :=2\pi i \int _{\gamma } f(z)\mathrm {d} z. \end{aligned}$$

Extending this to \(H_1(X_\Gamma ,{\mathbb {R}})\), the pairing becomes \({\mathbb {R}}\)-bilinear. As in Sect. 3.1, the action of J on \(\mathcal {H}\subset {\mathbb {C}}\) composed with complex conjugation determines an involution of \({\mathbb {R}}\)-algebras \(J^*:\;{\mathbb {C}}(X_G)\rightarrow {\mathbb {C}}(X_G)\), or equivalently an involution on the Weil restriction \(\mathrm {Res}_{{\mathbb {C}}/{\mathbb {R}}}(X_G)_{{\mathbb {C}}}\). Here \(z\in \mathcal {H}\) is mapped to \(z^*:=-{\overline{z}}=\overline{J(z)}\), and \(f\in S_2(\Gamma ,{\mathbb {C}})\) to \(J^*(f)=\overline{f(z^*)}\). We note that \(f\mapsto 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_{\Gamma },{\mathbb {R}})\). Denote by \(H_1(X_{\Gamma },{\mathbb {R}})^+\) its \(+1\)-eigenspace. Then our pairing restricts to an exact duality of real vector spaces

$$\begin{aligned} S_2(\Gamma ,{\mathbb {R}})\times H_1(X_\Gamma ,{\mathbb {R}})^+\rightarrow {\mathbb {R}}. \end{aligned}$$

Define

$$\begin{aligned} H_{{\mathbb {C}}}(\Gamma ):=H_1(X_\Gamma ,{\mathbb {R}})^+\otimes {\mathbb {C}}. \end{aligned}$$

Finally, we extend the pairing \({\mathbb {C}}\)-linearly on both sides to obtain an exact \({\mathbb {C}}\)-bilinear pairing

$$\begin{aligned} S_2(\Gamma ,{\mathbb {C}})\times H_{{\mathbb {C}}}(\Gamma )\rightarrow {\mathbb {C}},\; (f,\mu )\mapsto \langle f,\mu \rangle . \end{aligned}$$
(8)

The pairing (8) identifies \(H_{{\mathbb {C}}}(\Gamma )\) with the dual of \(S_2(\Gamma ,{\mathbb {C}})\). Subsequently, the Petersson inner product identifies \(S_2(\Gamma ,{\mathbb {C}})\) with its own dual. We thus obtain an isomorphism

$$\begin{aligned} S_2(\Gamma ,{\mathbb {C}})\rightarrow H_{{\mathbb {C}}}(\Gamma ),\; f\mapsto \gamma _f \end{aligned}$$
(9)

(due to Cremona) defined by

$$\begin{aligned} \langle g,\gamma _f\rangle = \langle g,f\rangle \text{ for } \text{ all } g\in S_2(\Gamma ,{\mathbb {C}}), \end{aligned}$$

where the latter pair of brackets denotes the Petersson inner product. Our strategy for studying \(S_2(\Gamma ,{\mathbb {C}})\) is to study \(H_{{\mathbb {C}}}(\Gamma )\) 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 \({\mathbb {C}}\)-linear. This means that

$$\begin{aligned} \gamma _{\alpha f}={\overline{\alpha }}\gamma _f \text { for each }\alpha \in {\mathbb {C}}. \end{aligned}$$

The great benefit of studying the homology group is that the action of \(\mathcal {N}_{\Gamma }\) on \(H_1(X(\Gamma ),{\mathbb {Z}})\) can be computed explicitly when \(\Gamma =\Gamma _0(K^2M)\cap \Gamma _1(K)\), i.e. for each \(\gamma \in \mathcal {N}_{\Gamma }\) one can find a matrix for this linear action on \(H_1(X_{\Gamma },{\mathbb {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 \(\Gamma \supset \Gamma _0(MK^2)\cap \Gamma _1(K)\), one can compute \(H_1(X_{\Gamma },{\mathbb {Q}})\) as the subspace of \(H_1(X_{\Gamma _0(MK^2)\cap \Gamma _1(K)},{\mathbb {Q}})\) fixed by \(\Gamma \) with ease. The challenge is to relate this subspace \(H_1(X_{\Gamma },{\mathbb {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 \(\Gamma \) normalised by J, but one may think of this as being \(\Gamma _0(MK^2)\cap \Gamma _1(K)\).

Recall that every \(U=\begin{pmatrix} a &{}\quad b \\ c &{}\quad d\end{pmatrix}\in \mathrm {GL}_2^+({\mathbb {Q}})\) acts on the complex upper half-plane by fractional linear transformations, giving rise to an action on meromorphic functions on \(\mathcal {H}\)

$$\begin{aligned}{}[U]: \;f(\tau )\mapsto (f|U)(\tau ):=(c\tau +d)^{-2}f\circ U(\tau ) \end{aligned}$$

and on paths \(\gamma :[0,1]\rightarrow \mathcal {H}\):

$$\begin{aligned}{}[U]:\; \gamma \mapsto U(\gamma ):=U\circ \gamma . \end{aligned}$$
(10)

Definition 3.7

We define the Hecke algebra \({\mathbb {T}}_{\Gamma }\) to be the \({\mathbb {C}}\)-algebra of \({\mathbb {C}}\)-valued functions on \(\mathrm {P}\Gamma \backslash \mathrm {P}\mathrm {GL}_2^+({\mathbb {Q}})/\mathrm {P}\Gamma \), where the \(\mathrm {P}\) denotes the image in \(\mathrm {PGL}_2({\mathbb {Q}})\).

Each \(T\in {\mathbb {T}}_{\Gamma }\) can be represented as a \({\mathbb {C}}\)-linear combination of double cosets \(\mathrm {P}\Gamma \alpha \mathrm {P}\Gamma \). Such a coset has a left-\(\mathrm {P}\Gamma \) action, and splits as a finite disjoint union \(\mathrm {P}\Gamma \alpha \mathrm {P}\Gamma =\sqcup \mathrm {P}\Gamma \alpha _i\). This way, we obtain a Hecke operator \(T_{\alpha }=\sum _i [\alpha _i]\), acting on \((X_{\Gamma })_{{\mathbb {C}}}\) as a correspondence, and consequently on \(S_2(\Gamma ,{\mathbb {C}})\) and \(H_1(X_{\Gamma },{\mathbb {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\in {\mathbb {T}}_{\Gamma }\), and \(\gamma \in H_{{\mathbb {C}}}(\Gamma )\) such that \(JT(\gamma )=T(\gamma )\) (i.e. \(T(\gamma )\) remains in the +1-eigenspace). This is always the case when \(TJ=JT\). Then for all \(f\in S_2(\Gamma ,{\mathbb {C}})\) we have

  1. (a)

    \(\langle f|T,\gamma \rangle = \langle f,T(\gamma )\rangle \)

  2. (b)

    \(\gamma _{f|T^*}=T(\gamma _f)\),

where \(T^*\) is the adjoint of T with respect to the Petersson inner product.

Proof

By definition of the action, \((f|U)(\tau )\mathrm {d}\tau = f(U(\tau ))\mathrm {d}U(\tau )\) for each matrix U. Integrating this relation for each U in T gives us part (a), as long as \(T(\gamma )\in H_{{\mathbb {C}}}(\Gamma )\). Part (b) follows by definition of the Petersson inner product. \(\square \)

We recall (see e.g. [17, Proposition 5.5.2]) that for \(U\in \mathrm {GL}_2^+({\mathbb {Q}})\), we have \( [U]^*=\mathrm {det}(U)[U^{-1}]. \)

3.5 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_{{\mathbb {C}}}(\Gamma )\) under (9).

When \(\Gamma =\Gamma _0(MK^2)\cap \Gamma _1(K)\), the solution is to use Hecke operators and their common eigenvectors. Let \(f_1,\ldots ,f_n\in S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {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 \(\mu _1,\ldots ,\mu _n \in H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K))\) instead, by Lemma 3.8. This yields the q-expansions for a basis of \(S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {C}})\).

This approach does not work for \(S_2(\Gamma ,{\mathbb {C}})\) when \(\Gamma \supset \Gamma _0(MK^2\cap \Gamma _1(K)\) and the subspace \(S_2(\Gamma ,{\mathbb {C}})\subset S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {C}})\) is not a direct sum of Hecke eigenspaces, the problem being that each \(\mu _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 \(\alpha _1\mu _1+\alpha _2\mu _2\) when \(\mu _2\) is a twist of \(\mu _1\). While two Hecke eigenvectors need not always be twists, we define in Sect. 4.1 the twist orbit space of \(\mu _1\), and show that the action of \(\Gamma \) preserves this space.

3.6 Operators on modular forms and modular symbols

In this subsection, we study the congruence subgroup \( \Gamma _0(MK^2)\cap \Gamma _1(K), \) where again \(N,M\in {\mathbb {Z}}_{\ge 1}\) (not necessarily coprime). We define \(N:=K^2M\). Let \(\mathcal {D}_K\) be the group of Dirichlet characters on \(({\mathbb {Z}}/K{\mathbb {Z}})^{\times }\). Then

$$\begin{aligned} S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {C}})=\bigoplus _{\epsilon \in \mathcal {D}_K}S_2(N,\epsilon _N), \end{aligned}$$

where \(\epsilon _N\) denotes the composition of \(({\mathbb {Z}}/N{\mathbb {Z}})^{\times }\rightarrow ({\mathbb {Z}}/K{\mathbb {Z}})^{\times }\) and \(\epsilon \), and \(S_2(N,\epsilon )\) is the common eigenspace in \(S_2(\Gamma _1(N),{\mathbb {C}})\) for the diamond operators \(\langle d \rangle \) for \(\mathrm {gcd}(d,N)=1\) with eigenvalues \(\epsilon (d)\) respectively. The diamond operators also act on modular symbols, and Stein [24] defines their eigenspaces \(H_1(N,\epsilon )\subset H_1(X_{\Gamma _1(N)},{\mathbb {C}})\). We obtain a similar decomposition

$$\begin{aligned} H_1(X_{\Gamma _0(MK^2)\cap \Gamma _1(K)},{\mathbb {C}})=\bigoplus _{\epsilon \in \mathcal {D}_K}H_1(N,\epsilon ). \end{aligned}$$

The diamond operators commute with J, and \(H_1(N,\epsilon )^+\) is identified with \(S_2(N,{\overline{\epsilon }})\) under the isomorphism (9). Note here the complex conjugation of \(\epsilon \) which occurs due to Lemma 3.8(b) since \(\langle d \rangle ^*=\langle d \rangle ^{-1}\) for d coprime to N. Similarly, for primes \(p\not \mid N\), we have (see e.g. [17])

$$\begin{aligned} T_p^*=\langle p\rangle ^{-1}T_p. \end{aligned}$$

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 \(\langle p \rangle \), for all but finitely many primes p.

Under the isomorphism (9), we conclude by Lemma 3.8 that Hecke eigenspaces in \(S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {C}})\) are identified with Hecke eigenspaces in \(H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K))\), but the eigenvalues get complex conjugated.

Definition 3.10

Let L be a positive integer, and define, as before, \( {\widetilde{T}}_L:=\begin{pmatrix} 1 &{}\quad 1/L \\ 0 &{}\quad 1\end{pmatrix}. \) For \(\chi \in \mathcal {D}_L\) we define the twist operator

$$\begin{aligned} R_{\chi }(L):=\sum _{u\in {\mathbb {Z}}/L{\mathbb {Z}}} {\overline{\chi }}(u)[{\widetilde{T}}_L^u]. \end{aligned}$$

When \(L=\mathrm {cond}(\chi )\), we write \(R_{\chi }(L)=R_{\chi }\).

It is important to note that, even if f is of level N and \(L\mid N\), then \(\chi \) is considered as a mod L character in the definition of \(f|R_{\chi }(L)\); not as a mod N character.

We saw in Corollary 3.3 that \({\widetilde{T}}_1\) acts on \({\widetilde{X}}(\Gamma _0(M)\cap \Gamma (K))\) (and hence normalises \(\Gamma _0(M)\cap \Gamma (K))\). By (6), conjugation by \(\gamma _K\) shows that \({\widetilde{T}}_K=\gamma _K^{-1}{\widetilde{T}}_1\gamma _K\) normalises \(\Gamma _0(MK^2)\cap \Gamma _1(K)\) and acts on its spaces of cusp forms (with coefficients in \({\mathbb {Q}}(\zeta _K)\)) and homology; hence so does \(R_{\chi }(K)\) for \(\chi \in \mathcal {D}_K\).

Definition 3.11

Consider \(L\mid N\), \(d\mid N/L\) and \(\epsilon \in \mathcal {D}_N\) of conductor dividing L. Let \(\epsilon ': ({\mathbb {Z}}/L{\mathbb {Z}})^{\times }\rightarrow {\mathbb {C}}^{\times }\) be the corresponding mod L character. Let \(D_d:=\begin{pmatrix} 1&{}\quad 0\\ 0&{}\quad d\end{pmatrix}\) and suppose that \(\eta _1,\ldots ,\eta _s\) are the defined so that \(D_d\eta _1,\ldots ,D_d\eta _s\) are a full set of coset representatives for the left-action of \(\Gamma _0(N)\) on \(\begin{pmatrix}1&{}\quad 0 \\ 0 &{}\quad d\end{pmatrix}\Gamma _0(L)\). Then we have maps

$$\begin{aligned} B_d^{N/L}=B_d: S_2(L,\epsilon ')\rightarrow S_2(N,\epsilon ), \quad f\mapsto f|\begin{pmatrix} d&{}\quad 0 \\ 0&{}\quad 1\end{pmatrix} \end{aligned}$$

and

$$\begin{aligned} \mathrm {Tr}_d^{N/L}: S_2(N,\epsilon )\rightarrow S_2(L,\epsilon '),\quad f \mapsto \sum _{i=1}^s\epsilon '(\gamma _i)^{-1}f|D_d\gamma _i \end{aligned}$$

satisfying that \(\mathrm {Tr}^{N/L}_d\circ B_d^{N/L}\) is multiplication by \([\Gamma _0(N):\Gamma _0(L)]\). These operators similarly act on homology as in (10).

Lemma 3.12

We have \(JR_{\chi }(L)J=\chi (-1)R_{\chi }(L)\), \(JB_dJ=B_d\) and \(J\mathrm {Tr}_d^{N/L}J=\mathrm {Tr}_d^{N/L}\) for all \(\chi \in \mathcal {D}_L\) and all positive integers \(d\mid N/L\).

Proof

For \(B_d\) one simply multiplies matrices. For \(\mathrm {Tr}_d^{N/L}\), it suffices to note that \(\mathrm {Tr}_d^{N/L}\) is independent of the choice of coset representatives, and that J commutes with \(D_d\) and normalises \(\Gamma _0(N)\) and \(\Gamma _0(L)\). For \(R_{\chi }(L)\), we use its definition and note that \(J{\widetilde{T}}_K^aJ={\widetilde{T}}_K^{-a}\). \(\square \)

Lemma 3.13

Consider \(f\in S_2(N,\epsilon )\) and \(g\in S_2(L,\epsilon ')\), where \(L\mid N\). Let \(d\mid N/L\), and let \(\chi \in \mathcal {D}_L\) with \(\chi (-1)=1\). Then

$$\begin{aligned} \gamma _{f|R_{\chi }}&=R_{{\overline{\chi }}}(\gamma _f),\\ [\Gamma _0(N):\Gamma _0(L)]\cdot \gamma _{g|B_d^{N/L}}&=\mathrm {Tr}_d^{N/L}(\gamma _g) \text { and}\\ \gamma _{f|\mathrm {Tr}_d^{N/L}}&=[\Gamma _0(N):\Gamma _0(L)]\cdot \mathrm {B}_d^{N/L}(\gamma _f). \end{aligned}$$

Proof

For the first equality, we use that \({\widetilde{T}}_L^*={\widetilde{T}}_L^{-1}\) and recall that the isomorphism (9) is \({\mathbb {C}}\)-linear in both arguments, to find that

$$\begin{aligned} \langle h,\gamma _{f|R_{\chi }}\rangle = \langle h,f|R_{\chi }\rangle = \langle h|R_{{\overline{\chi }}},f\rangle =\langle h|R_{{\overline{\chi }}},\gamma _f\rangle = \langle h,R_{{\overline{\chi }}}(\gamma _f)\rangle , \end{aligned}$$

where we used Lemma 3.8(a) in the last equality.

Next, recall that

$$\begin{aligned} \langle f|\mathrm {Tr}_d^{N/L},g\rangle = [\Gamma _0(N):\Gamma _0(L)]\langle f,g|B_d\rangle . \end{aligned}$$

Define \(I:=[\Gamma _0(N):\Gamma _0(L)]\). We thus find that

$$\begin{aligned} I\cdot \langle g,\gamma _{f|B_d}\rangle = I\cdot \langle g,f|B_d\rangle = \langle g|\mathrm {Tr}_d^{N/L},f\rangle = \langle g|\mathrm {Tr}_d^{N/L},\gamma _f\rangle = \langle g,\mathrm {Tr}_d^{N/L}(\gamma _f)\rangle , \end{aligned}$$

as desired. Now repeat this with \(I\cdot B_d\) and \(\mathrm {Tr}_d^{N/L}\) reversed. \(\square \)

We define one final operator.

Definition 3.14

Suppose that \(L\mid N\) and \(\epsilon \in \mathcal {D}_N\) of conductor dividing L. Then we denote by

$$\begin{aligned} \mathrm {pr}_{N/L}: \; S_2(N,\epsilon )\rightarrow B_1^{N/L}(S_2(L,\epsilon ')) \end{aligned}$$

the orthogonal projection map onto the subspace, where “orthogonal” refers to the Petersson inner product, and \(\epsilon ': ({\mathbb {Z}}/L{\mathbb {Z}})^{\times }\rightarrow {\mathbb {C}}^{\times }\) is the character \(\epsilon \) factors through.

Similarly, we denote by

$$\begin{aligned} \pi _{N/L}:\; H_1(N,\epsilon )\rightarrow \mathrm {Tr}_1^{N/L}(H_1(L,\epsilon ')) \end{aligned}$$

the orthogonal projection onto the image of \(\mathrm {Tr}_1^{N/L}\).

By Lemma 3.13, we find that these operators are indeed dual to each other, i.e.

$$\begin{aligned} \pi _{N/L}(\gamma _f) = \gamma _{\mathrm {pr}_{N/L}(f)} \text { for all } f\in S_2(N,\epsilon ). \end{aligned}$$
(11)

Next, we study the \(R_{\chi }(L)\)-operators in more detail. We define \( U_q:=\sum _{u=0}^{q-1}\left[ \begin{pmatrix} 1 &{}\quad u \\ 0 &{}\quad q\end{pmatrix}\right] \) and recall a list of properties of the \(R_{\chi }(L)\) operators.

Lemma 3.15

Consider a character \(\chi \) of conductor dividing L, where \(L\mid N\).

  1. (a)

    Suppose \(f\in S_2(N,\epsilon )\) and \(\mu \in H_1(N,\epsilon )\), where \(\epsilon \) has conductor \(N'\), and set \({\widetilde{N}}:=\mathrm {lcm}(N,N'L,L^2)\). Then \(f|R_{\chi }(L)\in S_2({\widetilde{N}},\epsilon \chi ^2)\) and \(R_{\chi }(L)(\mu )\in H_1({\widetilde{N}},\epsilon {\overline{\chi }}^2)\).

  2. (b)

    If \(\mathrm {gcd}(L_1,L_2)=1\), \(\chi \in \mathcal {D}_{L_1}\) and \(\psi \in \mathcal {D}_{L_2}\), then \(R_{\chi }(L_1)R_{\psi }(L_2)=\chi (L_2)\psi (L_1)R_{\chi \psi }(L_1L_2)\).

  3. (c)

    We have \(f|R_{\chi }=g({\overline{\chi }})f\otimes \chi \), where \(g({\overline{\chi }})\) is the Gauss sum of \({\overline{\chi }}\).

  4. (d)

    When \(p\not \mid LN\), we have \(R_{\chi }(L)T_p=\chi (p)T_pR_{\chi }(L)\).

  5. (e)

    For \(a\in {\mathbb {Z}}\) with \(\mathrm {gcd}(a,L)=1\), we have \(\phi (L){\widetilde{T}}_L^a=\sum _{\epsilon \in \mathcal {D}_L}\epsilon (a)R_{\epsilon }(L)\).

  6. (f)

    Suppose that q is prime and \(N=q^sL\) for some \(s>0\). Suppose further that \(f\in S_2(N,\epsilon )\) is a newform with \(a_1(f)=1\) and \(\psi \) is a character whose conductor is a power of q. Then \(f\otimes \psi =g-g|U_Q|B_Q\), where Q is a power of q and \(g\in S_2(QL,\epsilon \psi ^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. \(\square \)

Parts (a) and (d) tell us exactly how \(R_{\chi }(L)\) acts on the set of Hecke eigenspaces. We extend part (f) to non-prime power conductors.

Corollary 3.16

Suppose that \(f\in S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {C}})\) is a newform at a level dividing N with \(a_1(f)=1\), and \(\chi \in \mathcal {D}_K\). Then \(f\otimes \chi =k-k'\), where k is the newform at a level L dividing N with \(a_1(k)=1\), and

$$\begin{aligned} k'\in \bigoplus _{\begin{array}{c} q\mid K \\ q>1 \text { prime} \end{array}}\mathrm {Im}B_q^{N/(N/q)}. \end{aligned}$$

In particular, \(\mathrm {pr}_{N/L}(f|R_{\chi })=g({\overline{\chi }})k\).

Proof

First, we note that

$$\begin{aligned} B_qR_{\chi }=\left( \sum _{u\in {\mathbb {Z}}/\mathrm {cond}(\epsilon ){\mathbb {Z}}}\chi (u){\widetilde{T}}_{\mathrm {cond}(\chi )}^{qu}\right) B_q. \end{aligned}$$

We now write \(\chi =\prod _{p\mid K}\chi _p\) as a product of characters of prime-power conductor. Then \(R_{\chi }=\lambda \prod _{p\mid K}R_{\chi _p}\) for some \(\lambda \in {\overline{{\mathbb {Q}}}}\) by Lemma 3.15(b). We now repeatedly apply Lemma 3.15(f) to each \(R_{\chi _p}\), keeping in mind the displayed equation above. \(\square \)

Given f and \(\chi \), we note that a q-expansion for k can be computed explicitly from its Hecke eigenvalues using Lemma 3.15(d). For \(R_{\chi }\) and \(B_d\) it is well-known how they act on q-expansions: \(f|B_d(q)=f(q^d)\) and \(f|R_{\chi }=g({\overline{\chi }})f\otimes \chi \), where \(g({\overline{\chi }})\) is the Gauss sum of \({\overline{\chi }}\). The above corollary allows us to determine how \(\mathrm {pr}_{N/L}\) acts on the q-expansions of twists of newforms.

For \(Q\mid N\) with \(\mathrm {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\equiv 1 \text { mod }N/Q\) and \(y\equiv 1 \text { mod }Q\). We study how these interact with the Hecke operators, using classical properties due to Atkin and Li [3].

Lemma 3.17

Consider an integer N, a divisor \(Q\mid N\) such that \(\mathrm {gcd}(Q,N/Q)=1\), and \(\epsilon \in \mathcal {D}_N\). Write \(\epsilon =\epsilon _Q\epsilon _{N/Q}\), where \(\epsilon _Q\in \mathcal {D}_Q\) and \(\epsilon _{N/Q}\in \mathcal {D}_{N/Q}\). We consider \(\mu \in H_1(N,\epsilon )\) and \(f\in S_2(N,\epsilon )\). Then

  1. (a)

    Consider \(Q'\) such that \(Q'\mid N\) and \(\mathrm {gcd}(Q',NQ)=1\), and write \(\epsilon _{N/Q}=\epsilon _{Q'}\epsilon _{N/(QQ')}\). Then \(w_Qw_{Q'}(\mu )=\epsilon _{Q'}(Q)w_{QQ'}(\mu )\).

  2. (b)

    \(w_Q(x,y,z,w)(\mu )=\epsilon _Q(y)\epsilon _{N/Q}(x)w_Q(\mu )\),

  3. (c)

    \(w_Q(x,y,z,w)\) maps \(H_1(N,\epsilon _Q\epsilon _{N/Q})\) to \(H_1(N,\overline{\epsilon _Q}\epsilon _{N/Q})\),

  4. (d)

    \(T_pw_Q(\mu )={\overline{\epsilon }}_Q(p)w_QT_p(\mu )\) when \(\mathrm {gcd}(p,Q)=1\),

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). \(\square \)

Parts (b), (c) and (d) determine how the Atkin–Lehner operators act on the set of Hecke eigenspaces of \(H_1(X_{\Gamma _0(MK^2)\cap \Gamma _1(K)},{\mathbb {C}})\).

4 Algorithms

4.1 Twist orbit spaces

We consider again \(N=KM\), \(h\mid 24\) such that \(h^2\mid M\), and the congruence subgroup \(\Gamma =\Gamma _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 \(\Gamma _0(N)\) is to determine first the Hecke eigenforms. When N is prime, the Hecke algebra \({\mathbb {T}}_{\Gamma _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 \(\Gamma _0(MK^2)\cap \Gamma _1(K)\), however, this is not the case. Recall that \({\widetilde{T}}_h\) normalises \(\Gamma _0(M)\cap \Gamma (K)\). Hence \({\widetilde{T}}_{Kh}=\gamma _K^{-1}{\widetilde{T}}_h\gamma _K\) normalises \(\Gamma _0(MK^2)\cap \Gamma _1(K)\), making the twist operators \(R_{\chi }(Kh)\), for \(\chi \in \mathcal {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 \({\mathbb {T}}_{M,K}\) to be the sub-algebra of \({\mathbb {T}}_{\Gamma _0(MK^2)\cap \Gamma _1(K)}\) generated by the \(T_p\)-operators for \(p\not \mid MK\) prime, the diamond operators \(\langle d\rangle \) for \(d\in ({\mathbb {Z}}/K{\mathbb {Z}})^{\times }\), the Atkin–Lehner operators \(w_m(x,y,z,w)\) for \(m\mid MK^2\) such that \(\mathrm {gcd}(MK^2/m,m)=1\), and the twist operators \(R_{\chi }(Kh)\) for \(\chi \in \mathcal {D}_{Kh}\).

Remark 4.2

It is not unreasonable to expect that \({\mathbb {T}}_{M,K}\) is the full Hecke algebra, as we have added to the Hecke operators all matrices that visibly normalise \(\Gamma _0(MK^2)\cap \Gamma _1(K)\), c.f. Lemma 3.2 and Corollary 4.5.

In the situation of our interest, some of the Atkin–Lehner operators coincide.

Lemma 4.3

If \(Q=mK^2\) for some \(m\mid M\) with \(\mathrm {gcd}(m,M/m)=1\), then

$$\begin{aligned} -W_Q(x,-y,-z,w)\cdot W_Q(x,y,z,w)^{-1}\in \Gamma _0(MK^2)\cap \Gamma _1(K). \end{aligned}$$

In other words, \(w_Q(x,y,z,w)\in {\mathbb {T}}_{M,K}\) satisfies \(Jw_Q(x,y,z,w)J=w_Q(x,y,z,w)\).

Proof

Simply multiply the matrices.\(\square \)

Define \(T:=\begin{pmatrix} 1 &{}\quad 1 \\ 0 &{}\quad 1\end{pmatrix}\) and \(S:=\begin{pmatrix} 0 &{}\quad 1 \\ -1&{}\quad 0\end{pmatrix}\). In their studies of modular forms, Banwait and Cremona [5] and Zywina [27] made crucial use of the fact that \(\mathrm {SL}_2({\mathbb {Z}})\) is generated by T and S, which satisfy \(\gamma _K^{-1}T\gamma _K={\widetilde{T}}_K\) and \(\gamma _K^{-1}S\gamma _K=W_{K^2}\). A similar statement can be obtained for our “parent group” \(\Gamma _0(M)\).

Lemma 4.4

Suppose that \(K>1\) satisfies \(\mathrm {gcd}(K,M)=1\). Then \(\Gamma _0(M)\) can be generated by T and a finite set of matrices of the form

$$\begin{aligned} \begin{pmatrix} K a &{}\quad b \\ M c &{}\quad K d\end{pmatrix} \text { with } a,b,c,d\in {\mathbb {Z}}. \end{aligned}$$

Proof

Let \(T,\gamma _1,\ldots ,\gamma _{n}\) be a set of generators for \(\Gamma _0(M)\). We add \(\gamma _0:=\begin{pmatrix} 1 &{}\quad 0 \\ M &{}\quad 1\end{pmatrix}\) to this set. We note that

$$\begin{aligned} \gamma _0^k\begin{pmatrix} a &{}\quad b \\ cM &{}\quad d\end{pmatrix} = \begin{pmatrix} a &{}\quad * \\ (ka+c)M&{}\quad *\end{pmatrix}. \end{aligned}$$

Consider \(\gamma =\begin{pmatrix}a &{}\quad b \\ cM &{}\quad d \end{pmatrix}\in \Gamma _0(M)\). Then \(\mathrm {gcd}(\det (\gamma ),K)=1\) implies that \(\mathrm {gcd}(a,cM,K)=1\). Therefore, given the finite set S of primes dividing K, we can choose \(k\in {\mathbb {Z}}\) such that \((ka+c)M\) is not divisible by any prime in S. So after replacing each \(\gamma _i\) for \(i>0\) by \(\gamma _0^{k_i}\gamma _i\) for some \(k_i\in {\mathbb {Z}}\), we may assume that the bottom left entry of each \(\gamma _i\) (\(i\in \{0,\ldots ,n\}\)) is coprime to K.

Next, let \(\gamma =\begin{pmatrix} a &{}\quad b \\ c M &{}\quad d\end{pmatrix}\) be one of the \(\gamma _i\). We note that

$$\begin{aligned} T^k\gamma T^{k'}=\begin{pmatrix} a+kcM &{}\quad * \\ c M &{}\quad d+k'cM\end{pmatrix}. \end{aligned}$$

As cM is invertible mod K, we can find \(k,k'\in {\mathbb {Z}}\) such that \(kcM\equiv -a \text { mod }K\) and \(k'cM\equiv -d \text { mod }K\). In particular, \(T^k\gamma T^{k'}\) has its top left and bottom right coefficient divisible by K. We thus replace \(\gamma \) by \(T^k\gamma T^{k'}\). Doing this for each \(\gamma _i\), we obtain a suitable set of generators. \(\square \)

Corollary 4.5

The group \(\Gamma _0(M)\) can be generated by T and elements \(\gamma _1,\ldots ,\gamma _n\) such that \(K\gamma _K^{-1}\gamma _i\gamma _K\) is an Atkin–Lehner matrix \(W_{K^2}(x,y,z,w)\). Moreover, if m is a prime power dividing M maximally, and \(W_m(a,b,c,d)\) is a corresponding Atkin–Lehner matrix at level M, then there exist \(\mu ,\nu \in \Gamma _0(M)\) such that \(K\gamma _K^{-1}\mu W_{m}(a,b,c,d)\nu \gamma _K = W_{mK^2}(x,y,z,w)\) for some choice of xyzw.

Proof

For the first statement, let \(\gamma =\begin{pmatrix} K a &{}\quad b \\ M c &{}\quad K d\end{pmatrix}\) be one of the generators \(\gamma _i\) from the previous lemma. Then \(K\gamma _K^{-1}\gamma \gamma _K=W_{K^2}(a,b,c,d)\) at level \(K^2M\). Next, we consider \(W_m(a,b,c,d)=\begin{pmatrix} m a &{}\quad b \\ M c &{}\quad m d\end{pmatrix}\). As \(\det (W_m(a,b,c,d))\) is coprime to K, the proof of the previous lemma allows us to find \(\mu ,\nu \in \Gamma _0(M)\) such that \(\mu W_m(a,b,c,d)\nu \) is of the form \(\begin{pmatrix} K m x &{}\quad y \\ M z &{}\quad K m w\end{pmatrix}\). (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 \(\gamma _K\) and multiplying with K gives us \(W_{mK^2}(x,y,z,w)\), as desired. \(\square \)

Corollary 4.6

Suppose that \(\gamma \in \mathrm {GL}_2^+({\mathbb {Q}})\) normalises \(\Gamma _0(M)\). Then \([\gamma _{K}^{-1}\gamma \gamma _K]\in {\mathbb {T}}_{M,K}\).

Proof

By Lemma 3.2, we may suppose \(\gamma \) is a generator of \(\Gamma _0(M)\), an Atkin–Lehner matrix, or \({\widetilde{T}}_{h}\). The result thus follows from the previous corollary and Lemma 3.15(e). \(\square \)

The next step is to describe a decomposition of \(H_1(X_{\Gamma _0(MK^2)\cap \Gamma _1(K)},{\mathbb {C}})\) into sub-\({\mathbb {T}}_{M,K}\)-modules.

Each Hecke eigenspace \(H\subset H_1(X_{\Gamma _0(MK^2)\cap \Gamma _1(K)},{\mathbb {C}})\) splits as a direct sum \(H=H^+\oplus H^-\), where \(H^+\) is the \(+1\)-subspace for J, and \(H^-\) is the \(-1\)-subspace. We call \(H^+\) and \(H^-\) Hecke-J-eigenspaces. Given a Hecke-J-eigenvector \(\mu \in H_1(X_{\Gamma _0(MK^2)\cap \Gamma _1(K)},{\mathbb {C}})\), denote by \(H(\mu )\) its Hecke-J-eigenspace. This space is 1-dimensional when \(\mu \) is new, but not when \(\mu \) is old.

Definition 4.7

Suppose that \(\mu \in H_1(X_{\Gamma _0(MK^2)\cap \Gamma _1(K)},{\mathbb {C}})\) is a Hecke-J-eigenvector. We define the twist orbit space of \(\mu \) to be

Note that \(R_{\chi }(\mu )\) is indeed still a Hecke-J-eigenvector by Lemmas 3.15(d) and 3.12. The subspace \(O(\mu )^+\) on which J acts with \(+1\)-eigenvalues is called the real twist orbit space of \(\mu \).

By Lemma 3.12, if \(J\mu =\mu \), we have

Proposition 4.8

Suppose that \(\mu \in H_1(X_{\Gamma _0(MK^2)\cap \Gamma _1(K)},{\mathbb {C}})\) is a Hecke-J-eigenvector. Then \(O(\mu )\) is a representation of \({\mathbb {T}}_{M,K}\).

Proof

Since \(O(\mu )\) is a direct sum of Hecke-J-eigenspaces, it suffices to determine how the twist and Atkin–Lehner operators act on the set of Hecke-J-eigenspaces. For the Atkin–Lehner operators \(w_{Q}(x,y,z,w)\) we use Lemmas 3.17(c), (d) and 3.15(d) to see that the Hecke eigenspace of \(\mu \) is mapped to the Hecke eigenspace of \(R_{\epsilon }(\mu )\), where \(\epsilon \) is the Nebentypus character of \(\mu \). Furthermore, Atkin–Lehner operators commute with J by Lemma 4.3, whereas \(JR_{\epsilon }J=\epsilon (-1)R_{\epsilon }\). Note, however, that \(\epsilon (-1)=1\) unless \(\mu =0\), so indeed \(H(\mu )\) is mapped to \(H(R_{\epsilon }(\mu ))\).

Finally, for \(\chi \in \mathcal {D}_{Kh}\), the operator \(R_{\chi }(Kh)\) maps a Hecke-J-eigenspace to the same Hecke-J-eigenspace as \(R_{\chi }\) does, and hence preserves \(O(\mu )\) by definition. \(\square \)

Proposition 4.9

Suppose that \(f\in S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {C}})\) is a newform at a level dividing N and \(\mu =\gamma _f\). Then a basis for \(O(\mu )^+\) is given by the elements

$$\begin{aligned} \mathrm {Tr}_e^{N/L}\pi _{N/L}R_{\chi }(\mu ), \end{aligned}$$

where \(\chi \in \mathcal {D}_{Kh}\) is even, \(R_{\chi }(\mu )\) has new level \(L\mid 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. \(\square \)

We note that each real twist orbit space contains an element \(\mu =\gamma _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(\mu )^+\) 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

$$\begin{aligned} V(f)^+\subset S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\overline{{\mathbb {Q}}}}) \end{aligned}$$

the subspace spanned by the real twist orbit spaces \(O(f^{\sigma })^+\), where \(\sigma \in \mathrm {Gal}({\overline{{\mathbb {Q}}}}/{\mathbb {Q}})\).

4.2 Computing q-expansions

We consider again the set-up from the previous section. Now assume that \(JGJ=G\), \(-I\in G\) and \(\mathrm {det}(G)=({\mathbb {Z}}/N{\mathbb {Z}})^{\times }\). Consider also a group \(\mathcal {A}\subset (\mathcal {N}_{\Gamma _0(M)}\cap \mathcal {N}_{G^h})/\mathrm {P}\Gamma \) such that \(J\mathcal {A}J=\mathcal {A}\). Here \(G^h\) is the subgroup of G with determinant \(1\text { mod }h\), and h is the largest divisor of 24 such that \(h^2\mid M\). Then the group \(F:=\langle \mathrm {P}\Gamma ,\mathcal {A}\rangle \) satisfies \(JFJ=F\) and \(F\subset \mathcal {N}_{\Gamma _0(M)}\). (Technically, we should replace \(\mathcal {A}\) by a set of lifts to \(\mathcal {N}_{\Gamma _0(M)}\), but note that F is independent of the choices of lifts.) Also define \(V:=H_1(X_{\Gamma _0(MK^2)\cap \Gamma _1(K)},{\mathbb {C}})\) and decompose \(V=\oplus _i O_i\) into distinct twist orbit spaces.

By Corollary 4.6 and Proposition 4.8, F acts on each \(O_i\) separately, and \( V^{F}=\bigoplus _i O_i^{F}. \) Now J acts on each \(O_i^F\) separately, and we obtain

$$\begin{aligned} V^{F,+}=\bigoplus _i O_i^{F,+}, \text { where } O_i^{F,+} \subset O_i^+ \end{aligned}$$

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(\Gamma ,{\mathbb {C}})^{\mathcal {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

$$\begin{aligned} S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {C}})\rightarrow H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K)),\;\; f \mapsto \gamma _f, \end{aligned}$$

under which the operators correspond as follows:

$$\begin{aligned} T_p&\longleftrightarrow T_p^*,\;\; R_{\chi } \longleftrightarrow R_{{\overline{\chi }}} \text { if } \chi (-1)=1,\;\; \mathrm {pr}_{N/L}\longleftrightarrow \pi _{N/L},\;\; [\Gamma _0(N):\Gamma _0(L)]B_d^{N/L}\longleftrightarrow \mathrm {Tr}_d^{N/L}. \end{aligned}$$

This means the following.

Proposition 4.10

Suppose that \(f\in S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {C}})\) and \(\mu =\gamma _f\in H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K))\). For each \(i\in \{1,\ldots ,n\}\), consider even \(\chi _i\in \mathcal {D}_{Kh}\) and \(a_i\in {\mathbb {C}}\). Let \(L_i\mid N\) be the new level of \(f|R_{{\overline{\chi }}_i}\), and consider \(e_i\mid N/L_i\). Then

$$\begin{aligned} \sum _{i=1}^na_i\mathrm {Tr}_{e_i}^{N/L_i}\pi _{N/L_i}R_{\chi _i}(\mu )=\gamma _g, \end{aligned}$$

where

$$\begin{aligned} g=\sum _{i=1}^n[\Gamma _0(N):\Gamma _0(L_i)]\cdot \overline{a_i}\cdot f|R_{{\overline{\chi }}_i}\mathrm {pr}_{N/L_i}B^{N/L_i}_{e_i}. \end{aligned}$$

From the action of \(T_p\) on newforms we can determine q-expansions of newforms. Moreover, we know how \(B_e\) and \(R_{\chi }\) act on q-expansions, and by Corollary 3.16, we can also determine what \(\mathrm {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.

Algorithm 4.11

(For computing q-expansions for a basis of \(S_2(\Gamma ,{\mathbb {Q}}(\zeta _{Kh})^+)^{\mathcal {A}}\)) Input: Coprime integers K and M, a finite subset S of \(\mathrm {GL}_2^+({\mathbb {Q}})\) generating a subgroup \(F\subset \mathcal {N}_{\Gamma _0(M)}\) normalised by J, and a positive integer prec . Let h be the largest divisor of 24 such that \(h^2\mid M\).

Steps:

  1. (1)

    Find a basis for \(H_1(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {Q}})\) and determine the fixed subspace \(H_1(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {Q}}(\zeta _{Kh}))^{F}\).

  2. (2)

    Choose a divisor \(L=L_1L_2^2\mid K^2M\) with \(L_1\mid M\) and \(L_2\mid K\), and a newform \(f \in S_2(\Gamma _0(L)\cap \Gamma _1(L_2),{\overline{{\mathbb {Q}}}})\). Compute the q-expansion for f up to \(q^{\texttt {prec }+1}\).

  3. (3)

    Using Corollary 3.16, compute the q-expansions (up to \(q^{\texttt {prec }+1}\)) for all \(f|R_{{\overline{\chi }}}\mathrm {pr}_{N/L}B^{N/L}_{e}\), where \(\chi \in \mathcal {D}_{Kh}\) is even, \(L\mid N\) is the new level of \(f|R_{{\overline{\chi }}}\) and \(e\mid N/L\).

  4. (4)

    Using (finitely many) \(T_p\)-operators and their eigenvalues, compute\(\mu \in H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K))\) such that \(\mu =\alpha \gamma _f\) for some \(\alpha \in {\overline{{\mathbb {Q}}}}^{\times }\).

  5. (5)

    Compute the modular symbols \(\mathrm {Tr}^{N/L}_{e}\pi _{N/L}R_{\chi }(\mu )\) corresponding to the modular forms computed in (3). The space \(O(\mu )^+\) they generate is a real twist orbit space.

  6. (6)

    Determine a basis for the intersection \(O(\mu )^+\cap H_1(\Gamma _0(MK^2)\cap \Gamma _1(K),{\overline{{\mathbb {Q}}}})^{F}\), as linear combinations of the modular symbols computed in Step (5).

  7. (7)

    Using Proposition 4.10 and the result from Step (3), determine the q-expansions of the modular forms corresponding to the basis computed in Step (6).

  8. (8)

    Return to Step (2), unless the spaces \(O(\mu )^+\) considered so far span\(H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K))^F\).

  9. (9)

    The q-expansions for the computed basis are defined over a number field containing \({\mathbb {Q}}(\zeta _{Kh})^+\). Take linear combinations to reduce to a basis over \({\mathbb {Q}}(\zeta _{Kh})^+\).

Output: A finite set of q-expansions \(a_1q+a_2q^2+\ldots +a_{\texttt {prec }+1}q^{\texttt {prec }+1}\) with each \(a_i\in {\mathbb {Q}}(\zeta _{Kh})^+\), corresponding to a basis for \(S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\mathbb {Q}}(\zeta _{Kh})^+)^F\). When \(\mathcal {A}\), \(\Gamma \) and F are defined as at the start of this section, this space equals \(S_2(\Gamma ,{\mathbb {Q}}(\zeta _{Kh})^+)^{\mathcal {A}}\).

Proof

The discussion at the start of this section shows that we indeed obtain a basis for the space \(S_2(\Gamma _0(MK^2)\cap \Gamma _1(K),{\overline{{\mathbb {Q}}}})^F\). In (7) in Sect. 3.3, we saw that a basis of q-expansions with coefficients in \({\mathbb {Q}}(\zeta _{Kh})\) exists, and, as J normalises F, we can reduce further to \({\mathbb {Q}}(\zeta _{Kh})^+\). \(\square \)

4.3 The \({\mathbb {Q}}\)-rational structure

We continue the notation from the previous section. Assume also that \(\mathcal {A}\) determines a \(\mathrm {Gal}({\overline{{\mathbb {Q}}}}/{\mathbb {Q}})\)-invariant automorphism group. Then we know that a model for \(X_G/\mathcal {A}\) over \({\mathbb {Q}}\) must exist. Given the modular forms in \(S_2(\Gamma ,{\mathbb {Q}}(\zeta _{Kh})^+)^{\mathcal {A}}\) computed using Algorithm 4.11, we can compute some model for \((X_G/\mathcal {A})_{{\mathbb {Q}}(\zeta _{Kh})^+}\), but this model tends to be defined over \({\mathbb {Q}}(\zeta _{Kh})^+\) rather than over \({\mathbb {Q}}\).

We want to compute the fixed space for the action of the remaining matrices in \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) of determinant unequal to 1, as defined in Sect. 3.1. This action on cusp forms is only \({\mathbb {Q}}\)-linear, as opposed to \({\mathbb {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 \({\mathbb {Q}}\)-vector spaces.

We first prove a Sturm bound. For a curve X and a divisor D on X, denote by \(\Omega \) the sheaf of regular differential 1-forms, and by \(\mathcal {O}_X(D)\) the sheaf such that for each open \(U\subset X\), the set \(\mathcal {O}_X(D)(U)\) consists of those functions f in the function field of X satisfying \(\mathrm {div}(f|_U)\ge -D\cap U\).

Lemma 4.12

Suppose that X is a curve, and \(\omega \in H^0(X,\Omega ^{\otimes k})\). We consider a point \(x\in X\) and a uniformiser \(q\in \widehat{\mathcal {O}}_x\) in the completed local ring. Write the image of \(\omega \) in \((\Omega ^{\otimes k})_x\) as \(\omega _x = (a_1+a_2q+a_3q^2+\cdots )\left( \mathrm {d}q\right) ^{\otimes k}\). If \(a_i=0\) for all \(i\in \{1,\ldots ,k(2g-2)+1\}\) then \(\omega =0\).

Proof

This is a standard argument. Let K be the canonical divisor. By assumption, \(\omega \) yields a global section of the sheaf \(\mathcal {O}_X(kK-(k(2g-2)+1)x)\). This sheaf has degree \(k\mathrm {deg}(K)-k(2g-2)-1<0\), and therefore has no non-zero global sections. \(\square \)

Algorithm 4.13

(For computing a model for \(X_G/\mathcal {A}\) over \({\mathbb {Q}}\)) Input: A finite set of matrices generating a subgroup \(G\subset \mathrm {GL}_2({\mathbb {Z}}/N{\mathbb {Z}})\) with \(\mathrm {det}(G)=({\mathbb {Z}}/N{\mathbb {Z}})^{\times }\), \(-I\in G\) and \(JGJ=G\). An integer M such that \(N=MK\) with \(\mathrm {gcd}(M,K)=1\) and G surjects onto \(B_0(M)\subset \mathrm {GL}_2({\mathbb {Z}}/M{\mathbb {Z}})\). Let h be the largest divisor of 24 such that \(h^2\mid M\). A finite subset of \(\mathrm {GL}_2^+({\mathbb {Q}})\) generating a subgroup \(\mathcal {A}\subset (\mathcal {N}_{\Gamma _0(M)}\cap \mathcal {N}_{G^h})/\mathrm {P}\Gamma _G\) normalised by J, and defining a \(\mathrm {Gal}({\overline{{\mathbb {Q}}}}/{\mathbb {Q}})\)-invariant automorphism group on \(X_G\) such that \(X_G/\mathcal {A}\) has genus \(g\ge 2\). A positive integer prec .

Steps:

  1. (1)

    Define \(F:=\langle \Gamma _G,\mathcal {A}\rangle \) and run Algorithm 4.11 for FKMh, prec to determine q-expansions for a basis of \(S_2(\Gamma _G,{\mathbb {Q}}(\zeta _{Kh})^+)^{\mathcal {A}}\), and reduce to a basis of \(S_2(\Gamma _G,{\mathbb {Q}}(\zeta _{K}^+))^{\mathcal {A}}\). The dimension of this space is the genus g of \(X_G/\mathcal {A}\).

  2. (2)

    Find generators \(A_1,\ldots ,A_n,A_{n+1},\ldots ,A_{n'}\) for the image \(G_{K}\) of G in \(\mathrm {GL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) such that \(A_{n+1},\ldots ,A_{n'}\) generate \(G_{K}\cap \mathrm {SL}_2({\mathbb {Z}}/K{\mathbb {Z}})\) and \(\mathrm {det}(A_i)\ne 1\) for all \(i\in \{1,\ldots ,n\}\).

  3. (3)

    For each \(A\in \{A_1,\ldots ,A_n\}\), run Steps (4)–(6).

  4. (4)

    Write \(A=B\cdot \gamma _d\), where \(d=\mathrm {det}(A)\) and \(\gamma _d=\begin{pmatrix} d &{}\quad 0 \\ 0 &{}\quad 1\end{pmatrix}\). Determine a lift \({\widetilde{B}}\) of B to \(\Gamma _0(M)\subset \mathrm {SL}_2({\mathbb {Z}})\). For each real twist orbit space \(O(\mu )^+\) computed in Algorithm 4.11, \({\widetilde{B}}\) maps \(O(\mu )^{\Gamma _G,+}\) into \(O(\mu )^+\). Run steps (5)–(6) for each such real twist orbit space.

  5. (5)

    As in Algorithm 4.11, compute the action of \({\widetilde{B}}\) on \(O(\mu )^{\Gamma _G,+}\), and translate this to a \({\mathbb {Q}}(\zeta _{K})\)-linear map \({\widetilde{B}}:\;V(f)^+\cap S_2(\Gamma _G,{\mathbb {Q}}(\zeta _{K}))\rightarrow V(f)^+\) in terms of the basis computed in Step (1).

  6. (6)

    Using a basis for \({\mathbb {Q}}(\zeta _{K})/{\mathbb {Q}}\), consider the linear map computed in (5) as a \({\mathbb {Q}}\)-linear map, and postcompose with the action of \(\gamma _d:\; V(f)^+\rightarrow V(f)^+\), which Galois conjugates coefficients in a q-expansion with \(\sigma _d: \zeta _{K}\rightarrow \zeta _{K}^d\). This composition yields a map \(V(f)^+\cap S_2(\Gamma _G,{\mathbb {Q}}(\zeta _{K}))\rightarrow V(f)^+\cap S_2(\Gamma _G,{\mathbb {Q}}(\zeta _{K}))\) corresponding to the action of A on q-expansions.

  7. (7)

    For each \(V(f)^+\), determine q-expansions of a basis for \((V(f)^+\cap S_2(\Gamma _G,{\mathbb {Q}}(\zeta _{K})))^{\mathcal {A},A_1,\ldots ,A_n}\), up to the precision needed for the next step.

  8. (8)

    Use the q-expansions to determine equations for \(X_G/\mathcal {A}\), as done by Galbraith [19]. Unless \(X_G/\mathcal {A}\) is hyperelliptic, this is done by computing homogeneous \({\mathbb {Q}}\)-rational polynomial equations satsified by the q-expansions, up to \(q^\texttt {prec} \). To show an equation of degree d holds provably, we need \(\texttt {prec} >d(2g-2)-(d-1)\), where \(g=\mathrm {dim}(S_2(\Gamma _G,{\mathbb {Q}}(\zeta _{K}))^{\mathcal {A}})\). For the details when \(X_G/\mathcal {A}\) is hyperelliptic, we refer to [19].

Output: A finite number of homogeneous polynomials over \({\mathbb {Q}}\) in \(g+1\) variables if \(X_G/\mathcal {A}\) is non-hyperelliptic, a single polynomial in 2 variables if \(X_G/\mathcal {A}\) is hyperelliptic.

Remark 4.14

By Petri’s theorem (see [25]), the canonical image of a non-hyperelliptic curve of genus \(g\ge 4\) is an intersection of quadrics unless the curve is trigonal or (isomorphic to) a plane quintic. It thus often suffices to take \(\texttt {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, \(\texttt {prec}>8g-11\) suffices.

Proof

This algorithm computes the right object because \(S_2(\Gamma _G,{\mathbb {Q}}(\zeta _{K}))^{\mathcal {A},A_1,\ldots ,A_n}\) is equal to \(H^0(X_G/\mathcal {A},\Omega ^1)\), as shown in Sect. 3.3.

In Step (1), a basis over \({\mathbb {Q}}(\zeta _K^+)\) exists because \(\mathcal {A}\) is Galois invariant. The crucial claim in Step (4) that \({\widetilde{B}}\) maps \(O(\mu )^{\Gamma _G,+}\) into \(O(\mu )^+\) requires proof. Since \(A\in G_{K}\) and \(JAJ\in G_{K}\), we find that \(JAJA^{-1}\in G_{K}\cap \mathrm {SL}_2({\mathbb {Z}}/K{\mathbb {Z}})\). So JAJ and A, though different operators in general, have identical restriction to

$$\begin{aligned} (H_1(X(\Gamma _0(MK^2)\cap \Gamma _1(K)),{\mathbb {R}})\otimes {\mathbb {C}})^{\Gamma _G}. \end{aligned}$$

In particular, A acts maps the +-eigenspace \(H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K))^{\Gamma _G}\) into the space \(H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K))\). Since \(\gamma _d\) commutes with J (even as matrices), we conclude that \({\widetilde{B}}\) maps \(H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K))^{\Gamma _G}\) into \(H_{{\mathbb {C}}}(\Gamma _0(MK^2)\cap \Gamma _1(K))\). Because \({\widetilde{B}}\in \Gamma _0(M)\) moreover acts on twist orbit spaces, this proves the claim. Furthermore, \(\gamma _d\) acts on \(V(f)^+\), since for \(\sigma :\zeta _{K}\rightarrow \zeta _{K}^d\), we have

$$\begin{aligned} (f|R_{\chi }\mathrm {pr}_LB_d)^{\sigma }=g({\overline{\chi }})^{\sigma }(f^{\sigma }\otimes \chi ^{\sigma })|\mathrm {pr}_LB_d. \end{aligned}$$

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}(\Gamma _G,{\mathbb {Q}}(\zeta _{K}))^{\mathcal {A}}=H^0(X/\mathcal {A},\Omega ^{\otimes k})\). The lower bound on prec follows from Lemma 4.12 by noting that the coefficient for \(q^{\ell }\) in the expansion of a product of d cusp forms is determined by the first \(\ell -(d-1)\) coefficients of each cusp form. \(\square \)

Remark 4.15

If \(\alpha \in \mathcal {N}_{G}/\mathrm {P}\Gamma _G\) commutes with each element of \(\mathcal {A}\), then \(\alpha \) determines an automorphism of \(X_G/\mathcal {A}\). If \(\alpha \) also commutes with J, the action of \(\alpha \) on each real twist orbit space can be determined explicitly, which can be translated into a matrix for the action of \(\alpha \) on the basis of cusp forms found in Step (7). From this, we obtain the automorphism on \(X_G/\mathcal {A}\) determined by \(\alpha \) explicitly.

Moreover, having determined the q-expansions for generators of the function field of \(X_G/\mathcal {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 \({\mathbb {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/\mathcal {A}\) is—in general—not a \({\mathbb {Q}}\)-rational point, so the expansion of a regular differential form at this cusp also tends to have non-rational coefficients.

5 Examples

5.1 The three curves

Consider the subgroup

$$\begin{aligned} G(\mathrm {e}7)=\left\langle \begin{pmatrix} 0 &{}\quad 5 \\ 3 &{}\quad 0 \end{pmatrix},\begin{pmatrix} 5 &{}\quad 0 \\ 3 &{}\quad 2 \end{pmatrix}\right\rangle \subset \mathrm {GL}_2({\mathbb {F}}_7) \end{aligned}$$
(12)

defined in [18, Proposition 9.1]. This is an index 2 subgroup of the normaliser \(G(\mathrm {ns}7^+)\) of a non-split Cartan subgroup of \(\mathrm {GL}_2({\mathbb {F}}_7)\). Also consider \(B_0(5)\subset \mathrm {GL}_2({\mathbb {F}}_5)\), and let \(G(\mathrm {b}5,\mathrm {e}7)\) be the intersection of the inverse images of \(G(\mathrm {e}7)\) and \(B_0(5)\) in \(\mathrm {GL}_2({\mathbb {Z}}/35{\mathbb {Z}})\). We obtain a degree 2 map

$$\begin{aligned} X(\mathrm {b}5,\mathrm {e}7):=X_{G(\mathrm {b}5,\mathrm {e}7)}\rightarrow X(\mathrm {b}5,\mathrm {ns}7):=X_{G(\mathrm {b}5,\mathrm {ns}7^{+})}. \end{aligned}$$

Every degree 2 map of curves is the quotient by an involution. Let us call this involution \(\phi _7: X(\mathrm {b}5,\mathrm {e}7)\rightarrow X(\mathrm {b}5,\mathrm {e}7)\). This corresponds to the action of a matrix in \(G(\mathrm {ns}7^+)\setminus G(\mathrm {e}7)\) (c.f. Example 2.6) and commutes with the Atkin–Lehner involution \(w_5\) (defined in Definition 2.8, using any \(\eta \in G(e7)\) of determinant \(5\text { mod }7\)). We thus obtain the following diagram of degree 2 maps between modular curves

figure d

We note that \(\phi _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(\mathrm {b}5,\mathrm {ns}7)/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 \(\sqrt{5}\) are modular.

We note that the genera of \(X(\mathrm {b}5,\mathrm {ns}7)\), \(X(\mathrm {b}5,\mathrm {e}7)/w_5\) and \(X(\mathrm {b}5,\mathrm {e}7)/\phi _7w_5\) are 6, 5 and 8 respectively, while \(X(\mathrm {b}5,\mathrm {e}7)\) has genus 15 and \(X(\mathrm {b}5,\mathrm {ns}7)/w_5\) is hyperelliptic of genus 2. A model for \(X(\mathrm {b}5,\mathrm {ns}7)\) was first computed by Le Hung [21] using its description as a fibred product of \(X(\mathrm {b}5)\) and \(X(\mathrm {e}7)\), and this was transformed into a planar model by Derickx, Najman and Siksek in [16]. This known model serves as an extra verification for the correctness of our computations. We also compute the map \(X(\mathrm {b}5,\mathrm {ns}7)\rightarrow X(\mathrm {ns}7)\). Composition with Chen’s j-map [11, p. 69] on \(X(\mathrm {ns}7)=\mathbb {P}^1\)

$$\begin{aligned} j_{\mathrm {ns}7}(x)=\frac{\left( (4x^2+5x+2)(x^2+3x+4)(x^2+10x+4)(3x+1)\right) ^3}{(x^3+x^2-2x-1)^7} \end{aligned}$$
(13)

thus yields the j-map on \(X(\mathrm {b}5,\mathrm {ns}7)\).

Theorem 5.1

A canonical model for \(X(\mathrm {b}5,\mathrm {ns}7)\) in \(\mathbb {P}_{X_0,\ldots ,X_5}^5\) is given by:

$$\begin{aligned}\qquad X(\mathrm {b}5,\mathrm {ns}7):\;&14X_0^2 + 12X_2X_3 - 16X_3^2 - 14X_2X_4 + 30X_3X_4 - 11X_4^2\\ {}&\;\;\;\;\; + 28X_2X_5 - 58X_3X_5 + 40X_4X_5 - 28X_5^2=0,\\ {}&7X_0X_1 - 2X_2X_4 - 4X_3X_4 + 2X_4^2 + 12X_3X_5 - 7X_4X_5 + 10X_5^2=0,\\ {}&14X_1^2 - 4X_2X_3 + 16X_3^2 + 10X_2X_4 + 14X_3X_4 - 21X_4^2\\ {}&\;\;\;\;\; + 4X_2X_5 - 58X_3X_5 + 64X_4X_5 - 66X_5^2=0,\\ {}&2X_0X_2 - 2X_0X_3 + 2X_1X_3 - 5X_0X_4 - 6X_1X_4 + 8X_0X_5 + 4X_1X_5=0,\\ {}&4X_1X_2 - 2X_0X_3 - 6X_1X_3 - X_0X_4 + 3X_1X_4 + 3X_0X_5 - 2X_1X_5=0,\\ {}&8X_2^2 - 20X_2X_3 + 16X_3^2 - 14X_2X_4 + 14X_3X_4 - 21X_4^2\\ {}&\;\;\;\;\; + 28X_2X_5 - 42X_3X_5 + 56X_4X_5 - 28X_5^2=0. \end{aligned}$$

and the Atkin–Lehner involution acts as

$$\begin{aligned} w_5:\; (X_0:X_1:X_2:X_3:X_4:X_5)\mapsto (-X_0:-X_1:X_2:X_3:X_4:X_5). \end{aligned}$$

The map \(X(\mathrm {b}5,\mathrm {ns}7)\rightarrow X(\mathrm {ns}7)=\mathbb {P}^1\) is given by

$$\begin{aligned}&(X_0:\ldots :X_5)\mapsto (7X_0 - 2X_2 + 4X_3 - X_4 - 4X_5: -14X_0 - 7X_1 + 6X_2 - 12X_4 \\&\;\;\;\;\; + 10X_4 - 9X_5). \end{aligned}$$

A canonical model for \(X(\mathrm {b}5,\mathrm {e}7)/\phi _7w_5\) in \(\mathbb {P}^4_{X_0,\ldots ,X_4}\) is given by

$$\begin{aligned}&\displaystyle X(\mathrm {b}5,\mathrm {e}7)/w_5:\; 448X_0^2 - 9X_1^2 + 9X_2^2 + 54X_2X_3 + 9X_3^2 + 112X_0X_4 + 126X_1X_4 + 7X_4^2=0,\\&\displaystyle 16X_0X_1 - 3X_1^2 + 3X_2^2 + 6X_2X_3 + 3X_3^2 + 2X_1X_4 + 21X_4^2=0,\\&\displaystyle 3X_1X_2 + 28X_0X_3 + 12X_1X_3 + 21X_2X_4 + 14X_3X_4=0 \end{aligned}$$

and \(\phi _7\) acts as

$$\begin{aligned} \phi _7:\; (X_0:X_1:X_2:X_3:X_4)\mapsto (X_0:X_1:-X_2:-X_3:X_4). \end{aligned}$$

Finally, a canonical model for \(X(\mathrm {b}5,\mathrm {e}7)/\phi _7w_5\) in \(\mathbb {P}^7_{X_0,\ldots ,X_7}\) is given by

$$\begin{aligned}&3528X_0^2 + 177X_4X_5 + 597X_5^2 - 2716X_0X_6 - 423X_1X_6 - 6365X_2X_6 - 1918X_3X_6\\&\;\;\;\;\; - 13454X_6^2 + 2842X_0X_7 + 626X_1X_7 + 9144X_2X_7 + 3010X_3X_7 + 35252X_6X_7 \\&\;\;\;\;\; - 22960X_7^2=0,\\&56X_0X_1 - 135X_4X_5 - 327X_5^2 - 140X_0X_6 - 37X_1X_6 + 2381X_2X_6 + 1890X_3X_6\\&\;\;\;\;\; + 2982X_6^2 + 910X_0X_7 + 16X_1X_7 - 3270X_2X_7 - 2758X_3X_7 - 7476X_6X_7 \\&\;\;\;\;\; + 4816X_7^2=0,\\&56X_1^2 + 1215X_4X_5 + 2835X_5^2 + 11340X_0X_6 - 715X_1X_6 \\&\;\;\;\;\;- 22389X_2X_6 - 12726X_3X_6 - 38290X_6^2 - 19530X_0X_7 + 820X_1X_7\\&\;\;\;\;\; + 30894X_2X_7 + 21546X_3X_7 + 99764X_6X_7 - 64624X_7^2=0,\\&168X_0X_2 - 15X_4X_5 - 3X_5^2 - 56X_0X_6 - 45X_1X_6 + 89X_2X_6 + 238X_3X_6\\&\;\;\;\;\; - 238X_6^2 + 182X_0X_7 + 52X_1X_7 - 138X_2X_7 - 406X_3X_7 + 532X_6X_7 - 224X_7^2=0,\\&56X_1X_2 - 171X_4X_5 - 315X_5^2 + 168X_0X_6 - 253X_1X_6 + 2713X_2X_6 + 2562X_3X_6\\&\;\;\;\;\; + 2086X_6^2 + 1050X_0X_7 + 260X_1X_7 - 3910X_2X_7 - 3738X_3X_7 - 5292X_6X_7 \\&\;\;\;\;\; + 3584X_7^2=0,\\&56X_2^2 + 87X_4X_5 + 147X_5^2 - 364X_0X_6 + 141X_1X_6 - 1285X_2X_6 - 1582X_3X_6\\&\;\;\;\;\; - 714X_6^2 - 266X_0X_7 - 148X_1X_7 + 1894X_2X_7 + 2170X_3X_7 + 1764X_6X_7 \\&\;\;\;\;\; - 1232X_7^2=0,\\&1764X_0X_3 - 579X_4X_5 - 1050X_5^2 + 1505X_0X_6 - 774X_1X_6 + 7009X_2X_6 + 6083X_3X_6\\&\;\;\;\;\; + 7021X_6^2 + 1456X_0X_7 + 851X_1X_7 - 9837X_2X_7 - 8582X_3X_7 - 15778X_6X_7 \\&\;\;\;\;\; + 9044X_7^2=0,\\&28X_1X_3 + 9X_4X_5 + 6X_5^2 + 357X_0X_6 - X_1X_6 + 74X_2X_6 + 161X_3X_6\\ {}&\;\;\;\;\; - 63X_6^2 - 364X_0X_7 - 20X_1X_7 - 144X_2X_7 - 168X_3X_7 + 210X_6X_7 - 140X_7^2=0,\\&84X_2X_3 - 15X_4X_5 - 30X_5^2 - 35X_0X_6 - 27X_1X_6 + 80X_2X_6 + 133X_3X_6\\&\;\;\;\;\; + 329X_6^2 + 140X_0X_7 + 34X_1X_7 - 66X_2X_7 - 196X_3X_7 - 854X_6X_7 + 532X_7^2=0,\\&252X_3^2 + 12X_4X_5 - 30X_5^2 + 70X_0X_6 + 45X_1X_6 + 443X_2X_6 + 28X_3X_6\\&\;\;\;\;\; + 350X_6^2 - 196X_0X_7 - 59X_1X_7 - 639X_2X_7 + 14X_3X_7 - 728X_6X_7 + 280X_7^2=0,\\&18X_0X_4 - 19X_0X_5 - 12X_1X_5 - 27X_2X_5 + 17X_3X_5 - 120X_4X_6\\&\;\;\;\;\; - 66X_5X_6 + 114X_4X_7 + 54X_5X_7=0,\\&2X_1X_4 - 21X_0X_5 + 8X_1X_5 + 7X_2X_5 - 21X_3X_5 + 28X_4X_6 + 56X_5X_6 - 28X_4X_7 \\&\;\;\;\;\; - 84X_5X_7=0,\\&6X_2X_4 + 7X_0X_5 + 3X_2X_5 + 7X_3X_5=0,\\&9X_3X_4 - 28X_0X_5 - 3X_1X_5 - 9X_2X_5 + 8X_3X_5 - 39X_4X_6 - 30X_5X_6 + 33X_4X_7 \\&\;\;\;\;\; + 27X_5X_7=0,\\&63X_4^2 + 426X_4X_5 + 690X_5^2 + 1120X_0X_6 + 207X_1X_6 - 4405X_2X_6 - 2702X_3X_6\\&\;\;\;\;\; - 7000X_6^2 - 2464X_0X_7 - 263X_1X_7 + 6057X_2X_7 + 4298X_3X_7 + 18172X_6X_7\\&\;\;\;\;\; - 11984X_7^2=0 \end{aligned}$$

and the remaining involution acts as

$$\begin{aligned} w_5=\phi _7:\; (X_0:\ldots :X_7)\mapsto (X_0:X_1:X_2:X_3:-X_4:-X_5:X_6:X_7). \end{aligned}$$

The quotients of each of these three curves by their respective involutions give rise to the same genus 2 hyperelliptic curve

$$\begin{aligned} X(\mathrm {b}5,\mathrm {ns}7)/w_5:\;y^2 = x^6 + 2x^5 + 7x^4 - 4x^3 + 3x^2 - 10x + 5. \end{aligned}$$

Using Magma’s built-in Genus6PlaneCurveModel function, we can transform our model for \(X(\mathrm {b}5,\mathrm {ns}7)\) into a planar model. As in [16], this planar model has four singular points, and we can make a translation such that the singular points have coordinates \((i:0:1),\;(-i:0:1),\;(0:1/\sqrt{5}:1)\) and \((0:-1/\sqrt{5}:1)\). The planar equation thus obtained is identical to the one found by Derickx–Najman–Siksek, showing that our model is indeed isomorphic to theirs.

5.2 Finding generators

In [18], the group \(G(\mathrm {e}7)\) 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

$$\begin{aligned} G(\mathrm {ns}7):=\left\{ \begin{pmatrix} a &{}\quad 5b \\ b &{}\quad a\end{pmatrix} \in \mathrm {GL}_2({\mathbb {F}}_7) \mid a,b\in {\mathbb {F}}_7\right\} \end{aligned}$$

and its normaliser \(G(\mathrm {ns}7^+)\) generated by \(G(\mathrm {ns}7)\) and \(\begin{pmatrix} 1 &{}\quad 0 \\ 0 &{}\quad -1\end{pmatrix}\). Note that 5 is a generator of \({\mathbb {F}}_7^{\times }\).

In order to determine which subgroup of \(G(\mathrm {ns}7^+)\) corresponds to \(G(\mathrm {e}7)\), we first find a choice-independent definition.

Lemma 5.2

Let G be the normaliser of a non-split Cartan subgroup of \(\mathrm {GL}_2({\mathbb {F}}_7)\). The corresponding subgroup \(G(\mathrm {e}7)\subset G\) is the unique index 2 subgroup \(H\subset G\) such that

  1. (i)

    H is not cyclic and

  2. (ii)

    \(H\cap \mathrm {SL}_2({\mathbb {F}}_7)\) is cyclic of order 8.

Proof

The group \(\mathrm {GL}_2({\mathbb {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(\mathrm {ns}7^+)\), and we use the one defined above. To verify that \(G(\mathrm {e}7)\) indeed satisfies these properties, we can work with the group defined in (12). \(\square \)

We also see from the definition of \(G(\mathrm {ns}7^+)\) and Lemma 5.2 that \(G(\mathrm {ns}7+)\) and \(G(\mathrm {e}7)\) are normalised by J. This means that also \(\phi _7\) is normalised by J. Since the only element of order 2 in \(\mathrm {SL}_2({\mathbb {F}}_7)\) is \(-I\), we deduce from (ii) that \(-I\in G(\mathrm {e}7)\). We also check that \(\mathrm {det}(G(\mathrm {e}7))={\mathbb {F}}_7^{\times }\).

Next, we use Lemma 5.2 to find generators, and we lift them to \(\Gamma _0(5)\) to obtain the following five matrices. Define

$$\begin{aligned} g_0:=\begin{pmatrix} 61 &{}\quad -55 \\ 10 &{}\quad -9\end{pmatrix} \text { and } \phi _7:=\begin{pmatrix} 3 &{}\quad 1\\ -10&{}\quad -3\end{pmatrix} \in \mathrm {SL}_2({\mathbb {Z}}). \end{aligned}$$

Then \(g_0\) reduces to the identity mod 5 and to a generator of \(G(\mathrm {e}7)\cap \mathrm {SL}_2({\mathbb {F}}_7)\) mod 7, while \(\phi _7\) is in \(\Gamma _0(5)\) and reduces mod 7 to an element in \(G(\mathrm {ns}7+)\cap \mathrm {SL}_2({\mathbb {F}}_7)\setminus G(\mathrm {e}7)\cap \mathrm {SL}_2({\mathbb {F}}_7)\). Next, define

$$\begin{aligned} B:=\begin{pmatrix} 6 &{}\quad 5 \\ -5 &{}\quad -4 \end{pmatrix},\; C:=B\cdot \begin{pmatrix} 4 &{}\quad 0 \\ 0 &{}\quad 1\end{pmatrix}\text { and }w_5:=\begin{pmatrix} 2890 &{}\quad 193 \\ -8685 &{}\quad -580 \end{pmatrix} \in \mathrm {GL}_2^+({\mathbb {Q}}). \end{aligned}$$

We note that C reduces into \(B_0(5)\) mod 5, \(\mathrm {det}(w_5)=5\) and \(w_5\) reduces into \(G(\mathrm {e}7)\) mod 7. So \(w_5\) indeed corresponds to the Atkin–Lehner involution. Moreover,

$$\begin{aligned} G(\mathrm {e}7)=\langle {\overline{g}}_0,{\overline{C}},{\overline{J}}\rangle \text { and } G(\mathrm {ns}7^{+})=\langle {\overline{g}}_0,{\overline{C}},{\overline{J}},{\overline{\phi }}_7\rangle , \end{aligned}$$

where a bar denotes reduction mod 7.

Using the built-in commands in Sage, we compute \(S:=S_2(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\mathbb {Q}}(\zeta _7))\). This space has dimension 61. We need to determine the fixed spaces

$$\begin{aligned} S^{\langle g_0,\phi _7,C,J\rangle },\; S^{\langle g_0,w_5,C,J\rangle } \text { and } S^{\langle g_0,w_5\cdot \phi _7,C,J\rangle }. \end{aligned}$$

To this end, we first compute the fixed spaces \(S^{\langle g_0,\phi _7\rangle },S^{\langle g_0,w_5\rangle }\) and \(S^{\langle g_0,w_5\cdot \phi _7\rangle }\), after which we determine the \({\mathbb {Q}}\)-rational structure by considering C and J.

5.3 The twist orbit spaces

We execute Step (4) of Algorithm 4.11, by computing q-expansions for the eigenforms corresponding to the bases of the real twist orbit spaces as described in Proposition 4.9. There are two non-zero spaces of cusp forms of lower level: \(S_2(\Gamma _0(49)\cap \Gamma _1(7),{\mathbb {Q}}(\zeta _7))\) (3-dimensional), and \(S_2(\Gamma _0(5)\cap \Gamma _1(7),{\mathbb {Q}}(\zeta _7))\) (7-dimensional).

Define

$$\begin{aligned} \chi : ({\mathbb {Z}}/7{\mathbb {Z}})^{\times }\rightarrow {\mathbb {C}}^{\times },\;\; \chi (3)=e^{\pi i/3}. \end{aligned}$$

Then \(\chi \) has order 6 and \(\mathcal {D}_{7}=\langle \chi \rangle \). Also, \(\chi (-1)=-1\), so the even characters are generated by \(\chi ^2\). We note all found equations have degree 2, so it suffices to take \(\texttt {prec}=2(2\cdot 8-2)=28\). To save space, we here display modular forms only up to \(q^{10}\).

We consider the following newforms, all of which have trivial Nebentypus character:

$$\begin{aligned}&f_{49}:=q+q^2-q^4-3q^8-3q^9+O(q^{11}) \in S_2(\Gamma _0(49)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}}), \\&f_{35}:=q+q^3-2q^4-q^5+q^6-2q^8-3q^{10}+O(q^{11})\in S_2(\Gamma _0(5)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}}),\\&g_{35}:=q+ \alpha q^2 -(\alpha +1)q^3 +(2-\alpha )q^4+ q^5 -4q^6, -q^7+ (\alpha - 4)q^8+(\alpha + 2)q^9\\&\;\;\;\;+ \alpha q^{10}+O(q^{11}) \in S_2(\Gamma _0(5)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}}), \text { where }\alpha =(-1+\sqrt{17})/2,\\&f_0:=q -2q^2 -3q^3+ 2q^4 +q^5+ 6q^6 +6q^9 -2q^{10}+O(q^{11})\in S_2(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}}),\\&f_1:=q+\sqrt{2}q^2-(\sqrt{2}+1)q^3-q^5\\&\;\;\;\;-(\sqrt{2}+2)q^6-2\sqrt{2}q^8+2\sqrt{2}q^9-\sqrt{2}q^{10}+O(q^{11}) \in S_2(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}}),\\&\text { and}\\&f_2:=q+ (1+\sqrt{2})q^2+ (1-\sqrt{2})q^3+(2\sqrt{2}+1)q^4 +q^5-q^6+ (\sqrt{2}+3)q^8-2\sqrt{2}q^9\\&\;\;\;\; +(1+\sqrt{2})q^{10}+O(q^{11})\in S_2(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}}). \end{aligned}$$

When f is a cusp form defined over a quadratic field, let \(f^c\) be its Galois conjugate cusp form. For brevity, we write \(\mathrm {pr}:=\mathrm {pr}_{245/35}\), and we omit any application of the \(B_1\)-operator, since it acts as the identity on q-expansions. This leads to the following real twist orbit spaces of modular forms:

$$\begin{aligned}&O_1^+:=\mathrm {Span}\{f_{49},f_{49}\otimes \chi ^2,f_{49}\otimes \chi ^4,f_{49}|B_5,(f_{49}\otimes \chi ^2)|B_5,(f_{49}\otimes \chi ^4)|B_5\},\\&O_2^+:=\mathrm {Span}\{f_{35},f_{35}\otimes \chi ^2,f_{35}\otimes \chi ^4,f_{35}|B_7\},\\&O_3^+:=\mathrm {Span}\{f_{35}\otimes \chi ,f_{35}\otimes \chi ^3,f_{35}\otimes \chi ^5\},\\&O_4^+:=\mathrm {Span}\{g_{35},g_{35}\otimes \chi ^2,g_{35}\otimes \chi ^4,g_{35}|B_7\} \text { and } O_4^{c,+}:=\mathrm {Span}\{g_{35}^c,g_{35}^c\otimes \chi ^2,g_{35}^c\otimes \chi ^4,g_{35}^c|B_7\},\\&O_5^+:=\mathrm {Span}\{g_{35}\otimes \chi ,g_{35}\otimes \chi ^3,g_{35}\otimes \chi ^5\} \text { and } O_5^{c,+}:=\mathrm {Span}\{g_{35}^c\otimes \chi ,g_{35}^c\otimes \chi ^3,g_{35}^c\otimes \chi ^5\},\\&O_6^+:=\mathrm {Span}\{f_0,f_0\otimes \chi ^2,f_0\otimes \chi ^4\},\\&O_7^+:=\mathrm {Span}\{f_0\otimes \chi ,f_0\otimes \chi ^3,f_0\otimes \chi ^5\},\\&O_8^+:=\mathrm {Span}\{f_1,f_1\otimes \chi ^2,f_1\otimes \chi ^4\} \text { and }O_8^{c,+}:=\mathrm {Span}\{f_1^c,f_1^c\otimes \chi ^2,f_1^c\otimes \chi ^4\},\\&O_9^+:=\mathrm {Span}\{f_1\otimes \chi ,f_1\otimes \chi ^3,f_1\otimes \chi ^5\} \text { and } O_9^{c,+}:=\mathrm {Span}\{f_1^c\otimes \chi ,f_1^c\otimes \chi ^3,f_1^c\otimes \chi ^5\},\\&O_{10}^+:=\mathrm {Span}\{f_2,(f_2\otimes \chi ^2)|\mathrm {pr},(f_2\otimes \chi ^4)|\mathrm {pr},(f_2\otimes \chi ^2)|\mathrm {pr}|B_7,(f_2\otimes \chi ^4)|\mathrm {pr}|B_7\} \text { and }\\&O_{10}^{c,+}:=\mathrm {Span}\{f_2^c,(f_2^c\otimes \chi ^2)|\mathrm {pr},(f_2^c\otimes \chi ^4)|\mathrm {pr},(f_2^c\otimes \chi ^2)|\mathrm {pr}|B_7,(f_2^c\otimes \chi ^4)|\mathrm {pr}|B_7\},\\&O_{11}^+:=\mathrm {Span}\{f_2\otimes \chi ,f_2\otimes \chi ^3,f_2\otimes \chi ^5\} \text{ and } O_{11}^{c,+}:=\mathrm {Span}\{f_2^c\otimes \chi ,f_2^c\otimes \chi ^3,f_2^c\otimes \chi ^5\}. \end{aligned}$$

By counting dimensions, we see that these are all of the real twist orbit spaces. These computations were done in the “space of cusp forms” in Sage, but note that the underlying calculations do happen in the space of modular symbols.

For each \(i\in \{1,\ldots ,11\}\), denote by \(V_i^+\) the sum of \(O_i^+\) and, if it exists, \(O_i^{c,+}\).

5.4 Computations with modular symbols

We ask Sage to compute the 122-dimensional space \(H_1(X_{\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7)},{\mathbb {Q}})\). Given a basis for this space, we ask for the matrix of the operator induced by J, and we determine the \(+1\)-eigenspace. Consider an eigenform \(f\in S_2(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}})\). As \(T_p\) commutes with J, we can use Lemma 3.8 to determine the modular symbol \(\gamma \in H_1(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}})^+\) such that \(\gamma =\gamma _f\) up to a constant multiple. In practice, it sufficed for us to compute eigenvectors in \(H_1(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}})^+\) for the \(T_2\)- and \(T_3\)-operators only: when the intersection of the kernels of \(T_2-{\overline{a}}_2(f)\) and \(T_3-{\overline{a}}_3(f)\) on \(H_1(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}})^+\) is 1-dimensional, its elements must be multiples of \(\gamma _{f}\). We thus obtain explicit eigensymbols

$$\begin{aligned} \mu _0:=\alpha _0\gamma _{f_0},\; \mu _1:=\alpha _1\gamma _{f_1},\; \mu _2:=\alpha _2\gamma _{f_2},\; \mu _{35}:=\alpha _{35}\gamma _{f_{35}},\; \mu _{49}:=\alpha _{49}\gamma _{f_{49}},\; \nu _{35}:=\beta _{35}\gamma _{g_{35}}, \end{aligned}$$

where \(\beta _{35}\) and all \(\alpha _i\) are non-zero but unknown. However, within twist orbit spaces these constants are also irrelevant.

Moreover, we recall that \(R_{\chi ^2}(\gamma _f)=g({\overline{\chi }}^2)\gamma _{f\otimes {\overline{\chi }}^2}\) and \([\Gamma _0(N):\Gamma _0(M)]\gamma _{f|B_d}=\mathrm {Tr}_d^{N/L}(\gamma _f)\), where the action of \(R_{\chi ^2}\), \(\mathrm {Tr}_7\) and \(\mathrm {Tr}_5\), as well as that of \(\pi _{245/35}\) and \(\pi _{235/49}\), on \(H_1(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}})\) can be determined explicitly. To compute the coset representatives needed for the \(\mathrm {Tr}_d^{N/L}\) operators, we used an algorithm of Stein [24, Algorithm 2.20]. We thus explicitly compute the real twist orbit spaces on the modular symbols side.

The next step is to conjugate \(g_0\), \(\phi _7\) and \(w_5\) by \(\gamma _7\) and compute their action on \(H_1(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7),{\overline{{\mathbb {Q}}}})\). This can be done in Sage via built-in functions. We intersect the different fixed-spaces with the real twist orbit spaces to obtain the desired basis of fixed modular symbols. For brevity reasons, we do not display all of these here, but we give two examples: we find that

$$\begin{aligned} 4\left( \mu _{35}-\mathrm {Tr}_7(\mu _{35})\right) +\left( \frac{6\zeta _3}{7}+\frac{2}{7}\right) R_{{\overline{\chi }}^2}(\mu _{35})+\left( \frac{36}{343}\zeta _3-\frac{2}{343}\right) R_{{\overline{\chi }}^4}(\mu _{35})\end{aligned}$$

is in \((H_{{\mathbb {C}}}(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7))^+)^{g_0,w_5\cdot \phi _7}\) and that

$$\begin{aligned} \left( \frac{2}{21}\sqrt{2} + \frac{8}{21}\right) \mu _2&+ \left( \left( \frac{10}{1029} \zeta _3 - \frac{2}{343}\right) \sqrt{2} + \frac{40}{1029}\cdot \zeta _3 - \frac{8}{343}\right) R_{{\overline{\chi }}^2}(\mu _2)\\ {}&+ \left( \left( \frac{16}{7203} \zeta _3 + \frac{10}{7203}\right) \sqrt{2} + \frac{64}{7203} \zeta _3 + \frac{40}{7203}\right) R_{{\overline{\chi }}^4}(\mu _2)\\ {}&+ \left( \left( -\frac{2}{147} \zeta _3 - \frac{4}{147}\right) \sqrt{2} - \frac{20}{1029} \zeta _3 - \frac{16}{1029}\right) \frac{B_7\mathrm {pr}R_{{\overline{\chi }}^4}(\mu _2)}{7}\\ {}&+ \left( \left( \frac{46}{1029} \zeta _3 + \frac{188}{1029}\right) \sqrt{2} - \frac{68}{1029} \zeta _3 + \frac{80}{1029}\right) \frac{B_7\mathrm {pr}R_{{\overline{\chi }}^2}(\mu _2)}{ 7} \end{aligned}$$

is in \(H_{{\mathbb {C}}}(\Gamma _0(5\cdot 7^2)\cap \Gamma _1(7))^{g_0,\phi _7}\). Finally, we determine the \({\mathbb {C}}\)-linear action of B on these bases of fixed modular symbols, one real twist orbit at a time. We also find a matrix for the \({\mathbb {Q}}\)-linear action of \(\sigma _4: \; \zeta _7\mapsto \zeta _7^4\) and J on the corresponding cusp forms. We choose to translate the actions of \(\sigma _4\) and J to a \({\mathbb {Q}}\)-linear action on modular symbols (rather than translating the action of B to modular forms), and compose \(\sigma _4\) and J with B. This yields two \({\mathbb {Q}}\)-linear maps on each fixed subspace of a real twist orbit space, and we determine the \({\mathbb {Q}}\)-linear subspace fixed by these two maps. Translating this back to modular forms, we obtain the desired cusp forms.

5.5 The cusp forms

Let \(\beta _7=\zeta _7+\zeta _7^{-1}\). On each of the curves, denote by \(q=e^{2\pi i\tau /7}\) a uniformiser at (the image of) \(\infty \). The space \(H^0(X(\mathrm {b}5,\mathrm {ns}7)/w_5,\Omega ^1)\) has a basis of 1-forms with q-expansions \(h_1(q)\frac{\mathrm {d}q}{q}\) and \(h_2(q)\frac{\mathrm {d}q}{q}\), where

$$\begin{aligned}&h_1:=\left( 10\beta _7^2 + 2\beta _7 - 16\right) q + \left( 4\beta _7^2 + 12\beta _7 - 12\right) q^2 + \left( -6\beta _7^2 - 4\beta _7 + 18\right) q^3 \\&\;\;\;\;\;+ \left( 8\beta _7^2 + 10\beta _7 - 10\right) q^5 + \left( -8\beta _7^2 + 4\beta _7 + 24\right) q^6 + \left( 24\beta _7^2 + 16\beta _7 - 16\right) q^8 \\&\;\;\;\;\;+ \left( 8\beta _7^2 + 24\beta _7 - 24\right) q^9 + O\left( q^{10}\right) \in V_8^+,\\&h_2:= \left( -6\beta _7^2 - 4\beta _7 + 4\right) q + \left( -8\beta _7^2 - 10\beta _7 + 10\right) q^2 + \left( -2\beta _7^2 - 6\beta _7 + 6\right) q^3 \\&\;\;\;\;\;+ \left( -2\beta _7^2 - 6\beta _7 + 6\right) q^5 + \left( 2\beta _7^2 + 6\beta _7 + 8\right) q^6 + \left( -20\beta _7^2 - 4\beta _7 + 32\right) q^8 \\&\;\;\;\;\;+ \left( -16\beta _7^2 - 20\beta _7 + 20\right) q^9 + O\left( q^{10}\right) \in V_8^+. \end{aligned}$$

The space \(H^0(X(\mathrm {b}5,\mathrm {ns}7),\Omega ^1)\) has a basis of 1-forms \(f(q)\frac{\mathrm {d}q}{q}\), where f(q) is in the following set:

$$\begin{aligned}&h_1,\; h_2,\in V_8^+,\\&\left( -2\beta _7^2 - 6\beta _7 + 6\right) q + \left( -16\beta _7^2 + 8\beta _7 + 48\right) q^2 + \left( -12\beta _7^2 - 8\beta _7 + 8\right) q^3 \\&\;\;\;\;\;+ \left( 42\beta _7^2 + 28\beta _7 - 28\right) q^4 + \left( -4\beta _7^2 + 2\beta _7 + 12\right) q^5 + \left( 2\beta _7^2 + 6\beta _7 - 6\right) q^6 + \\&\;\;\;\;\; \left( -28\beta _7^2 + 28\beta _7 + 56\right) q^7+ \left( -12\beta _7^2 - 36\beta _7 + 36\right) q^8 + \left( 24\beta _7^2 - 12\beta _7 - 72\right) q^9 \\&\;\;\;\;\;+ O\left( q^{10}\right) \in V_{10}^+,\\&\left( -3\beta _7^2 - 9\beta _7 + 9\right) q + \left( -10\beta _7^2 + 5\beta _7 + 30\right) q^2 + \left( 3\beta _7^2 + 2\beta _7 - 2\right) q^3\\&\;\;\;\;\;+ \left( 21\beta _7^2 + 14\beta _7 - 14\right) q^4 + \left( -6\beta _7^2 + 3\beta _7 + 18\right) q^5 + \left( 3\beta _7^2 + 9\beta _7 - 9\right) q^6 \\&\;\;\;\;\;+ \left( 21\beta _7 + 7\right) q^7 + \left( -11\beta _7^2 - 33\beta _7 + 33\right) q^8 + \left( 8\beta _7^2 - 4\beta _7 - 24\right) q^9 \\&\;\;\;\;\; + O\left( q^{10}\right) \in V_{10}^+,\\&\left( 10\beta _7^2 + 2\beta _7 - 16\right) q + \left( -4\beta _7^2 - 12\beta _7 + 12\right) q^2 + \left( -10\beta _7^2 + 12\beta _7 + 30\right) q^3 \\&\;\;\;\;\; + \left( -8\beta _7^2 - 10\beta _7 + 10\right) q^5 \left( 32\beta _7^2 + 12\beta _7 - 40\right) q^6 + \left( -24\beta _7^2 - 16\beta _7 + 16\right) q^8 \\&\;\;\;\;\; + \left( -8\beta _7^2 - 24\beta _7 + 24\right) q^9 + O\left( q^{10}\right) \in V_{9}^+, \left( 6\beta _7^2 + 4\beta _7 - 4\right) q \\&\;\;\;\;\; + \left( -8\beta _7^2 - 10\beta _7 + 10\right) q^2 + \left( -6\beta _7^2 + 10\beta _7 + 18\right) q^3 + \left( -2\beta _7^2 - 6\beta _7 + 6\right) q^5\\&\;\;\;\;\; + \left( 22\beta _7^2 + 10\beta _7 - 24\right) q^6 + \left( -20\beta _7^2 - 4\beta _7 + 32\right) q^8 + \left( -16\beta _7^2 - 20\beta _7 + 20\right) q^9 \\&\;\;\;\;\; + O\left( q^{10}\right) \in V_{9}^+. \end{aligned}$$

The space \(H^0(X(\mathrm {b}5,\mathrm {e}7)/w_5\phi _7),\Omega ^1)\) has a basis of 1-forms \(f(q)\frac{\mathrm {d}q}{q}\), where f(q) is one of:

$$\begin{aligned}&\left( \beta _7^2 - \beta _7 - 2\right) q + \left( -2\beta _7^2 - \beta _7 + 3\right) q^2 + \left( -\beta _7^2 - 2\beta _7 + 1\right) q^4 + \left( 10\beta _7^2 + 5\beta _7 - 15\right) q^5\\ {}&\;\;\;\;\; + \left( -3\beta _7^2 + 3\beta _7 + 6\right) q^8 + \left( 6\beta _7^2 + 3\beta _7 - 9\right) q^9 + O\left( q^{10}\right) \in V_1^+,\\ {}&\left( -14\beta _7^2 - 14\beta _7 + 28\right) q + \left( -7\beta _7 - 7\right) q^2 + \left( -7\beta _7^2 + 7\right) q^3\\ {}&\;\;\;\;\; + \left( 35\beta _7^2 - 35\right) q^4 + \left( 14\beta _7 + 14\right) q^5 + \left( 56\beta _7^2 + 56\beta _7 - 112\right) q^6\\ {}&\;\;\;\;\; + 56q^7 + \left( 63\beta _7^2 + 63\beta _7 - 126\right) q^8 + \left( 21\beta _7 + 21\right) q^9 + O\left( q^{10}\right) \in V_4^+,\\ {}&\left( 7\beta _7 + 7\right) q^2 + \left( -7\beta _7^2 + 7\right) q^3 + \left( -7\beta _7^2 + 7\right) q^4\\ {}&\;\;\;\;\; + \left( -7\beta _7^2 - 7\beta _7 + 14\right) q^8 + \left( 7\beta _7 + 7\right) q^9 + O\left( q^{10}\right) \in V_4^+,\\ {}&\left( -\beta _7^2 + \beta _7 + 2\right) q + \left( -4\beta _7^2 - 2\beta _7 + 6\right) q^2 + \left( 3\beta _7^2 + 6\beta _7 - 3\right) q^3\\ {}&\;\;\;\;\; + \left( -2\beta _7^2 - 4\beta _7 + 2\right) q^4 + \left( 2\beta _7^2 + \beta _7 - 3\right) q^5 + \left( -6\beta _7^2 + 6\beta _7 + 12\right) q^6\\ {}&\;\;\;\;\; + \left( 12\beta _7^2 + 6\beta _7 - 18\right) q^9 + O\left( q^{10}\right) \in V_6^+,\\ {}&h_1,\; h_2\in V_8^+,\\ {}&\left( 2\beta _7^2 + 2\beta _7 + 2\right) q + \left( -4\beta _7 + 8\right) q^2 + \left( -6\beta _7^2 + 24\right) q^4\\ {}&\;\;\;\;\; + \left( -2\beta _7 + 4\right) q^5 + \left( -2\beta _7^2 - 2\beta _7 - 2\right) q^6 + \left( 12\beta _7^2 - 20\right) q^7\\ {}&\;\;\;\;\; + \left( 8\beta _7^2 + 8\beta _7 + 8\right) q^8 + \left( 4\beta _7 - 8\right) q^9 + O\left( q^{10}\right) \in V_{10}^+,\\ {}&\left( \beta _7^2 + \beta _7 + 1\right) q + \left( -3\beta _7 + 6\right) q^2 + \left( \beta _7^2 - 4\right) q^3\\ {}&\;\;\;\;\; + \left( -5\beta _7^2 + 20\right) q^4 + \left( -\beta _7 + 2\right) q^5 + \left( -\beta _7^2 - \beta _7 - 1\right) q^6\\ {}&\;\;\;\;\; + \left( 12\beta _7^2 + 3\beta _7 - 19\right) q^7 + \left( 5\beta _7^2 + 5\beta _7 + 5\right) q^8 + \left( 4\beta _7 - 8\right) q^9 + O\left( q^{10}\right) \in V_{10}^+. \end{aligned}$$

Finally, the space \(H^0(X(\mathrm {b}5,\mathrm {e}7)/w_5),\Omega ^1)\) has a basis of 1-forms \(f(q)\frac{\mathrm {d}q}{q}\), where f(q) is in the set

$$\begin{aligned}&\left( -\beta _7^2 + \beta _7 + 2\right) q + \left( 2\beta _7^2 + \beta _7 - 3\right) q^2 + \left( \beta _7^2 + 2\beta _7 - 1\right) q^4 + \left( 10\beta _7^2 + 5\beta _7 - 15\right) q^5\\ {}&\;\;\;\;\; + \left( 3\beta _7^2 - 3\beta _7 - 6\right) q^8 + \left( -6\beta _7^2 - 3\beta _7 + 9\right) q^9 + O\left( q^{10}\right) \in V_1^+,\\ {}&\left( -7\beta _7^2 - 7\beta _7 + 14\right) q + \left( 7\beta _7^2 - 7\right) q^3 + \left( -14\beta _7^2 + 14\right) q^4\\ {}&\;\;\;\;\; + \left( -7\beta _7 - 7\right) q^5 - 28q^7 + \left( -14\beta _7 - 14\right) q^9 + O\left( q^{10}\right) \in V_2^+,\\ {}&h_1,\; h_2\in V_8^+,\\ {}&\left( -\beta _7^2 + \beta _7 + 2\right) q + \left( -4\beta _7^2 - 2\beta _7 + 6\right) q^2 + \left( -3\beta _7^2 - 6\beta _7 + 3\right) q^3\\ {}&\;\;\;\;\; + \left( -2\beta _7^2 - 4\beta _7 + 2\right) q^4 + \left( -2\beta _7^2 - \beta _7 + 3\right) q^5 + \left( 6\beta _7^2 - 6\beta _7 - 12\right) q^6\\ {}&\;\;\;\;\; + \left( 12\beta _7^2 + 6\beta _7 - 18\right) q^9 + O\left( q^{10}\right) \in V_7^+. \end{aligned}$$

For each of the final three curves, these cusp forms satisfy the equations as displayed in Theorem 5.1, where the variable \(X_i\) corresponds to the \((i+1)\)th displayed cusp form.

5.6 The map \(X(\mathrm {b}5,\mathrm {ns}7)\rightarrow X(\mathrm {ns}7)\)

To determine \(X(\mathrm {b}5,\mathrm {ns}7)\rightarrow X(\mathrm {ns}7)\), we first use Chen’s j-map (13) to find the q-expansion of a Hauptmodul \(n_7\) on \(X(\mathrm {ns}7)\), by solving the equation

$$\begin{aligned} j(q^7)=j_{\mathrm {ns}7}(n_7(q)). \end{aligned}$$

(Note the 7th power of q because we defined q as \(e^{2\pi i \tau /7}\).) This yields

$$\begin{aligned} \eta _7(q)&=-\beta _7^2 - \beta _7 + 1+ (-4\beta _7^2 - \beta _7 + 11)q+ (-18\beta _7^2 - 11\beta _7 + 38)q^2\\ {}&+ (-53\beta _7^2 - 26\beta _7 + 124)q^3+ (-171\beta _7^2 - 102\beta _7 + 370)q^4+O(q^5). \end{aligned}$$

Denote by \(f_0,\ldots ,f_5\) the computed basis for \(H^0(X(\mathrm {b}5,\mathrm {ns}7),\Omega ^1)\), in the same order as displayed above. It is a linear algebra computation to find homogeneous polynomials \(p,r\in {\mathbb {Q}}[X_0,\ldots ,X_5]\) such that

$$\begin{aligned} r(f_0(q),\ldots ,f_5(q))n_7(q)=p(f_0(q),\ldots ,f_5(q), \end{aligned}$$

at least up to \(O(q^{200})\). The map \(X(\mathrm {b}5,\mathrm {ns}7)\rightarrow X(\mathrm {ns}7)\) is then given by \(\pi :(X_0:\ldots :X_5)\mapsto (p(X_0,\ldots ,X_5):r(X_0,\ldots ,X_5))\).

We verify correctness as follows. We compute that \(\pi \) has degree 6. The correct map \(\pi '\) to \(X(\mathrm {ns}7)\) also has degree 6. Viewing \(\pi ,\pi '\) as elements of the function field of \(X(\mathrm {b}5,\mathrm {ns}7)\), their difference \(\pi -\pi '\) thus has polar degree at most 12. Hence a precision of 13 suffices.