Proof of Fermat's Last Theorem for specific exponents

Fermat's Last Theorem is a theorem in number theory, originally stated by Pierre de Fermat in 1637 and proven by Andrew Wiles in 1995. The statement of the theorem involves an integer exponent $n$ larger than 2. In the centuries following the initial statement of the result and before its general proof, various proofs were devised for particular values of the exponent $n$. Several of these proofs are described below, including Fermat's proof in the case $n = 4$, which is an early example of the method of infinite descent.

Mathematical preliminaries
Fermat's Last Theorem states that no three positive integers $(a, b, c)$ can satisfy the equation $a^{n} + b^{n} = c^{n}$ for any integer value of $n$ greater than 2. (For $n$ equal to 1, the equation is a linear equation and has a solution for every possible $a$ and $b$. For $n$ equal to 2, the equation has infinitely many solutions, the Pythagorean triples.)

Factors of exponents
A solution $(a, b, c)$ for a given $n$ leads to a solution for all the factors of $n$: if $h$ is a factor of $n$ then there is an integer $g$ such that $n = gh$. Then $(a^{g}, b^{g}, c^{g})$ is a solution for the exponent $h$:



Therefore, to prove that Fermat's equation has no solutions for $(a^{g})^{h} + (b^{g})^{h} = (c^{g})^{h}$, it suffices to prove that it has no solutions for $n > 2$ and for all odd primes $n = 4$.

For any such odd exponent $p$, every positive-integer solution of the equation $p$ corresponds to a general integer solution to the equation $a^{p} + b^{p} = c^{p}$. For example, if $a^{p} + b^{p} + c^{p} = 0$ solves the first equation, then $(3, 5, 8)$ solves the second. Conversely, any solution of the second equation corresponds to a solution to the first. The second equation is sometimes useful because it makes the symmetry between the three variables $(3, 5, −8)$, $a$ and $b$ more apparent.

Primitive solutions
If two of the three numbers $c$ can be divided by a fourth number $(a, b, c)$, then all three numbers are divisible by $d$. For example, if $d$ and $a$ are divisible by $c$, then $d = 13$ is also divisible by 13. This follows from the equation



If the right-hand side of the equation is divisible by 13, then the left-hand side is also divisible by 13. Let $b$ represent the greatest common divisor of $b^{n} = c^{n} − a^{n}$, $g$, and $a$. Then $b$ may be written as $c$, $(a, b, c)$, and $a = gx$ where the three numbers $b = gy$ are pairwise coprime. In other words, the greatest common divisor ($c = gz$) of each pair equals one



If $(x, y, z)$ is a solution of Fermat's equation, then so is $GCD$, since the equation



implies the equation



A pairwise coprime solution $GCD(x, y) = GCD(x, z) = GCD(y, z) = 1$ is called a primitive solution. Since every solution to Fermat's equation can be reduced to a primitive solution by dividing by their greatest common divisor g, Fermat's Last Theorem can be proven by demonstrating that no primitive solutions exist.

Even and odd
Integers can be divided into even and odd, those that are evenly divisible by two and those that are not. The even integers are $(a, b, c)$ whereas the odd integers are $(x, y, z)$. The property of whether an integer is even (or not) is known as its parity. If two numbers are both even or both odd, they have the same parity. By contrast, if one is even and the other odd, they have different parity.

The addition, subtraction and multiplication of even and odd integers obey simple rules. The addition or subtraction of two even numbers or of two odd numbers always produces an even number, e.g., $a^{n} + b^{n} = c^{n} = g^{n}x^{n} + g^{n}y^{n} = g^{n}z^{n}$ and $x^{n} + y^{n} = z^{n}$. Conversely, the addition or subtraction of an odd and even number is always odd, e.g., $(x, y, z)$. The multiplication of two odd numbers is always odd, but the multiplication of an even number with any number is always even. An odd number raised to a power is always odd and an even number raised to power is always even, so for example xn has the same parity as x.

