# Proving $8 | x^2 + y^2$ iff x,y are both even is false

Per the question above I am trying to prove this statement false. As such only one of two conditions have to be met both x and y being odd, or them both being odd. I've seen a lot of examples on this site regarding x^2 - y^2 for a similar example but none where they are added together so I was looking for a pointer on what I might be missing. This is what I have so far: False via contraposition: a^2 + b^2 is not divisible by 8 iff a or b are not even

Assume both a and b are odd A = 2k + 1 and b = 2n + 1 where k and n are both integers

a^2 + b^2 = (2k + 1)^2 + (2n + 1)^2

a^2 + b^2 = 4k^2 + 4k + 1 + 4n^2 + 4n + 1

a^2 + b^2 = 4(k^2 + k + n^2 + n) + 2 (not divisble by 8 so doesnt help the case)

Assume a is odd

A = 2k + 1 and b = 2n

x^2 = 4k(k + 1) + 1 k(k + 1) is even (product of 2 numbers)

x^2 is of form 8k + 1

a^2 + b^2 = 8x + 1 + 8y + 1

a^2 + b^2 = 8(x - y) + 2 (the extra 2 is stoping this case from being true as well)

• To prove false, a counterexample suffices: $8$ does not divide $2^2+4^2$ – J. W. Tanner Apr 15 at 12:06
• @J. W. Tanner Wouldn't we have to provide a counterexample where x^2 + y^2 is divisible by 8 though? – Tunifish17 Apr 15 at 12:13
• @Tunifish17 It's only a counterexample if it makes the statement false. Otherwise it's just an example (which is not helpful if you're trying to disprove the statement). – Théophile Apr 15 at 12:28

## 1 Answer

You want to disprove the statement

$$8\mid x^2+y^2\iff 2\mid x, y$$

As @J.W. Tanner pointed out in the comments, a simple counterexample - such as $$2^2+4^2$$ or its generalization $$(2n)^2+(2n+2)^2=8n^2+8n+4\not\equiv 0\pmod 8$$ - is enough. This proves that $$2\mid x, y\color{red}{\not\Rightarrow}8\mid x^2+y^2$$

However, you won't be able to disprove the other direction, since it is true $$8\mid x^2+y^2\color{red}{\implies}2\mid x,y$$ This follows from the fact that the only quadratic residues modulo $$8$$ are $$\{0, 1, 4\}$$.

• I think I am missing something since doesnt this just prove what we were trying to prove was false? aka that x and y must be even in order to be divisible by 8? – Tunifish17 Apr 15 at 13:45
• I fact, $x$ and $y$ have to be even in order $x^2+y^2$ to be divisible by $8$ – Dr. Mathva Apr 15 at 14:15
• However, the other direction is wrong, i.e. being even doesn't imply that they will be divisible by $8$ – Dr. Mathva Apr 15 at 14:16
• due to the fact that x and y both have to be even in order to be divisible by 8 wouldnt that make the original question true and thus not able to be proved false? – Tunifish17 Apr 15 at 15:08
• No, because you said iff. The statement "$8\mid x^2+y^2$" implies that $x,y$ are even is, however, correct. – Dr. Mathva Apr 15 at 16:30