# On Darmon's program for the generalized Fermat equation, I

Nicolas Billerey, Imin Chen, Luis Dieulefait, Nuno Freitas

► To cite this version:

Nicolas Billerey, Imin Chen, Luis Dieulefait, Nuno Freitas. On Darmon's program for the generalized Fermat equation, I. Journal für die reine und angewandte Mathematik, In press, 10.1515/crelle-2025-0014. hal-04421240

HAL Id: hal-04421240

https://hal.science/hal-04421240v1

Submitted on 16 Apr 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# ON DARMON'S PROGRAM
## FOR THE GENERALIZED FERMAT EQUATION, I

NICOLAS BILLEREY, IMIN CHEN, LUIS DIEULEFAIT, AND NUNO FREITAS

*Dedicated to the memory of Bas Edixhoven*

**ABSTRACT.** In 2000, Darmon described a program to study the generalized Fermat equation using modularity of abelian varieties of $GL_2$-type over totally real fields. The original approach was based on hard open conjectures, which have made it difficult to apply in practice. In this paper, building on the progress surrounding the modular method from the last two decades, we analyze and expand the current limits of this program by developing all the necessary ingredients to use Frey abelian varieties for new Diophantine applications. In particular, we deal with all but the fifth and last step in the modular method for Fermat equations of signature $(r, r, p)$ in almost full generality.

As an application, for all integers $n \ge 2$, we give a resolution of the generalized Fermat equation $x^{11} + y^{11} = z^n$ for solutions $(a, b, c)$ such that $a + b$ satisfies certain 2- or 11-adic conditions.

Moreover, the tools developed can be viewed as an advance in addressing a difficulty not treated in Darmon's original program: even assuming 'big image' conjectures about residual Galois representations, one still needs to find a method to eliminate Hilbert newforms at the Serre level which do not have complex multiplication. In fact, we are able to reduce the problem of solving $x^5+y^5=z^p$ to Darmon's 'big image conjecture', thus completing a line of ideas suggested in his original program, and notably only needing the Cartan case of his conjecture.

## 1. INTRODUCTION

This paper is the first part of a series of works about Darmon's program for the generalized Fermat equation. This manuscript is not intended for publication. A shorter version of this work has been published [12]<fnref n="1" />.

In this volume we develop theoretical tools and apply our results on a concrete case. In the next volumes, we explore computational aspects and obtain further applications of the results proved here.

**1.1. The generalized Fermat equation.** Since Wiles' groundbreaking proof [83] of Fermat's Last Theorem, attention has shifted towards the study of the *generalized Fermat equation*, namely,

<footnote>Date: April 16, 2025.</footnote>

<footnote n="2020">2020 Mathematics Subject Classification. Primary 11D41.</footnote>

<footnote>Key words and phrases. Generalized Fermat Equation, modular method, Frey abelian varieties.</footnote>

<footnote>Billerey was supported by the ANR-23-CE40-0006-01 Gaec project. Chen was supported by NSERC Discovery Grant RGPIN-2017-03892. Freitas was partly supported by the European Union's Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No. 747808 and the grant Proyecto RSME-FBBVA 2015 José Luis Rubio de Francia; Dieulefait and Freitas were partly supported by the PID2019-107297GB-I00 grant of the MICINN (Spain); Dieulefait was partly supported by the Spanish State Research Agency, through the Severo Ochoa and María de Maeztu Program for Centers and Units of Excellence in R&D (CEX2020-001084-M).</footnote>

<footnote n="1">¹Warning. The citations to ‘On Darmon’s program for the generalized Fermat equation, I’ in the second part of this series [11] follow the numbering of this document and not of the shorter published version.</footnote>
the equation

$$ (1.1) \qquad Ax^r + By^q = Cz^p, \quad r, q, p \in \mathbb{Z}_{\ge 0}, \qquad \frac{1}{r} + \frac{1}{q} + \frac{1}{p} < 1, $$

where $A, B, C \in \mathbb{Z}_{\ge 0}$ are coprime.

We say that a solution $(a, b, c) \in \mathbb{Z}^3$ of (1.1) is non-trivial if it satisfies $abc \neq 0$ and we call it primitive if $\gcd(a, b, c) = 1$. We call a signature any triple of exponents $r, q, p$ as above and say that (1.1) is a Fermat-type equation of signature $(r, q, p)$. We reserve the letter $p$ for a prime that is varying while the others exponents are fixed. This way, fixing a prime $r$, the signatures $(r, r, p)$ and $(p, p, r)$ correspond to different infinite families of Fermat-type equations. The generalized Fermat equation is the subject of the following conjecture, which is known to be a consequence of the abc-conjecture (see [30, Section 5.2]).

**Conjecture.** Fix $A, B, C \in \mathbb{Z}$ coprime. Then, there are only finitely many triples $(x^r, y^q, z^p)$ such that $x, y, z$ are coprime integers and $r, q, p$ are integers $\ge 2$ satisfying $\frac{1}{r} + \frac{1}{q} + \frac{1}{p} < 1$ and $Ax^r + By^q = Cz^p$.

In the case when $A = B = C = 1$ and $r, q, p \ge 3$, the finite list of non-trivial primitive solutions was conjectured to be empty by several people (see [4]) including Beal who has funded a monetary prize [67] for its resolution or counterexample.

A result of Darmon-Granville [30] states that if we fix $A, B, C$ and the signature $(r, q, p)$ then there are only finitely many non-trivial primitive solutions to (1.1) as predicted. This is proven by a clever application of the Chevalley-Weil theorem which reduces the result to Faltings' theorem on the finiteness of rational points on curves of genus $\ge 2$. Apart from this result, almost all progress towards the above conjecture was obtained using extensions of Wiles' proof of Fermat's Last Theorem that rely on modularity of elliptic curves.

## 1.2. The modular method.
The crucial link between modularity of elliptic curves and Galois representations with Diophantine equations goes back to the work of Serre [78] and Darmon [25, 26] who studied instances of (1.1) assuming certain modularity conjectures. In a nutshell, the core idea is to map any putative solution of a Diophantine equation to 2-dimensional Galois representations valued in $GL_2(\mathbb{F}_p)$ of bounded conductor, and to show these representations arise from modular forms of weight 2 and level equal to their Serre level which should be essentially independent of the solution. A resolution of the equation is obtained, if one can show, by methods for distinguishing residual Galois representations, that the mod $p$ representations arising from all the modular forms at the Serre level (and weight 2) are not isomorphic to the representations constructed from a non-trivial putative solution.

The above strategy is known as the *modular method* to solve Diophantine equations.

Wiles' proof of modularity of semistable elliptic curves over $\mathbb{Q}$ also gave birth to the new era of modularity lifting theorems. In the last 25 years, this area has seen remarkable progress due to the work of Breuil, Calegari, Diamond, Fujiwara, Gee, Geraghty, Kisin, Savitt, Skinner, Taylor, Thorne, and others. This progress opened the door for extending the modular method to the setting of totally real fields and Hilbert modularity in [36].

In practice, when applying the modular method, the association of a residual Galois representation to a putative solution of a Diophantine equation is provided by elliptic curves. Furthermore, the fact that the representation arises on an elliptic curve allows to study its properties in great detail, as there are many tools available in this setting. The main steps of the modular method over totally real fields can be summarized as follows.
**Constructing a Frey curve.** Attach an elliptic curve $E/K$ to a putative solution of a Diophantine equation, where $K$ is some totally real field. In the case of Fermat's Last Theorem, following an idea of Frey-Hellegouarch one considers the curve

$$y^2 = x(x - a^p)(x + b^p) \quad \text{where} \quad a^p + b^p = c^p, \quad abc \neq 0, \quad a, b, c \in \mathbb{Z}.$$

Studying different equations require constructing different curves; such an elliptic curve is called a *Frey elliptic curve* or simply *Frey curve* for short.

**Modularity.** Prove modularity of $E/K$.

**Irreducibility.** Prove irreducibility of $\bar{\rho}_{E,p}$, the mod $p$ Galois representation attached to $E$.

**Level lowering.** Conclude that $\bar{\rho}_{E,p} \simeq \bar{\rho}_{g,p}$ where $g$ is a Hilbert newform over $K$ of parallel weight 2, trivial character and level among finitely many explicit; here $\bar{\rho}_{g,p}$ denotes the mod $p$ representation attached to $g$ for some $p \mid p$.

**Contradiction.** Compute all the newforms predicted in the previous step; then, for each computed newform $g$ and $p \mid p$ in its field of coefficients, show that $\bar{\rho}_{E,p} \neq \bar{\rho}_{g,p}$. This rules out the isomorphism predicted by level lowering, yielding a contradiction. This final step is also known as the *elimination step*.

**1.3. The Darmon program.** There are only a few instances of Fermat-type equations having Frey curve attached to them; in fact, those defined over $\mathbb{Q}$ were already known to Darmon in 1997 (see [27, p. 14] for a list). Since then, new Frey curves defined over totally real fields were found by Freitas [45], which are attached to Fermat equations of the shape $x^r+y^r=Cz^p$ where $r \ge 5$ is a prime and $C$ is a non-zero integer. This scarcity prompted Darmon to develop an ambitious program [29] to tackle Fermat-type equations with one varying exponent. A main idea of his program is to replace the use of Frey curves by higher dimensional abelian varieties defined over $\mathbb{Q}$ that become of GL$_2$-type over certain totally real fields; we refer to these varieties as *Frey abelian varieties* or simply *Frey varieties* for short. In this way Darmon systematically attaches residual 2-dimensional Galois representations with bounded conductor to putative solutions of (1.1) for all signatures.

However, Darmon's Frey varieties are not always explicit enough to work with and, moreover, applying the rest of his program is challenging because several of the main steps rely on hard open conjectures. Notably, Conjecture 4.1 of [29] stating that Darmon's Frey varieties have residual Galois representations with large image (which includes irreducibility) except in the complex multiplication (CM) case is still wide open. We state it here for convenience of the reader.

**Conjecture 1.2.** Let $F$ be a totally real field and $L$ a number field. There exists a constant $C(L, F)$, depending only on $L$ and $F$, such that for any abelian variety $A/L$ of GL$_2$-type with

$$\mathrm{End}_L(A) \otimes \mathbb{Q} = \mathrm{End}_L(A) \otimes \mathbb{Q} \simeq F,$$

and all primes $p$ in $F$ above rational primes $p$ of norm greater than $C(L, F)$ the image of the mod $p$ representation associated to $A$ contains $\mathrm{SL}_2(\mathbb{F}_p)$, where $\mathbb{F}_p$ denotes the residue field of $F$ at $p$.

This conjecture is crucially used to distinguish the mod $p$ Galois representations attached to a non-trivial solution from the mod $p$ representation attached to the trivial solutions, since the latter arise from Frey varieties with CM.

Among the other challenges faced by the program are the difficulty of proving modularity of residual Galois representations over number fields and the lack of sufficiently general modularity lifting theorems in the case of residually reducible image.

Finally, another important difficulty which emerges for large signatures is that the spaces of Hilbert modular forms become too large to allow explicit computation. This issue was not central in
Darmon's original program, but it becomes of prime importance when trying to realize it. For instance, even assuming Conjecture 1.2, one still needs a method to eliminate Hilbert newforms at the Serre level without complex multiplication.

As it will be explained in detail below, one of our contributions is to reduce the problem of solving certain instances of (1.1) to the Cartan case of Conjecture 1.2 for a specific family of abelian varieties. More precisely, the following special case of Conjecture 1.2.

**Conjecture 1.3.** Let $r \ge 5$ be a prime and $K$ the maximal totally real subfield of the cyclotomic field $\mathbb{Q}(\zeta_r)$. There exists a constant $C_K$ such that for any abelian variety $A/\mathbb{Q}$ of $\mathrm{GL}_2$-type over $K$ with $\mathrm{End}_K(A) \otimes \mathbb{Q} = \mathrm{End}_{\overline{K}}(A) \otimes \mathbb{Q} \simeq K$ and all primes $p$ in $K$ above rational primes $p$ of norm greater than $C_K$ the image of the mod $p$ representation associated to $A/K$ is not contained in the normalizer of a Cartan subgroup of $\mathrm{GL}_2(\mathbb{F}_p)$.

**1.4. Our contribution to the Darmon program.** The main goal of this paper is to understand and expand the current limits of Darmon's approach using higher dimensional Frey varieties.

By exploring the ideas in the Darmon program together with some of the latest developments surrounding the modular method, we will study in detail an approach to Fermat-type equations of the shape $x^r + y^r = Cz^p$ using a hyperelliptic Frey curve constructed by Kraus [57].

For most cases of signatures $(p, p, r)$ or $(q, r, p)$, Frey curves are absent, so the use of Frey varieties becomes essential; the groundwork we lay for signature $(r, r, p)$ opens the road to resolving other signatures which afford a Frey variety arising from the Jacobian of a hyperelliptic curve as, for example, Darmon's construction for signature $(p, p, r)$ used in [18].

As mentioned, several aspects of the Darmon program are impractical or conjectural. We now summarize the main challenges we face and the ways we deal with them in more detail.

**The Frey variety.** Darmon's construction of the Frey varieties attached to signature $(r, r, p)$ starts from superelliptic curves and considers certain quotients of them and their Jacobians (see [29, pp. 422-423]). Further explicit development of this theory is needed to allow its practical use in Diophantine applications. Instead, we show that certain odd Frey representations of signature $(r, r, p)$ (see Subsection 2.1 for a definition) can in fact be given by the Jacobian of a Frey hyperelliptic curve $C_r(a, b)$ due to Kraus [57] (see Section 3). To accomplish this, we exhibit a curious relation between Kraus' Frey hyperelliptic curve and Darmon's Frey varieties for equations of signature $(p, p, r)$ which allows us to prove that its Jacobian $J_r = \mathrm{Jac}(C_r(a, b))$ becomes of $\mathrm{GL}_2$-type over $K = \mathbb{Q}(\zeta_r)^+ = \mathbb{Q}(\zeta_r + \zeta_r^{-1})$, the maximal totally real subfield of $\mathbb{Q}(\zeta_r)$. Therefore, there are 2-dimensional Galois representations of $G_K = \mathrm{Gal}(\overline{\mathbb{Q}}/K)$ attached to $J_r$. Furthermore, Kraus' construction extends to the case of 'general coefficients' Fermat equation of signature $(r, r, p)$, opening the road for extending the methods of this paper to this case as well (see Remark 3.8).

**Modularity.** A remarkable feature of Darmon's Frey varieties is that they share some Galois structures. In particular, in [29, p. 433] there is a diagram describing the possibility of propagating modularity among them once suitable modularity lifting theorems become available. We will make this idea work in our setting. Indeed, let $J_r$ be the Jacobian of Kraus' hyperelliptic curve $C_r(a, b)$; it has dimension $(r-1)/2$ and becomes of $\mathrm{GL}_2$-type over $K = \mathbb{Q}(\zeta_r)^+$. From the relation mentioned above between $J_r$ and Darmon's Frey variety for signature $(p, p, r)$ we first show that the residual representation $\bar{\rho}_{J_r, p_r} : G_K \to \mathrm{GL}_2(\mathbb{F}_r)$ arises on an elliptic curve and descends to $G_{\mathbb{Q}} = \mathrm{Gal}(\overline{\mathbb{Q}}/\mathbb{Q})$. Here $p_r$ is the unique prime ideal above $r$ in $K$. Secondly, we show it is absolutely irreducible when restricted to $\mathrm{Gal}(\overline{\mathbb{Q}}/\mathbb{Q}(\zeta_r))$, allowing us to apply Serre's conjecture, cyclic base change and modularity lifting theorems to conclude modularity of $J_r/K$.
**The conductor.** A very useful advantage of Kraus' hyperelliptic curves is that we can successfully compute their conductors. Let $J_r$ be as above. We are interested in the conductor of the 2-dimensional $p$-adic Galois representations $\rho_{J_r,p}$ attached to $J_r/K$. This is known to be related to the conductor of $J_r/K$. The recent work [2] goes a long way using 'cluster pictures' to determine the latter, but it is insufficient for us as it does not apply in residual characteristic 2. Our approach to determine the conductor at a prime $q$ in $K$ works uniformly independently of the residual characteristic of $q$ as follows. Using explicit calculations with Weierstrass models of hyperelliptic curves we first determine the minimal ramification degree at $q$ of a field $L/K_q$ where $J_r$ becomes semistable at $q$. Then, we pin down which local type at $q$ for $\rho_{J_r,p}$ is compatible with the field $L$ and then apply the well-known conductor formulas for such representations.

**Irreducibility.** Let $p$ a prime ideal in $K$ above a rational prime $p$. To apply level lowering results to the residual representation $\bar{\rho}_{J_r,p}$ attached to $J_r/K$ we first need to show it is irreducible. Our method for computing the conductor gives an exact description of the local representations $\bar{\rho}_{J_r,p}|_{D_q}$, where $q | q \neq p$ is a prime in $K$ and $D_q$ is a decomposition group at $q$. If such a local representation is supercuspidal then irreducibility holds locally already, otherwise, if we have a principal series we show irreducibility for large enough $p$.

**Finiteness of the $p$-torsion representation.** Another key input for level lowering is to guarantee that $\bar{\rho}_{J_r,p}|_{D_q}$ arises on a finite flat group scheme for all $q | p$. This implies that $\bar{\rho}_{J_r,p}$ arises on a Hilbert newform of parallel weight 2, independently of the putative solution. In the case of Frey curves this follows from standard arguments using the theory of the Tate curve, but for higher dimensional varieties the situation is more delicate. Ellenberg [43] gives a criterion which is a direct generalization of the usual criterion for elliptic curves, but it is hard to use due to the need to determine a discriminantal set. In [29], Darmon implicitly uses such a theorem for signature $(p, p, r)$, but we are not aware of a complete reference for general signatures. Inspired by Darmon's ideas, we give a criterion that is easy to apply in practice in many interesting cases; see Theorems 7.5 and 7.6 in Section 7.

**Level lowering and contradiction.** To obtain a contradiction, we need to show that $\bar{\rho}_{J_r,p} \neq \bar{\rho}_{g,\mathfrak{g}}$ for all newforms $g$ and all primes $\mathfrak{p} \nmid p$ in the field of coefficients of $g$, where $\bar{\rho}_{g,\mathfrak{g}}$ is the mod $\mathfrak{g}$ representation attached to $g$. Computing the possible newforms $g$ can be a serious obstruction. Furthermore, aiming to obtain an optimal bound for the exponent can introduce further computational complications; indeed, applying the standard trace comparison method requires, for each newform $g$, to factor multiple norms from the compositum of $K$ with the field of coefficients of $g$, which can be of very large degree. To reduce such computations, we apply a level lowering theorem with prescribed inertial types (due to Breuil and Diamond), together with a result that relates the field of coefficient of a newform to its inertial types. This yields two major benefits: it reduces the number of spaces where we have to eliminate forms and also dramatically cuts down the number of forms we have to consider in the remaining space. We remark that this powerful technique is not available when working with Frey curves (see Section 8 for further discussion). Despite this improvement, there are still computational challenges left. We describe various ways to overcome these issues in Section 9.

**1.5. Diophantine applications.** In the works of Dieulefait-Freitas [36, 37] and Freitas [45] several Frey curves were attached to Fermat equations of the form

$$ (1.4) \qquad x^r + y^r = dz^p, \quad xyz \neq 0, \quad \gcd(x, y, z) = 1 $$

with $r$ a fixed prime, $d$ a fixed positive integer and $p$ allowed to vary. These curves are defined over totally real subfields of the $r$-th cyclotomic field $\mathbb{Q}(\zeta_r)$. Together with powerful developments
of modularity lifting theorems for totally real fields (e.g. [16]) and consequent modularity of many elliptic curves over these fields, this opened a door to pursue the study of these Fermat equations.

The equation (1.4) for $r = 3$ and $d = 1$ is studied by Kraus in [58, Théorème 6.1] where it is proved that any non-trivial primitive solutions $(a, b, c)$ must satisfy $2 \mid a + b$ and $3 \mid a + b$ (see [24, §3.3.2.] for the exponents $5 \le p \le 13$). Similarly, in [10, Theorem 4], we proved that when $r = 5$ and $d = 1$ there is no non-trivial primitive solution to equation (1.4) for every prime $p$ such that $2 \mid a + b$ or $5 \mid a + b$. The methods developed in the present paper can be applied to obtain the following similar results for $r = 11$.

**Theorem 1.5.** For all integers $n \ge 2$, there are no integer solutions $(a, b, c)$ to the equation

$$ (1.6) \qquad x^{11} + y^{11} = z^n $$

such that $abc \ne 0$, $\gcd(a, b, c) = 1$, and $2 \mid a + b$ or $11 \mid a + b$.

As an additional application of our methods, in the second volume of this series [11], we study in detail the equation $x^7 + y^7 = dz^p$ for $d \in \{1, 3\}$. In particular, we obtain in loc. cit. a result similar to the above for $d = 1$; furthermore, we discuss how, for $d = 3$, the extra structure of the Frey varieties allows us to give a computationally more efficient proof than applying the modular method exclusively with Frey curves.

**Remark 1.7.** For $r = 3$, the Catalan solution $2^3 + 1^3 = 3 \cdot 3^1 = 3^2$ currently prevents the modular method from proving results such as Theorems 1.5. Nevertheless, the work of Chen-Siksek [19] together with the work of Freitas [46] imply that $x^3 + y^3 = z^p$ has no non-trivial primitive solutions for a set of prime exponents with density 0.844.

Recall that in Kummer's cyclotomic approach to the Fermat equation $x^p + y^p = z^p$, we say that a solution $(a, b, c)$ is a first case solution if $p \mid abc$ and a second case solution if $p \nmid abc$ where $p \ge 3$ is a prime exponent. From the point of view of the modular method, first case solutions correspond to a Frey curve with conductor exponent 0 at $p$, and second case solutions to a curve with conductor exponent 1 at $p$ (that is, first case solutions correspond to the minimal conductor exponent possible; second case solutions to larger conductor exponents).

For the Frey varieties $J = J_{11}(a, b)$ used in the proof of Theorem 1.5, the condition $q \mid a + b$ corresponds to potential multiplicative reduction of $J$ at a prime $q$ above the prime $q$ and hence up to twist $\rho_{J,p}$ has conductor exponent 1 at the prime $q$, whereas $q \mid a + b$ corresponds to potential good reduction of $J$ at $q$ and hence $\rho_{J,p}$ has conductor exponent $\ge 2$ at $q$. Thus, we may view Theorem 1.5 as resolving (1.6) for first case solutions with respect to the primes $q = 2$ and $q = 11$.

The 2- and 11-adic conditions in Theorem 1.5 are due to the Hilbert newforms at the Serre level corresponding to trivial primitive solutions with $ab = 0$. As mentioned, Conjecture 1.2 is still not sufficient to overcome this obstruction as one has to first eliminate Hilbert newforms at the Serre level without complex multiplication. To illustrate this point, we will perform this 'elimination/reduction to CM forms' for $r = 5$.

**Theorem 1.8.** Let $r = 5$, $d = 1$ and $p \notin \{2, 3, 5\}$ be a prime. Then any non-trivial primitive solution $(a, b, c)$ to the equation (1.4) gives rise to an irreducible residual Frey representation $\bar{\rho}_{J_5(a,b),p}$ such that $\bar{\rho}_{J_5(a,b),p} \simeq \bar{\rho}_{J_5(0,1),p} \otimes \chi$ for a character $\chi$ of order dividing 2 and any choice of prime $p$ of $K = \mathbb{Q}(\zeta_5)^+$ above $p$.

As a consequence, Darmon's conjectural ideas can kick in.
**Corollary 1.9.** *Assuming Conjecture 1.3, there are no non-trivial primitive solutions to*

$$x^5 + y^5 = z^p$$

when $p$ is sufficiently large.

It should be remarked that the natural conclusion of Theorem 1.8 based on Darmon's original program would also include the possibility that $\bar{\rho}_{J_5(a,b),p}$ is reducible. A surprising outcome of our study is that we have used Frey elliptic curves not covered by Darmon's classification to 'propagate' irreducibility results to Kraus' Frey hyperelliptic curve, also not predicted in the initial program, thereby removing the need for the Borel case of Conjecture 1.2.

Many of the tools we develop for achieving the results in Theorem 1.5 can thus be viewed as addressing the difficulty of eliminating non-CM Hilbert newforms as in Theorem 1.8, an issue not addressed in Darmon's original program. Advances in the ability to compute Hilbert modular forms or to eliminate Hilbert newforms would allow more cases of $r$ to be completed using the methods developed in this paper.

**1.6. Electronic resources.** The Magma programs used for the computations needed in this paper are posted in [8], where there is included a list of programs, their descriptions, output transcripts, timings, and machines used.

**1.7. Acknowledgments.** We thank Lassina Dembélé, Angelos Koutsianas, and Ariel Pacetti for helpful discussions and remarks on a preliminary version. We also thank Henri Darmon for useful conversations about Section 7 and Filip Najman for his help with Theorem 4.4. The fourth author is grateful to the Max Planck Institute for Mathematics in Bonn for its hospitality and financial support.

**1.8. Organisation of the paper.** The main goal of this paper is to lay down all the theoretical foundations for a modular approach to generalized Fermat equations (1.4) using a Frey hyperelliptic curve constructed by Kraus [57] and ideas from Darmon's program [29]. This objective covers Sections 2 to 9 where we go over all the steps in the modular method as recalled above.

More precisely, building on an unexpected connection between Frey representations of signatures $(p, p, r)$ and $(r, r, p)$ explained in Section 2, we first show in Section 3 that there are 2-dimensional Galois representations attached to the Jacobian $J_r$ of Kraus' Frey hyperelliptic curve. Using these representations, we then prove in Section 4 that $J_r$ is modular, as well as other Frey varieties constructed by Darmon. In Section 5, we compute the conductor of the system of $\lambda$-adic representations attached to $J_r$ and we give in Section 6 several criteria that allow to prove irreducibility of the residual representations under various assumptions. Assuming irreducibility and building on results from Section 7, we state in Section 8 level lowering results that are refinements of the classical ones in the context of Frey abelian varieties of higher dimension. Finally, we discuss in Section 9 the crucial elimination step in great details.

The last two sections are devoted to proving the Diophantine applications stated in the introduction.

For a field $k$, fix an algebraic closure $\bar{k}$ and let $G_k := \text{Gal}(\bar{k}/k)$ be its absolute Galois group.

## 2. CONNECTING FREY REPRESENTATIONS FOR SIGNATURES $(p, p, r)$ AND $(r, r, p)$

In this section, we first introduce Frey representations which are a key idea in Darmon's program. After recalling some useful background on abelian varieties of $\text{GL}_2$-type and hyperelliptic curves, we give in Subsection 2.4 an explicit construction of Frey representations of signature $(r, r, p)$
which differs from Darmon's approach in that it uses hyperelliptic curves instead of superelliptic curves. Our method reveals a surprising relation between Frey representations of signature $(r, r, p)$ and $(p, p, r)$ (recall these are different signatures as $r$ is fixed and $p$ varies). This construction plays a central role in the next section where we relate Kraus' construction to certain specializations of our abelian varieties in the spirit of [29, §1.3].

**2.1. Frey representations.** The following definitions are modifications of Darmon's original ones (see [29, Definitions 1.1 and 1.3]) adapted to our needs. Here $K$ is a number field and $\mathbb{F}$ is a finite field of characteristic $p$ with algebraic closure $\overline{\mathbb{F}}$. Recall that $G_{\overline{K}(t)}$ sits inside $G_{K(t)}$ as normal subgroup.

**Definition 2.1.** A Frey representation (in characteristic $p$) over $K(t)$ of signature $(n_i)_{i=1,...,m}$ with respect to the points $(t_i)_{i=1,...,m}$, where $n_i \in \mathbb{N}$ and $t_i \in \mathbb{P}^1(\overline{K})$, is a Galois representation

$$ \bar{\rho}: G_{K(t)} \to \mathrm{GL}_2(\mathbb{F}) $$

satisfying

(1) the restriction $\bar{\rho}|_{G_{\overline{K}(t)}}$ has trivial determinant and is irreducible,

(2) the projectivization $\mathbb{P}\bar{\rho}|_{G_{\overline{K}(t)}}: G_{\overline{K}(t)} \to \mathrm{PSL}_2(\mathbb{F})$ of $\bar{\rho}|_{G_{\overline{K}(t)}}$ is unramified outside the $t_i$,

(3) the projectivization $\mathbb{P}\bar{\rho}|_{G_{\overline{K}(t)}}$ maps the inertia subgroups at $t_i$ to subgroups of $\mathrm{PSL}_2(\mathbb{F})$ generated by elements of order $n_i$, respectively, for $i = 1, ..., m$.

**Definition 2.2.** Let $\bar{\rho}_1, \bar{\rho}_2$ be two Frey representations as in Definition 2.1 of the same signature with respect to the same points. We say $\bar{\rho}_1, \bar{\rho}_2$ are equivalent if they are isomorphic over $\overline{\mathbb{F}}$, up to a character; that is for a character $\chi: G_{K(t)} \to \overline{\mathbb{F}}^\times$, the representations $\bar{\rho}_1 \otimes \chi$ and $\bar{\rho}_2 \otimes \chi$ are isomorphic.

The following lemma is useful for verifying the first condition in Definition 2.1.

**Lemma 2.3.** Let $\sigma_0, \sigma_1, \sigma_\infty$ be elements of $\mathrm{PSL}_2(\mathbb{F})$ of order $p, p, r$ satisfying $\sigma_0\sigma_1\sigma_\infty = 1$, where $p$ and $r$ are prime numbers. Then $\sigma_0, \sigma_1, \sigma_\infty$ generate a subgroup of $\mathrm{PSL}_2(\mathbb{F})$ which acts irreducibly on $\mathbb{F}^2$.

*Proof.* By [29, Lemma 1.11], the elements $\sigma_0, \sigma_1, \sigma_\infty$ generate all of $\mathrm{PSL}_2(\mathbb{F})$ except in the case $(p, r) = (3, 5)$ when it generates a subgroup isomorphic to $A_5$. However, the order of $A_5$ does not divide the order of a Borel subgroup of $\mathrm{PSL}_2(\mathbb{F}_9)$. $\square$