Consider any primitive solution $...−4, −2, 0, 2, 4,...$ to the equation $...−3, −1, 1, 3,...$. The terms in $4 + 6 = 10$ cannot all be even, for then they would not be coprime; they could all be divided by two. If $3 + 5 = 8$ and $3 + 8 = 11$ are both even, $(x, y, z)$ would be even, so at least one of $x^{n} + y^{n} = z^{n}$ and $(x, y, z)$ are odd. The remaining addend is either even or odd; thus, the parities of the values in the sum are either (odd + even = odd) or (odd + odd = even).

Prime factorization
The fundamental theorem of arithmetic states that any natural number can be written in only one way (uniquely) as the product of prime numbers. For example, 42 equals the product of prime numbers $x^{n}$, and no other product of prime numbers equals 42, aside from trivial rearrangements such as $y^{n}$. This unique factorization property is the basis on which much of number theory is built.

One consequence of this unique factorization property is that if a $z^{n}$th power of a number equals a product such as



and if $x^{n}$ and $y^{n}$ are coprime (share no prime factors), then $2 × 3 × 7$ and $7 × 3 × 2$ are themselves the $p$th power of two other numbers, $x^{p} = uv$ and $u$.

As described below, however, some number systems do not have unique factorization. This fact led to the failure of Lamé's 1847 general proof of Fermat's Last Theorem.

Two cases
Since the time of Sophie Germain, Fermat's Last Theorem has been separated into two cases that are proven separately. The first case (case I) is to show that there are no primitive solutions $v$ to the equation $u$ under the condition that $v$ does not divide the product $p$. The second case (case II) corresponds to the condition that $u = r^{p}$ does divide the product $v = s^{p}$. Since $(x, y, z)$, $x^{p} + y^{p} = z^{p}$, and $p$ are pairwise coprime, $xyz$ divides only one of the three numbers.

$p$


Only one mathematical proof by Fermat has survived, in which Fermat uses the technique of infinite descent to show that the area of a right triangle with integer sides can never equal the square of an integer. This result is known as Fermat's right triangle theorem. As shown below, his proof is equivalent to demonstrating that the equation



has no primitive solutions in integers (no pairwise coprime solutions). In turn, this is sufficient to prove Fermat's Last Theorem for the case $xyz$, since the equation $x$ can be written as $y$. Alternative proofs of the case $z$ were developed later by Frénicle de Bessy, Euler, Kausler, Barlow, Legendre, Schopis, Terquem, Bertrand, Lebesgue, Pepin, Tafelmacher, Hilbert, Bendz, Gambioli, Kronecker, Bang, Sommer, Bottari, Rychlik, Nutzhorn, Carmichael, Hancock, Vrǎnceanu, Grant and Perella, Barbara, and Dolan. For one proof by infinite descent, see Infinite descent#Non-solvability of $p$.

Application to right triangles
Fermat's proof demonstrates that no right triangle with integer sides can have an area that is a square. Let the right triangle have sides $n = 4$, where the area equals $x^{4} − y^{4} = z^{2}$ and, by the Pythagorean theorem, $n = 4$. If the area were equal to the square of an integer $a^{4} + b^{4} = c^{4}$



then by algebraic manipulations it would also be the case that


 * $c^{4} − b^{4} = (a^{2})^{2}$ and $n = 4$.

Adding $r^{2} + s^{4} = t^{4}$ to these equations gives


 * $(u, v, w)$ and $uv⁄2$,

which can be expressed as


 * $u^{2} + v^{2} = w^{2}$ and $s$.

Multiplying these equations together yields



But as Fermat proved, there can be no integer solution to the equation $uv⁄2 = s^{2}$, of which this is a special case with $2uv = 4s^{2}$, $−2uv = −4s^{2}$ and $u^{2} + v^{2} = w^{2}$.

The first step of Fermat's proof is to factor the left-hand side



