Lecture 33: Fermat's Last Theorem


Fermat's Last Theorem states

\begin{equation} x^{n}+y^{n}=z^{n} \end{equation}

has no integer solutions for any $n>2$.

This problem had been unsolved for centuries, making it one of the longest standing challenges to mathematicians everywhere.
Due to continued work on its proof, branches of mathematics from all over the spectrum have been created and linked together. One such area is:

Diophantine Equations

Definition: A polynomial equation whose domain is restricted to the integers is called a Diophantine Equation.

Some examples include:
1) $x^{n}+y^{n}=z^{n}$
2) Pell's equation: $x^{2} - ny^{2} = \pm 1$
3) Brahmagupta: $61x^{2} + 1 =y^{2}$
4) linear: $ax+by=c$


  • Living in 17th century France, Fermat's official profession was a judge for the king. He did math as a hobby.
  • One of his favorite pastimes included posing questions to his mathematical friends, while taunting his friends with the assertion that he had already solved them.
  • He also highly disliked publishing any of his proofs, and rarely wrote them down in full. It is because of this that the hype and fury of solving this theorem has grown.
  • Most of the proofs he did write down contained jumps that were not easily followed.

Fermat often used a technique known as "infinite descent." This technique is specialized form of induction: we assume the opposite of what we want to prove and come up with a contradiction.

  • Suppose we have an solution to an equation.
  • Manipulate the equation to acquire a new solution to the equation that is strictly smaller than the original solution.
  • This process can be repeated infinitely, which is a contradiction.

Example: Method of infinite descent

Consider the equation

\begin{equation} x^2=5y^2. \end{equation}

Suppose a non-zero solution exists; call it x_0 and y_0. Then we get

\begin{equation} x_0^2 = 5y_0^2. \end{equation}

This equation gives us that $5 \mid x_0^2$. Moreover, since 5 is prime, we can say that $5 \mid x_{0}$. Then for some $a$, we have $5a = x_0$. Substituting back in, we get

\begin{equation} (5a)^2 = 5y_0^2 \end{equation}
\begin{equation} 5a^2 = y_0^2 \end{equation}

Thus, we have found a new solution that is smaller than our original solution. By applying the method of infinite descent, we can do this infinitely, creating infinitely smaller solutions. This is a contradiction, as the positive integers have a smallest element. Hence, there are no non-zero solutions to $x^{2}=5y^{2}$. $\square$

It is speculated that Fermat would have used this method to prove the general case of Fermat's Last Theorem, but no one has been able to recreate such a proof.

Lemmas for Proof of Fermat's Last Theorem for n=4

We now want to move on to proving Fermat's Last Theorem for the $n=4$ case. Before we start, though, let's look at three lemmas to help us get through the proof.

Lemma 1: If we have integers $l$, $m$ that are relatively prime, then $lm$ and $l^{2} - m^{2}$ are relatively prime.

Proof: Assume $\gcd(lm, l^{2} - m^{2}) = d > 1$. By the Fundamental Theorem of Arithmetic, we know that $p\mid d$ for some prime $p$.

We know that $d \mid lm$, so $p \mid lm$. Since $l$ and $m$ are relatively prime, then either $p\mid l$ or $p\mid m$. Assume that $p \mid l$ and that $l=pr$ for some r.

Also, $d \mid l^{2}-m^{2}$, so we get that $p \mid l^{2}-m^{2}$. Then $sp=l^{2}-m^{2}$ for some $s$. Plugging this in, we find that

\begin{equation} m^2 = l^2-sp = (pr)^2-sp = p(pr^2-s) \end{equation}

This implies that $p\mid m^2$, or $p\mid m$ since $p$ is prime. However, then we have that $p\mid l$ and $p\mid m$, which is a contradiction since $l$ and $m$ are relatively prime. $\square$

Lemma 2: Any solution to $x^{n}+y^{n}=z^{n}$ can be reduced to an equivalent solution with $x,y,z$ pairwise relatively prime.

Proof: It is easy to see that if any prime divides $x,y$ and $z$, we can easily reduce the equation by dividing through by it. However, it is not immediately obvious that we can say that they are pairwise relatively prime. We will show that if a prime divides two of $x,y,z$, then it must also divide the third. We will only prove one of the cases, but the other case's proof is nearly identical.

Assume that a prime $p$ divides both $x$ and $y$. Then $ap=x$ and $bp=y$ for some $a,b$. Plugging this in, we get

\begin{equation} z^n = (ap)^n + (bp)^n = p^n(a^n + b^n) \end{equation}

This implies that $p^{n} \mid z^{n}$ and hence $p \mid z$.
We can then reduce the original equation by dividing through by $p$. We can then continue this process until all variables are pairwise relatively prime. $\square$

Lemma 3: If $u,v$ are relatively prime and $z^2 = uv$ for some integer $z$, then $u$ and $v$ are both squares.