The above definition generalizes the original idea of Frey curve as follows. In [29, §1.2] a classification of Frey representations of signature $(r, r, p)$ and $(p, p, r)$ with respect to the points $(0, 1, \infty)$ is given and they are shown to arise from a base change of certain abelian varieties over $\mathbb{Q}(t)$. In particular, the varieties obtained by Darmon include the known Frey elliptic curves defined over $\mathbb{Q}$ (see [27, p. 14]) in case of prime exponents $p, r$. On the other hand, Frey elliptic curves genuinely defined over number fields, such as those in [45], are not explained by Darmon's classification for signature $(r, r, p)$ with respect to the points $(0, 1, \infty)$. Thus, when applying the multi-Frey technique with both kinds of Frey varieties one can expect to exploit independent information arising from each variety.

**Remark 2.4.** Darmon also obtained a similar classification of Frey representations of signature $(p, q, r)$ for three distinct prime exponents (see [29, Theorem 1.14]), but these are not considered in this work.
## 2.2. Abelian varieties of $GL_2$-type.
In this subsection we briefly recall basic facts (see [73]) about abelian varieties of $GL_2$-type as they will play an important role in the sequel.

**Definition 2.5.** Let $A$ be an abelian variety over a field $L$ of characteristic 0. We say that $A/L$ is of $GL_2$-type (or $GL_2(F)$-type) if there is an embedding $F \to \text{End}_L(A) \otimes_Z \mathbb{Q}$ where $F$ is a number field with $[F : \mathbb{Q}] = \text{dim } A$.

*Remark 2.6.* In the literature, $A/L$ being of $GL_2(F)$-type sometimes requires additional conditions such as $\text{End}_K(A) \otimes_Z \mathbb{Q} \cong F$ (see [51]); or $A/L$ does not decompose up to isogeny over $L$ as $B^n$, where $B$ is of $GL_2(E)$-type, $E \subseteq F$, and $F$ is embedded into $M_n(E) \cong M_n(\text{End}_K(B) \otimes \mathbb{Q})$ (see [74]); or, in addition, that $A$ does not have an absolutely simple CM factor (as in [51]). We do not require any further conditions for our results, and follow the original terminology of Ribet [74]. For additional facts about $\lambda$-adic and $\ell$-adic representations for abelian varieties of $GL_2$-type, see [20].

Let $A/L$ be an abelian variety with $F \to \text{End}_L(A) \otimes_Z \mathbb{Q}$ as in Definition 2.5. For a prime number $\ell$, denote by $T_\ell(A)$ the $\ell$-adic Tate module of $A$ and write $V_\ell(A) = T_\ell(A) \otimes_Z \mathbb{Q}_\ell$. Then, $T_\ell(A)$ is a free $\mathbb{Z}_\ell$-module of rank $2 \dim A$ and $V_\ell(A)$ is a $\mathbb{Q}_\ell$-vector space of dimension $2 \dim A$. The absolute Galois group $G_L$ of $L$ acts continuously on these modules so we get a continuous homomorphism

$$ \rho_{A,\ell} : G_L \to \text{Aut}_{\mathbb{Q}_\ell}(T_\ell(A)) \subset \text{Aut}_{\mathbb{Q}_\ell}(V_\ell(A)) $$

called the $\ell$-adic representation of $A$.

On the other hand, $\text{End}_L(A) \otimes_Z \mathbb{Q}$ operates on $V_\ell(A)$, so $V_\ell(A)$ is a module for $F_\ell = F \otimes_Z \mathbb{Q}_\ell$. Since $F \to \text{End}_L(A) \otimes_Z \mathbb{Q}$, the action of $G_L$ on $V_\ell(A)$ is $F_\ell$-linear, and hence the image of $\rho_{A,\ell}$ lies in $\text{Aut}_{F_\ell}(V_\ell(A))$.

For each prime ideal $\lambda$ in $F$ above the rational prime $\ell$, write $\iota_\lambda : F \to F_\lambda$ the canonical embedding of $F$ into its $\lambda$-adic completion. We have a decomposition $F_\ell \simeq \prod_{\lambda|\ell} F_\lambda$ mapping $x \otimes a$ to $(a\iota_\lambda(x))_{\lambda|\ell}$. For each $\lambda$, put $V_\lambda(A) = V_\ell(A) \otimes_{F_\ell} F_\lambda$. Then, $G_L$ acts $F_\lambda$-linearly on $V_\lambda(A)$, since it acts $F_\ell$-linearly on $V_\ell$. According to [73, (2.1.1)], we have that $V_\lambda(A)$ is a 2-dimensional vector space over $F_\lambda$ and thus $V_\ell(A)$ is a free module of rank 2 over $F_\ell$. Therefore, we get a homomorphism

$$ \rho_{A,\lambda} : G_L \to \text{Aut}_{F_\lambda}(V_\lambda(A)) \simeq \text{GL}_2(F_\lambda), $$

which is a $\lambda$-adic representation attached to $A$.

Moreover, the $\ell$-adic representation $\rho_{A,\ell} : G_L \to \text{Aut}_{F_\ell}(V_\ell(A)) \simeq \text{GL}_2(F_\ell)$ decomposes as (see Section 9 for a more detailed study)

$$ (2.7) \qquad \rho_{A,\ell} \simeq \bigoplus_{\lambda|\ell} \rho_{A,\lambda}. $$

As $\lambda$ runs over all the prime ideals in $F$, the representations $\{\rho_{A,\lambda}\}_\lambda$ form a strictly compatible system of $F$-rational representations with exceptional set equal to the set of places of $L$ at which $A$ has bad reduction (see [73, Theorem (2.1.2)]; note that Ribet’s definition of strictly compatible systems of Galois representations differs from that of Böckle used in Section 5).

Let $q$ be a prime ideal in $L$ of good reduction for $A$ above a rational prime $q$. We denote by Frob$_q$ a Frobenius element at $q$ in $G_L$ and write $a_q(A) = \text{tr} \rho_{A,\lambda}(\text{Frob}_q)$ for a prime ideal $\lambda \nmid q$. By the previous discussion, this definition is independent of the choice of such $\lambda$.

For a prime ideal $\lambda$ in $F$, the representation $\rho_{A,\lambda}$ can be conjugated to take values in $\text{GL}_2(\mathcal{O}_\lambda)$ where $\mathcal{O}_\lambda$ is the integer ring of $F_\lambda$. By reduction modulo the maximal ideal, we get a representation

$$ \bar{\rho}_{A,\lambda} : G_L \to \text{GL}_2(\mathbb{F}_\lambda), $$

with values in the residue field $\mathbb{F}_\lambda$ of $F_\lambda$. For a representation

$$ \rho : G_L \to \text{GL}_2(\mathbb{F}_\lambda), $$
let $\rho^{ss}$ denote its semisimplification. The representation $\bar{\rho}_{A,\lambda}^{ss}$ is unique up to isomorphism by Brauer-Nesbitt [23, (30.16)] [15, p. 560]. For instance, if $\bar{\rho}_{A,\lambda}$ is irreducible, then $\bar{\rho}_{A,\lambda} = \bar{\rho}_{A,\lambda}^{ss}$ is unique up to isomorphism.

We finish this section with the following basic property which is used throughout [29] and our paper. For example, it ensures the relevant Frey varieties from Section 4 are modular with trivial character.

**Theorem 2.8.** Let $L$ and $F$ be totally real number fields. Suppose $A/L$ is a polarized abelian variety of $GL_2(F)$-type and let $\lambda$ be a prime ideal in $F$ above a rational prime $p$. Then $\det \rho_{A,\lambda}$ is the $p$-adic cyclotomic character $\chi_p$.

*Proof.* The case $L = \mathbb{Q}$ follows from the classical work of Ribet [74]. For the general case see [84, §2.2], more precisely, Lemma 2.2.5 and Corollary 2.2.10 in loc. cit. $\square$

*Remark 2.9.* For $\lambda$-adic representations arising from odd weight newforms, the analogue of Theorem 2.8 is not true. For example, there is a classical newform $f$ with LMFDB label 4.5.b.a which has weight 5, level 4, and complex multiplication by $\mathbb{Q}(\sqrt{-1})$, whose field of eigenvalues is $\mathbb{Q}$, but whose Nebentypus is a character of order 2.

## 2.3. Hyperelliptic equations.
In this subsection, we summarize well-known facts (taken in part from [63]) that will be relevant for later calculations in this section and in Subsection 5.2.

Let $K$ be a local field. Denote by $\mathcal{O}$ the ring of integers of $K$, $\pi$ a uniformizer in $\mathcal{O}$, $k$ the residue field of $\mathcal{O}$, and $v$ its normalized valuation. Let $g$ be a positive integer.

We refer the reader to the definition of a hyperelliptic equation $E$ over $K$ of genus $g$ and its discriminant $\Delta_E$ in general form described in [62, §7.4, Proposition 4.24], but do not recall it as we will only need the special case in (2.10).

An algebraic curve $C$ given by a hyperelliptic equation $E$ over $K$ with $\Delta_E \neq 0$ is called a hyperelliptic curve over $K$.

A model $C$ over $\mathcal{O}$ for a hyperelliptic curve $C$ over $K$ is a $\mathcal{O}$-scheme which is proper and flat over $\mathcal{O}$ such that $C_K \simeq C$ where $C_K$ denotes the generic fiber of $C$.

A model $C$ over $\mathcal{O}$ for a hyperelliptic curve $C$ over $K$ has good reduction if and only if its reduction mod $v$ is a non-singular curve over the residue field $k$ of $\mathcal{O}$.

A model $C$ over $\mathcal{O}$ for a hyperelliptic curve $C$ over $K$ has bad semistable reduction if and only if its reduction mod $v$ is reduced and has only ordinary double points as singularities and at least one singularity (over $\bar{k}$).

A hyperelliptic model $\mathcal{E}$ over $\mathcal{O}$ for a hyperelliptic curve $C$ over $K$ is a model over $\mathcal{O}$ arising from hyperelliptic equation $E: y^2 + Q(x)y = P(x)$ over $K$ such that $P, Q \in \mathcal{O}[x]$.

A hyperelliptic curve $C$ over $K$ has good reduction (resp. bad semistable reduction) if and only if there is some model $C$ over $\mathcal{O}$ for $C$ which has good reduction (resp. bad semistable reduction).

A hyperelliptic curve $C$ over $K$ has semistable reduction if and only if $C$ has good or bad semistable reduction.

An abelian variety over $K$ has semistable reduction if and only if the linear part of the special fiber of the connected component of its Néron model is an algebraic torus.

An odd degree hyperelliptic equation $E$ over $K$ of genus $g$ is an equation of the form

$$ (2.10) \qquad y^2 + Q(x)y = P(x) $$
where $Q, P \in K[x]$, $\deg Q \le g$, $\deg P = 2g+1$ and $P$ is monic. The discriminant of $E$ is given by

$$ \Delta_E = 2^{4g} \Delta(P + Q^2/4), $$

where $\Delta(H)$ is the discriminant of $H \in K[x]$.

Two odd degree hyperelliptic models $E: y^2+Q(x)y = P(x)$ and $F: z^2+T(u)z = S(u)$ for the same hyperelliptic curve $C$ over $K$ are related by a transformation of the shape

$$ x = e^2u + r, \quad y = e^{2g+1}z + t(u), $$

where $e \in K^*$, $r \in K$, and $t \in K[u]$ with $\deg(t) \le g$. The discriminants of the odd degree hyperelliptic models are related by

$$ \Delta_F = \Delta_E e^{-4g(2g+1)}, $$

hence the valuation of the discriminant modulo $4g(2g+1)$ is an invariant of the isomorphism class of $C$.

**Proposition 2.11.** Let $C$ be a hyperelliptic curve over $K$ with a $K$-rational Weierstrass point. Then $C$ has good reduction if and only if $C$ has an odd degree hyperelliptic model $\mathcal{E}$ over $\mathcal{O}$ such that $v(\Delta(\mathcal{E})) = 0$.

*Proof.* If $C$ has an odd degree hyperelliptic model $\mathcal{E}$ over $\mathcal{O}$ such that $v(\Delta(\mathcal{E})) = 0$, then $\mathcal{E}$ is a model with good reduction so $C$ has good reduction.

Suppose $C$ has good reduction, so there exists a model $\mathcal{C}$ of $C$ with good reduction. By [62, Exercise 8.3.6], the hyperelliptic map

$$ \pi : C \to \mathbb{P}_K^1 $$

extends to

$$ \pi : \mathcal{C} \to \mathbb{P}_\mathcal{O}^1. $$

As a result, $\mathcal{C}_k$ is a non-singular pointed hyperelliptic curve, so using [63, Proposition 1.2] we deduce that $C$ has an odd degree hyperelliptic model $\mathcal{E}$. $\square$

Let $C$ be a hyperelliptic curve over $K$.

If $K$ has odd residual characteristic, then $C/K$ has bad semistable reduction if it has a hyperelliptic model $\mathcal{E}: y^2 = P(x)$ over $\mathcal{O}$ such that the reduction of $P$ mod $v$ has at most double roots and at least one double root over $\bar{k}$.

Consider now $J/K$ the Jacobian of a hyperelliptic curve defined over $K$. By Chevalley's theorem, the special fiber of the connected component of the Néron model of $J$ is an extension of a linear algebraic group by an abelian variety. We define the toric rank of $J$ as the number of copies of $\mathbb{G}_m$ occurring in this algebraic group. Moreover, $J$ has semistable reduction if this linear algebraic group is an algebraic torus. We say that $J$ has multiplicative reduction if it is semistable and its toric rank is positive.

**Lemma 2.12.** Let $K$ be a local field. Let $C$ be a smooth geometrically irreducible curve of genus $g \ge 2$ over $K$ and $J$ be the Jacobian of $C$. The following properties of semistable reduction for $C/K$ hold:

(1) If $C/K$ does not have semistable reduction, then $J/K$ does not have semistable reduction, in particular $J/K$ does not have good reduction.

(2) If $C/K$ has good (resp. bad semistable) reduction, then $C/L$ has good (resp. multiplicative) reduction for any extension $L/K$ with finite ramification index. Moreover, if $C/K$ has semistable reduction, it can only have good reduction or bad semistable reduction, but not both.
(3) If $J/K$ has good reduction and $C/L$ has good reduction for some extension $L/K$ with finite ramification index, then $C/K$ has good reduction.

*Proof.* We first recall that $C/K$ has semistable reduction if and only if $J/K$ has semistable reduction [32, Theorem 2.4], from which (1) follows immediately.

(2) If $C/K$ has good reduction (resp. bad semistable reduction), then there is a model for $C/K$ which has good reduction (resp. bad semistable reduction). Over $L$, this model still has good reduction (resp. bad semistable reduction). For the second assertion, we note that $C/K$ has good reduction if and only if its minimal regular model over $O$ (which is unique up to isomorphism) has good reduction [62, §10.1 Proposition 1.21.b].

Suppose $C/K$ has bad semistable reduction, then it has a model $C$ over $O$ with bad semistable reduction. Let $s$ be an ordinary double point in the special fiber of $C/O$. After replacing $K$ by a finite extension, we may assume $s$ is a split ordinary double point. By [62, §10.3, Corollary 3.25], we conclude that the minimal regular model over $O$ of $C/K$ has bad reduction, and hence by [62, §10.1, Proposition 1.21(b)] it follows that $C/K$ does not have good reduction.

(3) If $J/K$ has good reduction, then $J/K$ is semistable, hence $C/K$ is semistable and has either good reduction or bad semistable reduction. If $C/K$ has bad semistable reduction, then $C/LK$ has bad semistable reduction by (2), contradicting its good reduction because $C/L$ has good reduction.

□

It is known from [32, Corollary 2.7] that there is a finite extension $L/K$ such that $C/L$ has semistable reduction, that is, $C/K$ has potential semistable reduction. Lemma 2.12 (2) implies that $C/K$ either has potential good reduction or potential bad semistable reduction, but not both.

*Remark 2.13.* In what follows, we can restrict to odd degree hyperelliptic equations in our applications due to Proposition 2.11 and the fact that our Frey hyperelliptic curves have a $K$-rational Weierstrass point at $\infty$.

## 2.4. The Frey hyperelliptic curves over $K(s)$ and $K(t)$.
Some of the results that follow are based on the arguments in [81].

We remark that Darmon constructs two hyperelliptic curves over $\mathbb{Q}(t)$, denoted $C_r^+(t)$ and $C_r^-(t)$ in [29, §1.3], attached to equations of signature $(p, p, r)$. Our hyperelliptic curve $C_r(s)$ for signature $(r, r, p)$ defined in (2.15) below is related to Darmon's $C_r^-(t)$. This will be important for our argument to work, for example, in the proof of Proposition 2.32. Since we have no use for Darmon's curve $C_r^+(t)$ in this paper, we omit the ‘-’ in our notation $C_r(s)$.

Let $r \ge 3$ be prime and $\omega_j = \zeta_r^j + \zeta_r^{-j}$ for $j \in \mathbb{Z}$ where we write $\zeta_r$ for a fixed primitive $r$-th root of unity. Let $i$ be a fixed primitive fourth root of unity.

Let $K = \mathbb{Q}(\omega_1) = \mathbb{Q}(\zeta_r)^+$ be the maximal totally real subfield of $\mathbb{Q}(\zeta_r)$.

Let $\mathbb{Q}(s)$ be the field of rational functions over $\mathbb{Q}$ in the variable $s$ and set

$$ (2.14) \qquad h(x) = \prod_{j=1}^{\frac{r-1}{2}} (x - \omega_j), \qquad f^{-}(x) = xh(x^2 + 2) + s. $$
Note that $h \in \mathbb{Z}[x]$ is monic of degree $(r-1)/2$. We consider the hyperelliptic curve over $\mathbb{Q}(s)$ given by

$$ (2.15) \qquad C_r(s) : y^2 = f^{-}(x) = xh(x^2 + 2) + s $$

and write $J_r(s)$ for its Jacobian. For studying the relevant properties of $C_r(s)$ and $J_r(s)$ we will need the following auxiliary lemmas.

Set $H(x, z) = z^{r-1}xh\left(\left(\frac{x}{z}\right)^2 + 2\right) \in \mathbb{Z}[x, z^2]$ so that $H(x, 1) = xh(x^2 + 2)$, and denote by $T_r$ the r-th Chebyshev polynomial of the first kind.

**Lemma 2.16.** We have that

$$ H(x, z) = 2(iz)^r T_r \left( \frac{x}{2iz} \right). $$

In particular, we have

$$ (2.17) \qquad H(x, z) = \sum_{k=0}^{\frac{r-1}{2}} c_k z^{2k} x^{r-2k}, \quad \text{where } c_k = \frac{r}{r-k} \binom{r-k}{k} \in \mathbb{Z}, $$

and $c_k$ is divisible by r for $k > 0$.

*Proof.* According to [66, Section 2.3.2], $T_r$ is explicitly given by the formula

$$ T_r(X) = \sum_{k=0}^{\frac{r-1}{2}} (-1)^k 2^{r-2k-1} c_k X^{r-2k}, $$

and we have the following identities for $c_k$:

$$ c_k = 2 \binom{r-k}{k} - \binom{r-k-1}{k} = \frac{1}{2^{r-2k-1}} \sum_{j=k}^{\frac{r-1}{2}} \binom{r}{2j} \binom{j}{k}. $$

This proves that $c_k$ is an integer for all $k \ge 0$ and that $c_k \equiv 0 \pmod{r}$ for $k > 0$. Note that $H(x, z)$ and $z^r T_r(\frac{x}{2iz})$ have degree r with respect to $x$. We claim they have the same set of r distinct complex zeros, hence are scalar multiples of each other, that is there exists a complex number $\alpha$ such that

$$ H(x, z) = \alpha \cdot z^r T_r \left( \frac{x}{2iz} \right). $$

Since $H$ is monic and the leading coefficient of $z^r T_r(\frac{x}{2iz})$ is $1/2i^r$ we conclude $\alpha = 2i^r$, as desired. To complete the proof we will now prove the claim.

Fix $\zeta_r^{1/2}$ a $2r$-th root of unity whose square is $\zeta_r$. The zeros of $h(x)$ are $\omega_j$ for $j = 1, \dots, \frac{r-1}{2}$, so that the zeros of $H(x, z)$ as a polynomial in $x$ satisfy $x = 0$ or

$$ \left(\frac{x}{z}\right)^2 = \omega_j - 2 = (\zeta_r^{j/2} - \zeta_r^{-j/2})^2 = \left(2i \sin \frac{\pi j}{r}\right)^2 \iff x = \pm 2iz \sin \frac{\pi j}{r} $$

which are $r-1$ distinct values for $j = 1, \dots, \frac{r-1}{2}$. We now show that these values of $x$ also satisfy $T_r(\frac{x}{2iz}) = 0$. Indeed, recall the defining identity $T_r(\cos \theta) = \cos r\theta$ and compute

$$ \begin{aligned} T_r \left( \frac{\pm 2iz \sin \frac{\pi j}{r}}{2iz} \right) &= T_r \left( \cos \left( \frac{\pi}{2} - \frac{\pi(\pm j)}{r} \right) \right) \\ &= \cos \left( \frac{r\pi}{2} - \frac{r\pi(\pm j)}{r} \right) = \cos \left( \frac{r\pi}{2} - \pi(\pm j) \right) = 0, \end{aligned} $$

where for the first equality we use that $\sin$ is an odd function and for the last that $r$ is odd.
Finally, the equalities above also hold for $j = 0$, showing that $x = 0$ is also a root of $z^r T_r(\frac{x}{2iz})$. $\square$

**Lemma 2.18.** The polynomial $f^{-}(x) = xh(x^2 + 2) + s$ is irreducible in $\mathbb{Q}(s)[x]$.

*Proof.* Reducing $f^{-}(x)$ modulo $s$ gives the polynomial $xh(x^2 + 2)$. In the notation of Lemma 2.16 (applied to $z = 1$), we have

$$h(x^2 + 2) = \sum_{k=0}^{\frac{r-1}{2}} c_k x^{r-2k-1} \in \mathbb{Z}[x]$$

with $c_0 = 1$, $c_k$ divisible by $r$ for any $k \in \{1, \dots, \frac{r-3}{2}\}$ and $c_{\frac{r-1}{2}} = r$. By Eisenstein's criterion, we get that $h(x^2 + 2)$ is irreducible over $\mathbb{Q}$. Thus, if $f^{-}(x)$ is not irreducible in $\mathbb{Q}(s)[x]$, then it must factor into a linear factor and an irreducible factor of degree $r-1$. However, $f^{-}(x)$ has no roots in $\mathbb{Q}(s)$. $\square$

**Lemma 2.19.** The formal derivative of $H(x, z) = z^{r-1}xh\left(\left(\frac{x}{z}\right)^2 + 2\right)$ with respect to the variable $x$ is $z^{r-1}rh\left(\frac{ix}{z}\right)h\left(-\frac{ix}{z}\right)$.

*Proof.* Let $U_n(x)$ for $n \ge 1$ be the nth Chebyshev polynomial of the second kind. Using Lemma 2.16 and the well-known fact $\frac{d}{dx}T_n = nU_{n-1}$ we compute

$$\frac{d}{dx} H(x, z) = 2(iz)^r \frac{1}{2iz} \frac{d}{dx} T_r\left(\frac{x}{2iz}\right) = (iz)^{r-1} r U_{r-1}\left(\frac{x}{2iz}\right).$$

Next we will show that

$$U_{r-1}\left(\frac{x}{2i}\right) = i^{r-1}h\left(\frac{ix}{z}\right)h\left(-\frac{ix}{z}\right)$$

which implies the result.

Indeed, it is well known that the $r-1$ zeros of $U_{r-1}$ are $\cos \frac{k\pi}{r}$ for $k = 1, \dots, r-1$. These are the same as $\pm \cos \frac{2\pi j}{r}$ for $j = 1, \dots, \frac{r-1}{2}$, hence $U_{r-1}(\frac{x}{2iz})$ has zeros $\pm 2iz \cos \frac{2\pi j}{r}$.

On the other hand, the zeros of $h(x)$ are $\omega_j = \zeta_r^j + \zeta_r^{-j} = 2 \cos \frac{2\pi j}{r}$ for $j = 1, \dots, \frac{r-1}{2}$, which implies that

$$U_{r-1}\left(\frac{x}{2iz}\right) = \alpha h\left(\frac{ix}{z}\right)h\left(-\frac{ix}{z}\right)$$

for some constant $\alpha$, as both sides have the same set of $r-1$ distinct zeros. As the leading coefficient of $U_{r-1}$ is $2^{r-1}$ and $h$ is monic, we have $\alpha = i^{r-1}$ as desired. $\square$

**Lemma 2.20.** For any $j = 0, \dots, \frac{r-1}{2}$, we have

$$H(iz\omega_j, z) = 2(iz)^r \quad \text{and} \quad H(-iz\omega_j, z) = -2(iz)^r.$$

*Proof.* For $x = \pm i\omega_j z$ we have $\frac{x}{2iz} = \pm \cos \frac{2\pi j}{r}$. Using the identity $T_r(\cos \theta) = \cos r\theta$ and the fact that $T_r(x)$ is an odd function (as $r$ is odd), we compute

$$T_r\left(\frac{x}{2iz}\right) = T_r\left(\pm \cos \frac{2\pi j}{r}\right) = \pm \cos 2\pi j = \pm 1.$$

The conclusion now follows from Lemma 2.16. $\square$

The proof of the following proposition uses the results of the previous lemmas. It will serve in the study of Kraus' varieties in the next section.

**Proposition 2.21.** The discriminant of the polynomial $f^{-}(x)$ is

$$\Delta(f^{-}) = (-1)^{\frac{r-1}{2}} r^r (s^2 + 4)^{\frac{r-1}{2}}.$$
Proof. Let $\alpha \in \overline{\mathbb{Q}}(s)$ be a root of $f^{-}(x)$, which is irreducible over $\mathbb{Q}(s)$ by Lemma 2.18. It is well known that the discriminant of $f^{-}(x)$ is then given by

$$ (2.22) \qquad \Delta(f^{-}) = (-1)^{\frac{r(r-1)}{2}} N\left(\frac{d}{dx}f^{-}(\alpha)\right) $$

where $N(\cdot)$ is the norm map from $\mathbb{Q}(s)(\alpha)$ to $\mathbb{Q}(s)$.

Since $r$ is odd, the sets $\{\omega_j\}$ and $\{\omega_{2j}\}$ where $j$ ranges over $j = 1, \dots, \frac{r-1}{2}$ are equal. Moreover, we have

$$ (2.23) \qquad (\pm i\omega_j)^2 + 2 = -(\zeta_r^j + \zeta_r^{-j})^2 + 2 = -(\zeta_r^{2j} + \zeta_r^{-2j}) = -\omega_{2j}, $$

showing that the zeros of $h(-(x^2 + 2))$ are $\pm i\omega_j$ for $j = 1, \dots, \frac{r-1}{2}$. These are also the zeros of $h(ix)h(-ix)$ and, by comparing leading coefficients, this gives the identity

$$ h(-(x^2 + 2)) = (-1)^{\frac{r-1}{2}} h(ix)h(-ix). $$

From Lemma 2.19 applied to $z = 1$, equation (2.22) and the previous equality we have that

$$ \begin{aligned} \Delta(f^{-}) &= (-1)^{\frac{r(r-1)}{2}} N\left(\frac{d}{dx}f^{-}(\alpha)\right) = (-1)^{\frac{r(r-1)}{2}} N(rh(i\alpha)h(-i\alpha)) \\ &= r^r N((-1)^{\frac{r(r-1)}{2}} h(i\alpha)h(-i\alpha)) = r^r \prod_{\beta} h(-\beta^2 + 2), \end{aligned} $$

where $\beta$ ranges through the roots of $f^{-}(x) = xh(x^2 + 2) + s$.

To prove the final discriminant formula, we compute as follows

$$ \begin{aligned} & \prod_{\beta} h(-\beta^2 + 2)) \\ &= \prod_{\beta} \prod_{j=1}^{\frac{r-1}{2}} (-\beta^2 - 2 - \omega_j) = \prod_{j=1}^{\frac{r-1}{2}} \prod_{\beta} (-\beta^2 - 2 - \omega_{2j}) \quad (\text{as } r \text{ is odd}) \\ &= \prod_{j=1}^{\frac{r-1}{2}} \prod_{\beta} (-\beta^2 - \omega_j^2) = (-1)^{\frac{r(r-1)}{2}} \prod_{j=1}^{\frac{r-1}{2}} f^{-}(i\omega_j) f^{-}(-i\omega_j) \quad \text{by (2.23)} \\ &= (-1)^{\frac{r(r-1)}{2}} \prod_{j=1}^{\frac{r-1}{2}} ((i\omega_j)h((i\omega_j)^2 + 2) + s)((-i\omega_j)h((-i\omega_j)^2 + 2) + s) \\ &= (-1)^{\frac{r(r-1)}{2}} (s + 2i)^{\frac{r-1}{2}} (s - 2i)^{\frac{r-1}{2}} \quad \text{by Lemma 2.20} \\ &= (-1)^{\frac{r-1}{2}} (s^2 + 4)^{\frac{r-1}{2}} \quad (\text{as } r \text{ is odd}). \end{aligned} $$

□

**Lemma 2.24.** We have the following identity of polynomials:

$$ X^{2r} - 1 = X^r (X - 1/X) h(X^2 + X^{-2}). $$

Proof. Note that

$$ X^r + Y^r = (X + Y) \prod_{j=1}^{\frac{r-1}{2}} (X^2 + \omega_j XY + Y^2) $$
and evaluating at $(X^2, -1)$ leads to

$$ 
\begin{aligned}
X^{2r} - 1 &= (X^2 - 1) \prod_{j=1}^{\frac{r-1}{2}} (X^4 - \omega_j X^2 + 1) = (X^2 - 1) X^{r-1} \prod_{j=1}^{\frac{r-1}{2}} (X^2 - \omega_j + X^{-2}) \\
&= (X^{r+1} - X^{r-1}) h(X^2 + X^{-2}) = X^r (X - 1/X) h(X^2 + X^{-2}).
\end{aligned}
$$

□

**Proposition 2.25.** The map $\pi : (X, Y) \mapsto (X - X^{-1}, Y/X^{\frac{r+1}{2}})$ identifies the curve $C_r(s)$ with the quotient of the hyperelliptic curve

$$ D_r(s) : Y^2 = X(X^{2r} + sX^r - 1) $$

by the involution $\tau : (X, Y) \mapsto (-1/X, (-1)^{\frac{r+1}{2}} Y/X^{r+1})$.