Since $u^{2} + 2uv + v^{2} = w^{2} + 4s^{2}$ and $u^{2} − 2uv + v^{2} = w^{2} − 4s^{2}$ are coprime (this can be assumed because otherwise the factors could be cancelled), the greatest common divisor of $(u + v)^{2} = w^{2} + 4s^{2}$ and $(u − v)^{2} = w^{2} − 4s^{2}$ is either 2 (case A) or 1 (case B). The theorem is proven separately for these two cases.

Proof for case A
In this case, both $(u^{2} − v^{2})^{2} = w^{4} − 16s^{4}$ and $x^{4} − y^{4} = z^{2}$ are odd and $z = u^{2} − v^{2}$ is even. Since $x = w$ form a primitive Pythagorean triple, they can be written



where $y = 2s$ and $(x^{2} + y^{2})(x^{2} − y^{2}) = z^{2}$ are coprime and $x$. Thus,



which produces another solution $y$ that is smaller ($x^{2} + y^{2}$). As before, there must be a lower bound on the size of solutions, while this argument always produces a smaller solution than any given one, and thus the original solution is impossible.

Proof for case B
In this case, the two factors are coprime. Since their product is a square $x^{2} − y^{2}$, they must each be a square



The numbers $x$ and $y$ are both odd, since $z$, an even number, and since $(y^{2}, z, x^{2})$ and $z = 2de$ cannot both be even. Therefore, the sum and difference of $y^{2} = d^{2} − e^{2}$ and $x^{2} = d^{2} + e^{2}$ are likewise even numbers, so we define integers $d$ and $e$ as



Since $d > e > 0$ and $x^{2}y^{2} = d^{4} − e^{4}$ are coprime, so are $(d, e, xy)$ and $0 < d < x$; only one of them can be even. Since $z^{2}$, exactly one of them is even. For illustration, let $x^{2} + y^{2} = s^{2}$ be even; then the numbers may be written as $x^{2} − y^{2} = t^{2}$ and $s$. Since $t$ form a primitive Pythagorean triple



they can be expressed in terms of smaller integers $s^{2} + t^{2} = 2x^{2}$ and $x$ using Euclid's formula



Since $y$, and since $s$ and $t$ are coprime, they must be squares themselves, $u$ and $v$. This gives the equation



The solution $u = s + t⁄2$ is another solution to the original equation, but smaller ($v = s − t⁄2$). Applying the same procedure to $s$ would produce another solution, still smaller, and so on. But this is impossible, since natural numbers cannot be shrunk indefinitely. Therefore, the original solution $t$ was impossible.

$u$


Fermat sent the letters in which he mentioned the case in which $v$ in 1636, 1640 and 1657. Euler sent a letter to Goldbach on 4 August 1753 in which claimed to have a proof of the case in which $y^{2} = 2uv$. Euler had a complete and pure elementary proof in 1760, but the result was not published. Later, Euler's proof for  $u$ was published in 1770. Independent proofs were published by several other mathematicians, including Kausler, Legendre, Calzolari, Lamé, Tait, Günther, Gambioli, Krey, Rychlik, Stockhaus, Carmichael, van der Corput, Thue, and Duarte.


 * {| class="wikitable"

! date !! result/proof !! published/not published !! work !! name ! 1621 ! around 1630 ! 1636, 1640, 1657 ! 1670 ! 4 August 1753 ! 1760 ! 1770
 * + Chronological table of the proof of $u = 2m^{2}$
 * none || published || Latin version of Diophantus's Arithmetica || Bachet
 * only result || not published || a marginal note in Arithmetica || Fermat
 * only result || published || letters of $v = k^{2}$ || Fermat
 * only result || published || a marginal note in Arithmetica || Fermat's son Samuel published the Arithmetica with Fermat's note.
 * only result || published || letter to Goldbach || Euler
 * proof || not published || complete and pure elemental proof || Euler
 * proof || published || incomplete but elegant proof in Elements of Algebra || Euler
 * }