Proof Sketch: For every prime $p$ that divides $z$, we know that it must divide either $u$ or $v$. Moreover, since we have $z^2$, then there must be an even number of copies of primes found in $u$ and $v$, so they must both be squares. $\square$

Now, with these three lemmas under our belt, let's move on to prove the $n=4$ case of Fermat's Last Theorem.

Proof of Fermat's Last Theorem for n=4

The proof we will show is based off of one of the few proofs that Fermat bothered to write down. To help give a sense of how sparse Fermat's proofs were, at least in comparison to the verbosity we use today, we'll interject a few of lines of his proof to help motivate the proof.

Theorem: There is no right triangle whose area is a perfect square.

To get us started, here is a translation of the first line of Fermat's proof:

"If the area of a right-angled triangle were a square, there would exist two biquadrates, the difference of which would be a square number."

A biquadrate is a fancy word for a fourth power; for example, 16 is a biquadrate since $16=2^4$. Thus, Fermat is claiming that given a right triangle whose area is a square, we can find an equation $i^4-j^4=k^2$. If we let $i=z$, $j=y$ and $k=x^2$, we get $z^4 = x^4 + y^4$. Thus, if there were a solution to the $n=4$ case of Fermat's Last Theorem, we could find a right triangle whose area is a square; however, as this theorem states, there is no such right triangle, and hence there are no integer solutions to $x^4+y^4 = z^4$.

Let's consider a right triangle that gives us $a^2+b^2=c^2$ by the Pythagorean Theorem. It's area then is $(ab)/2$ and is equal to $y^2$ for some integer $y$ by our hypothesis.

To see how Fermat's logic flows, we need to employ the solution to Pythagorean Triples. Note that we will not give a proof of why this is true or where it comes from. We get that $a=2nm$ and $b = n^2-m^2$, where $\gcd(n,m)=1$. Plugging this back in, we get

\begin{align} y^2 = \frac{ab}{2} = \frac{1}{2}(2nm(n^2-m^2)) = nm(n^2-m^2) \end{align}

Since $n$ and $m$ are relatively prime, we know that $nm$ and $n^2-m^2$ are relatively prime by Lemma 1. Then, by Lemma 3, we know that $nm$ and $n^2-m^2$ are both squares. We can apply this again to $nm$ and find that $n$ and $m$ are squares. So, let $n=N^2$, $m=M^2$, and $nm=k^2$. Substituting back in, we get

\begin{split} y^2 &= nm(n^2-m^2) = k^2(N^4-M^4) \\ \left(\frac{y}{k}\right)^2 &= N^4 - M^4 \end{split}

Letting $z = \frac{y}{k}$ for ease, this equation gives us $z^2 = N^4 - M^4$, which is of the form that we wanted. Factoring, we get

\begin{equation} z^2 = N^4-M^4 = (N^2+M^2)(N^2-M^2) \end{equation}