*Proof.* Note that $\pi(\tau(X, Y)) = \pi(X, Y)$. Suppose that $(X, Y)$ satisfies $Y^2 = X(X^{2r} + sX^r - 1)$. Set $x = X - X^{-1}$ and $y = Y/X^{\frac{r+1}{2}}$. We have that

$$ 
\begin{aligned}
xh(x^2 + 2) + s &= X^r - X^{-r} + s \\
&= X^{-r}(X^{2r} + sX^r - 1) \\
&= X^{-r}(Y^2/X) = (Y/X^{\frac{r+1}{2}})^2 = y^2,
\end{aligned}
$$

where the first equality follows from Lemma 2.24. This shows that $\pi$ factors via the quotient $D_r(s)/\langle\tau\rangle$. Comparing degrees in the respective function fields, we obtain the result. □

**Theorem 2.26.** There is an embedding

$$ K \hookrightarrow \mathrm{End}_{K(s)}(J_r(s)) \otimes \mathbb{Q}. $$

Furthermore, when $s$ is specialized to any element $s_0 \in K$, the above embedding is well-defined.

In particular, $J_r(s_0)/K$ is of GL$_2$-type with real multiplications by $K$.

*Proof.* Let $D = D_r(s)$, $C = C_r(s)$, $\tau : D \to D$ and $\pi : D \to C$ be the curves and maps in Proposition 2.25.

There is an injection $\pi^* : H^0(C, \Omega^1) \to H^0(D, \Omega^1)$ given by pull back, and a projection $\pi_* : H^0(D, \Omega^1) \to H^0(C, \Omega^1)$ given by the trace map [35, p.221]. The subspace $H^0(C, \Omega^1)$ can thus be described as the $\tau$-invariant subspace of $H^0(D, \Omega^1)$.

Consider the following automorphism of the hyperelliptic curve $D$

$$ (2.27) \qquad [\zeta_r] : (X, Y) \mapsto (\zeta_r X, \zeta_r^{\frac{r+1}{2}} Y). $$

A basis for the $\tau$-invariant regular differentials on $D$ is given by

$$ (2.28) \qquad w_j = (X^j + (-1)^{\frac{r+1}{2}-j} X^{r-1-j}) \frac{dX}{Y} $$

where $j = 0, \dots, \frac{r-3}{2}$. We check that:

$$ (2.29) \qquad ([\zeta_r]^* + [\zeta_r^{-1}]^*) w_j = \left( \zeta_r^{\frac{r+1}{2}-j-1} + (\zeta_r^{-1})^{\frac{r+1}{2}-j-1} \right) w_j. $$

Let $J_D$ and $J_C$ be the Jacobians of $D$ and $C$, respectively. The homomorphism

$$ (2.30) \qquad J_C \to J_D $$

induced by $\pi$ using Picard functoriality has finite kernel.
Note that $\psi = [\zeta_r]^* + [\zeta_r^{-1}]^*$ as a map from $J_D$ to $J_D$ is defined over $K(s)$ by (2.29). We wish to show $\psi$ stabilizes the image of $J_C$ in $J_D$. It suffices to verify this on complex points for every specialization $s \in \mathbb{P}^1(\mathbb{C}) \setminus \{\pm 2i, \infty\}$. On complex points, the homomorphism in (2.30) corresponds to the homomorphism

$$ (2.31) \qquad H^0(C, \Omega^1)^*/\Lambda_C \to H^0(D, \Omega^1)^*/\Lambda_D, $$

where $\Lambda_C$ and $\Lambda_D$ are the images of $H_1(C, \mathbb{Z})$ and $H_1(D, \mathbb{Z})$ under integration.

By (2.29), the map induced by $\psi = [\zeta_r]^* + [\zeta_r^{-1}]^*$ stabilizes $H^0(C, \Omega^1)^*$ inside $H^0(D, \Omega^1)^*$ and the lattice $\Lambda_D \cap H^0(C, \Omega^1)^*$, which contains $\Lambda_C$ with finite index. It follows that $\mathrm{End}_{K(s)}(J_C) \otimes \mathbb{Q}$ contains $K$ since isogenous abelian varieties have isomorphic endomorphism algebras. $\square$

According to Theorem 2.26 and the construction recalled after Definition 2.5, one considers for every prime ideal $\mathfrak{p}$ of $K$ above a prime $p$ the Galois representation

and its reduction

$$ \rho_{J_r(s),\mathfrak{p}} : G_{K(s)} \to \mathrm{GL}(V_{\mathfrak{p}}(J_r(s))) \simeq \mathrm{GL}_2(K_{\mathfrak{p}}) $$

$$ \bar{\rho}_{J_r(s),\mathfrak{p}} : G_{K(s)} \to \mathrm{GL}_2(\mathbb{F}_{\mathfrak{p}}) $$

where $\mathbb{F}_{\mathfrak{p}}$ is the residue field of $K_{\mathfrak{p}}$.

**Proposition 2.32.** Let $\mathfrak{p}$ be a prime ideal in $K$ above a prime $p$. Then the representation $\bar{\rho}_{J_r(s),\mathfrak{p}}$ is a Frey representation of signature $(p, p, r)$ with respect to the points $(-2i, 2i, \infty)$ in the sense of Definition 2.1.

*Proof.* Let $\tilde{C}_r^-(u)$ be the hyperelliptic curve given by the equation

$$ (2.33) \qquad y^2 = xg(x^2 - 2) + u, $$

where

$$ g(x) = \prod_{j=1}^{\frac{r-1}{2}} (x + \omega_j). $$

Note that (2.33) with $u = 2 - 4t$ defines the curve $C_r^-(t)$ in [29, p. 420].

Let $\tilde{J}_r^-(u)$ denote the Jacobian of $\tilde{C}_r^-(u)$. It is of $\mathrm{GL}_2(K)$-type ([29, p. 420]) and $\bar{\rho}_{\tilde{J}_r^-(u),\mathfrak{p}}$ is an odd Frey representation of signature $(p, p, r)$ with respect to the points $(2, -2, \infty)$ by the proof of [29, Theorem 1.10].

Replacing $x$ by $x/i$, $y$ by $y/i^{1/2}$ in (2.33) gives the equation

$$ y^2 = xg(-x^2 - 2) + iu. $$

Since $g(-x) = (-1)^{\frac{r-1}{2}} h(x)$, we obtain the equation

$$ y^2 = (-1)^{\frac{r-1}{2}} xh(x^2 + 2) + iu. $$

Multiplying by $(-1)^{\frac{r-1}{2}}$ and setting $s = (-1)^{\frac{r-1}{2}} iu$ leads to the model

$$ C_r^0(s) : (-1)^{\frac{r-1}{2}} y^2 = xh(x^2 + 2) + s = f^-(x) $$

which is the equation for $C_r(s)$ when $\frac{r-1}{2}$ is even and its quadratic twist by $-1$ when $\frac{r-1}{2}$ is odd. Write $J_r^0(s)$ for the Jacobian of $C_r^0(s)$. Then,

$$ \bar{\rho}_{J_r(s),\mathfrak{p}} |_{G_{K(\sqrt{i})}(s)} \simeq \bar{\rho}_{J_r^0(s),\mathfrak{p}} |_{G_{K(\sqrt{i})}(s)} \simeq \bar{\rho}_{\tilde{J}_r^-(u),\mathfrak{p}} |_{G_{K(\sqrt{i})}(u)}. $$

By (2.15) and Proposition 2.21, the curve $C_r(s)$ has good reduction outside $\{\pm 2i, \infty\}$. The conclusion follows by noting that the points $\{\pm 2i, \infty\}$ are mapped to $\{\pm 2i, \infty\}$ by $s = (-1)^{\frac{r-1}{2}} iu$, and
the order of an inertia subgroup as mapped to PSL$_2(\mathbb{F}_p)$ is unaffected by restriction to $G_{K(\sqrt{i})(u)}$, since the extension $K(\sqrt{i})(u)/K(u)$ is unramified. Furthermore, applying Lemma 2.3 gives that $\bar{\rho}_{J_r(s),p}|_{G_{\bar{K}(s)}}$ is irreducible. $\square$

Let $t \neq s$ be another variable. Let $K(s,t)$ be the function field where $s$ and $t$ are related by

$$ (2.34) \qquad \frac{1}{s^2 + 4} = t(1-t). $$

We can see both $K(s)$ and $K(t)$ as subfields of $K(s,t)$. Define $\alpha$ by the following equation

$$ (2.35) \qquad \alpha s = 2t - 1 $$

and note, from relation (2.34), that $\alpha$ is a square-root of $t - t^2$. The following lemma uses the notation of Lemma 2.16.

**Lemma 2.36.** The quadratic twist by $\alpha$ of the base change of $C_r(s)$ to $K(s,t)$ has a model

$$ C'_r(t) : y^2 = x^r + c_1 \alpha^2 x^{r-2} + \dots + c_{\frac{r-1}{2}} \alpha^{r-1} x + \alpha^{r-1} (2t-1) $$

defined over $K(t)$.

*Proof.* Because $f^{-}(x) = H(x, 1) + s = x^r + c_1 x^{r-2} + \dots + c_{\frac{r-1}{2}} x + s$ has only odd powers of $x$ except for the constant term, we may apply the transformation $x \to \frac{x}{\alpha}$, $y \to \frac{y}{\alpha^{\frac{r-1}{2}}}$ to obtain, using (2.35), the model $C'_r(t)$ of the quadratic twist by $\alpha$ of $C_r(s)$ over $K(t)$ given in the statement. $\square$

Combining Proposition 2.21 and Lemma 2.36 with standard formulae for models of hyperelliptic curves (see Section 2.3 for a summary) it follows that $C'_r(t)$ has discriminant