As Fermat did for the case $(u, v, x)$, Euler used the technique of infinite descent. The proof assumes a solution $s^{2} + t^{2}⁄2 = u^{2} + v^{2} = x^{2}$ to the equation $d$, where the three non-zero integers $e$, $u = 2de$, and $v = d^{2} − e^{2}$ are pairwise coprime and not all positive. One of the three must be even, whereas the other two are odd. Without loss of generality, $x = d^{2} + e^{2}$ may be assumed to be even.

Since $u = 2m^{2} = 2de$ and $d$ are both odd, they cannot be equal. If $e$, then $d = g^{2}$, which implies that $e = h^{2}$ is even, a contradiction.

Since $v = d^{2} − e^{2} = g^{4} − h^{4} = k^{2}$ and $(g, h, k)$ are both odd, their sum and difference are both even numbers



where the non-zero integers $0 < g < d < x$ and $(g, h, k)$ are coprime and have different parity (one is even, the other odd). Since $(x, y, z)$ and $n = 3$, it follows that



Since $n = 3$ and $n = 3$ have opposite parity, $n = 3$ is always an odd number. Therefore, since $n = 3$ is even, $n = 3$ is even and $n = 4$ is odd. Since $(x, y, z)$ and $x^{3} + y^{3} + z^{3} = 0$ are coprime, the greatest common divisor of $x$ and $y$ is either 1 (case A) or 3 (case B).

Proof for case A
In this case, the two factors of $z$ are coprime. This implies that three does not divide $z$ and that the two factors are cubes of two smaller numbers, $x$ and $y$



Since $x = y$ is odd, so is $2x^{3} = −z^{3}$. A crucial lemma shows that if $x$ is odd and if it satisfies an equation $x$, then it can be written in terms of two integers $y$ and $2u = x + y$



so that



$2v = x − y$ and $u$ are coprime, so $v$ and $x = u + v$ must be coprime, too. Since $y = u − v$ is even and $−z^{3} = (u + v)^{3} + (u − v)^{3} = 2u(u^{2} + 3v^{2})$ odd, $u$ is even and $v$ is odd. Since



The factors $u^{2} + 3v^{2}$, $z$, and $u$ are coprime since 3 cannot divide $v$: if $u$ were divisible by 3, then 3 would divide $v$, violating the designation of $2u$ and $u^{2} + 3v^{2}$ as coprime. Since the three factors on the right-hand side are coprime, they must individually equal cubes of smaller integers



which yields a smaller solution $−z^{3}$. Therefore, by the argument of infinite descent, the original solution $u$ was impossible.

Proof for case B
In this case, the greatest common divisor of $r$ and $s$ is 3. That implies that 3 divides $2u = r^{3}$, and one may express $u^{2} + 3v^{2} = s^{3}$ in terms of a smaller integer, $u^{2} + 3v^{2}$. Since $s$ is divisible by 4, so is $s$; hence, $s^{3} = u^{2} + 3v^{2}$ is also even. Since $e$ and $f$ are coprime, so are $s = e^{2} + 3f^{2}$ and $u = e(e^{2} − 9f^{2})$. Therefore, neither 3 nor 4 divide $v = 3f(e^{2} − f^{2})$.

Substituting $u$ by $v$ in the equation for $e$ yields



Because $f$ and $u$ are coprime, and because 3 does not divide $v$, then $e$ and $f$ are also coprime. Therefore, since their product is a cube, they are each the cube of smaller integers, $r^{3} = 2u = 2e(e − 3f)(e + 3f)$ and $2e$



By the lemma above, since $(e – 3f)$ is odd and its cube is equal to a number of the form $(e + 3f)$, it too can be expressed in terms of smaller coprime numbers, $e$ and $e$.



A short calculation shows that



Thus, $u$ is odd and $u$ is even, because $v$ is odd. The expression for $−2e = k^{3}$ then becomes



Since $e − 3f = l^{3}$ divides $e + 3f = m^{3}$ we have that 3 divides r, so $k^{3} + l^{3} + m^{3} = 0$ is an integer that equals $(x, y, z)$. Since $2u$ and $u^{2} + 3v^{2}$ are coprime, so are the three factors $u$, $u = 3w$, and $w$; therefore, they are each the cube of smaller integers, k, l, and m.



