[proofplan]
We first reduce the assertion for an arbitrary integer exponent $n>2$ to the assertion for exponent $4$ or for an odd prime exponent $p$. The exponent $4$ and exponent $3$ cases are classical, so the only remaining case is a primitive solution of $A^p+B^p=C^p$ with $p\geq 5$ prime. From such a solution one constructs the Frey elliptic curve; the [modularity theorem for elliptic curves over $\mathbb{Q}$](/theorems/4787) makes it modular, while [Ribet's level-lowering theorem](/theorems/4774) forces a weight-$2$ newform of level $2$, and the dimension computation for that space says no such form exists. This contradiction eliminates every possible exponent.
[/proofplan]
[step:Reduce an arbitrary exponent to exponent $4$ or an odd prime exponent]
Assume, for contradiction, that there exist an integer $n>2$ and non-zero integers $a,b,c$ such that
\begin{align*}
a^n+b^n=c^n.
\end{align*}
Let $d:=\gcd(a,b,c)$, and define non-zero integers $a_0:=a/d$, $b_0:=b/d$, and $c_0:=c/d$. Dividing the displayed equation by $d^n$ gives
\begin{align*}
a_0^n+b_0^n=c_0^n,
\end{align*}
and $\gcd(a_0,b_0,c_0)=1$. This also implies that $a_0,b_0,c_0$ are pairwise coprime: if a prime divides two of them, the displayed equation forces it to divide the third.
If $4\mid n$, define non-zero integers $A:=a_0^{n/4}$, $B:=b_0^{n/4}$, and $C:=c_0^{n/4}$. Then
\begin{align*}
A^4+B^4=C^4,
\end{align*}
contradicting Fermat's theorem for exponent $4$. Hence $4\nmid n$.
Since $n>2$ and $4\nmid n$, either $3\mid n$ or some prime $p\geq 5$ divides $n$. If $3\mid n$, define non-zero integers $A:=a_0^{n/3}$, $B:=b_0^{n/3}$, and $C:=c_0^{n/3}$. Then
\begin{align*}
A^3+B^3=C^3,
\end{align*}
contradicting Fermat's theorem for exponent $3$.
It remains to handle the case in which a prime $p\geq 5$ divides $n$. Define non-zero integers
\begin{align*}
A:=a_0^{n/p}, \qquad B:=b_0^{n/p}, \qquad C:=c_0^{n/p}.
\end{align*}
Then
\begin{align*}
A^p+B^p=C^p.
\end{align*}
Since $a_0,b_0,c_0$ are pairwise coprime, the integers $A,B,C$ are pairwise coprime. Therefore it remains only to rule out a primitive solution of
\begin{align*}
A^p+B^p=C^p
\end{align*}
with $p\geq 5$ prime and $ABC\neq 0$.
[/step]
[step:Attach the Frey curve to a primitive prime exponent solution]
Assume that $p\geq 5$ is prime and that non-zero pairwise coprime integers $A,B,C$ satisfy
\begin{align*}
A^p+B^p=C^p.
\end{align*}
Let $\mathbb{Q}$ denote the field of rational numbers, let $\overline{\mathbb{Q}}$ denote a fixed [algebraic closure](/page/Algebraic%20Closure) of $\mathbb{Q}$, let $\mathbb{F}_p$ denote the finite field with $p$ elements, let $G_{\mathbb{Q}}:=\operatorname{Gal}(\overline{\mathbb{Q}}/\mathbb{Q})$ denote the absolute [Galois group](/page/Galois%20Group) of $\mathbb{Q}$, and let $GL_2(\mathbb{F}_p)$ denote the group of invertible $2\times 2$ matrices with entries in $\mathbb{F}_p$.
Define the Frey elliptic curve $E_{A,B,p}$ over $\mathbb{Q}$ by the affine Weierstrass equation
\begin{align*}
E_{A,B,p}: y^2=x(x-A^p)(x+B^p).
\end{align*}
Let
\begin{align*}
\rho_{E_{A,B,p},p}: G_{\mathbb{Q}} \to GL_2(\mathbb{F}_p)
\end{align*}
denote the mod-$p$ Galois representation induced by the action of $G_{\mathbb{Q}}$ on the $p$-torsion subgroup $E_{A,B,p}[p]$.
By the Frey curve theorem for primitive Fermat solutions, the displayed primitive Fermat relation implies the following concrete properties: $E_{A,B,p}$ is semistable over $\mathbb{Q}$; the residual representation $\rho_{E_{A,B,p},p}$ is irreducible; the prime-to-$p$ conductor of $E_{A,B,p}$ is supported only at $2$ and at the primes dividing $ABC$; and after removing, by level lowering, the primes dividing $ABC$, the residual conductor of $\rho_{E_{A,B,p},p}$ is exactly $2$. The hypotheses of this cited Frey theorem are precisely the pairwise coprimality of $A,B,C$, the primality condition $p\geq 5$, the non-vanishing condition $ABC\neq 0$, and the equation $A^p+B^p=C^p$, all of which are in force.
[guided]
The purpose of the Frey curve is to convert a hypothetical Diophantine solution into an elliptic curve whose Galois representation has impossible modular-form consequences. We first fix the ambient arithmetic notation. The field $\mathbb{Q}$ is the field of rational numbers, $\overline{\mathbb{Q}}$ is a chosen algebraic closure, $G_{\mathbb{Q}}:=\operatorname{Gal}(\overline{\mathbb{Q}}/\mathbb{Q})$ is the absolute Galois group, $\mathbb{F}_p$ is the finite field with $p$ elements, and $GL_2(\mathbb{F}_p)$ is the group of invertible $2\times 2$ matrices over $\mathbb{F}_p$.
From the primitive solution we define the elliptic curve
\begin{align*}
E_{A,B,p}: y^2=x(x-A^p)(x+B^p)
\end{align*}
over $\mathbb{Q}$. Its $p$-torsion subgroup $E_{A,B,p}[p]$ is a two-dimensional [vector space](/page/Vector%20Space) over $\mathbb{F}_p$, so the natural Galois action on torsion gives a representation
\begin{align*}
\rho_{E_{A,B,p},p}: G_{\mathbb{Q}} \to GL_2(\mathbb{F}_p).
\end{align*}
The Frey curve theorem for primitive Fermat solutions applies because $A,B,C$ are pairwise coprime, $ABC\neq 0$, $p\geq 5$ is prime, and $A^p+B^p=C^p$. Its conclusion is not merely that a Frey curve exists: it gives the exact arithmetic input needed later. Namely, $E_{A,B,p}$ is semistable over $\mathbb{Q}$, $\rho_{E_{A,B,p},p}$ is irreducible, the prime-to-$p$ conductor of $E_{A,B,p}$ is supported only at $2$ and at primes dividing $ABC$, and Ribet level lowering removes the primes dividing $ABC$ from the residual conductor, leaving residual level $2$.
[/guided]
[/step]
[step:Use modularity and level lowering to force a level $2$ newform]
Here an elliptic curve over $\mathbb{Q}$ is called modular if its $L$-function is the $L$-function of a weight-$2$ cuspidal newform of level equal to its conductor. By the [modularity theorem for semistable elliptic curves](/theorems/4787) over $\mathbb{Q}$, every semistable elliptic curve over $\mathbb{Q}$ is modular. Since $E_{A,B,p}$ is semistable by the preceding step, $E_{A,B,p}$ is modular.
Apply Ribet's level-lowering theorem to the irreducible residual representation $\rho_{E_{A,B,p},p}$. The theorem requires a modular residual representation, irreducibility, and the local minimality and conductor hypotheses governing which primes may be removed from the modular level. Modularity follows from the preceding paragraph, irreducibility was supplied by the Frey curve theorem, and the Frey conductor computation says precisely that the primes dividing $ABC$ are removable and that the remaining residual conductor is $2$. Therefore there exists a weight-$2$ cuspidal newform of level $2$ whose mod-$p$ Galois representation is congruent to $\rho_{E_{A,B,p},p}$.
[guided]
The modularity theorem supplies the bridge from elliptic curves to modular forms. In the form needed here, it says that every semistable elliptic curve over $\mathbb{Q}$ is modular: its $L$-function is the $L$-function of a weight-$2$ cuspidal newform at the same conductor. The Frey curve theorem proved semistability for $E_{A,B,p}$, so $E_{A,B,p}$ is modular.
Now Ribet's level-lowering theorem is applied to
\begin{align*}
\rho_{E_{A,B,p},p}: G_{\mathbb{Q}} \to GL_2(\mathbb{F}_p).
\end{align*}
Its hypotheses are not only formal modularity. It requires that the residual representation be irreducible, that it arise from a modular form, and that its local conductor behaviour permit removal of the primes at which the original elliptic curve has semistable multiplicative reduction. These are exactly the facts recorded in the Frey step: $\rho_{E_{A,B,p},p}$ is irreducible, modularity has just been obtained from semistable modularity, and the Frey conductor computation says that all primes dividing $ABC$ are removed by level lowering while the residual conductor left behind is $2$. Ribet's conclusion is therefore that there exists a weight-$2$ cuspidal newform of level $2$ whose mod-$p$ Galois representation is congruent to $\rho_{E_{A,B,p},p}$.
[/guided]
[/step]
[step:Contradict the nonexistence of weight $2$ level $2$ cusp forms]
Let $\Gamma_0(2)$ denote the congruence subgroup
\begin{align*}
\Gamma_0(2):=\left\{\begin{pmatrix} a & b \\ c & d \end{pmatrix}\in SL_2(\mathbb{Z}) : c\equiv 0 \pmod{2}\right\},
\end{align*}
and let $S_2(\Gamma_0(2))$ denote the complex vector space of weight-$2$ cusp forms for $\Gamma_0(2)$. By the dimension formula for weight-$2$ cusp forms on $\Gamma_0(2)$,
\begin{align*}
\dim S_2(\Gamma_0(2))=0.
\end{align*}
Thus there is no weight-$2$ cuspidal newform of level $2$. This contradicts the newform forced by Ribet's level-lowering theorem in the previous step.
Consequently no primitive non-zero integer solution exists for prime exponent $p\geq 5$. Together with the exponent $3$ and exponent $4$ exclusions and the reduction step, this proves that for every integer $n>2$ there are no non-zero integers $a,b,c$ satisfying $a^n+b^n=c^n$.
[/step]