$$ (2.37) \qquad \Delta(C'_r(t)) = (-1)^{\frac{r-1}{2}} 2^{2(r-1)} r^r (t(1-t))^{\frac{(r-1)^2}{2}}. $$

In particular, we see that the ramification set $\{\pm 2i, \infty\}$ of $C_r(s)$ corresponds to the ramification set $\{0, 1, \infty\}$ for $C'_r(t)$.

**Theorem 2.38.** Let $J'_r(t)$ be the Jacobian of $C'_r(t)$ from Lemma 2.36. Then

(1) There is an embedding $K \to \text{End}_{K(t)}(J'_r(t)) \otimes \mathbb{Q}$.

(2) For every specialization of $t$ to $t_0 \in \mathbb{P}^1(K) \setminus \{0, 1, \infty\}$, the above embedding is well-defined.

(3) For every prime $p$ of $K$ above a prime $p$, $\bar{\rho}_{J'_r(t),p} : G_{K(t)} \to \text{GL}_2(\mathbb{F}_p)$ is an odd Frey representation of signature $(r, r, p)$ with respect to the points $(0, 1, \infty)$.

*Proof.* Let $J = J_r(s)$ be the Jacobian of $C = C_r(s)$. Similarly, let $J' = J'_r(t)$ be the Jacobian of $C' = C'_r(t)$. By Proposition 2.32, the endomorphism algebra $\text{End}_{K(s)}(J) \otimes \mathbb{Q}$ contains $K$ and $\bar{\rho}_{J,p} : G_{K(s)} \to \text{GL}_2(\mathbb{F}_p)$ is a Frey representation of signature $(p, p, r)$ with respect to the points $(-2i, 2i, \infty)$ for every prime $p$ of $K$ above $p$.

Consider $C$ over $K(s,t)$ which is a degree 2 extension of $K(t)$ and $K(s)$. Thus, we can identify $\overline{K(s)} = \overline{K(s,t)} = \overline{K(t)}$, and we denote this common field by $\overline{L}$.

Let $\phi : C' \to C$ be the isomorphism $(x, y) \mapsto (\frac{x}{\alpha}, \frac{y}{\alpha^{r/2}})$ given by Lemma 2.36. It induces homomorphisms defined over $\overline{L}$

$$ \phi^* : J \to J' $$

$$ \phi_* : J' \to J $$
by Picard and Albanese functoriality respectively. Note that $\phi^*$ and $\phi_*$ are isomorphisms defined over $\bar{L}$ and each is the inverse of the other.

If we have an endomorphism $\psi: J \to J$, we obtain an endomorphism $\psi': J' \to J'$ given by

$$ (2.39) \qquad \psi' = \phi^* \circ \psi \circ \phi_* : J' \to J', $$

using the identification of $J$ and $J'$ under $\phi^*$ and $\phi_*$.

To decide if $\psi'$ is defined over $K(t)$, we may check if the following holds:

$$ (2.40) \qquad \psi'^{\sigma} = \psi', \quad \text{for all } \sigma \in G_{K(t)}. $$

For $\sigma \in G_{K(t)}$, set $\xi_{\sigma} = \phi^{\sigma}\phi^{-1} : C \to C^{\sigma}$, which is explicitly given by

$$ (2.41) \qquad (x, y) \mapsto \left( x \frac{\alpha}{\alpha^{\sigma}}, y \frac{\alpha^{\frac{r}{2}}}{\alpha^{\frac{r}{2}\sigma}} \right). $$

Then, we have

$$ \begin{align} \psi'^{\sigma} &= \psi' \notag \\ \iff (\phi^* \circ \psi \circ \phi_*)^{\sigma} &= \phi^* \circ \psi \circ \phi_* \notag \\ \iff \phi^{*\sigma} \circ \psi^{\sigma} \circ \phi_*^{\sigma} &= \phi^* \circ \psi \circ \phi_* \notag \\ \iff \psi^{\sigma} \circ \phi_*^{\sigma} \phi_*^{-1} &= (\phi^{*\sigma})^{-1} \phi^* \circ \psi \notag \\ (2.42) \qquad \iff \psi^{\sigma} \circ \xi_{\sigma_*} &= \xi_{\sigma_*} \circ \psi, \end{align} $$

where we have used that $\phi^* = \phi_*^{-1}$ and $(\phi^{*\sigma})^{-1} = \phi_*^{\sigma}$.

Let $\psi = [\zeta_r + \zeta_r^{-1}] := [\zeta_r]^* + [\zeta_r^{-1}]^* \in \text{End}_{K(s)}(J) \otimes \mathbb{Q}$ and $\psi'$ the corresponding element in $\text{End}_{K(t)}(J')$ from (2.39). To verify (2.40) holds for all $\sigma \in G_{K(t)}$, it suffices to check that it holds on complex specializations of $t \notin \{0, 1, \infty\}$. Recall that

$$ (2.43) \qquad J(\mathbb{C}) \simeq H^0(C, \Omega^1)^*/\Lambda_C $$

where $\Lambda_C$ is the image of $H_1(C, \mathbb{Z})$ in $H^0(C, \Omega^1)^*$ under the map $\gamma \mapsto (w \mapsto \int_{\gamma} w)$. From (2.41) and (2.29), we can verify that the commutation relation (2.40) holds when considered as an equality in $\text{Hom}(J(\mathbb{C}), J^{\sigma}(\mathbb{C}))$ by checking it holds on differentials.

Finally remark that $t = 0, 1$ correspond to $s = \infty$, and $t = \infty$ corresponds to $s = \pm 2i$. Using this correspondence of points, it follows that $\bar{\rho}_{J',p}$ is a Frey representation of signature $(r, r, p)$ with respect to the points $(0, 1, \infty)$ for every prime $p$ of $K$ above $p$. Irreducibility of $\bar{\rho}_{J',p}$ on $G_{\bar{K}(t)}$ follows from Lemma 2.3.

Furthermore, since the inertia subgroups at $t = 0, 1, \infty$ are generated by an element of order $2r, 2r, 2p$, respectively, it follows that $\bar{\rho}_{J',p}$ is an odd Frey representation. $\square$

**Remark 2.44.** In [29], a superelliptic construction of Frey representations of signature $(r, r, p)$ with respect to the points $(0, 1, \infty)$ is given. Theorem 2.38 shows that there is a hyperelliptic construction (using $C'_r(t)$) of odd Frey representations of signature $(r, r, p)$ with respect to the points $(0, 1, \infty)$.

### 3. KRAUS' FREY HYPERELLIPTIC CURVES FOR SIGNATURE $(r, r, p)$

In this section, we introduce Kraus' Frey varieties as in [57, §V] and study their first properties. In particular, we relate them to the varieties in Subsection 2.4. This allows to attach 2-dimensional Galois representations to them. The study of these associated Galois representations will in particular lead to the proof of the modularity results in the next section.
We keep the notation of Subsection 2.4. In particular, $K = \mathbb{Q}(\zeta_r)^+$ is the maximal totally real subfield of $\mathbb{Q}(\zeta_r)$ where $\zeta_r$ is a fixed primitive $r$-th root of unity for $r \ge 3$ a prime.

For $a, b \in \mathbb{Z}$ coprime and such that $a^r + b^r \ne 0$, we let $C_r(a, b)$ be the hyperelliptic curve of genus $(r-1)/2$ constructed by Kraus (denoted $C$ in [57, §V]). Namely, for $ab \ne 0$, we have

$$ (3.1) \qquad C_r(a, b) : y^2 = (ab)^{\frac{r-1}{2}} xh\left(\frac{x^2}{ab} + 2\right) + b^r - a^r $$

where $h$ is defined in (2.14). For $ab = 0$ coprimality gives $(a, b) = \pm(0, 1)$ or $\pm(1, 0)$ and we set

$$ (3.2) \qquad C_r(a, b) : y^2 = x^r + b^r - a^r. $$

**Proposition 3.3.** The curve $C_r(b, a)$ is the quadratic twist by $-1$ of $C_r(a, b)$.

*Proof.* This is clear for $ab = 0$ and follows from

$$ C_r(b, a) : y^2 = (ab)^{\frac{r-1}{2}} xh\left(\frac{x^2}{ab} + 2\right) - (b^r - a^r) $$

when $ab \ne 0$.

□

In the next lemma we show that for $ab \ne 0$, the hyperelliptic curve $C_r(a, b)$ is related to a specialization of the model $C'_r(t)$ given by Lemma 2.36. We first need further notation. Let $z_0$ be a fixed square-root of $ab \ne 0$. We specialize the variables $s$ and $t$ in (2.34) to be $s = s_0$ and $t = t_0$ where

$$ (3.4) \qquad t_0 = \frac{a^r}{a^r + b^r} \quad \text{and} \quad s_0 = \frac{b^r - a^r}{z_0^r}. $$

Observe that $t_0 \in \mathbb{P}^1(\mathbb{Q})\setminus\{0, 1, \infty\}$ and that the following relations are satisfied

$$ t_0(1 - t_0) = \frac{(ab)^r}{(a^r + b^r)^2} \quad \text{and} \quad s_0^2 = \frac{(a^r - b^r)^2}{(ab)^r} = \frac{1}{t_0(1 - t_0)} - 4. $$

**Lemma 3.5.** Assume $ab \ne 0$. The curve $C'_r(t_0)$ is the quadratic twist of $C_r(a, b)$ by $-\frac{(ab)^{\frac{r-1}{2}}}{a^r + b^r}$.

*Proof.* Note that $C_r(a, b)$ can be obtained from $C_r(s_0)$ by replacing $x$ by $\frac{x}{z_0}$ and $y$ by $\frac{y}{z_0^{r/2}}$, showing that $C_r(a, b)$ is the quadratic twist of $C_r(s_0)$ by $z_0$. Also, by Lemma 2.36 and (3.4), $C'_r(t_0)$ is the quadratic twist of $C_r(s_0)$ by $\alpha$ where $\alpha = \frac{2t_0-1}{s_0} = -\frac{z_0^r}{a^r+b^r}$ is given by equation (2.35). Therefore, by composing both twists, the curve $C'_r(t_0)$ is the quadratic twist of $C_r(a, b)$ by

$$ \frac{\alpha}{z_0} = -\frac{z_0^{r-1}}{a^r + b^r} = -\frac{(ab)^{\frac{r-1}{2}}}{a^r + b^r}. $$

□

Combining (2.37) and Lemma 3.5 with standard formulae for models of hyperelliptic curves (see Section 2.3 for a summary) it follows that $C_r(a, b)$ has discriminant

$$ (3.6) \qquad \Delta(C_r(a, b)) = (-1)^{\frac{r-1}{2}} 2^{2(r-1)} r^r (a^r + b^r)^{r-1}. $$

Note that this latter formula holds in the case $ab = 0$ as well, with $C_r(a, b)$ defined as in (3.2). We write $J_r(a, b)$ for the Jacobian of $C_r(a, b)$.

**Remark 3.7.** A nice feature of these Frey varieties is that when $ab = 0$, then from equation (3.2), we have an endomorphism $(x, y) \mapsto (\zeta_r x, y)$ on $C_r(a, b)$ and hence $J_r(a, b)$ has CM by $\mathbb{Q}(\zeta_r)$.
Remark 3.8. Another nice feature of these Frey varieties is that setting

$$z_0^2 = ABab, \quad t_0 = \frac{Aa^r}{Aa^r + Bbr} \quad \text{and} \quad s_0 = (AB)^{\frac{r-1}{2}} \frac{Bb^r - Aa^r}{z_0^r}$$

allows the study of the ‘general coefficient’ Fermat equation of signature $(r, r, p)$:

$$(3.9) \qquad Ax^r + By^r = Cz^p.$$

In contrast, the known Frey elliptic curves for signature $(r, r, p)$ rely on the natural factorization of the left hand side of (3.9) which occurs for $A = B = 1$ but not for general $A, B$ (see [45]). The first author and his student are carrying out a more complete study of the ‘general coefficient’ equation of signature $(r, r, p)$ in forthcoming work.

If $H(x, y) \in \mathbb{Z}[x, y]$ is a homogeneous polynomial of degree $r$ which is $\text{GL}_2(\overline{\mathbb{Q}})$-equivalent to the homogeneous polynomial of degrees 3, 4, 6, 12 whose linear factors correspond to the vertices of an equilateral triangle, tetrahedron, octahedron, and icosahedron, aka ‘Klein form’, then [6] [5] study the equation

$$(3.10) \qquad H(x, y) = Cz^p.$$

using Frey elliptic curves with constant mod 2, 3, 4, 5 representations, respectively.

Not all homogeneous forms of the shape $Ax^r + By^r$ are Klein forms, even for $r = 4, 6, 12$, so our work in developing the necessary ingredients to use Kraus’ Frey hyperelliptic curve in the modular method paves the way for resolving new equations of the form (3.10).

The next result implies (see Subsection 2.2) that there are 2-dimensional Galois representations attached to $J_r$ which is a key property for the detailed study of these abelian varieties done below.

**Theorem 3.11.** Assume $ab \neq 0$. The base change $J_r$ of $J_r(a, b)$ to $K$ is of $\text{GL}_2$-type. More precisely, there is an embedding

$$K \hookrightarrow \text{End}_K(J_r) \otimes \mathbb{Q}$$

giving rise to a strictly compatible system of $K$-integral $\lambda$-adic representations

$$(3.12) \qquad \rho_{J_r, \lambda} : G_K \to \text{GL}_2(K_\lambda).$$

*Proof.* This follows from Theorem 2.38 and Lemma 3.5. $\square$

Recall from Subsection 2.2 that if $q$ be a prime ideal in $K$ of good reduction for $J_r$ above a rational prime $q$, we denote by $\text{Frob}_q$ a Frobenius element at $q$ in $G_K$ and write $a_q(J_r) = \text{tr} \rho_{J_r, \lambda}(\text{Frob}_q)$ for a prime ideal $\lambda + q$. This definition is independent of the choice of such $\lambda$ and from the $K$-integral property, we have $a_q(J_r) \in K$.

Since the abelian variety $J_r$ is the base change of $J_r(a, b)$ which is defined over $\mathbb{Q}$, for any prime $\ell$, there is a semi-linear action of $G_{\mathbb{Q}}$ on $V_\ell(J_r)$ which extends the $G_K$-action provided by Theorem 3.11 and satisfies

$$(3.13) \qquad \sigma(\alpha v) = \sigma(\alpha)\sigma(v),$$

for $\sigma \in G_{\mathbb{Q}}$, $v \in V_\ell(J_r)$, and $\alpha \in K \otimes \mathbb{Q}_\ell$, where $V_\ell(J_r)$ is the $\ell$-adic Tate module of $J_r$.

**Lemma 3.14.** Let $q$ be a prime ideal in $K$ of good reduction for $J_r$ over a rational prime $q$. We have

$$(3.15) \qquad \sigma(a_q(J_r)) = a_{\sigma(q)}(J_r),$$

for every $\sigma \in G_{\mathbb{Q}}$. In particular, if $q$ is inert in $K$, then $a_q(J_r)$ belongs to $\mathbb{Z}$.
Proof. Let $\lambda$ be a prime ideal in $K$ not dividing the residue characteristic of $\mathfrak{q}$. Let $(v_1, v_2)$ be a basis for $V_\lambda(J_r)$ as a $K_\lambda$-vector space. Denote by $B$ the matrix of $\rho_{J_r,\lambda}(\mathrm{Frob}_q)$ with respect to this basis and let $\sigma$ be in $G_\mathbb{Q}$. It follows from (3.13) that $\sigma(B)$ is the matrix of $\rho_{J_r,\sigma(\lambda)}(\mathrm{Frob}_{\sigma(q)})$ with respect to the basis $(\sigma(v_1), \sigma(v_2))$ of $V_{\sigma(\lambda)}(J_r)$ and hence

$$a_{\sigma(q)}(J_r) = \mathrm{tr} \, \rho_{J_r, \sigma(\lambda)}(\mathrm{Frob}_{\sigma(q)}) = \mathrm{tr} \, \sigma(B) = \sigma(\mathrm{tr} \, B) = \sigma(a_q(J_r)).$$

□

When there exists $c \in \mathbb{Z}$ such that $(a, b, c)$ is a primitive solution to (1.4), then (3.6) reads

$$(3.16) \qquad \Delta(C_r(a, b)) = (-1)^{\frac{r-1}{2}} 2^{2(r-1)} r^r d^{r-1} c^{p(r-1)}$$

and we say that $J_r(a, b)$ is the Frey variety attached to $(a, b, c)$.

We conclude this section with the following examples of $C_r(a, b)$ for small values of $r$:

$$r = 3: \quad y^2 = x^3 + 3abx + b^3 - a^3,$$

$$r = 5: \quad y^2 = x^5 + 5abx^3 + 5a^2b^2x + b^5 - a^5,$$

$$r = 7: \quad y^2 = x^7 + 7abx^5 + 14a^2b^2x^3 + 7a^3b^3x + b^7 - a^7,$$

$$r = 11: \quad y^2 = x^{11} + 11abx^9 + 44a^2b^2x^7 + 77a^3b^3x^5 + 55a^4b^4x^3 + 11a^5b^5x + b^{11} - a^{11}.$$

Observe that $r = 3$ is the only case where the Frey variety is an elliptic curve; this is a well-known curve, which has been used to study the equation $x^3 + y^3 = z^p$ in [19, 46, 58]. The curve for $r = 7$ will be essential in the proof of the main result in the second part of this series [11].

## 4. MODULARITY OF FREY VARIETIES

As we shall see in Subsection 4.1, the modularity of $J_r$ follows by analyzing its mod $\mathfrak{p}_r$ representation, comparing it to the one arising on the Legendre family and modularity lifting. This comparison to the Legendre family is a key idea in Darmon's program. Indeed, conjecturally the mod $\mathfrak{p}_r$ representation is modular and plays the role of a 'seed' for modularity of all Frey varieties described by Darmon (see diagram in [29, p. 433]). The results in this section make this argument unconditional for the Kraus Frey variety $J_r$ and two of the varieties introduced by Darmon as well (see Subsection 4.2).

### 4.1. Modularity of Kraus' varieties $J_r$.
In this subsection, we keep the notation of Section 3. In particular, $a, b$ are non-zero coprime integers such that $a^r + b^r \neq 0$ and we set $t_0 = \frac{a^r}{a^r+b^r}$. Recall that $J_r$ denotes the base change of $J_r(a, b)$ to $K$, where $K = \mathbb{Q}(\zeta_r)^+$. Let $\mathfrak{p}_r$ be the unique prime in $K$ above $r$. Since $r$ is totally ramified in $K$, its residue field is $\mathbb{F}_{\mathfrak{p}_r} = \mathbb{F}_r$. In the next sections, the prime $\mathfrak{p}_r$ will often be denoted by $\mathfrak{q}_r$, but here we use a different notation to emphasize the fact that we think of $K$ not as the base field of $J_r$ but instead as the field of real multiplication.

As $\lambda$ varies, the representations $\rho_{J_r,\lambda}$ in (3.12) form a strictly compatible system of Galois representations (see Subsection 2.2). So $J_r/K$ is modular if and only if one of them is modular if and only if all of them are modular and, in such case, they coincide with the strictly compatible system arising in a Hilbert modular cuspform defined over $K$ of parallel weight 2 and trivial character.<fnref n="2" />

<footnote n="2">²Due to the work of many authors, it is known that regular, algebraic, self-dual cuspidal automorphic forms of $\mathrm{GL}_n$ over a totally real field $K$ give rise to strictly compatible systems (see for example [3, Theorem 2.1.1]). In this paper, we are interested in the particular case of Hilbert cuspforms over $K$ of parallel weight 2 and trivial character; we note that when $K$ is of odd degree field, it was originally proved by Carayol [17] that such Hilbert cuspforms give rise to strict compatible systems.</footnote>
We first establish properties of the mod $p_r$ representation $\bar{\rho}_{J_r,p_r} : G_K \to \text{GL}_2(\mathbb{F}_r)$ that will be used in the proof of the next two results.

**Theorem 4.1.** The representation $\bar{\rho}_{J_r,p_r}$ is isomorphic to a twist of $\bar{\rho}_{L(t_0),r}$, where $L(t)$ is the Legendre family $y^2 = x(x-1)(x-t)$.

Moreover, the representation $\bar{\rho}_{J_r,p_r}$ extends to $G_Q$.

*Proof.* From Theorem 2.38, we know that $\bar{\rho}_{J'_r(t),p_r}$ is a Frey representation over $K$ of signature $(r,r,r)$ with respect to the points $(0,1,\infty)$. Writing $G_Q(t_0)$ and $G_K(t_0)$ for $G_Q$ and $G_K$ respectively to make clear that the actions involved are obtained by specialization, it follows from [29, Theorem 1.5 and §1.3] and specialization at $t = t_0$ that, as representations of $G_K(t_0)$, we have

$$ (4.2) \qquad \bar{\rho}_{J'_r(t_0),p_r} \simeq \bar{\rho}_{L(t_0),r} \otimes \epsilon $$

where $\epsilon: G_K(t_0) \to \bar{\mathbb{F}}_r^\times$ is a character; both $J'_r(t_0)$ and $L(t_0)$ are non-singular as $t_0 \neq 0, 1, \infty$.

The same conclusion holds for $\bar{\rho}_{J_r,p_r}$ by Lemma 3.5, completing the proof of the first assertion.

Because $r$ is totally ramified in $K$, the action, given (for $r = p$) by (3.13), of $G_Q(t_0)$ on $T_r(J_r) \otimes \mathcal{O}_{p_r} \mathbb{F}_r$, where the tensor product is taken with respect to the reduction map $\mathcal{O}_{p_r} \to \mathbb{F}_r$, is linear and restricts to the action of $G_K(t_0)$ given by $\bar{\rho}_{J_r,p_r}$. This achieves the proof of the second statement. $\square$

*Remark 4.3.* Taking determinants of both sides of (4.2) and applying Theorem 2.8 to the left hand side, shows that $\det \bar{\rho}_{J_r,p_r} = \det \bar{\rho}_{L(t_0),r} = \chi_r$ is the mod $r$ cyclotomic character. Hence, it follows that $\epsilon$ from (4.2) has order dividing 2. If $\bar{\rho}_{J_r,p_r}$ and $\bar{\rho}_{L(t_0),r}$ are unramified at $q$, then $\epsilon$ is unramified at $q$.

**Theorem 4.4.** Assume $r \ge 5$. The representation $\bar{\rho}_{J_r,p_r}$ is absolutely irreducible when restricted to $G_Q(\zeta_r)$.

*Proof.* From Theorem 4.1 we know that $\bar{\rho}_{J_r,p_r}$ satisfies

$$ (4.5) \qquad \bar{\rho}_{J_r,p_r} \simeq \bar{\rho}_{L,r} \otimes \chi $$

as $G_K$-representations, where $\chi: G_K \to \bar{\mathbb{F}}_r^\times$ is a character and $L = L(t_0)$, where $t_0$ is given by (3.4). Note that $L/\mathbb{Q}$ is an elliptic curve (it is non-singular as $ab(a^r + b^r) \neq 0$) with full 2-torsion over $\mathbb{Q}$, as it belongs to the Legendre family.

By (4.5), the representation $\bar{\rho}_{J_r,p_r}|_{G_Q(\zeta_r)}$ is absolutely irreducible if and only if $\bar{\rho}_{L_r|_{G_Q(\zeta_r)}}$ is absolutely irreducible. We note that we have $\bar{\rho}_{L_r}(G_Q(\zeta_r)) = \bar{\rho}_{L_r}(G_Q) \cap \text{SL}_2(\mathbb{F}_r)$.

For $L$ non-CM, it follows from [69, Propositions 3.1 and 4.3] that $\bar{\rho}_{L_r}(G_Q(\zeta_r)) = \text{SL}_2(\mathbb{F}_r)$ for $r \ge 5$. If $\bar{\rho}_{L_r|_{G_Q(\zeta_r)}}$ were absolutely reducible, its image would have to be isomorphic to a subgroup of upper triangular matrices or non-split Cartan subgroup, which is solvable. But $\text{SL}_2(\mathbb{F}_r)$ is not solvable for $r \ge 5$. Hence the result in that case.

Suppose now that $L$ has CM. Thus $L$ has potentially good reduction everywhere and integral $j$-invariant; more precisely, we obtain

$$ (4.6) \qquad j(L) = 2^8 \cdot \frac{((a^r + b^r)^2 - (ab)^r)^3}{((ab)^r(a^r + b^r))^2} \in \mathbb{Z}. $$

Since $a,b$ are coprime we get that $(ab)^{2r}$ divides $2^8$, hence $ab = \pm 1$; from $a^r + b^r \neq 0$, we conclude that $(a,b) = \pm(1,1)$ and hence $j(L) = 1728$, and $L$ has CM by $\mathbb{Q}(i)$. According to [85, Proposition 1.14], $\bar{\rho}_{L_r}(G_Q)$ is conjugate to the normalizer of a Cartan subgroup $C$ of $\text{GL}_2(\mathbb{F}_r)$ which is split if $r \equiv 1 \pmod 4$ and non-split if $r \equiv 3 \pmod 4$. In particular, the projective image of $\bar{\rho}_{L_r}(G_Q)$ is a
dihedral group $D_n$ of order $2n$ where $n = r - 1$ or $r + 1$ according to whether $C$ is split or non-split. By the assumption $r \ge 5$, we note that we necessarily have $n > 2$. In particular, $D_n$ has a unique cyclic subgroup of order $n$ given by the projective image of $G_{\mathbb{Q}(i)}$. On the other hand, $\bar{\rho}_{L,r}(G_{\mathbb{Q}(\zeta_r)})$ has order $2n$ and a projective image $H$ of order $n$. Assume for a contradiction that $\bar{\rho}_{L,r}|_{G_{\mathbb{Q}(\zeta_r)}}$ is absolutely reducible. Since $2n$ is coprime to $r$, the representation is decomposable, and thus the group $H$ is cyclic. By uniqueness of order $n$ cyclic subgroups of $D_n$, we must have $\mathbb{Q}(i) = \mathbb{Q}(\zeta_r)$, which is not the case. This gives the desired contradiction. $\square$

**Remark 4.7.** For $r = 11$ or $r \ge 17$, we can give a slightly different proof of the above theorem as follows. The curve $L$ (in the notation of the proof) is a quadratic twist (by $-(a^r+b^r)$) of the classical Hellegouarch-Frey curve $L': y^2 = x(x-a^r)(x+b^r)$. Since $L'$ has good or bad multiplicative reduction at $r$ (and $r \ge 7$), it follows from [77, §§1.11-1.12 and Proposition 17] that if $\bar{\rho}_{L',r}(G_{\mathbb{Q}}) \neq \text{GL}_2(\mathbb{F}_r)$, then $\bar{\rho}_{L',r}(G_{\mathbb{Q}})$ is either contained in a Borel subgroup or in the normalizer of a Cartan subgroup $C'_r$ of $\text{GL}_2(\mathbb{F}_r)$. In the former case, $L'$ gives rise to a rational point on $Y_0(2r)$, contradicting results of Mazur and Kenku (see [53, Theorem 1]). In the latter case, using [13, Theorem 6.1] and [61, Proposition 2.1] when $C'_r$ is split or non-split respectively, we get that $j(L) = j(L') \in \mathbb{Z}$ and we conclude as in the above proof.

**Theorem 4.8.** The abelian variety $J_r = J_r(a, b)/K$ is modular.

**Proof.** For $r = 3$, we have $K = \mathbb{Q}$ and $J_r$ is the rational elliptic curve denoted $E(a, b)$ in [58]. Therefore it is modular. According to the comment at the beginning of loc. cit. this modularity result originally follows from [22]. We now assume $r \ge 5$. By Theorem 4.1 the representation $\bar{\rho}_{J_r, \mathbb{F}_r} : G_K \to \text{GL}_2(\mathbb{F}_r)$ extends to an odd representation $\bar{\rho}$ of $G_{\mathbb{Q}}$ which is absolutely irreducible as a consequence of Theorem 4.4. From Serre's Conjecture [55, 56], the representation $\bar{\rho}$ is modular, hence $\bar{\rho}_{J_r, \mathbb{F}_r}$ is also modular by cyclic base change [60]. The conclusion that $J_r/K$ is modular now follows from (the full content of) Theorem 4.4 and [54, Theorem 1.1]. $\square$

**Remark 4.9.** From Remark 3.7, we note that when $ab = 0$, $J_r$ has CM and hence is modular as well.

Recall from [29, Definition 3.17] that a Hilbert modular form $g$ over $K$ of level $N$ is called a $\mathbb{Q}$-form if for all primes $q \nmid N$ it satisfies

$$a_{\sigma(q)}(g) = \sigma(a_q(g)), \quad \text{for all } \sigma \in G_{\mathbb{Q}}.$$

The modularity of $J_r$ and Lemma 3.14 now lead to the following refined statement (see also [29, Lemma 3.18] for the analogous result for Darmon's Frey varieties $J_r^\pm$ assuming modularity, and the next subsection for a discussion on this assumption).

**Theorem 4.10.** The variety $J_r$ is associated with a $\mathbb{Q}$-form.

4.2. Modularity of Darmon's varieties $J_r^-$ and $J_{r,r}^-$. In [29, pp. 420–424] Darmon describes four Frey varieties for Generalized Fermat Equations of signature $(r, r, p)$ and $(p, p, r)$, denoted $J_{r,r}^\pm$ and $J_r^\pm$, respectively. More precisely, he defines abelian varieties $J_{r,r}^\pm(t)$ and $J_r^\pm(t)$ over $\mathbb{Q}(t)$ and obtains the Frey varieties by taking an appropriate quadratic twist of the specialization at $t = t_0$, where $t_0$ is given by (3.4) for signature $(r, r, p)$ and $t_0 = \frac{a^p}{a^p+b^p}$ for signature $(p, p, r)$. Moreover, the base change $J_{r,r}^\pm/K$ and $J_r^\pm/K$ is of GL$_2$-type with real multiplications by $K$. Our method for proving modularity of $J_r$ from the previous section also applies to $J_r^-$ and $J_{r,r}^-$, giving a complete proof of [29, Theorem 2.9] for these varieties.

A general inductive strategy on the lcm of the orders of inertia at $0, 1, \infty$ for proving modularity of fibers in rigid local systems is given in [28], assuming a generic modularity lifting conjecture.
**Theorem 4.11.** Let $J = J_r^{-}$ or $J = J_{r,r}^{-}$. Then $J/K$ is modular.

*Proof.* This follows similarly to the proof of Theorem 4.8 where Theorem 4.1 is replaced by [29, Theorem 2.6]. The rest of the proof is the same for $J = J_{r,r}^{-}$. When $J = J_r^{-}$ the proof is also the same except that in formula (4.6) for $j(L)$ we get $r$ replaced by $p$ since $t_0 = \frac{a^p}{a^p+b^p}$.

We also make use of the fact that for $ab = 0$, $(a,b) = \pm(1,1), \pm(1,-1)$, these varieties are either singular or have CM. $\square$

*Remark 4.12.* The mod $p_r$ representations attached to $J_r^+/K$ and $J_{r,r}^+/K$ descend to $G_Q$ and are modular by [29, Corollary 2.7]. However, from [29, Theorem 2.6] we see they are reducible, making lifting modularity impossible in general. Sometimes this is possible under some additional local hypothesis (cf. [29, Theorem 2.9]).

*Remark 4.13.* Note that $J_r^-$ already appeared in the proof of Proposition 2.32.

## 5. THE CONDUCTOR OF $J_r$

We keep the notation of Sections 3 and 4 and assume throughout that $r \ge 5$. In particular, $a,b$ are non-zero coprime integers such that $a^r + b^r \ne 0$ and $J_r$ denotes the base change of $J_r(a,b)$ to $K$, where $K = \mathbb{Q}(\zeta_r)^+$. Let $\mathfrak{p}_r$ be the unique prime in $K$ above $r$. Since $r$ is totally ramified in $K$, its residue field is $\mathbb{F}_{\mathfrak{p}_r} = \mathbb{F}_r$. In the next sections, the prime $\mathfrak{p}_r$ will be denoted by $q_r$ when we think of $K$ as the base field of $J_r$ and by $\mathfrak{p}_r$ when we think of $K$ as the field of real multiplications of $J_r$.

We proved in Sections 3 and 4 that $J_r = J_r(a,b)/K$ is a GL$_2$-type modular abelian variety associated to a Hilbert newform $g$ defined over $K$. Therefore, the $\lambda$-adic Galois representations attached to $J_r$ form a strictly compatible system in the sense of [14, Definition 4.10] (see also the discussion after this definition in loc. cit). It follows from part (3) in [14, Definition 4.10] and [82, §8] that the restrictions $\rho_{J_r,\lambda}|_{D_q}$ have the same Artin conductor for all $\lambda$ in $K$ such that $q \nmid \text{Norm}(\lambda)$. We call this common conductor the conductor at $q$ of the compatible system $\{\rho_{J_r,\lambda}\}$ and define $\mathcal{N}$ to be the product of all these local conductors. In particular, $\mathcal{N}$ coincides with the level of $g$.

The objective of this section is to determine the ideal $\mathcal{N}$ which is given in Theorem 5.16 under certain 2-adic restrictions on $a,b$. The method used is based on exhibiting a local field $L$ over which $J_r$ has semistable reduction. The classification of 2-dimensional local Weil-Deligne representations guides the choice of $L$, which we confirm by explicit computations on hyperelliptic equations. The conductor can then be read off by standard formulae once the type of local representation is identified.

The problem of determining the conductors of Jacobians of hyperelliptic curves in general remains an interesting open problem, for which remarkable progress has been obtained recently in [41, 40]. For instance, in [41], one finds a formula which in principle can be used to explicitly determine the conductor exponent of the Jacobian of a hyperelliptic curve over a local field of odd residue characteristic.

The method we use is more specific as it relies on $J_r$ having GL$_2$-type, as well as on an initial guess for the field of semistable reduction. However, it is in practice efficient and well adapted for computing conductor exponents in parameterized families of hyperelliptic curves, including the case of even residue characteristic.

Before we proceed to the conductor calculation, we recall some standard facts about local 2-dimensional Galois representations.
5.1. **Inertial types.** Let $\rho: G_{K_q} \to GL_2(\overline{\mathbb{Q}}_p)$ be a $p$-adic Galois representation where $K_q$ is a local field with residual characteristic different from $p$. When $\rho$ has infinite image of inertia we call it a *Steinberg (or Special) representation*. If the image of inertia is finite then we call $\rho$ a *principal series representation* if it is reducible and a *supercuspidal representation* if it is irreducible. Moreover, $\rho$ is a principal series if and only if there is an abelian extension $L/K_q$ where $\rho|_{G_L}$ is unramified.

Let $K$ be a number field. We let $I_q \subset D_q \subset G_K$ denote a choice in $G_K := \text{Gal}(\overline{K}/K)$ of inertia and decomposition subgroups at a prime $q$, respectively.

We say that the inertial type of $J/K$ at a prime $q$ of $K$ is Steinberg, principal series or supercuspidal if for some (and hence any) $\lambda$ not dividing the residue characteristic of $q$, we have that $\rho|_{J,\lambda}|_{D_q}$ is a Steinberg, principal series or supercuspidal representation, respectively.

We refer to, for example, [38] for a summary of definitions and formulae about inertial types. One fact we shall use repeatedly is the following:

Suppose $\rho: G_{K_q} \to GL_2(\overline{\mathbb{Q}}_p)$ as above has finite image of inertia. Then $\rho$ is a principal series representation if and only if there is an abelian extension $L/K_q$ such that $\rho|_{G_L}$ is unramified.

Indeed, the image of $\rho$ is abelian if and only if there exists an abelian extension $L/K_q$ such that $\rho|_{G_L}$ is unramified: The forward implication is clear. For the reverse implication, let $M/K_q$ be the field cut out by $\rho$ so $M$ corresponds to $G_M \subseteq G_{K_q}$. Suppose that $L/K_q$ is an abelian extension where $\rho|_{G_L}$ is unramified. We have that $L$ corresponds to $G_L \subseteq G_{K_q}$ and $I_L = I_{K_q} \cap G_L$ corresponds to $K_q^{\text{nr}}L$. Since $\rho|_{G_L}$ is unramified, $I_L \subseteq G_M$ so $K_q^{\text{nr}}L$ is an extension of $M$. As $K_q^{\text{nr}}L$ is abelian over $K_q$, it follows that $M/K_q$ is abelian.

The claim then follows from the fact that the principal series case is the only case having finite image of inertia and abelian image.

5.2. **Conductor calculation.** Recall that an equation for $C_r(a, b)$ is given by (3.1) which we repeat below for the convenience of the reader:

$$C_r(a, b) : y^2 = (ab)^{\frac{r-1}{2}} xh\left(\frac{x^2}{ab} + 2\right) + b^r - a^r.$$

Let $z_0$ be a square-root of $ab$. Specializing (2.17) to $z = z_0$ yields the following expression for the above model:

$$(5.1) \qquad C_r(a, b) : y^2 = \sum_{k=0}^{\frac{r-1}{2}} c_k(ab)^k x^{r-2k} + b^r - a^r, \quad \text{where } c_k = \frac{r}{r-k} \binom{r-k}{k} \in \mathbb{Z}.$$

(Note that this latter equation is also compatible with (3.2) when $ab = 0$, assuming $(ab)^0 = 1$.) This is the model we will consider for $C_r(a, b)$ in the rest of this section. Recall also the formula (3.6) for the discriminant of (5.1) (also valid for $ab = 0$, see the discussion after (3.6)):

$$(5.2) \qquad \Delta(C_r(a, b)) = (-1)^{\frac{r-1}{2}} 2^{2(r-1)} r^r (a^r + b^r)^{r-1}.$$

We write $C_r = C_r(a, b)$ and $J_r = J_r(a, b)$ for simplicity.

We now determine the conductor of $J_r/K$. For this we use facts from Subsection 2.3-Subsection 2.4 and Section 3.

For a prime $q$ of $K$ we denote by $K_q$ the completion of $K$ at $q$. For a rational prime $\ell$ we denote by $q_\ell$ a prime in $K$ above $\ell$. Recall that 2 is unramified in $K$ and that there is a unique prime ideal $q_r$ in $K$ above $r$.
**Proposition 5.3.** Assume that $a \equiv 0 \pmod{2}$ and $b \equiv 1 \pmod{4}$. Let $L/K_{q_2}$ be a finite extension with ramification index $r$. Then $C_r$ has good reduction over $L$, and moreover, there is no unramified extension of $K_{q_2}$ where $C_r$ or $J_r$ attains good reduction.

*Proof.* Let $L/K_{q_2}$ be a finite extension with ramification index $r$, ring of integers $\mathcal{O}$, uniformizer $\pi$ and corresponding valuation $\upsilon$.

Applying the substitutions $x \to \pi^2 x$, $y \to \pi^r y + 1$ to (5.1) and dividing out by $\pi^{2r}$ yields the following model for $C_r$

$$y^2 + \frac{2}{\pi^r} y = x^r + \sum_{k=1}^{\frac{r-1}{2}} c_k \left(\frac{ab}{\pi^4}\right)^k x^{r-2k} + \frac{b^r - a^r - 1}{\pi^{2r}}.$$

The 2-adic conditions on $a, b$ and the assumption $r \ge 5$ imply that

$$\upsilon(ab) \ge \upsilon(2) = r \ge 4 \quad \text{and} \quad \upsilon(b^r - a^r - 1) \ge \upsilon(4) = 2r.$$

Therefore the above model of $C_r$ is defined over $\mathcal{O}$. According to (5.2) and the formulae in Section 2.3, its discriminant is

$$(-1)^{\frac{r-1}{2}} \frac{2^{2(r-1)}}{\pi^{2(r-1)r}} \cdot r^r (a^r + b^r)^{r-1}$$

which is a unit in $\mathcal{O}$. Hence $C_r$ has good reduction over $L$.

Over an unramified extension $K'$ of $K_{q_2}$, the valuation of the discriminant of any hyperelliptic model for $C_r$ is $\equiv 2(r-1) \pmod{2r(r-1)}$ by (5.2) and the results in Subsection 2.3. Hence $C_r/K'$ cannot have good reduction by Proposition 2.11, and so by Lemma 2.12 (3), $J_r/K'$ cannot have good reduction. $\square$

**Corollary 5.4.** Assume $a \equiv 0 \pmod{2}$ and $b \equiv 1 \pmod{4}$. Let $\mathfrak{q}_2$ be a prime ideal in $K$ above 2. The inertial type of $J_r/K$ at $\mathfrak{q}_2$ is a principal series if $r | \#\mathfrak{F}_{\mathfrak{q}_2}^*$ and supercuspidal otherwise. Moreover, for all $\lambda \ge 2$ in $K$, the image of inertia $\rho_{J_r,\lambda}(I_{\mathfrak{q}_2})$ is cyclic of order $r$.

*Proof.* From Proposition 5.3 we know that $J_r/K_{q_2}$ obtains good reduction over any extension $L/K_{q_2}$ with ramification degree $r$. In particular, this shows that $\rho_{J_r,\lambda}|_{D_{\mathfrak{q}_2}}$ becomes unramified over $L$, hence the inertial type of $J_r/K$ is not Steinberg at $\mathfrak{q}_2$. Moreover, the inertial type of $J_r/K$ at $\mathfrak{q}_2$ is a principal series if and only if there is an abelian extension $L/K_{q_2}$ with ramification degree $r$ and supercuspidal otherwise. By local class field theory, such an extension exists if and only if $r$ divides $\#\mathfrak{F}_{\mathfrak{q}_2}^*$. This proves the first statement.

Also from Proposition 5.3, there is no unramified extension of $K_{q_2}$ over which $J_r$ has good reduction, hence $\#\rho_{J_r,\lambda}(I_{\mathfrak{q}_2}) \ne 1$ and divides $r$. The conclusion follows. $\square$

Keeping the notation of Subsection 2.4, we write $H(x) = \sum_{k=0}^{\frac{r-1}{2}} c_k(ab)^k x^{r-2k} \in \mathbb{Z}[x]$ for the polynomial showing up in the right-hand side of (5.1) (up to the constant term) and recall the standard factorization

$$(5.5) \qquad x^r + y^r = (x + y)\phi_r(x, y)$$

where

$$\phi_r(x, y) = \sum_{k=0}^{r-1} (-1)^k x^{r-1-k} y^k = \prod_{j=1}^{\frac{r-1}{2}} (x^2 + \omega_j xy + y^2).$$

The following lemma is used in the proofs of Propositions 5.7 and 5.9.
**Lemma 5.6.** We have $H(a-b) = a^r - b^r$.

*Proof.* By Lemma 2.16 applied to $z = z_0$, we have

$$ 
\begin{aligned}
H(a-b) &= (ab)^{\frac{r-1}{2}} (a-b)h\left(\frac{(a-b)^2}{ab} + 2\right) \\
&= (a-b) \prod_{j=1}^{\frac{r-1}{2}} (a^2 + b^2 - ab\omega_j) \\
&= (a-b)\phi_r(a, -b) \\
&= a^r - b^r,
\end{aligned}
$$

as claimed.

□

**Proposition 5.7.** Let $L/K_{q_r}$ be a finite extension with ramification index 4. If $r \nmid a+b$ then $C_r$ and $J_r$ have good reduction over $L$. Moreover, there is no extension of $K_{q_r}$ with ramification index dividing 2 where $C_r$ or $J_r$ obtain good reduction.

*Proof.* Let $L/K_{q_r}$ be finite extension with ramification index 4, ring of integers $\mathcal{O}$, a uniformizer $\pi$ and $v$ the corresponding valuation.

Applying the substitutions $x \to \pi^2 x - (b-a)$, $y \to \pi^r y$ to (5.1) and dividing out by $\pi^{2r}$ yields the model $y^2 = P(x) + \frac{b^r - a^r}{\pi^{2r}}$ for $C_r$ where

$$ 
\begin{aligned}
P(x) &= \frac{1}{\pi^{2r}} H(\pi^2 x - (b-a)) \\
&= \frac{1}{\pi^{2r}} \sum_{k \ge 0} c_k (ab)^k (\pi^2 x - (b-a))^{r-2k} \quad \text{with } c_k = \frac{r}{r-k} \binom{r-k}{k} \\
&= \sum_{k \ge 0} c_k \frac{(ab)^k}{\pi^{4k}} \sum_{j \ge 0} \binom{r-2k}{j} \left(-\frac{b-a}{\pi^2}\right)^{r-2k-j} x^j \\
&= \sum_{j \ge 0} \sum_{k \ge 0} c_k \frac{(ab)^k}{\pi^{2(r-j)}} \binom{r-2k}{j} (a-b)^{r-2k-j} x^j \\
&= \sum_{j \ge 0} a_j x^j,
\end{aligned}
$$

with $\binom{n}{m} = 0$ if $m > n$. We claim that the coefficients $a_0, \dots, a_r$ of $P$ satisfy the following properties :

(i) $a_0 = \frac{a^r - b^r}{\pi^{2r}}$;

(ii) For $1 \le j \le r-1$, we have $v(a_j) \ge 0$;

(iii) $a_r = 1$.

The first property follows from Lemma 5.6 and the last one from the fact that $H$ is monic of degree $r$. Let $1 \le j \le r-1$ and let $k \ge 0$. We have

$$ v\left(c_k \binom{r-2k}{j}\right) \ge v(r) = 2(r-1) \ge 2(r-j), $$

since $c_k$ is divisible by $r$ for $k > 0$ by Lemma 2.16 and $r \mid \binom{r}{j}$. In particular, $a_j \in \mathcal{O}$ and it follows that the above model of $C_r$ is defined over $\mathcal{O}$. According to (5.2) and the formulae in Subsection 2.3, its discriminant is

$$ (-1)^{\frac{r-1}{2}} \frac{r^r}{\pi^{2(r-1)r}} \cdot 2^{2(r-1)} (a^r + b^r)^{r-1} $$
which is a unit in $\mathcal{O}$ since $r \sim \pi^{2(r-1)}$ and $r + a^r + b^r$. Hence $C_r$ has good reduction over $L$.

Over an extension $K'$ of $K_{q_r}$ with ramification index dividing 2, the valuation of the discriminant of any hyperelliptic model for $C_r$ is $\equiv r(r-1)/2, r(r-1)$ (mod $2r(r-1)$) by (5.2) and the results in Subsection 2.3. Hence $C_r/K'$ cannot have good reduction by Proposition 2.11, so by Lemma 2.12 (3), we deduce that $J_r/K'$ cannot have good reduction. $\square$

**Corollary 5.8.** Assume $r + a + b$. The inertial type of $J_r/K$ at $q_r$ is a principal series if $r \equiv 1 \pmod 4$ and supercuspidal otherwise. Moreover, for all $\lambda + r$ in $K$, the image of inertia $\rho_{J_r,\lambda}(I_{q_r})$ is cyclic of order 4.

*Proof.* From Proposition 5.7 we know that $J_r/K_{q_r}$ obtains good reduction over any extension $L/K_{q_r}$ with ramification degree 4. Now the same argument as in the proof of Corollary 5.4 shows that $\rho_{J_r,\lambda}|_{D_{q_r}}$ is a principal series when 4 divides $\#\mathbb{F}_{q_r}^* = r-1$ and supercuspidal otherwise. This proves the first statement.

Also from Proposition 5.7, there is no extension of $K_{q_r}$ with ramification index dividing 2 over which $J_r$ has good reduction, hence $\#\rho_{J_r,\lambda}(I_{q_r}) \neq 1, 2$ and divides 4. Thus $\#\rho_{J_r,\lambda}(I_{q_r}) = 4$. In this case $\#\rho_{J_r,\lambda}(I_{q_r})$ is not a prime number, but the fact that $\rho_{J_r,\lambda}(I_{q_r})$ is cyclic follows from the fact that there is a unique tamely ramified extension of order 4 of the maximal unramified extension of $K_{q_r}$. (Alternatively, it also follows from the fact that inertia is acting via characters as detailed in the proof of Theorem 5.16 below.) $\square$

**Proposition 5.9.** Let $L/K_{q_r}$ be a finite extension with ramification index 2. If $r | a+b$, then both $C_r$ and $J_r$ have multiplicative reduction over $L$ and, moreover, there is no unramified extension of $K_{q_r}$ where $C_r$ or $J_r$ attains semistable reduction.

*Proof.* Let $L/K_{q_r}$ be finite extension with ramification index 2, ring of integers $\mathcal{O}$, a uniformizer $\pi$ and $v$ the corresponding valuation. We assume that $r | a+b$. Note that we necessarily have $ab \neq 0$ since $a$ and $b$ are coprime.

As in the proof of Proposition 5.7, write

$$P(x) = \frac{1}{\pi^{2r}} H(\pi^2 x - (b-a)) = \sum_{j \ge 0} \sum_{k \ge 0} c_k \frac{(ab)^k}{\pi^{2(r-j)}} \binom{r-2k}{j} (a-b)^{r-2k-j} x^j = \sum_{j \ge 0} a_j x^j,$$

where $\binom{n}{m} = 0$ if $m > n$. We claim that the coefficients $a_0, \dots, a_r$ of $P$ satisfy the following properties:

(i) $a_0 = \frac{a^r - b^r}{\pi^{2r}}$;

(ii) $a_1 = \frac{1}{\pi^{2(r-1)}} r \phi_r(a, b) \in \mathcal{O}$ and reduces to $a^{r-1}$ modulo $\pi$;

(iii) For $1 < j < r$, $j \neq \frac{r+1}{2}$, we have $v(a_j) > 0$;

(iv) $a_{\frac{r+1}{2}} \in \mathcal{O}$ and reduces to $2a^{\frac{r-1}{2}}$ modulo $\pi$;

(v) $a_r = 1$.

Assuming these properties, it follows that applying the substitutions $x \to \pi^2 x - (b-a)$, $y \to \pi^r y$ to (5.1) and dividing out by $\pi^{2r}$ yields the model $y^2 = P(x) + \frac{b^r - a^r}{\pi^{2r}}$ for $C_r$ which is integral and reduces modulo $\pi$ to

$$y^2 = x^r + 2a^{\frac{r-1}{2}} x^{\frac{r+1}{2}} + a^{r-1} x = x \left( x^{\frac{r-1}{2}} + a^{\frac{r-1}{2}} \right)^2.$$

Therefore, $C_r$ has bad semistable reduction over $L$.

Let us then prove properties (i)-(v) above.
(i) By Lemma 5.6, we have

$$a_0 = P(0) = \frac{H(a-b)}{\pi^{2r}} = \frac{a^r - b^r}{\pi^{2r}}.$$

(ii) Let $i$ be a primitive fourth root of unity and recall that $z_0$ satisfies $z_0^2 = ab$. We have $a_1 = \frac{dP}{dx}(0)$ and hence

$$\begin{aligned}
a_1 &= \frac{1}{\pi^{2r}} \frac{d}{dx} \left( H(\pi^2 x - (b-a)) \right) \Big|_{x=0} \\
&= \frac{1}{\pi^{2(r-1)}} \frac{dH}{dx} \left( \pi^2 x - (b-a) \right) \Big|_{x=0} \\
&= \frac{1}{\pi^{2(r-1)}} \frac{dH}{dx} (a-b) \\
&= \frac{1}{\pi^{2(r-1)}} (ab)^{\frac{r-1}{2}} rh \left( i \frac{a-b}{z_0} \right) h \left( -i \frac{a-b}{z_0} \right), \quad \text{by Lemma 2.19.}
\end{aligned}$$

On the other hand, we compute

$$\begin{aligned}
(ab)^{\frac{r-1}{2}} h\left(i\frac{a-b}{z_0}\right) h\left(-i\frac{a-b}{z_0}\right) &= (ab)^{\frac{r-1}{2}} \prod_{m=1}^{\frac{r-1}{2}} \left(i\frac{a-b}{z_0} - \omega_m\right) \left(-i\frac{a-b}{z_0} - \omega_m\right) \\
&= (ab)^{\frac{r-1}{2}} \prod_{m=1}^{\frac{r-1}{2}} \left(\omega_m^2 + \frac{(a-b)^2}{ab}\right) \\
&= \prod_{m=1}^{\frac{r-1}{2}} \left(a^2 + b^2 + ab\omega_{2m}\right) \\
&= \prod_{m=1}^{\frac{r-1}{2}} \left(a^2 + b^2 + ab\omega_m\right) \\
&= \phi_r(a, b) \quad \text{by (5.5).}
\end{aligned}$$

Therefore we have proved that $a_1 = \frac{1}{\pi^{2(r-1)}} r \phi_r(a, b)$. Finally, we have

$$\begin{aligned}
\phi_r(a, b) &= \frac{1}{y}((y-a)^r + a^r), \quad \text{with } y = a+b \\
&= \frac{1}{y}\left(\sum_{m=0}^{r}\binom{r}{m}(-a)^{r-m}y^m + a^r\right) \\
&= \sum_{m=1}^{r}\binom{r}{m}(-a)^{r-m}y^{m-1} \quad (\text{as } r \text{ is odd}) \\
&\equiv ra^{r-1} \pmod{r^2}
\end{aligned}$$

since $y = a + b \equiv 0 \pmod{r}$ and $r \mid \binom{r}{m}$ for $m = 1, \dots, r-1$. As $r \sim \pi^{r-1}$ in $L$, we get that $a_1$ is in $O$ and reduces to $a^{r-1}$ modulo $\pi$.

(iii) For all $1 < j < r$ and all $k \ge 0$, we have $\nu\left(c_k\binom{r-2k}{j}\right) \ge \nu(r) = r-1$. Therefore, if $j > \frac{r+1}{2}$, we have

$$\nu(a_j) \ge \nu\left(c_k\binom{r-2k}{j}\right) - 2(r-j) \ge 2j - r - 1 > 0,$$
as claimed. Let us now assume $1 < j \le \frac{r+1}{2}$. Since $r | a+b$, for any integer $k$ such that $0 \le k \le \frac{r-j}{2}$, we have

$$ (ab)^k (a-b)^{r-2k-j} = (-1)^k 2^{r-2k-j} a^{r-j} + ru $$

for some $u \in \mathbb{Z}$. Therefore, we have

$$ a_j = \frac{1}{\pi^2(r-j)} \sum_{k=0}^{\frac{r-1}{2}} ((-1)^k 2^{r-2k-j} a^{r-j} + ru) \binom{r-2k}{j} c_k = \frac{a^{r-j}}{\pi^2(r-j)} \alpha_j + \pi \beta_j $$

where

$$ (5.10) \qquad \alpha_j = \sum_{k=0}^{\frac{r-1}{2}} (-1)^k 2^{r-2k-j} \binom{r-2k}{j} c_k $$

and $\beta_j \in \mathcal{O}$ since $\binom{r-2k}{j} c_k \in r\mathbb{Z}$ for all $k \ge 0$ (by Lemma 2.16), and $\upsilon(r^2) = 2(r-1) > 2(r-j)$ (as $j > 1$). Recall from [66, Section 2.3.2 and (4.35a)] that

$$ (5.11) \qquad T_r(x) = \sum_{k=0}^{\frac{r-1}{2}} (-1)^k 2^{r-2k-1} c_k x^{r-2k} $$

and $T_r$ is a solution of the differential equation $(1-x^2)y'' - xy' + r^2y = 0$. By induction we obtain the following identity:

$$ (5.12) \qquad (1-x^2)T_r^{(j)} - (2j+1)xT_r^{(j-1)} + (r^2-j^2)T_r^{(j-2)} = 0. $$

Hence we have

$$ \alpha_j = \frac{T_r^{(j)}(1)}{j! 2^{j-1}} = \frac{1}{j! 2^{j-1}} \prod_{s=0}^{j-1} \frac{r^2 - s^2}{2s + 1}. $$

where the first equality follows from (5.10) and (5.11) and the last equality is proved by induction from the relation (5.12).

Assume now that $j \ne \frac{r+1}{2}$. We have

$$ \alpha_j = r^2 \frac{1}{j! 2^{j-1}} \prod_{s=1}^{j-1} \frac{r^2 - s^2}{2s + 1} \in r^2 \mathcal{O} $$

since for $s \le j-1$, we have $2s+1 \le 2j-1 < r$ and hence $2s+1 \in \mathcal{O}^*$. The desired result follows as again $\upsilon(r^2) = 2(r-1) > 2(r-j)$.

(iv) Reasoning as above, and using the same notation, one has

$$ (5.13) \qquad \alpha_{\frac{r+1}{2}} = \frac{T_r^{(\frac{r+1}{2})}(1)}{\left(\frac{r+1}{2}\right)! 2^{\frac{r-1}{2}}} = \frac{1}{\left(\frac{r+1}{2}\right)! 2^{\frac{r-1}{2}}} \prod_{s=0}^{\frac{r-1}{2}} \frac{r^2 - s^2}{2s + 1} = \left(\frac{3r-1}{r+1}\right) \equiv 2r \pmod{r^2} $$

Since $r \sim \pi^{r-1}$ we get the desired result. For the last congruence in (5.13), first note that $\frac{3r-1}{2} = r-1 + \frac{r+1}{2}$. Now

$$ \begin{align*} \binom{r-1 + \frac{r+1}{2}}{\frac{r+1}{2}} &= \binom{r-1 + \frac{r+1}{2}}{r-1} = \frac{(r-1 + \frac{r+1}{2}) \cdots (1 + \frac{r+1}{2})}{(r-1)!} \equiv 2r \pmod{r^2} \\ &\iff \binom{r-1 + \frac{r+1}{2}}{2} \cdots \binom{1 + \frac{r+1}{2}}{2} \equiv 2r(r-1)! \pmod{r^2} \\ &\iff \frac{1}{r} \binom{r-1 + \frac{r+1}{2}}{2} \cdots \binom{1 + \frac{r+1}{2}}{2} \equiv 2(r-1)! \pmod{r}. \end{align*} $$
The last congruence is true as the left hand side taken mod $r$ is the product

$$ \left( \frac{r+1}{2} + 1 \right) \cdots (r-1) \cdot \hat{r} \cdot (1) \cdots \left( \frac{r+1}{2} - 1 \right) = \frac{(r-1)!}{\frac{r+1}{2}}. $$

(v) The polynomial $H$ is monic of degree $r$ and hence so is $P$.

Let $K'$ be an unramified extension of $K_{q_r}$. The twist $C'_r/K'$ of $C_r/K'$ by $\pi^{\frac{1}{2}}$ has bad semistable reduction, and from [76, Lemma 3.3.5], the toric rank of the Jacobian $J'_r/K'$ of $C'_r/K'$ is positive and hence $J'_r/K'$ has multiplicative reduction. From Grothendieck's inertial semistable reduction criterion [1, Exposé 9] we conclude that the action of $I_{K'}$ on the $p$-adic Tate module $V_p(J'_r/K')$ of $J'_r/K'$ is unipotent with infinite inertia image. Twisting $J_r$ by $\pi^{\frac{1}{2}}$ gives $J_r$, showing also that the action of $I_{K'}$ on $V_p(J_r/K')$ is not unipotent. Hence $J_r/K'$ is not semistable, nor is $C_r/K'$. We conclude $C_r$ does not have semistable reduction over any unramified extension $K'$ of $K_{q_r}$.

It now follows that $J_r/K'$ cannot have semistable reduction, for if so, then $C_r/K'$ would have semistable reduction, hence has either good or bad semistable reduction. The reduction type of $C_r/K'$ cannot be good reduction because then $C_r/LK'$ would have good reduction. However, $C_r/L$ has bad semistable reduction, so $C_r/LK'$ has bad semistable reduction, a contradiction. Hence, $C_r/K'$ has bad semistable reduction, contradicting the previous paragraph. $\square$

**Proposition 5.14.** Let $q \neq 2, r$ be a prime and let $q$ be a prime ideal above $q$ in $K$. Assume that we have $q \mid a^r + b^r$. Then $C_r$ has bad semistable reduction and $J_r$ has multiplicative reduction at $q$.

*Proof.* Let $K' = K_q(i, z_0)$ with $i$ a primitive fourth root of unity (and $z_0$ a square-root of $ab$) and denote by $k'$ the residue field of $K'$. It is a finite extension of the residue field $k$ of $K_q$. We shall prove that the polynomial $H(x) + b^r - a^r$ has one single root and $(r-1)/2$ double roots in $k'$.

By Lemma 2.16, we have $H(x) = H(x, z_0) = 2z_1^r T_r(\frac{x}{2z_1})$ where $z_1 = iz_0$. Hence by Lemma 2.20, we have

$$ H(2z_1) = 2z_1^r = H(\omega_j z_1), \quad j = 1, \dots, \frac{r-1}{2}. $$

Besides, we have $z_1^{2r} = (-ab)^r$ and $(-ab)^r \equiv a^{2r} \pmod q$. Up to changing $i$ to $-i$ if necessary, one may assume that $z_1^r$ reduces to $a^r$ in $k'$. Hence $2z_1$ and $\omega_j z_1$ are roots of $H(x) + b^r - a^r$ in $k'$. Moreover, the latter are roots of multiplicity $> 1$ by Lemma 2.19 applied to $z = z_0$. This proves the desired result and we conclude that $C_r$ has bad semistable reduction at $q$.

From [76, Lemma 3.3.5], the toric rank of $J_r$ is positive and hence $J_r$ has multiplicative reduction. $\square$

**Proposition 5.15.** Let $q + 2r(a^r + b^r)$ be a prime. Then $J_r/\mathbb{Q}_q$ has good reduction.

*Proof.* If a prime $q + 2r(a^r + b^r)$ then $q$ does not divide the discriminant given in (5.2); since the model (5.1) is integral, the curve $C_r$ has good reduction at $q$. $\square$

The following theorem finally gives the sought after conductor.

**Theorem 5.16.** Assume $a \equiv 0 \pmod 2$ and $b \equiv 1 \pmod 4$. The conductor of the compatible system $\{\rho_{J_r, \lambda}\}$ is given by

$$ \mathcal{N} = 2^2 \cdot \mathfrak{q}_r^2 \cdot \mathfrak{n}, $$

where $\mathfrak{n}$ is the squarefree product of all prime ideals dividing $a^r + b^r$ which are coprime to $2r$.

In particular, $J_r$ is semistable at all primes not dividing $2r$.
*Proof.* Let $\mathfrak{q}$ be a prime ideal in $K$. According to the discussion at the beginning of this section, the exponent at $\mathfrak{q}$ of $N$ matches the conductor of $\rho_{J_r,\lambda}|_{D_{\mathfrak{q}}}$ for any prime $\lambda$ in $K$ such that $\mathfrak{q} \not\equiv \text{Norm}(\lambda)$.

(a) From Corollary 5.4 we know that the inertial type at $\mathfrak{q}_2$ of $\rho_{J_r,\lambda}$ (where $\lambda \nmid 2$) is either principal series or supercuspidal and that $\rho_{J_r,\lambda}(I_{\mathfrak{q}_2})$ is cyclic of order $r$.

Suppose first the inertial type at $\mathfrak{q}_2$ of $\rho_{J_r,\lambda}$ is principal series. By Theorem 2.8 the restriction to inertia $(\rho_{J_r,\lambda} \otimes \overline{\mathbb{Q}}_p)|_{I_{\mathfrak{q}_2}}$ is isomorphic to $(\chi \oplus \chi^{-1})|_{I_{\mathfrak{q}_2}}$ for some character $\chi$ of $G_{K_{\mathfrak{q}_2}}$. Write $L/K_{\mathfrak{q}_2}$ for the extension cut out by $\chi$. Moreover, from Corollary 5.4, we know that $L$ has ramification index $r$ and that $r \nmid \#\mathbb{F}_{\mathfrak{q}_2}^*$. By class field theory, we conclude that $L$, and hence $\chi$, has conductor $\mathfrak{q}_2$. Therefore, we have that $\rho_{J_r,\lambda}$ is of conductor $\mathfrak{q}_2^2$ at $\mathfrak{q}_2$.

Suppose now the inertial type at $\mathfrak{q}_2$ of $\rho_{J_r,\lambda}$ is supercuspidal. A supercuspidal representation is either exceptional or obtained by induction of a character $\chi$ of a quadratic extension $M/K_{\mathfrak{q}_2}$. Since $\rho_{J_r,\lambda}(I_{\mathfrak{q}_2})$ is cyclic of odd order $r$ (hence coprime to the residual characteristic 2) it follows that we must be in the case of an induction from $M/K_{\mathfrak{q}_2}$ unramified for if $M/K_{\mathfrak{q}_2}$ is ramified, the induction would be irreducible and not have cyclic image. Moreover, $\rho_{J_r,\lambda}|_{D_{\mathfrak{q}_2}}$ restricted to the subgroup fixing $M/K_{\mathfrak{q}_2}$ is a principal series with corresponding characters $\chi$ and its conjugate $\chi^s$ where $s$ is the non-trivial element in $\text{Gal}(M/K_{\mathfrak{q}_2})$. These characters have the same conductor. From the above discussion regarding the principal series case, it follows that $r \nmid \#\mathbb{F}^*$ where $\mathbb{F}$ is the residue field of $M$ and $\chi$ has conductor exponent 1. The conductor formula together with $M/K_{\mathfrak{q}_2}$ being unramified give that $\rho_{J_r,\lambda}$ is of conductor $\mathfrak{q}_2^2$ at $\mathfrak{q}_2$.

(b) Suppose $r \nmid a+b$. From Corollary 5.8 we know that the inertial type of $\rho_{J_r,\lambda}$ at $\mathfrak{q}_r$ (for $\lambda \nmid r$) is either principal series or supercuspidal and $\rho_{J_r,\lambda}(I_{\mathfrak{q}_r})$ is cyclic of order 4. The rest of the argument follows as in part (a) (with the extra simplification that there are no exceptional types in odd characteristic). Thus the conductor of $\rho_{J_r,\lambda}$ at $\mathfrak{q}_r$ is $\mathfrak{q}_r^2$.

(c) Suppose $r \mid a+b$. From Proposition 5.9 we know that over any finite extension $L/K_{\mathfrak{q}_r}$ with ramification index 2 we have that $J_r/L$ has multiplicative reduction and this ramification index is minimal with respect to this property. From Grothendieck's inertial semistable reduction criterion [1, Exposé 9] we conclude that the action of $I_L$ on the $p$-adic Tate module $V_p(J_r/L)$ of $J_r/L$ is unipotent with infinite inertia image. Since $V_p(J_r/L) = \bigoplus_\mu \rho_{J_r,\mu}|_{G_L}$ (where $\mu$ runs over the prime ideals in $K$ above $p$), we see that $\rho_{J_r,\lambda}|_{G_L}$ has to be unipotent with infinite inertia image, hence a Steinberg representation. (Note that in fact all the blocks $\rho_{J_r,\mu}|_{G_L}$ are Steinberg due to strict compatibility.) Thus $\rho_{J_r,\lambda}|_{D_{\mathfrak{q}_r}}$ is a twist of Steinberg by the quadratic character corresponding to $L/K_{\mathfrak{q}_r}$ which has conductor $\mathfrak{q}_r$; therefore $\rho_{J_r,\lambda}$ is of conductor $\mathfrak{q}_r^2$ at $\mathfrak{q}_r$.

(d) From Proposition 5.15, we know that $C_r$ has good reduction at any prime $\mathfrak{q} \nmid 2r(a^r + b^r)$. Moreover, Proposition 5.14 and Grothendieck's inertial reduction criterion imply that $\rho_{J_r,\lambda}|_{D_{\mathfrak{q}}}$ is a Steinberg representation at any prime $\mathfrak{q}$ of $K$ above a prime $\mathfrak{q} \mid a^r + b^r$, $\mathfrak{q} \nmid 2, r$. Thus $\rho_{J_r,\lambda}$ has conductor $\mathfrak{q}$ at those primes.

The last statement follows directly from Propositions 5.14 and 5.15. $\square$

*Remark 5.17.* Parts (a) and (b) in the previous proof also follow from the standard fact that if the ramification is tame, i.e., if the order of inertia is coprime to the residual characteristic, then the conductor exponent is 2 as the dimension of the representation is 2. We decided to include the above proofs because they can be generalized to the wild case; moreover, this extension determines not only the conductor but in fact it pins down the inertial type. It has been shown at length in the literature that fully knowing the inertial type can be essential for distinguishing Galois representations and successfully applied in the modular method; we refer the reader to [10] for a detailed treatment of this idea using elliptic Frey curves and to [7] for the case of an abelian surface.
We now give a hypothetical example of such a generalization; suppose that we are in the principal series case in part (a) but instead the degree of $L/K_{q_2}$ is $2r$. Let $\delta$ be the character defining this principal series; now it follows by local class field theory that $\delta^2$ has conductor $q_2$ and is a power of the order $r$ character $\chi$ in the proof of (a). This yields a concrete bound on the conductor of $\delta$; moreover, we can compute all the characters with conductor respecting this bound and retain only those satisfying $\delta^2 = \chi^k$. For each character obtained this way we get an explicit principal series representation that may be the inertial type of $J/K$ at $q_2$.

## 6. IRREDUCIBILITY

To apply level lowering results a common hypothesis is that the relevant mod $p$ representation is absolutely irreducible. When using the modular method with Frey elliptic curves, there are powerful tools, e.g. Mazur's work on isogenies and Merel's uniform bound on torsion, that often allow to prove sharp lower bounds on $p$ for which the $p$-torsion representation is absolutely irreducible. For higher dimensional Frey varieties there are no such general statements; this is one of the key steps where Darmon's program is conjectural.

The results in this section explore the local information obtained in Section 5 to prove irreducibility of the mod $p$ representations attached to $J_r$ for many values of $r$ and prime ideals $p$ with arbitrary (large) residue characteristic $p$. Here we use the previous notation. In particular, $r \ge 5$ is a prime, $a, b$ are coprime integers such that $ab(a^r + b^r) \ne 0$ and we write $J_r$ for the base change of $J_r(a, b)$ to $K = \mathbb{Q}(\zeta_r)^+$.

We note that for the unique prime ideal $p_r$ above $r$ in $K$, we have established the absolute irreducibility of $\bar{\rho}_{J_r, p_r}$ in Section 4. Therefore, the results of this section will focus on proving irreducibility for $\bar{\rho}_{J_r, p}$ with $p$ not dividing $r$.

### 6.1. General irreducibility statements.
The following proposition applies to $r = 5$ for instance.

**Proposition 6.1.** Assume that $r = \#\mathbb{F}_{q_2}^*$ for the primes $q_2 \mid 2$ in $K$ and that $a, b$ satisfy $a \equiv 0 \pmod{2}$ and $b \equiv 1 \pmod{4}$. Then, for all primes $p \ne 2$ and all $p \mid p$ in $K$, the representation $\bar{\rho}_{J_r, p}$ is absolutely irreducible.

*Proof.* According to the discussion above, we may assume $p \ne r$. Corollary 5.4 implies that $J_r/K$ has a supercuspidal inertial type at $q_2$. Furthermore, from part (a) of the proof of Theorem 5.16 we know that $\rho_{J_r, p}|_{D_{q_2}}$ is an irreducible induction from the quadratic unramified extension of $K_{q_2}$ of a character having order $r$ on inertia. Since $p \mid 2r$ the residual representation $\bar{\rho}_{J_r, p}|_{D_{q_2}}$ is also an irreducible induction because there is no intersection of the image of inertia with the kernel of reduction. Therefore, $\bar{\rho}_{J_r, p}$ is absolutely irreducible since $K$ is totally real. $\square$

**Proposition 6.2.** Assume that $r \ne 1 \pmod{4}$ and that $r \ne a+b$. Then, for all primes $p \ne 2$ and all $p \mid p$ in $K$, the representation $\bar{\rho}_{J_r, p}$ is absolutely irreducible.

*Proof.* According to the discussion before the Proposition 6.1, we may assume $p \ne r$. Corollary 5.8 implies that $J_r/K$ has a supercuspidal inertial type at $q_r$ with inertia image of order 4. The result now follows as in the proof of Proposition 6.1. $\square$

The previous results give sharp lower bounds for irreducibility of the residual representations attached to $J_r/K$ under certain constraints on $r$ and $a, b \in \mathbb{Z}$. The following result has a weaker conclusion but holds for all $r$.
**Proposition 6.3.** There exists a constant $B_r$, depending only on $r$, such that the following holds.
Assume $a, b$ satisfy $ab \neq 0$ and $2r + a + b$.

Then, for every prime $p > B_r$ and all $\mathfrak{p} | p$ in $K$, the representation $\bar{\rho}_{J_r, \mathfrak{p}}$ is absolutely irreducible.

*Proof.* Since $2r + a+b$ we have either $2 + a+b$ or $r + a+b$. From Proposition 5.3 and Proposition 5.7, we have that $J_r/K$ has potentially good reduction at the primes $q_2 | 2$ or at $q_r$, respectively. Moreover, according to Theorem 5.16, we have that $J_r$ is semistable at all primes not dividing $2r$ and from Theorem 3.11 it is of GL$_2$-type by the totally real field $K$. Finally, the fact that all endomorphisms of $J_r$ are defined over $K$ follows from Proposition 5.14 because $ab \neq 0$ implies there is a prime $q \neq 2, r$ dividing $a^r + b^r$.

An application of [9, Corollary 1] with $\mathfrak{q} = \mathfrak{q}_2 | 2$ or $\mathfrak{q} = \mathfrak{q}_r$ then implies that there is a constant $C(K, g, \mathfrak{q})$ such that for every $p > C(K, g, \mathfrak{q})$ the proposition holds. Since $K = \mathbb{Q}(\zeta_r)^+$, $g = \frac{r-1}{2}$ we conclude that the maximum of such constants obtained by varying $\mathfrak{q} | 2r$ depends only on $r$. This is the desired constant $B_r$. $\square$

Note that for $r = 7$ (or $r = 23$ for instance), Proposition 6.1 does not apply while Proposition 6.2 only gives the desired irreducibility of $\rho_{J_r, \mathfrak{p}}$ when $r + a + b$ (and $p$ odd). The next proposition is another criterion based on Class Field Theory that applies in particular to $r = 7$ and it is important for the Diophantine applications we study in [11].

Write $g = \frac{r-1}{2}$ and let $\{\infty_1, \dots, \infty_g\}$ be the set of all infinite places of $K$. We define a modulus $\mathfrak{m}$ of $K$ as a pair $(\mathfrak{m}_0, \mathfrak{m}_\infty)$ consisting of an integral ideal $\mathfrak{m}_0$ of $K$ together with a (possibly empty) subset $\mathfrak{m}_\infty$ of $\{\infty_1, \dots, \infty_g\}$. We also write this formally as $\mathfrak{m} = \mathfrak{m}_0\mathfrak{m}_\infty$. Given a modulus $\mathfrak{m}$, we write $h_{\mathfrak{m}}$ for the cardinality of the corresponding ray class group (see [21, §3.2]).

We say that a modulus $\mathfrak{m} = \mathfrak{m}_0\mathfrak{m}_\infty$ divides a modulus $\mathfrak{m}' = \mathfrak{m}'_0\mathfrak{m}'_\infty$, and we write $\mathfrak{m} | \mathfrak{m}'$, if $\mathfrak{m}_0 | \mathfrak{m}'_0$ (that is $\mathfrak{m}_0 \supset \mathfrak{m}'_0$) and $\mathfrak{m}_\infty \subset \mathfrak{m}'_\infty$. When $\mathfrak{m} | \mathfrak{m}'$, we have $h_{\mathfrak{m}} | h_{\mathfrak{m}'}$ (loc. cit.) and if moreover $\mathfrak{m}_\infty = \mathfrak{m}'_\infty$, then, by [21, Corollary 3.2.4], $h_{\mathfrak{m}'}/h_{\mathfrak{m}}$ divides

$$ (6.4) \qquad \phi(\mathfrak{m}'_0 \mathfrak{m}_0^{-1}) = N_{K/\mathbb{Q}}(\mathfrak{m}'_0 \mathfrak{m}_0^{-1}) \prod_{\mathfrak{q} | \mathfrak{m}'_0 \mathfrak{m}_0^{-1}} \left(1 - \frac{1}{N_{K/\mathbb{Q}}(\mathfrak{q})}\right). $$

Write $m = (2^{f_2} - 1)(r - 1)$ with $f_2$ the residual degree of $K$ at 2. Let $(\epsilon_1, \dots, \epsilon_{g-1})$ be a basis for the free part of the group of units in $K$.

A special case of the following result will be used in [11].

**Proposition 6.5.** Assume that $a, b$ satisfy $a \equiv 0 \pmod{2}$ and $b \equiv 1 \pmod{4}$, and that we have :

(i) $g$ is an odd prime number;

(ii) the integer $h_{2\mathfrak{m}}/h_{\mathfrak{m}}$ is not divisible by $r$, where $\mathfrak{m} = \mathfrak{q}_r \infty_1 \cdots \infty_g$.

If, for some prime ideal $\mathfrak{p} | p$ in $K$ with $p + 2r$, the representation $\bar{\rho}_{J_r, \mathfrak{p}}$ is not absolutely irreducible, then the following assertions hold:

(1) $p$ is completely split in $K$;

(2) there exists an integer $s$ such that $1 \le s \le \lfloor \frac{g}{2} \rfloor$ and $p$ divides

$$ \operatorname{gcd} \left( \operatorname{Norm}_{K/\mathbb{Q}}(\epsilon_i^{2ms} - 1) \right); $$

(3) there exist $s$ distinct prime ideals $\mathfrak{p}_1, \dots, \mathfrak{p}_s$ above $p$ in $K$ such that $r$ divides the integer $h_{2\mathfrak{m}}/h_{\mathfrak{m}}$ where $\mathfrak{m} = \mathfrak{p}_1 \cdots \mathfrak{p}_s \mathfrak{m}$.
Remark 6.6. Under assumption (i), we note that the prime 2 is either totally split or inert in $K$. In the former case, we have $\#\mathbb{F}_{q_2}^* = 1$ for any $q_2 \mid 2$ and Proposition 6.1 already gives an optimal irreducibility result. In the latter case, by formula (6.4) above, the integer $h_{2m}/h_m$ is a divisor of $\phi(2) = 2^g - 1 = \#\mathbb{F}_{q_2}^*$ where $q_2$ is the unique prime above 2. In situations where $2^g - 1$ is divisible by $r$ (that is, when $r \equiv \pm 1 \pmod 8$), Proposition 6.1 does not apply, but the result above shows that $\bar{\rho}_{J_r,p}$ is still absolutely irreducible for all but finitely many values of $p$ in an explicit set of primes, assuming that $h_{2m}/h_m$ is not divisible by $r$.

**Proof of Proposition 6.5.** Assume that the representation $\bar{\rho}_{J_r,p}$ is not absolutely irreducible.

Since $\bar{\rho}_{J_r,p}$ is odd and $K$ is totally real it follows that $\bar{\rho}_{J_r,p} : G_K \to \text{GL}_2(\mathbb{F}_p)$ is reducible. Here $\mathbb{F}_p$ denotes the residual field of $K$ at $p$. Recall that $\det \bar{\rho}_{J_r,p} = \chi_p$ is the mod $p$ cyclotomic character by Theorem 2.8. Therefore, we have $\bar{\rho}_{J_r,p}^{ss} \simeq \theta \oplus \theta'$ with $\theta, \theta' : G_K \to \mathbb{F}_p^*$ satisfying $\theta\theta' = \chi_p$.

For all primes $q \mid p$, we have $\theta'|_{I_q} = \theta^{-1}|_{I_q}$ (since $\chi_p$ is unramified away from $p$). In particular, the conductor exponent of $\theta$ and $\theta'$ is the same at each such prime, and these characters are unramified at primes where the conductor $N(\bar{\rho}_{J_r,p})$ of $\bar{\rho}_{J_r,p}$ has odd valuation. Moreover, we know that $N(\bar{\rho}_{J_r,p})$ divides the conductor $N$ of the compatible system $\{\rho_{J_r,\lambda}\}$. According to Theorem 5.16, we have $N = 2^2 q_r^2 n$ where $n$ is a squarefree ideal coprime to $2r$. It then follows that the conductor of $\theta$ and $\theta'$ away from $p$ divides $2q_r$.

For each prime $q \mid p$, the restriction to $I_q$ of $\bar{\rho}_{J_r,p}$ is isomorphic to either $\chi_p|_{I_q} \oplus 1$ or $\psi \oplus \psi^p$, where $\psi$ is a fundamental character of level 2. Indeed, we know from the results in Section 5 that $J_r$ has either good or bad semistable reduction at $q$. In the former case, the desired description of $\bar{\rho}_{J_r,p}|_{I_q}$ follows from [72, Corollaire 3.4.4]. In the latter case, we rely on the modularity of $J_r$ proved in Section 4: since the reduction of the abelian variety at $q$ is multiplicative the corresponding Hilbert modular form is Steinberg locally at $q$, and since it is a form of parallel weight 2 it is well known (see for instance [50]) that in this case the attached Galois representation $\rho_{J_r,p}$ is ordinary locally at $q$, thus implying that the restriction to $I_q$ of $\bar{\rho}_{J_r,p}$ is isomorphic to $\chi_p|_{I_q} \oplus 1$.

Since $\theta, \theta'$ are valued in $\mathbb{F}_p$ which has odd degree over $\mathbb{F}_p$ by assumption (i), the case of fundamental characters of level 2 is excluded because $\mathbb{F}_{p^2} \notin \mathbb{F}_p$. We conclude that, for each $q \mid p$, we have

$$ (6.7) \qquad \bar{\rho}_{J_r,p}|_{I_q} \simeq \theta|_{I_q} \oplus \theta'|_{I_q} \simeq \chi_p|_{I_q} \oplus 1 $$

and exactly one of $\theta, \theta'$ is unramified at $q$, while the other one restricts to $I_q$ as the cyclotomic character.

(a) Suppose that one of $\theta, \theta'$ is unramified at every prime dividing $p$. We can assume it is $\theta$ (after relabeling if needed). From the above it follows that $\theta$ is a character of the ray class group of modulus $2m$. From Corollary 5.4 we know that $\bar{\rho}_{J_r,p}(I_{q_2})$ is of order $r$ for any $q_2$ above 2. In particular, $r$ divides $\#\text{Gal}(K(2m)/K(m)) = h_{2m}/h_m$ where $K(2m)$ and $K(m)$ denote the ray class fields of modulus $2m$ and $m$ respectively (see [21, §3.2]). This contradicts assumption (ii). Therefore this case does not occur.

(b) If $p$ is inert in $K$, then from (6.7) one of $\theta, \theta'$ is unramified above the prime above $p$ and from (a) we conclude this case does not happen. Hence, $p$ is totally split in $K$ as $K/\mathbb{Q}$ is Galois of prime degree $g$, proving (1).

(c) Assume now that $p$ is totally split in $K$ and that $\theta, \theta'$ ramify at some prime above $p$. As $g$ is odd, one of $\theta, \theta'$ (say $\theta$ after relabeling if necessary) ramifies at strictly less prime ideals than the other. In particular, there exist an integer $s$ such that $1 \le s \le \lfloor \frac{g}{2} \rfloor$ and $s$ distinct prime ideals $\mathfrak{p}_1, \dots, \mathfrak{p}_s$ above $p$ in $K$ such that $\theta$ ramifies precisely at $\mathfrak{p}_1, \dots, \mathfrak{p}_s$ among all prime ideals above $p$. Let $q_2$ be a prime ideal above 2 in $K$. From the conductor of $\theta$, we have that $\theta|_{I_{q_2}}$ factors (after applying Artin's reciprocity map from class field theory)
via $(\mathcal{O}_K/\mathfrak{q}_2)^* = \mathbb{F}_{2f_2}^*$ and $\theta|_{I_{\mathfrak{q}_r}}$ factors via $(\mathcal{O}_K/\mathfrak{q}_r)^* = \mathbb{F}_r^*$. It follows that $\theta^m$ is unramified away from $\mathfrak{p}_1, \dots, \mathfrak{p}_s$ (including infinity) and that $\theta^m|_{I_{\mathfrak{p}_j}} = (\chi_p|_{I_{\mathfrak{p}_j}})^m$ for all $1 \le j \le s$. An application of Lemma 6.8 below with $F = K$, $S = \{\mathfrak{p}_1, \dots, \mathfrak{p}_s\}$, $\varphi = \theta^m$, $n_{\mathfrak{P}} = m$ (for any $\mathfrak{P} \in S$) and $u = \epsilon_i^2$ gives $\epsilon_i^{2ms} = 1$ (mod $p$) for all $1 \le i \le g-1$ (note that since $p$ splits completely in $K$, the norm maps are the identity map in this setting). In particular, $p$ divides $\text{gcd}(\text{Norm}_{K/\mathbb{Q}}(\epsilon_i^{2ms} - 1))$, hence proving (2).

(d) Following the argument with $I_{\mathfrak{q}_2}$ as in (a), but where now $\theta$ is a character of the ray class group of modulus $2\tilde{m}$ and $\tilde{m} = \mathfrak{p}_1 \cdots \mathfrak{p}_s m$ gives assertion (3).

□

To complete the previous proof, it remains to prove the following auxiliary result.

**Lemma 6.8.** Let $F$ be a number field with ring of integers $\mathcal{O}_F$. Let $p$ be a prime number unramified in $F$ and $S_p$ the set of places in $F$ above $p$. Let $S \subseteq S_p$ and $\varphi : G_F \to \mathbb{F}_p^*$ be a character satisfying the following conditions:

(1) $\varphi$ is unramified at all places of $F$ outside $S$ (including the places at infinity);

(2) For all $\mathfrak{P} \in S$, the restriction $\varphi|_{I_{\mathfrak{P}}}$ is equal to $(\chi_p|_{I_{\mathfrak{P}}})^{n_{\mathfrak{P}}}$ for some positive integer $n_{\mathfrak{P}}$, where $\chi_p$ is the $p$th cyclotomic character.

Then, for all totally positive units $u \in \mathcal{O}_F^*$, we have

$$ \prod_{\mathfrak{P} \in S} N_{\mathfrak{P}}(u + \mathfrak{P})^{n_{\mathfrak{P}}} = 1, $$

where $N_{\mathfrak{P}} : (\mathcal{O}_F/\mathfrak{P})^* \to \mathbb{F}_p^*$ is the norm map.

*Proof.* This follows from class field theory. The special case where $n_{\mathfrak{P}} = 1$ for all $\mathfrak{P} \in S$ is proved in [59, Appendice 1]. The exact same proof applies for general $n_{\mathfrak{P}}$; indeed, see the top of page 24 in loc. cit. for the unique place where hypothesis (2) is used. □

## 6.2. Avoiding the ‘bad projectively dihedral’ case.
The results of the previous subsection guarantee (under some conditions) that $\bar{\rho}_{J_r,p}$ is absolutely irreducible, but for the application of level lowering we will explain in Section 8 we also need that $\bar{\rho}_{J_r,p}$ is not ‘bad projectively dihedral’, that is, $\bar{\rho}_{J_r,p}|_{G_{K(\zeta_p)}}$ is absolutely irreducible, where $\zeta_p$ is a primitive $p$th root of unity.

For $p=r$, this is the content of Theorem 4.4. For $p \ge 2r$, assuming that $\bar{\rho}_{J_r,p}$ is absolutely irreducible, this is supplied by the following lemma (generalizing a result of Ribet [75] over $\mathbb{Q}$) when applied to $A = J_r$ (see Propositions 5.14 and 5.15 which show that the assumptions of the following lemma are satisfied in this case).

**Lemma 6.9.** Let $K/\mathbb{Q}$ be a number field. Let $A/K$ be a $\text{GL}_2$-type abelian variety with real multiplication by a field $F$. Let $p > 3$ be a prime unramified in $K$, and assume that $A$ has good or multiplicative reduction at all primes of $K$ above $p$. Let $\mathfrak{p} \mid p$ be a prime in $F$ and suppose that $\bar{\rho}_{A,p} : G_K \to \text{GL}_2(\mathbb{F}_p)$ is absolutely irreducible. Let $M/K$ be a quadratic extension where some prime $\mathfrak{p}' \mid p$ in $K$ ramifies in $M$.

Then $\bar{\rho}_{A,p}|_{G_M}$ is absolutely irreducible.

*Proof.* Assume, for a contradiction, that $\bar{\rho}_{A,p} \otimes \bar{\mathbb{F}}_p$ is reducible when restricted to $G_M$. It follows, by [44, Theorem 2.12], that the image of $\bar{\rho}_{A,p}$ lies in the normalizer of a Cartan subgroup of $\text{GL}_2(\mathbb{F}_p)$
and the projectivization $\mathbb{P}\bar{\rho}_{A,p}$ has dihedral image. Letting $H$ be this dihedral image, we have the short exact sequence of groups

$$0 \to C \to H \to C_2 \to 0,$$

where $C$ is a cyclic group and $C_2$ is of order 2. Moreover, the restriction of $\mathbb{P}\bar{\rho}_{A,p}$ to $G_M$ has image $C$ and $C_2 \simeq \text{Gal}(M/K)$. Let $I_{p'} \subset G_K$ be an inertia subgroup at $p'$, where $p' | p$ is a prime of $K$ ramified in $M$. We claim that $\mathbb{P}\bar{\rho}_{A,p}(I_{p'}) \subset H$ is cyclic of order > 2. Thus, since $H$ is dihedral, we have $\mathbb{P}\bar{\rho}_{A,p}(I_{p'}) \subset C$ and so $\text{Gal}(M/K)$ corresponds to an extension where $p'$ is unramified, a contradiction.

Let $p'$ be the prime in $K$ above $p$ as above. Let $z$ denote the inertial degree of $p'$. In this case, the restriction to $I_{p'}$ of $\bar{\rho}_{A,p} \otimes \bar{\mathbb{F}}_p$ can be described by two fundamental characters of some level $w$ dividing $z$, or by a pair of conjugated fundamental characters of level $2w$ for some $w$ dividing $z$.

Following [72, Corollaire 3.4.4], we have the following description for the action of $I_{p'}$:

$$\psi_s^{e_0+e_1p+\dots+e_{s-1}p^{s-1}} \oplus \psi_s^{f_0+f_1p+\dots+f_{s-1}p^{s-1}}$$

where $s = w$ or $s = 2w$ depending on the case, all the numbers $e_i$ and $f_i$ are 0 or 1, and $e_i \neq f_i$ for every $i = 0, 1, \dots, s-1$. Observe that here we allow some redundancy, for example if $w > 1$, $s = w$ and all $e_i$ are equal to 1 this agrees with the case of a fundamental character of level 1, which is a case already covered in the work of Ribet [75].

We want to get a lower bound for the order $k$ of $\mathbb{P}\bar{\rho}_{A,p}(I_{p'})$. This is the smallest positive exponent $k$ such that:

$$\psi_s^{k(e_0+e_1p+\dots+e_{s-1}p^{s-1})} = \psi_s^{k(f_0+f_1p+\dots+f_{s-1}p^{s-1})}.$$

Thus, since the order of $\psi_s$ is $p^s - 1$, we search for the smallest positive $k$ such that $p^s - 1$ divides $k((e_0 - f_0) + (e_1 - f_1)p + \dots + (e_{s-1} - f_{s-1})p^{s-1})$.

Since $p^s - 1 = (p-1)(1 + p + \dots + p^{s-1})$, from the inequality

$$|(e_0 - f_0) + (e_1 - f_1)p + \dots + (e_{s-1} - f_{s-1})p^{s-1}| \le 1 + p + \dots + p^{s-1},$$

we conclude that $k$ must satisfy $k \ge p - 1$, and since we are assuming that $p$ is at least 5 we conclude that $k \ge 4$. $\square$

## 7. FINITENESS OF SPECIALIZATIONS OF FREY REPRESENTATIONS

Besides irreducibility, another essential hypothesis for level lowering is that the relevant mod $p$ representation is finite at all primes $p \mid p$. In the context of the modular method, this guarantees the representation is of parallel weight 2, hence independent of $p$ and the putative solution. When working with Frey elliptic curves, the theory of the Tate curve provides a simple criterion, using the valuation of the minimal discriminant, to decide if the $p$-torsion representation is indeed finite. In [29], Darmon implicitly uses that an analogous criterion is available for Frey varieties, but we are not aware of a complete reference. We note also that [43] gives a related criterion which is a direct generalization of the usual criterion for elliptic curves. However, it is hard to use due to the need to determine a discriminantal set.

In this section we give such a finiteness criterion that in particular can be applied to the Frey variety $J_r$ and suffices for our Diophantine application below. More concretely, the objective of this section is to prove Theorem 7.6 which is a critical technical result needed for the proof of Proposition 8.2. We shall derive it from the more general Theorem 7.5.
**7.1. Finiteness of residual Galois representations.** Let $\ell$ be a prime. Let $K$ be a finite extension of $\mathbb{Q}_\ell$ with ring of integers $\mathcal{O}$, normalized valuation $v$, and residue field $k$. Let $G$ be the absolute Galois group of $K$, $P \subseteq I$ the wild inertia and inertia subgroup of $G$, respectively.

Let $K^{\text{nr}}$ be the maximal unramified extension of $K$, which is fixed by the inertia subgroup $I$ of $G$. Let $K^{\text{tr}}$ be the maximal tamely unramified extension of $K^{\text{nr}}$, which corresponds to the wild inertia subgroup $P$ of $I$. We denote also by $v$ the extension of $v$ to $K^{\text{nr}}$.

Let $\bar{\rho}: G \to \text{GL}_2(\mathbb{F})$ be a representation with $\mathbb{F}$ a finite field of size $p^f$, where $p$ is a prime.

The group $\bar{\rho}(I)$ corresponds to the Galois group of a finite totally ramified extension $M/K^{\text{nr}}$ and $\bar{\rho}(P)$ is an elementary $p$-group in $\text{GL}_2(\mathbb{F})$ which corresponds to a finite tamely ramified subextension $M^t$ of $M/K^{\text{nr}}$.

We have that $M = M^t(x_1^{1/p}, \dots, x_m^{1/p})$ for some $x_i \in K^{\text{nr}}$ and $p^m = \#\bar{\rho}(P)$ by Kummer theory.

We say that $\bar{\rho}$ is *peu ramifié* if $v(x_i) \equiv 0 \pmod{p}$ for all $i$. Note the case that $\bar{\rho}$ is tamely ramified (i.e. $\bar{\rho}(P) = 1$) is included in the peu-ramifié case.

We say that $\bar{\rho}$ is *finite* if $\bar{\rho}$ arises from a finite flat group scheme over $\mathcal{O}$.

**Theorem 7.1.** $\bar{\rho}$ is peu ramifié if and only if $\bar{\rho}$ is finite.

*Proof.* This is [80, Proposition 4.2.1]; see also [42, Proposition 8.2] for another proof in the case $K = \mathbb{Q}_\ell$. $\square$

**Theorem 7.2.** Suppose the extension cut out by the representation $\bar{\rho}: G \to \text{GL}_2(\mathbb{F})$ is contained in an extension of the form $K^{\text{nr}}(y_1^{1/p}, \dots, y_n^{1/p})$ in the case $\ell \neq p$, and $K^{\text{tr}}(y_1^{1/p}, \dots, y_n^{1/p})$ in the case $\ell = p$.

Assume $y_j \in K^{\text{nr}}$ and $v(y_j) \equiv 0 \pmod{p}$ for all $j = 1, \dots, n$.

Then $\bar{\rho}$ is unramified in the case $\ell \neq p$, and finite in the case $\ell = p$.

*Proof.* Recall that $P$ is the largest pro-$\ell$ subgroup of $G$.

If $\ell \neq p$, then the hypotheses imply that $\bar{\rho}$ is unramified.

If $\ell = p$, then we have that the extension $M^t(x_1^{1/p}, \dots, x_m^{1/p})$ corresponding to $\bar{\rho}(P)$ is contained in $K^{\text{tr}}(y_1^{1/p}, \dots, y_n^{1/p})$. By Kummer theory, the condition $v(y_j) \equiv 0 \pmod{p}$ for all $j$ implies that $v(x_i) \equiv 0 \pmod{p}$ for all $i$. Hence, $\bar{\rho}$ is peu-ramifié at $\ell = p$. By Theorem 7.1, $\bar{\rho}$ is finite. $\square$

Before proceeding, we introduce some notation that will be of use until the end of this section.

For $z_0 \in \mathbb{P}^1(K)$, let $\pi_0(t) = t - z_0$ if $z_0 \neq \infty$ and $\pi_0(t) = 1/t$ if $z_0 = \infty$. We will write $\pi_0$ for $\pi_0(t)$. Let $R = \mathcal{O}[[\pi_0]]$ and let $F$ be its field of fractions.

Let $A$ be an abelian variety over the function field $K(t)$ of dimension $d$. Assume :

(i) $A$ has a model over $R$ with multiplicative reduction at $\pi_0$ with full toric rank;

(ii) $A$ extends to an abelian scheme over $\mathcal{O}((\pi_0))$;

(iii) $A$ over $k[[\pi_0]]$ has multiplicative reduction at $\pi_0$ with full toric rank.

Condition (ii) ensures that $A(s_0)$ for $s_0 \neq z_0$ in the unit disk centered at $z_0$ is an abelian variety over $K$ and condition (iii) ensures such $A(s_0)$ has multiplicative reduction over $K$.
Replacing $K$ by a finite unramified extension if necessary, we may also assume that $A$ over $K[[\pi_0]]$ has split multiplicative reduction at $\pi_0$. By Mumford uniformization [68] (see also [64, Theorem 4.5]), we have that

$$ (7.3) \qquad A(\bar{F}) \simeq \mathbb{G}_m^d(\bar{F})/Y, $$

where $Y$ is a set of periods and $d = \dim A$ (a set of periods $Y$ is a subgroup of $\mathbb{G}_m^d(F)$ isomorphic to $\mathbb{Z}^d$ satisfying an analogue of the Riemann conditions; see [68, Definition 1.1]).

Let $X(T) = \operatorname{Hom}(T, \mathbb{G}_m)$ be the group of (algebraic) characters from $T = \mathbb{G}_m^d$ to $\mathbb{G}_m$. Denote by $\delta_1, \dots, \delta_d$ the component characters for $X(T)$. Let $y_1, \dots, y_d$ be a basis for $Y$.

**Proposition 7.4.** For all $\chi$ in $X(T)$ and $y \in Y$, we have that $\chi(y) = \pi_0^n u(\pi_0)$ where $n$ is an integer and $u(\pi_0)$ is a unit in $O[[\pi_0]]$.

*Proof.* We prove the statement for $\chi_i(y_j)$ where $\chi_1, \dots, \chi_d$ is a basis for $X(T)$. As $\chi_i(y_j) \in F^\times$, by Weierstrass preparation theorem, it is uniquely of the form

$$ \pi^m \frac{f(\pi_0)}{g(\pi_0)} u(\pi_0), $$

where $\pi$ is a uniformizer for $O$, $m$ is an integer, $f(\pi_0), g(\pi_0) \in O[\pi_0]$ are distinguished polynomials in $\pi_0$, and $u(\pi_0)$ is a unit in $O[[\pi_0]]$. Using functoriality of Mumford uniformization with respect to the base, the periods of $A/k[[\pi_0]]$ are precisely the reductions of the periods of $A/K[[\pi_0]]$, hence $m = 0$.

If $f$ or $g$ is not a power of $\pi_0$, then there is an element $s_0 \neq z_0 \in O'$ the ring of integers of a finite extension $K'/K$ such that $f(\pi_0)/g(\pi_0)$ and hence $\chi_i(y_j)$ has a zero or pole at $s_0$. Similarly, the periods of $A(s_0)$ are precisely the specializations of the periods of $A/O[[\pi_0]]$, hence $\chi_i(y_j)$ cannot have a zero or pole at $s_0$. $\square$

**Theorem 7.5.** Assume further the following two hypotheses :

(1) $A$ is of $\mathrm{GL}_2$-type with real multiplications by $F \hookrightarrow \mathrm{End}_{K(t)}(A) \otimes \mathbb{Q}$;

(2) there exists $t_1 \in \mathbb{P}^1(K)$ satisfying $\mathrm{ord}_K(\pi_0(t_1)) > 0$ and $\mathrm{ord}_K(\pi_0(t_1)) \equiv 0 \pmod{p}$.

Let $\mathfrak{p}$ be any prime of $F$ above a rational prime $p$. Then $A(t_1)[\mathfrak{p}]$ is unramified (resp. finite) if $\ell \neq p$ (resp. $\ell = p$).

*Proof.* Recall that $\delta_i$ are the component characters for $X(T)$ and $y_j(\pi_0)$ is a basis for $Y$. By Proposition 7.4, we write

$$ \delta_i(y_j(\pi_0)) = \alpha_n \pi_0^n + \alpha_{n+1} \pi_0^{n+1} + \alpha_{n+2} \pi_0^{n+2} + \dots \in \pi_0^n \mathbb{R} $$

where $\alpha_n \in O^\times$. By assumption (2), we have $\mathrm{ord}_K(\pi_0(t_1)) > 0$. Therefore, $\delta_i(y_j(\pi_0))$ converges to an element in $K$ after evaluating at $t = t_1$. By the second part of assumption (2) and the fact that $\alpha_n$ is a unit, we conclude that $\mathrm{ord}_K(\delta_i(y_j(\pi_0(t_1)))) \equiv 0 \pmod{p}$ for all $i, j$. Hence, by assumption (1) and (7.3), we have

$$ K(A(t_1)[\mathfrak{p}]) \subseteq K(A(t_1)[p]) \subseteq K(\zeta_p) \left( \left\{ \delta_i(y_j(\pi_0(t_1)))^{1/p} : i, j = 1, \dots, d \right\} \right), $$

where $\zeta_p$ is a primitive $p$th root of unity. By Theorem 7.2, $A(t_1)[\mathfrak{p}]$ is unramified (resp. finite) if $\ell \neq p$ (resp. $\ell = p$). $\square$
7.2. Specializations coming from solutions. We now give the criterion to prove finiteness of p-torsion representations arising on our Frey varieties. We again use the notation of the previous sections. In particular, $r \ge 5$ is a prime, $a, b$ are coprime integers such that $a^r + b^r \ne 0$ and we write $J_r$ for the base change of $J_r(a, b) = \text{Jac}(C_r(a, b))$ to $K = \mathbb{Q}(\zeta_r)^+$.

**Theorem 7.6.** Let $p$ be a rational prime number. Let $q$ be a prime in $K$ not dividing $2r$ such that $v_q(a^r + b^r) \equiv 0 \pmod{p}$. We have the following conclusions :

* If $q$ does not divide $p$, then $\bar{\rho}_{J_r,p}$ is unramified at $q$ for all $p \mid p$ in $K$;

* If $q$ divides $p$, then $\bar{\rho}_{J_r,p}$ is finite at $q$ for all $p \mid p$ in $K$.

*Remark 7.7.* When $p \mid r-1$, we note by (3.6) that the condition $v_q(a^r + b^r) \equiv 0 \pmod{p}$ in Theorem 7.6 is equivalent to the more usual condition $v_q(\Delta(C_r)) \equiv 0 \pmod{p}$, where $\Delta(C_r)$ is the discriminant of $C_r = C_r(a, b)$ defined in (3.1).

*Proof of Theorem 7.6.* Suppose $q$ lies above the rational prime $q$ not dividing $2r$.

If $q \mid a^r + b^r$, then $J_r$ has good reduction at $q$, and we have the desired conclusions.

Let us now assume that $q \mid a^r + b^r$, and hence $q \mid ab$. Recall from Lemma 2.36 that $C'_r(t)$ is given by

$$ (7.8) \qquad C'_r(t) : y^2 = x^r + c_1 \alpha^2 x^{r-2} + \dots + c_{\frac{r-1}{2}} \alpha^{r-1} x + \alpha^{r-1} (2t-1), $$

where $\alpha$ satisfies equation (2.35). According to equation (2.37), the discriminant of $C'_r(t)$ is given by

$$ \Delta'_r(t) = (-1)^{\frac{r-1}{2}} 2^{2(r-1)} r^r \alpha^{(r-1)^2} = (-1)^{\frac{r-1}{2}} 2^{2(r-1)} r^r (t(1-t))^{\frac{(r-1)^2}{2}}. $$

Letting $u = 1/t$ so $\alpha^2 = (u-1)/u^2$, we obtain

$$ (7.9) \qquad C'_r(u) : y^2 = x^r + c_1 \alpha^2 x^{r-2} + \dots + c_{\frac{r-1}{2}} \alpha^{r-1} x + \alpha^{r-1} (2-u)/u, $$

whose discriminant is given by

$$ (7.10) \qquad \Delta'_r(u) = (-1)^{\frac{r-1}{2}} 2^{2(r-1)} r^r \left(\frac{u-1}{u^2}\right)^{\frac{(r-1)^2}{2}}. $$

Let $i$ be a fixed primitive fourth root of unity. Replacing $x$ by $x/(iu)$ and $y$ by $y/(iu)^{\frac{r}{2}}$, yields the hyperelliptic curve

$$ W'_r(u) : y^2 = x^r - c_1 \alpha^2 u^2 x^{r-2} + \dots \pm c_{\frac{r-1}{2}} \alpha^{r-1} u^{r-1} x + i^r \alpha^{r-1} u^{r-1} (2-u), $$

with discriminant

$$ (7.11) \qquad 2^{2(r-1)} r^r (u-1)^{\frac{(r-1)^2}{2}} u^{r-1}. $$

Let $O'$ be the ring of integers of $K' = K_q(i)$, where $K_q$ is the completion of $K$ at $q$.

Let us write $t_0 = \frac{a^r}{a^r+b^r}$ and $J' = \text{Jac}(W'_r(u))$. By Lemma 3.5, the curve $C'_r(t_0)$ is a quadratic twist of $C_r(a, b)$ by $-\frac{(ab)^{\frac{r-1}{2}}}{a^{r-1}+b^{r-1}}$. Therefore, $W'_r(u_0)$ is the quadratic twist of $C_r(a, b)$ by $-ib^{\frac{r-1}{2}}/a^{\frac{r+1}{2}}$. As $q$ does not divide $2ab$, the desired result will follow from the same conclusion for $\bar{\rho}_{J',p}$. Therefore, we wish to apply Theorem 7.5 to the abelian variety $J'$ and $t_1 = \frac{1}{t_0}$.

From the discriminant formula (7.11), it follows that $J'$ extends to an abelian scheme over $O'((u))$, since $r, u$ and $u-1$ are all invertible in $O'((u))$.

Since $v_q(a^r + b^r) \equiv 0 \pmod{p}$, we have $v_q(t_1) > 0$ and $v_q(t_1) \equiv 0 \pmod{p}$. In particular, condition (2) of Theorem 7.5 is satisfied.
To apply Theorem 7.5 to $J'$ we have to show that the above model for $W'_r(u)$ over $O'[u]$ is such that it has the maximal number of double roots over $K'[[u]]$ and $k'[[u]]$ when $u=0$, where $k'$ denotes the residue field of $K'$. We first notice that $(\alpha u)^2 = u - 1$ reduces to $-1$ modulo $u$ and hence $i^r \alpha^{r-1} u^{r-1} = i^r ((\alpha u)^2)^{\frac{r-1}{2}}$ reduces to $i^r (-1)^{\frac{r-1}{2}} = i^{2r-1} = i$. Therefore the reduction of $W'_r(u)$ modulo $u$ is given by

$$y^2 = x^r + c_1 x^{r-2} + \dots + c_{\frac{r-1}{2}} x + 2i = xh(x^2 + 2) + 2i,$$

where $h$ is defined in (2.14). Let us assume $r \equiv 1 \pmod 4$. From Lemma 2.16, we know that $xh(x^2 + 2) = 2iT_r(\frac{x}{2i})$ where $T_r(x)$ is the $r$-th Chebyshev polynomial of the first kind. Hence, $-2i$ is a root of $xh(x^2 + 2) + 2i$ since $T_r(-1) = -1$; by Lemma 2.20, $-i\omega_j$ for $j = 1, \dots, \frac{r-1}{2}$ are also roots of $xh(x^2 + 2) + 2i$. Moreover, according to Lemma 2.19, these latter roots have multiplicity $> 1$. Since $xh(x^2 + 2) + 2i$ has degree $r$, they are double roots and we have found that this polynomial has the maximal number of double roots.

Finally observe that $\omega_j - \omega_k = \zeta_r^j (1 - \zeta_r^{k-j})(1 - \zeta_r^{-j-k})$ is a unit $K'(\zeta_r)$ unless $j = k$. Therefore, the elements $-i\omega_j$ in $O'$ reduce to different elements in $k'$. In particular, the above model also has the maximal number of double roots over $k'[[u]]$, completing the verification of the hypotheses in Theorem 7.5 in the case $r \equiv 1 \pmod 4$. We proceed similarly in the case $r \equiv 3 \pmod 4$. $\square$

## 8. REFINED LEVEL LOWERING

This section focuses on the 'level lowering' step by combining results from the previous two sections. Our approach replaces the classical level lowering theorems of Fujiwara-Jarvis-Rajaei [48, 52, 71] by a result of Breuil-Diamond [16, Theorem 3.2.2]. The latter has more restrictive hypotheses, but it gives existence and modularity of all lifts with prescribed inertial types as long as the types are compatible with the fixed residual representation. As we shall discuss here and again in Section 9, this approach has various advantages which are fundamental for the elimination step. We call this approach level lowering with prescribed types or simply refined level lowering.

Let $r, p \ge 5$ be prime numbers, and $d \in \mathbb{Z}_{>0}$ not divisible by any $r$th power. Assume $p \equiv 2rd$.

Suppose $(a, b, c)$ is a non-trivial primitive solution to equation (1.4), that is,

$$a^r + b^r = dc^p, \quad abc \neq 0, \quad \gcd(a, b, c) = 1.$$

We have that $a, b, c$ are pairwise coprime, due to our assumptions.

Throughout this section, we assume that $a, b$ satisfy the following parity condition:

$$(8.1) \qquad a \equiv 0 \pmod 2 \quad \text{and} \quad b \equiv 1 \pmod 4.$$

As usual, we let $J_r = J_r(a, b)/K$ be the attached Frey variety, where $K = \mathbb{Q}(\zeta_r)^+$. Recall from Theorem 3.11 that $J_r$ is of GL$_2$-type with real multiplications by $K$. Let $\mathfrak{p}$ be a prime ideal in $K$ dividing $p$. We write $\bar{\rho}_{J_r, \mathfrak{p}}$ for the corresponding representation of $G_K$ (see Section 3). We denote by $\mathfrak{q}_r$ the unique prime ideal above $r$ in $K$.

**8.1. Finiteness of the representation and Serre level.** For a representation $\bar{\rho}: G_K \to \text{GL}_2(\bar{\mathbb{F}}_p)$ its Serre level $N(\bar{\rho})$ is defined as the Artin conductor of $\bar{\rho}$ away from $p$.

The following proposition gives the finite possible values for the Serre level of $\bar{\rho}_{J_r, \mathfrak{p}}$. It uses the results from Theorems 5.16 and 7.6.

**Proposition 8.2.** *The following assertions hold.*
(1) The Serre level $N(\bar{\rho}_{J_r,p})$ of $\bar{\rho}_{J_r,p}$ divides $2^2 q_r^2 n_d$ where $n_d$ is the squarefree product of the primes $q+2r$ such that $q \nmid d$.

(2) For each prime $q \nmid p$ in $K$, the representation $\bar{\rho}_{J_r,p}|_{D_q}$ is finite.

*Proof.* From Theorem 5.16 we know that the conductor of $\rho_{J,p}$ and $\mathcal{N} = 2^2 q_r^2 n$ (where $n$ is the product of all prime ideals dividing $a^r + b^r$ which are coprime to $2r$) agree away from the places above $p$. We have $n_d \mid n$ and we set $n' = nn_d^{-1}$. Let $q$ be a prime in $K$ dividing $n'$, but not dividing $p$. Then $q$ is coprime to $2rd$ and divides $a^r + b^r$. Therefore, $p$ divides the valuation at $q$ of $a^r + b^r$ and from the first part of Theorem 7.6, it follows that $\bar{\rho}_{J_r,p}$ is unramified at $q$, hence proving (1).

Let now $q$ be a prime ideal in $K$ above $p$. By our assumptions, $q$ is coprime to $2rd$, and as before the valuation at $q$ of $a^r + b^r$ is divisible by $p$. We finally conclude using the second part of Theorem 7.6. $\square$

## 8.2. Level lowering.

**Theorem 8.3.** Suppose that $\bar{\rho}_{J_r,p}$ is absolutely irreducible. Then, there is a Hilbert newform $g$ over $K$ satisfying the following properties:

(i) $g$ is of parallel weight 2, trivial character and level $2^2 q_r^2 n_d$;

(ii) $\bar{\rho}_{J_r,p} \simeq \bar{\rho}_{g,\mathfrak{P}}$ for some $\mathfrak{P} \mid p$ in the field of coefficients $K_g$ of $g$;

(iii) for all $q_2 \mid 2$ in $K$, we have $(\rho_{g,\mathfrak{P}} \otimes \overline{\mathbb{Q}}_p)|_{I_{q_2}} \simeq \delta \oplus \delta^{-1}$, where $\delta$ is a character of order $r$;

(iv) $K \subset K_g$.

Moreover, if $n_d \neq 1$ then $g$ has no complex multiplication.

*Proof.* From Theorem 4.8, $J_r/K$ is modular, hence $\bar{\rho}_{J_r,p}$ is modular.

From the proof of part (a) of Theorem 5.16, we know that the inertial type of $J_r/K$ at any $q_2 \mid 2$ is of the form $(\rho_{J_r,p} \otimes \overline{\mathbb{Q}}_p)|_{I_{q_2}} \simeq \delta \oplus \delta^{-1}$, where $\delta$ is a character of order $r$ (note that this decomposition applies for both the principal series case and the supercuspidal case induced from the unramified quadratic extension of $K_{q_2}$). The same theorem also gives that $\rho_{J_r,p}$ is Steinberg at all $q+2q_r$ dividing $d$. In particular, since $\rho_{J_r,p}$ is a lift of $\bar{\rho}_{J_r,p}$, these inertial types are compatible with the residual representation $\bar{\rho}_{J_r,p}$.

We note that the proof of [39, Lemma 1.13] also holds over $K$, so $\bar{\rho}_{J_r,p}|_{G_K(\zeta_p)}$ is absolutely irreducible if and only if $\bar{\rho}_{J_r,p}|_{G_M}$ is absolutely irreducible where $M$ is the unique quadratic extension of $K$ contained in $K(\zeta_p)$. By our assumptions and Lemma 6.9 we know that $\bar{\rho}_{J_r,p}|_{G_K(\zeta_p)}$ is absolutely irreducible. Now, for all $p > 5$, conclusions (i)–(iii) follow from Proposition 8.2 and [16, Theorem 3.2.2].

For $p=5$ (hence $r \ge 7$) conclusions (i)–(iii) follow by the same results if we additionally show that $\bar{\rho}_{J_r,p}(G_{K(\zeta_5)}) \neq \text{PSL}_2(\mathbb{F}_5)$. Indeed, this is the case because $\text{PSL}_2(\mathbb{F}_5)$ has order 60, $[K(\zeta_5): K] = 4$ and $\bar{\rho}_{J_r,p}(I_{q_2})$ has prime order $r \ge 7$ (because there is no intersection of the image of inertia $\rho_{J_r,p}(I_{q_2})$ with the kernel of reduction mod $p \mid 5$).

Conclusion (iv) follows from Proposition 8.4 below. Finally, if $n_d \neq 1$ then $g$ has a Steinberg prime which is incompatible with $g$ having complex multiplication. $\square$

**Proposition 8.4.** Let $K$ be any totally real field. Let $g$ a Hilbert modular form over $K$ with field of coefficients $K_g$. Let $\lambda$ be a prime in $K_g$ above the rational prime $p$. Let $q+p$ be a prime in $K$. Suppose that $(\rho_{g,\lambda} \otimes \overline{\mathbb{Q}}_p)|_{I_q} \simeq \delta \oplus \delta^{-1}$, where $\delta$ has order $n$.

Then $\mathbb{Q}(\zeta_n + \zeta_n^{-1}) \subset K_g$ where $\zeta_n$ is a primitive $n$th root of unity.
*Proof.* We know that the system of Galois representations $\rho_{g,\lambda} : G_K \to \text{GL}_2(K_{g,\lambda})$ is strictly compatible. Thus, for all primes $\lambda$ in $K_g$ such that $\lambda \nmid \text{Norm}(q)$, the restriction $\rho_{g,\lambda}|_{I_q}$ has the same shape, hence, using the hypothesis, we have $\zeta_n + \zeta_n^{-1} \in K_{g,\lambda}$ for every such $\lambda$. This implies that the extension $K_g(\zeta_n + \zeta_n^{-1})/K_g$ is of degree 1 because almost all primes are split in it and hence $\mathbb{Q}(\zeta_n + \zeta_n^{-1}) \subset K_g$. $\square$

*Remark 8.5.* The previous result relates the field of coefficients of a Hilbert modular form to its inertial types. This allows for conclusion (iv) in Theorem 8.3 which turns out to be a powerful new elimination technique only available in the context of Frey abelian varieties which are not elliptic curves; indeed, it is well known that for an elliptic curve $J$, if the restriction to inertia of $\rho_{J,p}$ at a prime $q \neq p$ is of the form $\delta \oplus \delta^{-1}$ then $\delta$ is a character of order $n = 2, 3, 4$ or $6$. In this case, Proposition 8.4 leads to the trivial conclusion that $\mathbb{Q}(\zeta_n + \zeta_n^{-1}) = \mathbb{Q} \subset K_g$.

*Remark 8.6.* Note that Proposition 8.2 states that $N(\bar{\rho}_{J,p})$ is a divisor of $2^2 q_r^2 n_d$ but Theorem 8.3 concludes that we only need to consider newforms in the largest level $2^2 q_r^2 n_d$. This is a consequence of refined level lowering in the proof of Theorem 8.3 which, in particular, forces the presence of the Steinberg primes $q \mid n_d$. A *priori* this may not look like much of an improvement, as we have to compute at the larger level $2^2 q_r^2 n_d$ compared to $2^2 q_r^2$ for instance, but it turns out to cut running time considerably. Indeed, the current algorithms to compute Hilbert newforms of square level are very inefficient.

Let $\chi_r$ denote the mod $r$ cyclotomic character. Note that $\chi_r|_{G_K}$ is a quadratic character.

**Corollary 8.7.** *Assume the hypotheses of Theorem 8.3. Suppose further that $r \mid a+b$. Then, there is a Hilbert newform $g$ over $K$ satisfying the following properties:*

(i) $g$ is of parallel weight 2, trivial character and level $2^2 q_r n_d$;

(ii) $\bar{\rho}_{J_r,p} \otimes \chi_r|_{G_K} \simeq \bar{\rho}_{g,\mathfrak{P}}$ for some $\mathfrak{P} \mid p$ in the field of coefficients $K_g$ of $g$;

(iii) for all $q_2 \mid 2$ in $K$, we have $(\rho_{g,\mathfrak{P}} \otimes \bar{Q}_p)|_{I_{q_2}} \simeq \delta \oplus \delta^{-1}$, where $\delta$ is a character of order $r$;

(iv) $K \subset K_g$.

Moreover, if $n_d \neq 1$ then $g$ has no complex multiplication.

*Proof.* Assume all hypotheses of Theorem 8.3 plus $r \mid a+b$.

The quadratic extension $\mathbb{Q}(\zeta_r)/K$ fixed by the quadratic character $\chi_r|_{G_K}$ is unramified away from $r$ and has ramification index $e = 2$ at $q_r$. From Proposition 5.9 and its proof it follows that the Jacobian of the quadratic twist of $C_r/K$ corresponding to $\mathbb{Q}(\zeta_r)/K$ has conductor $q_r$ at $q_r$. Now applying the arguments in the proofs of Proposition 8.2 and Theorem 8.3 where we replace $\bar{\rho}_{J_r,p}$ by $\bar{\rho}_{J_r,p} \otimes \chi_r|_{G_K}$ yields the corollary. $\square$

*Remark 8.8.* We note that because of the parity condition (8.1), the assumption that $\bar{\rho}_{J_r,p}$ is absolutely irreducible which appears in both Theorem 8.3 and Corollary 8.7 is satisfied for $p > B_r$ where $B_r$ is the constant (depending only on $r$) introduced in Proposition 6.3.

## 9. CHALLENGES IN THE ELIMINATION STEP

When applying the modular method it is often in the elimination step where one faces the biggest challenges, due to the lack of general methods to distinguish Galois representations.

Difficulties start to arise when we have to compare traces with many newforms or newforms with large coefficients fields.
In this section, we discuss the elimination procedure for the Frey abelian variety $J_r$ (for arbitrary $r$) and describe the main issues. There are several challenges to overcome which we explain, together with the techniques we have developed to circumvent them, both theoretical and computational.

Some of the techniques below are used in the proof of Theorem 1.5. Furthermore, in volume II of this series [11] we show how putting them all together allows for resolution of the equation $x^7 + y^7 = 3z^p$ that is computationally more efficient than using the classical approach with Frey curves.

**9.1. Hecke constituents.** Let $K$ be a totally real number field and let $\mathcal{N}$ be an ideal in the integer ring $\mathcal{O}_K$ of $K$.

We denote by $S$ the set of Hilbert modular newforms of parallel weight 2 and level $\mathcal{N}$. According to Shimura [79], there is a left action $(\tau, f) \mapsto {}^\tau f$ of $G_Q$ on $S$ such that

$$a_q({}^\tau f) = \tau(a_q(f)),$$

for any prime ideal $q$ in $\mathcal{O}_K$. The Hecke constituent of $f \in S$ is defined as

$$[f] = \{ {}^\tau f : \tau \in G_Q \}.$$

For a form $f \in S$, we view its Hecke (or coefficient) field $K_f$ as a subfield of $\overline{\mathbb{Q}}$ and note that two forms in the same Hecke constituent have conjugated Hecke fields, i.e.

$$K_{\tau f} = \tau(K_f).$$

**9.2. Towards a bound on $p$.** From now on, and until the end of this section, we consider a prime $r \ge 3$ and two coprime integers $a, b$ such that $ab(a^r + b^r) \ne 0$. As usual, we write $J_r$ for the Jacobian of $C_r(a, b)$ base changed to $K = \mathbb{Q}(\zeta_r)^+$ and we recall that $K$ is the field of real multiplications of $J_r$ (see Theorem 3.11). Moreover, we assume throughout that we have an isomorphism

$$(9.1) \qquad \bar{\rho}_{J_r, \mathfrak{p}} \simeq \bar{\rho}_{g, \mathfrak{P}},$$

where $\mathfrak{p} \mid p$ in $K$, $g$ is a Hilbert newform over $K$ of some level $\mathcal{N}$, parallel weight 2, and trivial character; here $\mathfrak{P}$ denotes a prime ideal above $p$ in the coefficient field $K_g$ of $g$. We also assume that $K_g$ contains $K$. According to Theorem 8.3 such an isomorphism is expected to hold for a form $g$ of level $\mathcal{N} = 2^2 q_r^2 n_d$ if there exists $c \in \mathbb{Z}$ such that $(a, b, c)$ is a non-trivial primitive solution to equation (1.4) satisfying some parity conditions.

We stress the fact that everything to be discussed until the end of this section depends on $(a, b)$ such that $J_r = \text{Jac}(C_r(a, b))/K$. To ease the reading, we drop the pair $(a, b)$ from our notation (e.g., in the set $\mathcal{T}_q$ below) except in Subsection 9.8 and in Subsection 9.10.

We view $K_g \supset K$ as a subfield of $\overline{\mathbb{Q}}$ and note that choosing another embedding $K_g \to \overline{\mathbb{Q}}$ amounts to changing $g$ by a conjugate form ${}^\tau g$. The following proposition shows that, after replacing $g$ by an appropriate conjugate, we can assume that (9.1) holds and $\mathfrak{P} \cap \mathcal{O}_K = \mathfrak{p}$.

**Proposition 9.2.** Let $g$ be as above. There is $\tau \in G_Q$ such that the conjugated form ${}^\tau g$ satisfies $\bar{\rho}_{J_r, \mathfrak{p}} \simeq \bar{\rho}_{\tau g, \tau(\mathfrak{P})}$ and $\tau(\mathfrak{P}) \cap \mathcal{O}_K = \mathfrak{p}$.

*Proof.* Let $\overline{K}_g \subset \overline{\mathbb{Q}}$ be the Galois closure of $K_g/\mathbb{Q}$, and fix $\bar{\mathfrak{p}} \mid \mathfrak{p}$ in $\overline{K}_g$. Since Gal($\overline{K}_g/\mathbb{Q}$) acts transitively on the prime ideals of $\overline{K}_g$ above $p$, all such ideals are of the form $\sigma(\bar{\mathfrak{p}})$ with $\sigma \in \text{Gal}(\overline{K}_g/\mathbb{Q})$. In particular, $\tau(\overline{\mathfrak{P}}) = \bar{\mathfrak{p}}$ for some $\tau \in \text{Gal}(\overline{K}_g/\mathbb{Q})$ and $\overline{\mathfrak{P}}$ an ideal in $\overline{K}_g$ above $\mathfrak{P}$. Moreover, we have $\mathcal{O}_{K_{\tau g}} = \tau(\mathcal{O}_{K_g})$ and $\mathcal{O}_K \subset \mathcal{O}_{K_{\tau g}}$, thus $\tau(\overline{\mathfrak{P}}) \cap \mathcal{O}_{K_{\tau g}} = \tau(\overline{\mathfrak{P}})$ and

$$\tau(\overline{\mathfrak{P}}) \cap \mathcal{O}_K = \tau(\overline{\mathfrak{P}}) \cap \mathcal{O}_K = \bar{\mathfrak{p}} \cap \mathcal{O}_K = \mathfrak{p},$$
proving the last conclusion in the statement.

We will next show that $\bar{\rho}_{g,\mathfrak{P}} \simeq \bar{\rho}_{\tau g,\tau(\mathfrak{P})}$ and so the result follows from (9.1). These representations are valued in different residue fields, so to make sense of the isomorphism we first need to see them defined over a common field.

Let $f$ be the common inertial degree of the prime ideals in $\bar{K}_g$ above $p$, so that the residue fields at these primes are all isomorphic to $\mathbb{F}_q$ with $q = p^f$. We identify the residue field of $\mathcal{O}_{K_g}$ at $\mathfrak{P}$ and that of $\mathcal{O}_{K_{\tau g}}$ at $\tau(\mathfrak{P})$ as the same subfield of $\mathbb{F}_q$ as follows.

Fix an embedding $\iota_{\tau(\mathfrak{P})} : \tau(\mathcal{O}_{K_g})/\tau(\mathfrak{P}) \to \mathbb{F}_q$ and define the embedding

$$ \iota_{\mathfrak{P}} : \mathcal{O}_{K_g}/\mathfrak{P} \to \mathbb{F}_q \quad \text{by} \quad \iota_{\mathfrak{P}} := \iota_{\tau(\mathfrak{P})} \circ \phi_{\tau} $$

where $\phi_{\tau} : \mathcal{O}_{K_g}/\mathfrak{P} \to \tau(\mathcal{O}_{K_g})/\tau(\mathfrak{P})$ is the isomorphism of residue fields given by

$$ (9.3) \qquad \phi_{\tau}(x + \mathfrak{P}) := \tau(x) + \tau(\mathfrak{P}). $$

Therefore, by composing with $\iota_{\mathfrak{P}}$ and $\iota_{\tau(\mathfrak{P})}$ the representations $\bar{\rho}_{g,\mathfrak{P}}$ and $\bar{\rho}_{\tau g,\tau(\mathfrak{P})}$ respectively arise on vector spaces defined over the same subfield of $\mathbb{F}_q$. Now for all unramified $q$, we have

$$ \begin{aligned} \det \bar{\rho}_{\tau g, \tau(\mathfrak{P})}(\text{Frob}_q) &= \iota_{\tau(\mathfrak{P})}(N(q) + \tau(\mathfrak{P})) \\ &= \iota_{\tau(\mathfrak{P})}(\tau(N(q)) + \tau(\mathfrak{P})) \\ &= \det \bar{\rho}_{g, \mathfrak{P}}(\text{Frob}_q) \end{aligned} $$

and

$$ \begin{aligned} \operatorname{Tr} \bar{\rho}_{\tau g, \tau(\mathfrak{P})}(\text{Frob}_q) &= \iota_{\tau(\mathfrak{P})}(a_q(\tau g) + \tau(\mathfrak{P})) \\ &= \iota_{\tau(\mathfrak{P})}(\tau(a_q(g)) + \tau(\mathfrak{P})) \\ &= \iota_{\mathfrak{P}}(a_q(g) + \mathfrak{P}) \\ &= \operatorname{Tr} \bar{\rho}_{g, \mathfrak{P}}(\text{Frob}_q), \end{aligned} $$

showing that $\bar{\rho}_{\tau g, \tau(\mathfrak{P})} \simeq \bar{\rho}_{g, \mathfrak{P}}$, as both representations are semisimple by construction. $\square$

*Remark 9.4.* The second part of the previous proof in fact shows that $\bar{\rho}_{g,\mathfrak{P}} \simeq \bar{\rho}_{\tau g,\tau(\mathfrak{P})}$ for any Hilbert modular newform $g$, any prime $\mathfrak{P}$ in its field of coefficients, and any $\tau \in G_{\mathbb{Q}}$.

Until the end of Subsection 9.6, we fix a rational prime $q$ such that $q + 2r(a^T + b^T)$ and $q$ is coprime to $Np$. Let $q$ be a prime ideal of $K$ above $q$. According to Proposition 5.15, $J_r$ has good reduction at $q$. Moreover, by Theorem 3.11 we have that $a_q(J_r) \in K \subset K_g$. Therefore (9.1) implies that for every $\sigma \in \text{Gal}(K/\mathbb{Q})$, we have

$$ (9.5) \qquad a_{\sigma(q)}(J_r) \equiv a_{\sigma(q)}(g) \pmod{\mathfrak{P}} $$

and hence for every non-empty subset $\mathcal{S} \subset \text{Gal}(K/\mathbb{Q})$, we have

$$ (9.6) \qquad p \mid N_{q,\mathcal{S}}(g) := \gcd_{\sigma \in \mathcal{S}} \operatorname{Norm}_{K_g/\mathbb{Q}} (a_{\sigma(q)}(J_r) - a_{\sigma(q)}(g)). $$

Observe that $N_{q,\mathcal{S}}(g)$ is independent of $p$. Thus, in order to reach a contradiction with (9.1) in practice, we first use Magma to compute the Hecke constituents in the relevant space of Hilbert newforms; then we pick a representative $g$ for each constituent and compute $N_{q,\mathcal{S}}(g)$ using some auxiliary prime $q$ and some subset $\mathcal{S}$ of $\text{Gal}(K/\mathbb{Q})$. For all primes $p$ not dividing $N_{q,\mathcal{S}}(g)$, we have a contradiction to (9.1) with the form $g$. For this procedure to contradict (9.1) for all $\tau g \in [g]$
it is necessary that $N_{q,\mathfrak{S}}(g)$ is independent of choice of representative. The following calculation indicates this is not necessarily the case. Indeed, we have

$$
\begin{align*}
N_{q,\{1\}}(\tau g) &= \operatorname{Norm}_{K_{\tau g}/\mathbb{Q}} (a_q(J_r) - a_q(\tau g)) \\
&= \operatorname{Norm}_{\tau(K_g)/\mathbb{Q}} (a_q(J_r) - \tau(a_q(g))) \\
&= \operatorname{Norm}_{\tau(K_g)/\mathbb{Q}} (\tau(\tau^{-1}(a_q(J_r) - a_q(g)))) \\
&= \operatorname{Norm}_{K_g/\mathbb{Q}} (\tau^{-1}(a_q(J_r)) - a_q(g)),
\end{align*}
$$

showing that, in general, $N_{q,\mathfrak{S}}(\tau g) \neq N_{q,\mathfrak{S}}(g)$. To amend for this we will introduce a modification of $N_{q,\mathfrak{S}}(g)$ in (9.10). For now we remark this issue does not occur when applying the modular method with Frey elliptic curves; indeed, if $J_r$ is an elliptic curve, then $a_q(J_r) \in \mathbb{Q}$ and so $\tau^{-1}(a_q(J_r)) = a_q(J_r)$, as desired.

**9.3. Computing traces for $J_r$.** The above discussion indicates that, to discard (9.1), we will need to compute $a_q(J_r)$. Here we discuss an issue with the determination of $a_q(J_r)$. Fortunately, it turns out that, the solution to this issue will also solve the problem of $N_{q,\mathfrak{S}}(g)$ not being an invariant of the Hecke constituent of $g$, as we explained in Subsection 9.2.

Recall from Subsection 2.2 that $a_q(J_r) = \operatorname{tr} \rho_{J_r,p}(\operatorname{Frob}_q)$ arises as the middle coefficient of the characteristic polynomial of $\operatorname{Frob}_q$ acting on the 2-dimensional $K_p$-vector space $V_p(J_r)$. Unfortunately, current Magma functionality includes only computations of Euler factors for the full Tate module $V_p(J_r)$ of $J_r/K$ (which is a $\mathbb{Q}_p$-vector space of dimension $r-1$). To circumvent this issue we proceed as follows.

For each prime ideal $\mathfrak{p}$ above $p$ in $K$, we write $\iota_{\mathfrak{p}} : K \to K_{\mathfrak{p}}$ for the canonical embedding of $K$ into its $\mathfrak{p}$-adic completion; we identify $K \otimes_{\mathbb{Q}} \mathbb{Q}_p$ with $\prod_{\mathfrak{p}|p} K_{\mathfrak{p}}$ as discussed in Subsection 2.2.

For each prime ideal $\mathfrak{p}$ above $p$ in $K$ and each embedding $\tau_{\mathfrak{p}} : K_{\mathfrak{p}} \to \overline{\mathbb{Q}}_{\mathfrak{p}}$, we let $\rho_{J_r, \tau_{\mathfrak{p}}}$ be the composite

$$
G_K \xrightarrow{\rho_{J_r,p}} \mathrm{GL}_2(K_{\mathfrak{p}}) \to \mathrm{GL}_2(\overline{\mathbb{Q}}_{\mathfrak{p}})
$$

with the latter map being induced by $\tau_{\mathfrak{p}}$.

On the other hand, we regard $\rho_{J_r,\mathfrak{p}}$ as the $K \otimes \overline{\mathbb{Q}}_p$-representation via the composition

$$
G_K \xrightarrow{\rho_{J_r, \mathfrak{p}}} \mathrm{GL}_2(K \otimes \mathbb{Q}_p) \to \mathrm{GL}_2(K \otimes \overline{\mathbb{Q}}_p).
$$

From (2.7), we then have

$$
\rho_{J_r, \mathfrak{p}} \cong \bigoplus_{\mathfrak{p} \mid p} \bigoplus_{\tau_{\mathfrak{p}} : K_{\mathfrak{p}} \to \overline{\mathbb{Q}}_{\mathfrak{p}}} \rho_{J_r, \tau_{\mathfrak{p}}} \cong \bigoplus_{\tau : K \to \overline{\mathbb{Q}}_{\mathfrak{p}}} \rho_{\tau}
$$

where $\rho_{\tau} = \rho_{J_r, \tau_{\mathfrak{p}}}$ for a unique $(\mathfrak{p}, \tau_{\mathfrak{p}})$ as

$$
\{\tau : K \to \overline{\mathbb{Q}}_p\} = \bigsqcup_{\mathfrak{p}|p} \{\tau_{\mathfrak{p}} \circ \iota_{\mathfrak{p}} ; \tau_{\mathfrak{p}} : K_{\mathfrak{p}} \to \overline{\mathbb{Q}}_p\}.
$$

Since $K/\mathbb{Q}$ is Galois, each $\tau : K \to \overline{\mathbb{Q}}_p$ is of the shape $\iota \circ \sigma$ where $\iota : K \to \overline{\mathbb{Q}}_p$ is a fixed embedding and $\sigma \in \operatorname{Gal}(K/\mathbb{Q})$. Therefore, we have

$$
(9.7) \qquad \rho_{J_r, \mathfrak{p}} \cong \bigoplus_{\tau:K \to \overline{\mathbb{Q}}_p} \rho_{\tau} \cong \bigoplus_{\sigma \in \operatorname{Gal}(K/\mathbb{Q})} \rho_{\iota \circ \sigma}.
$$

As before, let $q$ be a rational prime such that $q + 2r(a^r + b^r)$ and $q$ is coprime to $\mathcal{N}p$. Define

$$
\mathcal{T}_q = \mathcal{T}_q(a, b) := \{a_{q'}(J_r) : q' \mid q \text{ in } \mathcal{O}_K\}.
$$
Since $K/\mathbb{Q}$ is Galois it follows from (3.15) that for any fixed prime ideal $q$ in $K$ dividing $q$, we have

$$ (9.8) \qquad \mathcal{T}_q = \{a_{\sigma(q)}(J_r) : \sigma \in \mathrm{Gal}(K/\mathbb{Q})\} = \{\sigma(a_q(J_r)) : \sigma \in \mathrm{Gal}(K/\mathbb{Q})\}. $$

In particular, $\mathcal{T}_q$ consists of exactly one element in $\mathbb{Z}$ when $q$ is inert in $K$ and of at most $[K : \mathbb{Q}] = (r-1)/2$ conjugated elements in $\mathcal{O}_K$ when $q$ splits in $K$.

According to (9.7) the characteristic polynomial of $\rho_{J_r,p}(\mathrm{Frob}_q)$ is the product over all $\sigma'$s of the characteristic polynomials of $\rho_{\iota\sigma}(\mathrm{Frob}_q)$ and hence it is given by

$$ (9.9) \qquad \prod_{\sigma \in \mathrm{Gal}(K/\mathbb{Q})} (X^2 - \sigma(a_q(J_r))X + N(q)), $$

where we have dropped the notation $\iota$ to emphasize that it actually belongs to $\mathcal{O}_K[X]$ (by the $K$-integrality property; see Subsection 2.2). This polynomial factorization can be obtained in Magma in the following way: we compute the Euler factor $L_q(C_r, X)$ (via the command EulerFactor), take its reverse polynomial and factor it in $K[X]$.

9.4. **A bound on $p$.** As explained above, when computing with Magma, we are unable to detect which element of $\mathcal{T}_q$ corresponds to the trace of the two dimensional block $\rho_{J_r,p}$ we are considering in (9.1). Nevertheless, since the relevant trace belongs to $\mathcal{T}_q$, it follows from (9.6) and (9.8) that for every non-empty subset $\mathfrak{S} \subset \mathrm{Gal}(K/\mathbb{Q})$, we have

$$ (9.10) \qquad p | N_{q,\mathfrak{S}}(g) := \prod_{u \in \mathcal{T}_q} \mathrm{gcd} \operatorname{Norm}_{K_g/\mathbb{Q}} (\sigma(u) - a_{\sigma(q)}(g)). $$

We now show that this version of $N_{q,\mathfrak{S}}(g)$ does not change when $g$ is replaced by another form in its Hecke constituent. Indeed, if $\tau \in G_{\mathbb{Q}}$, then $K_{\tau g} = \tau(K_g)$ and

$$ \begin{align*} N_{q,\mathfrak{S}}(\tau g) &= \prod_{u \in \mathcal{T}_q} \mathrm{gcd} \operatorname{Norm}_{K_{\tau g}/\mathbb{Q}} (\sigma(u) - a_{\sigma(q)}(\tau g)) \\ &= \prod_{u \in \mathcal{T}_q} \mathrm{gcd} \operatorname{Norm}_{\tau(K_g)/\mathbb{Q}} (\sigma(u) - \tau(a_{\sigma(q)}(g))) \\ &= \prod_{u \in \mathcal{T}_q} \mathrm{gcd} \operatorname{Norm}_{\tau(K_g)/\mathbb{Q}} (\tau(\tau^{-1}\sigma(u) - a_{\sigma(q)}(g))) \\ &= \prod_{u \in \mathcal{T}_q} \mathrm{gcd} \operatorname{Norm}_{K_g/\mathbb{Q}} (\sigma\tau^{-1}(u) - a_{\sigma(q)}(g)) \\ &= \prod_{u \in \mathcal{T}_q} \mathrm{gcd} \operatorname{Norm}_{K_g/\mathbb{Q}} (\sigma(u) - a_{\sigma(q)}(g)) = N_{q,\mathfrak{S}}(g) \end{align*} $$

since $\tau^{-1}\sigma(u) = \sigma\tau^{-1}(u)$ for $u \in \mathcal{T}_q$ and $\mathcal{T}_q = \{\tau^{-1}(u) : u \in \mathcal{T}_q\}$. In particular, it suffices to rule out the divisibility relation (9.10) to discard the existence of the isomorphism (9.1) for any conjugated form of $g$.

We note that if $\mathfrak{S}' \subset \mathfrak{S}$ are (non-empty) subsets of $\mathrm{Gal}(K/\mathbb{Q})$, then we have

$$ N_{q,\mathfrak{S}}(g) | N_{q,\mathfrak{S}'}(g). $$

*Remark 9.11.* This last divisibility relation suggests that, at least theoretically, working with the bigger set $\mathfrak{S}$ (e.g., with the whole group $\mathrm{Gal}(K/\mathbb{Q})$) gives sharper bounds. However, in practice it is sometimes more efficient to deal with more auxiliary primes $q$ and smaller sets $\mathfrak{S}$ than with bigger sets $\mathfrak{S}$ and less auxiliary primes.
9.5. Using split primes to bound $p$. We have the following formula which holds for any $\sigma \in \text{Gal}(K/\mathbb{Q})$ and any subset $\mathfrak{S}$ of $\text{Gal}(K/\mathbb{Q})$:

$$N_{\sigma(q), \mathfrak{S}}(g) = N_{q, \mathfrak{S}\sigma}(g)$$

where $\mathfrak{S}\sigma := \{\sigma' : \sigma' \in \mathfrak{S}\}$. In particular, we have $N_{q, \{\sigma\}} = N_{\sigma(q), \{1\}}$.

Let $\mathfrak{q}_1, \dots, \mathfrak{q}_d$ be prime ideals in $K$ above the rational prime $q$. For every $j \in \{1, \dots, d\}$, there exists $\sigma_j \in \text{Gal}(K/\mathbb{Q})$ such that $\sigma_j(\mathfrak{q}_1) = \mathfrak{q}_j$. Set $\mathfrak{S} = \{\sigma_j : 1 \le j \le d\}$. We have

$$ \begin{aligned} N_{\mathfrak{q}_1, \mathfrak{S}}(g) &= \prod_{u \in \mathcal{T}_q} \gcd \operatorname{Norm}_{K_g/\mathbb{Q}} (\sigma(u) - a_{\sigma(\mathfrak{q}_1)}(g)) \\ &= \prod_{u \in \mathcal{T}_q} \gcd \operatorname{Norm}_{K_g/\mathbb{Q}} (\sigma_j(u) - a_{\sigma_j(\mathfrak{q}_1)}(g)). \end{aligned} $$

Hence for any $j \in \{1, \dots, d\}$, we have that $N_{\mathfrak{q}_1, \mathfrak{S}}(g)$ divides

$$\prod_{u \in \mathcal{T}_q} \operatorname{Norm}_{K_g/\mathbb{Q}} (\sigma_j(u) - a_{\sigma_j(\mathfrak{q}_1)}(g)) = N_{\mathfrak{q}_1, \{\sigma_j\}} = N_{\sigma_j(\mathfrak{q}_1), \{1\}} = N_{\mathfrak{q}_j, \{1\}}.$$

Therefore, we have

$$N_{\mathfrak{q}_1, \mathfrak{S}}(g) \mid \gcd N_{\mathfrak{q}_j, \{1\}}$$

showing that in general it is more efficient to deal with the primes $\mathfrak{q}_1, \dots, \mathfrak{q}_d$ simultaneously than with each of them in turn.

*Remark 9.12.* The congruence (9.5) also leads for any $\mathfrak{S} \subset \text{Gal}(K/\mathbb{Q})$ to the following condition

$$p \mid \prod_{u \in \mathcal{T}_q} \operatorname{Norm}_{K_g/\mathbb{Q}} \left( \gcd(\sigma(u) - a_{\sigma(q)}(g)) \right)$$

which is sharper than (9.10). A similar calculation as above shows that the previous bound is an invariant of $[g]$. However, in practice we prefer not to use this bound as it requires computing several $\gcd$'s over $K$ which is usually more time consuming.

9.6. **Coefficients of $g$ living in subfields of $K_g$.** Assume here that $\sigma(\mathcal{N}) = \mathcal{N}$, for all $\sigma \in G_{\mathbb{Q}}$ (such hypothesis is satisfied when $\mathcal{N} = 2^2 \mathfrak{q}_1^2 \mathfrak{n}_d$ or $\mathcal{N} = 2^2 \mathfrak{q}_r \mathfrak{n}_d$ for instance). Recall that $S$ denotes the set of Hilbert modular newforms of parallel weight 2 and level $\mathcal{N}$. Then, there is a right action $(f, \sigma) \mapsto f^\sigma$ of $\text{Gal}(K/\mathbb{Q})$ on $S$ such that

$$a_q(f^\sigma) = a_{\sigma(q)}(f),$$

for any prime ideal $\mathfrak{q}$ in $\mathcal{O}_K$ (see [49, §6.3] for a high-level description).

This action commutes with that defined in Subsection 9.1 and thus $\text{Gal}(K/\mathbb{Q})$ acts on the set of Hecke constituents $\{[f] : f \in S\}$ as $([f], \sigma) \mapsto [f^\sigma]$.

**Definition 9.13.** Let $F/\mathbb{Q}$ be a subextension of $K/\mathbb{Q}$. We say that $f \in S$ is a base change from $F$ (to $K$) if for all $\sigma \in \text{Aut}(K/F)$, we have $f^\sigma = f$.

Observe that if $f \in S$ is a base change from $\mathbb{Q}$, then $a_q(f) = a_{\sigma(q)}(f)$ for all $\sigma$ in $\text{Gal}(K/\mathbb{Q})$ and all prime ideals $\mathfrak{q}$ in $\mathcal{O}_K$, and thus the orbit of its Hecke constituent $[f]$ under the $\text{Gal}(K/\mathbb{Q})$-action is of size 1; we remark the converse is not true (see [7, §3] for an example).

Let $\sigma_0$ be a fixed generator of $\text{Gal}(K/\mathbb{Q})$ and assume that $g \in S$ is such that its Hecke field $K_g$ contains $K$ and $g$ is not a base change from any (non-trivial) subextension of $K/\mathbb{Q}$. Suppose further that the orbit of $[g]$ under the action of $\text{Gal}(K/\mathbb{Q})$ has size 1, or in other words that $g$ and $g^{\sigma_0}$ define the same Hecke constituent. Hence there exists $\tau_0 \in G_{\mathbb{Q}}$ such that we have $g^{\sigma_0} = \tau_0 g$.
Moreover $\tau_0$ acts through its restriction to $K_g$ and this restriction is an automorphism of $K_g$ since $\tau_0(a_q(g)) = a_{\sigma_0(q)}(g) \in K_g$ for all prime ideals $q$ in $O_K$.

Let $E_g$ be the subfield of $K_g$ fixed by the subgroup of Aut$(K_g)$ generated by $\tau_0$. Let us show that $\tau_0$ has order $[K : \mathbb{Q}]$ in Aut$(K_g)$. For every $k \ge 1$, we have $g^{\sigma_0^k} = \tau_0^k g$ as the two actions commute. If $\sigma_0^k$ is trivial, then we have $\tau_0^k(a_q(g)) = a_q(\tau_0^k g) = a_q(g)$ for all prime ideals $q$ in $O_K$, and hence $\tau_0^k$ is also trivial. Conversely, if $\tau_0^k$ is trivial, then we have $g^{\sigma_0^k} = g$ and we conclude that $\sigma_0^k$ is trivial by the assumption that $g$ is not a base change from any subextension of $K$.

Therefore, we have $[K_g : \mathbb{Q}] = [K_g : E_g][E_g : \mathbb{Q}] = [K : \mathbb{Q}][E_g : \mathbb{Q}]$, and hence

$$[E_g : \mathbb{Q}] = [K_g : \mathbb{Q}]/[K : \mathbb{Q}] = [K_g : K].$$

Assume now that $q$ is inert in $K$ and write $qO_K = q$. On one hand, we know from Lemma 3.14 that $a_q(J_r) \in \mathbb{Z} \subset E_g$ and thus $T_q = \{a_q(J_r)\}$ consists of a single integer. On the other hand, we have

$$\tau_0(a_q(g)) = a_q(\tau_0 g) = a_q(g^{\sigma_0}) = a_{\sigma_0(q)}(g) = a_q(g)$$

and hence $a_q(g) \in E_g$.

Therefore, if (9.1) holds for $g$ satisfying all of the above assumptions, then for any subset $\mathfrak{S}$ of $\text{Gal}(K/\mathbb{Q})$, we have

$$N_{q,\mathfrak{S}}(g) = N_{q,\{1\}}(g) = \text{Norm}_{K_g/\mathbb{Q}}(a_q(J_r) - a_q(g))$$

and hence the divisibility relation (9.10) simplifies to

$$(9.14) \qquad p | \text{Norm}_{E_g/\mathbb{Q}}(a_q(J_r) - a_q(g))$$

because

$$\text{Norm}_{K_g/\mathbb{Q}}(a_q(J_r) - a_q(g)) = \text{Norm}_{E_g/\mathbb{Q}}(a_q(J_r) - a_q(g))^{[K_g:E_g]}.$$

We note that the right-hand side of (9.14) does not change if $g$ is replaced by a conjugate $^\tau g$. Indeed, this follows from the previous equality and the fact that $[K_{\tau g} : E_{\tau g}] = [K_g : E_g]$, where this equality of degrees holds because $(^\tau g)^{\sigma_0} = \tau_0^\tau \tau_0^{-1} (^\tau g)$ and hence $E_{\tau g} := K_{\tau g}^{\langle \tau_0^\tau \tau_0^{-1} \rangle} = \tau(E_g)$.

We point out that, due to possible large degrees of the Hecke fields involved in our applications, this improvement on the norm map will turn out to be very significant.

**9.7. A bound at primes of multiplicative reduction.** Here we again assume $\sigma(\mathcal{N}) = \mathcal{N}$ for all $\sigma \in G_{\mathbb{Q}}$. Suppose also that $q$ is a rational prime such that $q \nmid 2r$, $q \mid a^r + b^r$ and $q$ is coprime to $\mathcal{N}$. We know from Proposition 5.14 that $J_r$ has bad multiplicative reduction at any prime ideal above $q$ in $K$. Moreover, since $q$ is coprime to $\mathcal{N}$, we see from (9.1) that $g$ satisfies level raising mod $\mathfrak{P}$ at every such prime.

Therefore, for any prime ideal $q$ above $q$ in $K$ and any non-empty subset $\mathfrak{S}$ of $\text{Gal}(K/\mathbb{Q})$, we have

$$p | M_{q,\mathfrak{S}}(g) := \text{gcd} \text{Norm}_{K_g/\mathbb{Q}}(a_{\sigma(q)}(g)^2 - (N(q) + 1)^2),$$

where we used that $N(\sigma(q)) = N(q)$.

For all $\tau \in G_{\mathbb{Q}}$ and $\sigma \in \mathfrak{S}$, since $\tau(N(q) + 1) = N(q) + 1$, we have

$$\begin{align*}
& \text{Norm}_{K_{\tau g}/\mathbb{Q}}(a_{\sigma(q)}(^\tau g)^2 - (N(q) + 1)^2) \\
&= \text{Norm}_{\tau(K_g)/\mathbb{Q}}((^\tau g)^2 - (N(q) + 1)^2) \\
&= \text{Norm}_{\tau(K_g)/\mathbb{Q}}(\tau(a_{\sigma(q)}(g)^2 - (N(q) + 1)^2)) \\
&= \text{Norm}_{K_g/\mathbb{Q}}(a_{\sigma(q)}(g)^2 - (N(q) + 1)^2)
\end{align*}$$
showing that $M_{q,\mathfrak{g}}(\tau g) = M_{q,\mathfrak{g}}(g)$.

9.8. **Interchanging $a$ and $b$.** From Proposition 3.3 we see that $C_r(a, b)$ and $C_r(b, a)$ are related by the quadratic twist by $-1$, which, for all $q$ of good reduction for $J_r(a, b)$, gives the relation of traces

$$a_q(J_r(b, a)) = \chi_{-1}|_{G_K}(\text{Frob}_q)a_q(J_r(a, b)) = \begin{cases} a_q(J_r(a, b)) & \text{if } N(q) \equiv 1 \pmod 4 \\ -a_q(J_r(a, b)) & \text{if } N(q) \equiv -1 \pmod 4 \end{cases}$$

where $\chi_{-1}$ is the character of $G_{\mathbb{Q}}$ fixing $\mathbb{Q}(i)$. We stress the fact that, since $K/\mathbb{Q}$ is Galois, the condition $N(q) \equiv \pm 1 \pmod 4$ only depends on the rational prime $q$ below $q$.

9.9. **Quadratic twists by $\chi_r$.** Let $\chi_r$ denote the mod $r$ cyclotomic character of $G_{\mathbb{Q}}$. It has conductor $r$ and order $r-1$. In particular, $\chi_r|_{G_K}$ is quadratic and unramified away from $q_r$ in $K$. Therefore, for $g \in S$ of level $\mathcal{N} = q_r^2\mathcal{N}'$ with $q_r + \mathcal{N}'$, the quadratic twist $g \otimes \chi_r|_{G_K}$ is of level $\mathcal{N}'$, $q_r\mathcal{N}'$ or $q_r^2\mathcal{N}'$. Moreover, for all $q + \mathcal{N}$, we have the following relation on Fourier coefficients

$$a_q(g \otimes \chi_r|_{G_K}) = \chi_r(\text{Frob}_q)a_q(g) = \begin{cases} a_q(g) & \text{if } N(q) \equiv 1 \pmod r \\ -a_q(g) & \text{if } N(q) \equiv -1 \pmod r \end{cases}$$

In particular, this relation shows that we only need to access the value of the trace of one form in each pair of twisted forms. This still saves significant amounts of time due to the time that Magma needs to access Fourier coefficients at primes of large norm. As before, we note that, since $K/\mathbb{Q}$ is Galois, the condition $N(q) \equiv \pm 1 \pmod r$ only depends on the rational prime $q$ below $q$.

9.10. **Discarding isomorphisms.** In this last subsection, we put together all the arguments explained so far and discuss how we can finally rule out the existence of certain non-trivial primitive solutions to equation (1.4) for an explicit value of $r$ using properties of Kraus' Frey hyperelliptic curves.

Assume that there exists $c \in \mathbb{Z}$ such that $(a, b, c)$ is a non-trivial primitive solution to equation (1.4) satisfying

$$a \equiv 0 \pmod 2 \quad \text{and} \quad b \equiv 1 \pmod 4.$$

Moreover, assume that for every prime ideal $p$ in $K$ above $p$, the representation $\bar{\rho}_{J_r,p}$ is absolutely irreducible. According to Theorem 8.3, there exists $g \in S$, the set of Hilbert newforms of level $\mathcal{N} = 2^2 q_r^2 n_d$, parallel weight 2, and trivial character such that (9.1) holds and in addition $K \subset K_g$.

For each rational prime $q$ such that $q + 2rd$, each prime ideal $q$ of $K$ above $q$ and each non-empty subset $\mathfrak{S}$ of $\text{Gal}(K/\mathbb{Q})$, we construct an integer $B_{q,\mathfrak{S}}(g)$ (to be computed with Magma in practical situations) which only depends on the Hecke constituent $[g]$ of $g$. We will have that $p \mid B_{q,\mathfrak{S}}(g)$.

Therefore, if for each $g \in S$ running over a set of representatives of the Hecke constituents, we contradict this divisibility relation for one such prime $q$, then we have ruled out the existence of a solution $(a, b, c)$ as above. The construction of $B_{q,\mathfrak{S}}(g)$ uses all the results proved so far.

Let $(x', y') \in \{0, \dots, q-1\}^2 \setminus \{(0, 0)\}$ be such that we have $(a, b) \equiv (x', y') \pmod q$.

Assume that $q + x'^r + y'^r$. Then $J_r(a, b)$ has good reduction at all prime ideals above $q$ in $K$ and

$$\begin{aligned} \mathcal{T}_q(a, b) &= \{a_{q'}(J_r(a, b)) : q' \mid q \text{ in } \mathcal{O}_K\} \\ &= \{a_{q'}(J_r(x', y')) : q' \mid q \text{ in } \mathcal{O}_K\} = \mathcal{T}_q(x', y'). \end{aligned}$$

From the discussion in §9.4-Subsection 9.6 it follows that for any subset $\mathfrak{S}$ of $\text{Gal}(K/\mathbb{Q})$, we have

$$p \mid \prod_{u \in \mathcal{T}_q(x', y')} \text{gcd} \operatorname{Norm}_{E_g/\mathbb{Q}}(\sigma(u) - a_{\sigma(q)}(g)),$$
where $E_g = K_g$ or $E_g$ is a subextension of $K_g/\mathbb{Q}$ such that $[E_g : \mathbb{Q}] = [K_g : K]$. This latter case occurs only when $q$ is inert in $K$, $g$ is not a base change from any subextension of $K/\mathbb{Q}$ and $[g]$ is fixed under the action of $\text{Gal}(K/\mathbb{Q})$.

Putting this together with the discussion in Subsection 9.7, we conclude that, independently of the reduction type of $J_r(a, b)$ at the prime ideals above $q$ (that is independently of $a^r + b^r$ (mod $q$)), we have that $p$ divides

$$M_{q,\mathfrak{S}}(g) \cdot \prod_{\substack{0 \le x, y \le q-1 \\ q+x^r+y^r}} \prod_{u \in \mathcal{T}_q(x,y)} \gcd \operatorname{Norm}_{E_g/\mathbb{Q}} (\sigma(u) - a_{\sigma(q)}(g)).$$

Moreover, the two quantities above are invariants of $[g]$ since they are products of quantities which we know to have this property.

We will now refine this quantity using the discussion in Subsection 9.8; these improvements considerably lower the total computational time in practice.

Since $K/\mathbb{Q}$ is Galois, there is a unique residue degree among the primes $q \mid q$; denote it by $f_q$.

Assume $q^{f_q} \equiv 1 \pmod 4$. Then, for any $\mathfrak{q} \mid q$ in $K$, we have $N(\mathfrak{q}) \equiv 1 \pmod 4$ and by §9.8, for any $(x, y) \in \{0, \dots, q-1\}^2$ such that $q + x^r + y^r$, we have $a_{\mathfrak{q}}(J_r(x, y)) = a_{\mathfrak{q}}(J_r(y, x))$.

In this case, we set

$$(9.15) \qquad B_{q,\mathfrak{S}}(g) := M_{q,\mathfrak{S}}(g) \cdot \prod_{\substack{0 \le x \le y \le q-1 \\ q+x^r+y^r}} \prod_{u \in \mathcal{T}_q(x,y)} \gcd \operatorname{Norm}_{E_g/\mathbb{Q}} (\sigma(u) - a_{\sigma(q)}(g)).$$

where the notation is exactly as above; we highlight the difference that the outermost product differs from above in that it contains the additional restriction $x \le y$.

Assume $q^{f_q} \equiv -1 \pmod 4$. Then, for any $\mathfrak{q} \mid q$ in $K$, we have $N(\mathfrak{q}) \equiv 1 \pmod 4$. Then, for any $(x, y) \in \{0, \dots, q-1\}^2$ such that $q + x^r + y^r$, we have $a_{\mathfrak{q}}(J_r(x, y)) = -a_{\mathfrak{q}}(J_r(y, x))$.

In this case, we set

$$(9.16) \qquad B_{q,\mathfrak{S}}(g) := M_{q,\mathfrak{S}}(g) \cdot \prod_{\substack{0 \le x \le y \le q-1 \\ q+x^r+y^r}} \prod_{u \in \mathcal{T}_q(x,y)} \gcd \operatorname{Norm}_{E_g/\mathbb{Q}} (\sigma(u)^2 - a_{\sigma(q)}(g)^2).$$

Finally, from the discussion above, we have that $p \mid B_{q,\mathfrak{S}}(g)$ in all cases; furthermore, when $\mathfrak{S} = \text{Gal}(K/\mathbb{Q})$, we obtain a quantity $B_q(g) = B_{q,\mathfrak{S}}(g)$ depending only on $q$ and $[g]$.

We now explain how the discussion in Subsection 9.9 allows to reduce the number of forms to consider. Assume here that $g = h \otimes \chi_r|_{\mathcal{G}_K}$ where $h$ is in $S$ (i.e., $h$ also has level $2^2 q_r^2 n_d$). We have $a_{\mathfrak{q}}(g) = \chi_r(\text{Frob}_{\mathfrak{q}})a_{\mathfrak{q}}(h)$ for any prime ideal $\mathfrak{q} \mid 2q_r n_d$ in $K$, where $\chi_r(\text{Frob}_{\mathfrak{q}}) \in \{\pm 1\}$ depends only on the rational prime $q$ below $\mathfrak{q}$.

Further, we have $K_g = K_h$, the quantity $M_{q,\mathfrak{S}}(g)$ defined in Subsection 9.7 satisfies

$$ \begin{aligned} M_{q,\mathfrak{S}}(g) &= \gcd \operatorname{Norm}_{K_g/\mathbb{Q}} (a_{\sigma(q)}(g)^2 - (N(\mathfrak{q})+1)^2) \\ &= \gcd \operatorname{Norm}_{K_g/\mathbb{Q}} (a_{\sigma(q)}(h)^2 - (N(\mathfrak{q})+1)^2) \\ &= M_{q,\mathfrak{S}}(h). \end{aligned} $$

Moreover, the fields $E_g$ and $E_h$ are equal in all cases explained above.

Now, if $q^{f_q} \equiv 1 \pmod r$ or $q^{f_q} \equiv -1 \pmod 4$, then we deduce that $B_{q,\mathfrak{S}}(g) = B_{q,\mathfrak{S}}(h)$.
Else, if $q^{f_q} \equiv -1 \pmod r$ and $q^{f_q} \equiv 1 \pmod 4$, then $B_{q,\mathfrak{g}}(g)B_{q,\mathfrak{g}}(h)$ divides

$$M_{q,\mathfrak{g}}(g)^2 \cdot \prod_{\substack{0 \le x \le y \le q-1 \\ q+x^r+y^r}} \prod_{u \in \mathcal{T}_q(x,y)} \gcd \operatorname{Norm}_{E_g/\mathbb{Q}} (\sigma(u)^2 - a_{\sigma(q)}(g)^2),$$

and proving that $p$ does not divide this number implies $p \mid B_{q,\mathfrak{g}}(g)$ and $p \mid B_{q,\mathfrak{g}}(h)$.

In both cases, dealing with one form allows to get the desired information on the other.

Finally, if we further assume that $r \mid a+b$, then according to Corollary 8.7, we have

$$\bar{\rho}_{J_r, p} \otimes \chi_r |_{G_K} \simeq \bar{\rho}_{g, \mathfrak{P}}$$

for some $\mathfrak{P} \mid p$ in $K_g$ of $g$, where $g$ is a Hilbert modular newform over $K$ of parallel weight 2, trivial character and level $2^2 q_r n_d$ such that $K \subset K_g$ and $\mathfrak{P} \cap \mathcal{O}_K = \mathfrak{P}$.

Let again $q+2rd$ be a rational prime. With the same notation as before, if $q^{f_q} \equiv -1 \pmod 4$, then define $B_{q,\mathfrak{g}}(g)$ as in (9.16); if $q^{f_q} \equiv 1 \pmod 4$ and $q^{f_q} \equiv 1 \pmod r$, then define $B_{q,\mathfrak{g}}(g)$ as in (9.15). Lastly, if $q^{f_q} \equiv 1 \pmod 4$ and $q^{f_q} \equiv -1 \pmod r$, we define

$$(9.17) \qquad B_{q,\mathfrak{g}}(g) := M_{q,\mathfrak{g}}(g) \cdot \prod_{\substack{0 \le x \le y \le q-1 \\ q+x^r+y^r}} \prod_{u \in \mathcal{T}_q(x,y)} \gcd \operatorname{Norm}_{E_g/\mathbb{Q}} (\sigma(u) + a_{\sigma(q)}(g))$$

and the same reasoning as above, implies that $p$ divides $B_{q,\mathfrak{g}}(g)$ in all cases.

9.11. **Refined elimination.** Sometimes, after following the procedure explained in Subsection 9.10, we are unable to obtain a contradiction to (9.1) for a specific Hecke constituent $[g]$ and a concrete exponent $p$. It might be the case that this remaining exponent can be eliminated using the above procedure with additional auxiliary primes; however, we do not know how to predict a new prime $q$ that succeeds and, moreover, the required computational time grows fast with the norm of $q$ due to the growing number of congruence classes of $(x,y)$ mod $q$ to be considered.

Alternatively, we can use a technique introduced by the authors in [10, §7.3] which we refer to as *refined elimination*. This technique is designed to discard the possibility that concrete primes $\mathfrak{P} \mid p$ in $K_g$ appear on the right hand side of (9.1); the main difficulty with refined elimination is to compute the prime factorization of $p$ in $K_g$. In *loc. cit.* we explained how to apply it in the context of the modular method using Frey elliptic curves; to apply it in our present setting, we need to slightly modify the procedure due to the fact that the field of coefficients of our Frey variety is not $\mathbb{Q}$.

In the previous sections, after replacing $g$ by $^\tau g$ if needed, we assumed that (9.1) holds and $\mathfrak{P} \cap \mathcal{O}_K = \mathfrak{P}$. This led to (9.5) and then to $p \mid B_{q,\mathfrak{g}}(g)$ for some $q$. The observation behind refined elimination is that some prime $p$ may divide $B_{q,\mathfrak{g}}(g)$ but (9.1) does not hold for all $\mathfrak{P} \mid p$ in $K_g$. To detect this we work directly with the residual representations $\bar{\rho}_{J_r,p}$ and $\bar{\rho}_{g,\mathfrak{P}}$. We stress that $\bar{\rho}_{g,\mathfrak{P}}$ and $\bar{\rho}_{g,\mathfrak{P}'}$ do not have to be isomorphic when $\mathfrak{P}$ and $\mathfrak{P}'$ are different primes in $K_g$ dividing $p$. So we will show that $\bar{\rho}_{J_r,p} \not\equiv \bar{\rho}_{g,\mathfrak{P}}$ for all $\mathfrak{P} \mid p$ in $K_g$ which implies the same is true for all the forms in $[g]$ because $\bar{\rho}_{g,\mathfrak{P}} \simeq \bar{\rho}_{\tau g,\mathfrak{P}\tau}$ for all $\tau \in G_{\mathbb{Q}}$ by Proposition 9.2.

We assume that $K \subset K_g$ and $p$ is totally split in $K_g$. In particular, $p$ is totally split in $K$ and we write the two prime factorizations as

$$p\mathcal{O}_K = \mathfrak{P}_1 \cdots \mathfrak{P}_k \quad \text{and} \quad p\mathcal{O}_{K_g} = \mathfrak{P}_1 \cdots \mathfrak{P}_n.$$

Since $\mathbb{Z} \subset \mathcal{O}_K \subset \mathcal{O}_{K_g}$ and $\mathbb{Z}/p\mathbb{Z} = \mathbb{F}_p$ has no non-trivial automorphisms, we have a natural identification of all the residue fields

$$\mathcal{O}_K/\mathfrak{P}_i = \mathcal{O}_{K_g}/\mathfrak{P}_j = \mathbb{F}_p.$$
Assume now that a non-trivial primitive solution $(a, b, c)$ to (1.4) gives rise to (9.1) for some $i, j$, that is

$$ (9.18) \qquad \bar{\rho}_{J_r, \mathfrak{p}_i} \simeq \bar{\rho}_{g, \mathfrak{P}_j}. $$

Let $q + 2rd$ be a prime such that $J_r$ has multiplicative reduction at one (hence all) $q \mid q$ in $K$. From the isomorphism (9.18) we see that $g$ satisfies the level raising condition mod $\mathfrak{P}_j$ at all $q \mid q$. Therefore, for all $q \mid q$, we have

$$ (\mathrm{Norm}_{K/\mathbb{Q}}(q) + 1)^2 - a_q(g)^2 \pmod{\mathfrak{P}_j} = 0 \quad \text{in } \mathbb{F}_p. $$

With **Magma** we run over all the values for $j$ and check there is always some $q$ for which this equality fails. We conclude that $J_r$ has good reduction at all $q \mid q$ in $K$.

Let $(x, y) \in \{0, \dots, q-1\}^2$ be such that $q + x^r + y^r$ and $(a, b) \equiv (x, y) \pmod{q}$.

Pick $u \in \mathcal{T}_q(x, y)$ and assume that $a_q(J_r) = u$.

Now by taking traces at $\mathrm{Frob}_q$ in (9.18) and using (3.15) we have

$$ (9.19) \qquad \sigma(u) \pmod{\mathfrak{p}_i} = a_{\sigma(q)}(g) \pmod{\mathfrak{P}_j} \quad \text{as elements in } \mathbb{F}_p \text{ for all } \sigma \in \mathrm{Gal}(K/\mathbb{Q}). $$

With **Magma** we run over all the values for $i, j$ and verify that there is always some $\sigma$ for which this equality fails. We repeat this for all $u \in \mathcal{T}_q(x, y)$, reaching the same conclusion, hence $(a, b) \nmid (x, y) \pmod{q}$. Repeating this for all $(x, y)$ as above contradicts (9.18).

In practice, we can accelerate this procedure by using the properties discussed in the previous sections. This is analogous to the various cases explained in Subsection 9.10. Recall that $f_q$ denotes the common residue degree of the prime ideals above $q$ in $K$, so that $\mathrm{Norm}_{K/\mathbb{Q}}(q) = q^{f_q}$ for all $q \mid q$.

We have the following cases:

(1) We want to discard only $g$. We can run only over congruence classes such that $x \le y$ while replacing (9.19) with

$$ (9.20) \qquad \sigma(u)^2 \pmod{\mathfrak{p}_i} = a_{\sigma(q)}(g)^2 \pmod{\mathfrak{P}_j} \quad \text{as elements in } \mathbb{F}_p \text{ for all } \sigma \in \mathrm{Gal}(K/\mathbb{Q}) \\ \text{if } q^{f_q} \equiv -1 \pmod{4}; $$

(2) We want to discard both $g$ and $g \otimes \chi_r$ at the same level. We run over congruence classes such that $x \le y$ while testing (9.19) when $q^{f_q} \equiv 1 \pmod{4}$ and $q^{f_q} \equiv 1 \pmod{r}$, otherwise testing (9.20);

(3) We want to discard only a twist of $g$. This occurs when $r \mid a+b$, in which case (9.18) is replaced by $\bar{\rho}_{J_r, \mathfrak{p}_i} \simeq \bar{\rho}_{g, \mathfrak{P}_j} \otimes \chi_r|_{G_K}$. We run over congruence classes such that $x \le y$ while testing (9.19) if $q^{f_q} \equiv 1 \pmod{4}$ and $q^{f_q} \equiv 1 \pmod{r}$, testing (9.20) if $q^{f_q} \equiv -1 \pmod{4}$ and otherwise testing

$$ \sigma(u) \pmod{\mathfrak{p}_i} = -a_{\sigma(q)}(g) \pmod{\mathfrak{P}_j} \quad \text{as elements in } \mathbb{F}_p \text{ for all } \sigma \in \mathrm{Gal}(K/\mathbb{Q}). $$

## 10. A MULTI-FREY APPROACH TO $x^{11} + y^{11} = z^p$ USING FREY ABELIAN VARIETIES

This section is devoted to proving Theorem 1.5 using a multi-Frey approach.