# fermat's last theorem by elementary methods

I was wondering about correctness of the following theorem/proof.

Theorem:

Suppose $p$ is prime in:

$\quad \quad p^k | x - y$

$\quad \quad p^{k + 1} \not | x - y$

$\quad \quad gcd(x,y,z) = 1$

$\quad \quad n > 2$

$\quad \quad x^n = y^n + z^n$

Then:

$\quad \quad p | n$

Proof:

Let us consider the following identity:

$\quad \quad (ap^k + b)^n = b^n + rp^k \pmod {p^{2k}} \iff r = nab^{n - 1} \pmod {p^k}$

which we can prove by induction on $n$.

When we solve for $a,b$ in:

$\quad \quad ap^k + b = x$,

$\quad \quad b = y$,

we get:

$\quad \quad a = (x - y)/p^k \implies gcd(a,p) = 1$ because $x - y \not \equiv 0 \pmod {p^{k + 1}}$,

also note:

$\quad \quad gcd(b,p) = 1$ otherwise we would have $gcd(x,y,z) \gt 1$;

We now have:

$\quad \quad p^k$ a prime-power;

$\quad \quad gcd(a,p) = gcd(b,p) = 1$;

Now assume $z$ exists in:

$\quad \quad x^n \equiv y^n + z^n \pmod {p^{2k}} \iff (ap^k + b)^n \equiv b^n + rp^k \pmod {p^{2k}}$

$\quad \quad \implies z^n \equiv rp^k \pmod {p^{2k}}$

We must consider the following three cases:

1. $n \gt k \implies p | z \implies z = sp$ for some $s$

$\quad \quad \implies z^n \equiv (sp)^n \equiv rp^k \pmod {p^{2k}}$

$\quad \quad \implies s^np^{n - k} \equiv r \pmod {p^k}$

$\quad \quad$ so clearly $p | r$

1. $n = k \implies p | z \implies z = sp$ for some $s$

$\quad \quad \implies z^n \equiv (sp)^n \equiv rp^n \pmod {p^{2n}}$

$\quad \quad \implies s^n \equiv r \equiv nab^{n - 1} \pmod {p^n}$

$\quad \quad$ Now let:

$\quad \quad \quad \quad na \equiv b \pmod {p^n}$

$\quad \quad \quad \quad \implies r \equiv nab^{n - 1} \equiv b^n \pmod {p^n}$

$\quad \quad$ So we get:

$\quad \quad \quad \quad (ap^n + b)^n \equiv b^n + (bp)^n \pmod {p^{2n}}$

$\quad \quad \quad \quad \implies gcd(x,y,z) > 1$, which is impossible

1. $n < k \implies p^t | z \implies z = sp^t$ for some $s$ and with $t = ceil(k/n)$

$\quad \quad \implies z^n \equiv (sp^t)^n \equiv rp^k \pmod {p^{2k}}$

$\quad \quad \implies s^np^{tn - k} \equiv r \pmod {p^n}$

$\quad \quad$ and since $tn \gt k$ we have $p | r$

So we have shown $p | r \implies n \equiv 0 \pmod p$ always holds

Note that we cannot say anything about $n = 2$, because we always have:

$\quad \quad (ap + b)^2 \equiv b^2 + z^2 = b^2 \pmod {p^2}$

$\quad \quad \iff r \equiv 0 \pmod {p}$

no matter what $a,b$ will be

This proves our theorem.

• Looks okay to me. Jun 2, 2017 at 12:18

Let $n$ be a positive integer, $n > 1$, and suppose $b,c,d$ are positive integers with $\gcd(b,c,d)=1$ such that $d^n = b^n + c^n$.

Next, suppose $p$ is a prime such that $d=ap+b$. \begin{align*} \text{Then}\;\;&(ap + b)^n = b^n + c^n\\[4pt] \implies\;&p\mid c^n\\[4pt] \implies\;&p\mid c\\[4pt] \end{align*} So you can't choose $p$ arbitrarily, since $p$ must be a factor of $c$.

What you proved is that if $p$ is a prime factor of $c$, then $p\mid a$ or $p\mid n$.

Stated in full, what you proved is equivalent to this:

\begin{align*} &\text{If:}\\[4pt] &\;\;{\small\bullet}\;\;\text{$n$ is a positive integer with $n > 1$}\\[4pt] &\;\;{\small\bullet}\;\;\text{$b,c,d$ are positive integers with $\gcd(b,c,d)=1$}\\[-1pt] &{\phantom{\;\;{\small{\bullet}}\;\;}}\text{such that $d^n = b^n + c^n$}\\[4pt] &\;\;{\small\bullet}\;\;\text{$p$ is a prime factor of $c$}\\[8pt] &\text{Then:}\\[4pt] &\;\;{\small\bullet}\;\;\text{$p\mid n\;$ or $\;p^2 \mid (d-b)$}\\[4pt] \end{align*}

• actually I was trying to prove c cannot exist given gcd(a,p) = gcd(b,p) = gcd(n,p) = 1
– user451710
Jun 2, 2017 at 12:38
• Yes, that's OK. The confusion is what you were trying to prove. You made various assumptions and arrived at a contradiction. The main edit you need is to clearly state what you are trying to prove (i.e., clear hypotheses and conclusion), and then prove it, rather than just making assumptions along the way. Jun 2, 2017 at 12:46
• so when n is prime and p != n we know there are no solutions for c, p can be any prime but n.
– user451710
Jun 2, 2017 at 13:57
• Yes, provided the other assumptions are satisfied -- e.g., $p$ is a prime factor of $c$, and $p^2$ doesn't divide $(d-b)$. Jun 2, 2017 at 14:17
• As I previously suggested, you need to make a clear statement of your claim, with hypotheses and conclusion fully specified. In my answer, I gave one version of what you actually proved. There are alternate ways of saying the same thing, with no real advantage of one versus another. Jun 2, 2017 at 14:46