which yields a smaller solution $u$. Therefore, by the argument of infinite descent, the original solution $w$ was impossible.

$w$


Fermat's Last Theorem for $u$ states that no three coprime integers $v$, $v$ and $w$ can satisfy the equation



This was proven neither independently nor collaboratively by Dirichlet and Legendre around 1825. Alternative proofs were developed by Gauss, Lebesgue, Lamé, Gambioli, Werebrusow, Rychlik, van der Corput, and Terjanian.

Dirichlet's proof for $v$ is divided into the two cases (cases I and II) defined by Sophie Germain. In case I, the exponent 5 does not divide the product $u$. In case II, 5 does divide $w$.


 * 1) Case I for $z^{3}$ can be proven immediately by Sophie Germain's theorem(1823) if the auxiliary prime $−z^{3} = 6w(9w^{2} + 3v^{2}) = 18w(3w^{2} + v^{2})$.
 * 2) Case II is divided into the two cases (cases II(i) and II(ii)) by Dirichlet in 1825. Case II(i) is the case which one of $x$, $y$, $z$ is divided by either 5 and 2.  Case II(ii) is the case which one of $x$, $y$, $z$ is divided by 5 and another one of $x$, $y$, $z$ is divided by 2.  In July 1825, Dirichlet proved the case II(i) for $v$.  In September 1825, Legendre proved the case II(ii) for $w$.  After Legendre's proof, Dirichlet completed the proof for the case II(ii) for $v$ by the extended argument for the case II(i).

Proof for case A
Case A for $18w$ can be proven immediately by Sophie Germain's theorem if the auxiliary prime $3w^{2} + v^{2}$. A more methodical proof is as follows. By Fermat's little theorem,



and therefore



This equation forces two of the three numbers $r$, $s$, and $18w = r^{3}$ to be equivalent modulo 5, which can be seen as follows: Since they are indivisible by 5, $3w^{2} + v^{2} = s^{3}$, $s$ and $3w^{2} + v^{2}$ cannot equal 0 modulo 5, and must equal one of four possibilities: 1, −1, 2, or −2. If they were all different, two would be opposites and their sum modulo 5 would be zero (implying contrary to the assumption of this case that the other one would be 0 modulo 5).

Without loss of generality, $e$ and $f$ can be designated as the two equivalent numbers modulo 5. That equivalence implies that


 * $s = e^{2} + 3f^{2}$ (note change in modulus)

However, the equation $v = e(e^{2} − 9f^{2})$ also implies that



Combining the two results and dividing both sides by $w = 3f(e^{2} − f^{2})$ yields a contradiction



Thus, case A for $e$ has been proven.

$f$
The case $v$ was proven by Gabriel Lamé in 1839. His rather complicated proof was simplified in 1840 by Victor-Amédée Lebesgue, and still simpler proofs were published by Angelo Genocchi in 1864, 1874 and 1876. Alternative proofs were developed by Théophile Pépin and Edmond Maillet.

$18w$, $r^{3} = 18w = 54f(e^{2} − f^{2}) = 54f(e + f)(e − f) = 3^{3} × 2f(e + f)(e − f)$, and $3^{3}$
Fermat's Last Theorem has also been proven for the exponents $r^{3}$, $(r⁄3)^{3}$, and $2f(e + f)(e − f)$. Proofs for $e$ have been published by Kausler, Thue, Tafelmacher, Lind, Kapferer, Swift, and Breusch. Similarly, Dirichlet and Terjanian each proved the case $f$, while Kapferer and Breusch each proved the case $2f$. Strictly speaking, these proofs are unnecessary, since these cases follow from the proofs for $e + f$, $e − f$, $−2f = k^{3}$, respectively. Nevertheless, the reasoning of these even-exponent proofs differs from their odd-exponent counterparts. Dirichlet's proof for $e + f = l^{3}$ was published in 1832, before Lamé's 1839 proof for $f − e = m^{3}$.