# Proof of no primes such that $x^2 + y^2 = z^2$ [duplicate]

I'm in a pretty simple "CS Math" course for year 1 Comp Sci, and I came across this: Disprove, $x^2 + y^2 = z^2$, such that $x, y, z$ are primes I thought of this as, if n is a prime, then prime factorization of n must be: $n = z*1$ $n^2 = (z*1)(z*1) = (z)(z)$

So I tried to derive a contradiction:

Assume $x, y, z$ are primes such that $x^2 + y^2 = z^2$ Then: $x^2 = z^2 - y^2$

Then: $x^2 = (z-y)(z+y)$ #Contradiction, prime factorization of $x^2$ must be uniquely represented.
But then I noticed that this statement is true if $z-y = 1$ and $z+y = x^2$, So:
Then: $y = -1+z = y = z-1$

Because: $x^2 + y^2 = z^2$

Then: $(z-1)(z-1) + z+y = z^2$
Then: $z^2 - 2z + 1 + z + y = z^2$
Then: $z^2 - z + y + 1 = z^2$ # subtract $z^2$ from both sides
Then: $-z + y + 1 = 0$
Then: $y = -1 + z$
#Loop??

I remember reducing this to $x + y = z$, which I think is false?

EDIT: Thought of this:
z - y = 1
Then: z = y + 1
Then z must be 3, y must be 2
Because: z is greater than y by 1, since z is a prime and y is a prime, z and y must be 3 and 2 respectively since no other prime number is 1 apart because one of them would be even if greater than 2, and any even number has at least 3 divisors (2, the even number, and 1) thus not a prime.
Then: $x^2 + 2^2 = 3^2$ ,Because $2^2 = 4, 3^2 = 9$
Then: $x^2 = 9 - 4$
Then: $x = \sqrt5$
Contradiction: x is a prime, but sqrt(5) is not a prime!

Is this a solid evidence proof in that can I say that only prime numbers 1 apart are 2 and 3? I'm pretty sure there is a more simpler and intuitive way to prove this, are there any other ways to prove this via contradiction?

• Your $y=1-z$ should be $y=z-1$, but you square it, so the problem goes away. From $1-z+y=0$ you should get $y=z-1$ so you have nothing new. Commented Mar 9, 2015 at 16:54
• Yea, I just noticed that, thanks for pointing it out. How would I prove this then through this? Commented Mar 9, 2015 at 16:55

The easiest way is to note that they cannot all be odd, then show that the even one cannot be $2$.

Added: Let $y=2$. Then $z^2-x^2=(z+x)(z-x)=4$ As $z,x$ are both odd, $z-x \ge 2, z+x\ge 2$, which forces $z+x=2, z-x=2, z=2, x=0$ Contradiction.

• Is there no way of proving this through the method above? Commented Mar 9, 2015 at 16:59
• @PhilipTsang - within your proof you reach $y=z-1$ - clearly then one of $(y, z)$ is even. Commented Mar 9, 2015 at 17:04
• Thanks, i actually noticed that as I walking back to my computer. I attached the following evidence above, is that sufficient? Commented Mar 9, 2015 at 17:14
• Please give enough details to infer how you propose to finish. There are many ways to do this and it is impossible to guess how you propose to continue. Commented Mar 9, 2015 at 19:25

If $x,y,z\in\mathbb{N}_{\geq 1}$ and $x^2+y^2=z^2$, then at least one number between $x$ and $y$ is even and at least one number between $x$ and $y$ is a multiple of three, since the only possibilities for a square $\!\!\pmod{3}$ or $\!\!\pmod{4}$ are to be $0$ or $1$. So, in order to prove the statement it is sufficient to check that $2^2+3^2$ is not a square.

I think this proof is sufficient:

If x, y, z are primes, $x^2 + y^2 \ne z^2$
There exists x, y, z that are primes such that $x^2 + y^2 = z^2$, derive contradiction
Then: $x^2 = z^2 - y^2$
Then: $x^2 = (z-y)(z+y)$
Then: $z - y = 1$ and $z + y = x^2$, because by the Fundamental Theorem of Arithmetic, the prime factorization of x which is a prime is:
$x = (x)(1)$
Then: $x^2 = (x)(1)(x)(1) = (x)(x)$
Then: $x^2$ has only three factors, $x^2, 1, x$. Since $x - y \ne x + y$, then by elimination process, $x-y = 1$ and $z + y = x^2$
Then: $x - y = 1$
Then: $x = y + 1$
Then: $x = 3, y = 2$
Because: x and y are primes, x is one greater than y implies that one of x or y must be even as they both cannot be odd (odd number - 1 cannot equal odd). The only even prime number is 2, so by deduction, $y = 2, z = 3$
Also: $z + y = x^2$, as shown above
Then: $x^2 + 2^2 = 3^2$
Then: $x^2 = 9 - 4$
Then: $x = \sqrt5$
Contradiction! Prime Numbers must be natural numbers, $\sqrt5$ is not a whole number or natural number