Since $n=N^2$ and $m=M^2$ are relatively prime, then intuitively, it should make sense that $(N^2+M^2$ and $(N^2+M^2$ must also be relatively prime; proof is left as an exercise. By Lemma 3, we know then that $(N^2+M^2)$ and $(N^2+M^2)$ are squares. Let

\begin{split} S^2 &= N^2 + M^2 \\ T^2 &= N^2 - M^2 \end{split}

Rearranging the second equation gives us $N^2 = T^2+M^2$. Substituting back into the first equation gives us

\begin{equation} S^2 = N^2 + M^2 = T^2 + M^2 + M^2 = T^2 + 2M^2 \end{equation}

Now, Lemma 2 tells us that $S,N,M$ are pairwise relatively prime and $T,N,M$ are also pairwise relatively prime; we already knew that $S$ and $T$ were relatively prime from before, so we have that $S,T,N,M$ are all pairwise relatively prime.

We know that at most one of $S,T,N,M$ can be even. It's easy to see that $S$ and $T$ must have the same parity; since they cannot both be even, $S$ and $T$ must both be odd. Solving for $M^2$ in the last equation, we get

\begin{split} 2M^2 &= T^2 + S^2 \\ M^2 &= \frac{1}{2}(T^2+S^2) = \frac{1}{2} (T-S)(T+S) \end{split}

We saw that $S$ and $T$ were odd, so then $S-T$ and $S+T$ must be even; let $S-T = 2u$ and $S+T=2v$. Thus,

\begin{align} M^2 = \frac{1}{2}(2u)(2v) = 2uv \end{align}

Since $S$ and $T$ are odd, then they are either 1 or 3 mod 4. We can then see that $S+T=2u$ and $S-T=2v$ must be 0 and 2 mod 4. Thus, after dividing by 2, we can see that at one of $u$ and $v$ will be even; WLOG, $u$ be even. Then $u=2w$ for some $w$. This gives us

\begin{split} M^2 &= 2uv = 2(2w)v = 4wv \\ \left(\frac{M}{2}\right)^2 &= wv \end{split}

Similar to earlier, since $S$ and $T$ are relatively prime, then so are $S-T$ and $S+T$; this gives us that $u$ and $v$ are relatively prime, which implies that $w$ and $v$ are relatively prime. Thus, by the above equation and Lemma 3, we know that $w$ and $v$ are squares; let $w = W^2$ and $v = V^2$. This gives us the equation

\begin{split} 2S &= (S+T) + (S-T) = 2u + 2v = 2(2W^2 + V^2) \\ S &= 2W^2 + V^2 \end{split}

So where does Fermat go from here? He says:

"From this, we conclude that the said side is the sum of the sides about the right angle in a right-angled triangle and that the simple square contained in the sum is the base, and the double of the other square is the perpendicular."

So what does this mean? (Good question!) This translates to

\begin{align} S = 2W^2 + V^2 \Rightarrow (2W^2)^2 + (V^2)^2 \mbox{ is a square.} \end{align}

We can see this through the following:

\begin{split} (2W^2)^2 + (V^2)^2 &= (2w)^2 + v^2 = u^2 + v^2 \\ &= \left(\frac{1}{2}(S-T)\right)^2 + \left(\frac{1}{2}(S+T)\right)^2 = \frac{1}{4}(S^2-2ST+T^2) + \frac{1}{4}(S^2 + 2ST + T^2) \\ &= \frac{1}{4}(2S^2 +2T^2) = \frac{1}{2}(S^2 + T^2) \\ &= \frac{1}{2}(2M^2 + T^2 + T^2) = M^2 + T^2 = N^2 \end{split}

since $S^2 = 2M^2 + T^2$ and $N^2 = M^2 + T^2$. Thus, we have the equation $N^2 = (2W^2)^2 + (V^2)^2$, to which we can apply the solution to Pythagorean Triples. We get that for some $f,g$ relatively prime, $2W^2=2fg$, $V^2 = f^2 - g^2$, and $N = f^2+g^2$. This gives us

\begin{split} M^2 &= 4wv = 4W^2V^2 = 4fg(f^2-g^2) \\ \left(\frac{M}{2}\right)^2 &= fg(f^2-g^2) \end{split}

Since $f,g$ are relatively prime, then Lemma 1 tells us that $fg$ and $f^2-g^2$, which are both squares by Lemma 3. Since $fg$ is a square, then both $f$ and $g$ are squares; let $f=F^2$ and $g=G^2$. We then get

\begin{equation} V^2 = f^2 - g^2 = F^4 - G^4 = (F^2-G^2)(F^2+G^2) \end{equation}

Since $f$ and $g$ are relatively prime, we can say then that $F^2-G^2$ and $F^2 + G^2$ are relatively prime; this means that they are both squares, by Lemma 3.

So what have we found? Recall that we started with the equation $z^2 = (N^2 -M^2)(N^2+M^2)$ where $N^2-M^2$ and $N^2+M^2$ were relatively prime and were both squares. Thus we have found another solution to the equation. However,

\begin{align} F^2+G^2\leq f+g < N < N^2+M^2 \end{align}

so our new solution is strictly smaller. Thus, we can repeat this process infinitely to find infinitely small solutions; however, this is a contradiction since there is a smallest element in the positive integers. Thus, there can be no triangle whose area is a perfect square.

Fermat concludes his proof by saying:

"The margin is too small to enable me to give the proof completely and with all detail."


Andrew Wiles

We ran out of time in class to talk about Andrew Wiles, but here are some facts for your reading pleasure.

  • On June 23, 1993, Andrew Wiles gave the last of three lectures given at a mathematical conference. He concluded with "I think I'll stop here" and was met with thunderous applause. He had just proved Fermat's Last Theorem.
  • His written proof was comprised of nearly 300 pages.

Overview of Wiles' Proof

He used many different and complex mathematical techniques throughout several branches including elliptic curves, modular forms, Galois Theory, and the Taniyama-Shimura Conjecture.

  • Elliptic Curves: polynomials taking the form $y^{2}=x^{3}+ax+b$
    • Note that these are NOT ellipses.
    • They have applications in cryptography for integer solutions. This is because problems based on the discrete logarithm are extremely difficult to solve. It is thought by some that elliptic curve cryptography will replace the current methods.
  • Modular Forms: function F on the complex plane with solutions on the lattice points
    • They are built on elliptic curves in the complex plane.
  • Galois Theory: solves many previously unsolved problems, as mentioned by Andy
    • It started with permutation groups and polynomial equations, using the theory of symmetric polynomials.
  • Taniyama-Shimura Conjecture: relates elliptic curves to modular forms
    • In 1960, Gerhard Frey proposed that proving the Taniyama-Shimura Conjecture would prove Fermat's Last Theorem.
    • Wiles used a special case (with semistable elliptic curves) to prove Fermat's Last Theorem.
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License