Square Modulo 3

Theorem
Let $$x \in \Z$$ be an integer.

Then one of the following holds:

$$ $$

Corollary 1
Let $$x, y \in \Z$$ be integers.

Then:
 * $$3 \backslash \left({x^2 + y^2}\right) \iff 3 \backslash x \and 3 \backslash y$$

where $$3 \backslash x$$ means $$3$$ divides $$x$$.

Corollary 2
Let $$x, y, z \in \Z$$ be integers.

Then:
 * $$x^2 + y^2 = 3 z^2 \iff x = y = z = 0$$

Proof
Let $$x$$ be an integer.

Using Congruence of Powers throughout, we make use of $$x \equiv y \left({\bmod \, 3}\right) \implies x^2 \equiv y^2 \left({\bmod \, 3}\right)$$.

There are three cases to consider:


 * $$x \equiv 0 \left({\bmod \, 3}\right)$$: we have $$x^2 \equiv 0^2 \left({\bmod \, 3}\right) \equiv 0 \left({\bmod \, 3}\right)$$.


 * $$x \equiv 1 \left({\bmod \, 3}\right)$$: we have $$x^2 \equiv 1^2 \left({\bmod \, 3}\right) \equiv 1 \left({\bmod \, 3}\right)$$.


 * $$x \equiv 2 \left({\bmod \, 3}\right)$$: we have $$x^2 \equiv 2^2 \left({\bmod \, 3}\right) \equiv 1 \left({\bmod \, 3}\right)$$.

Proof of Corollary 1
Let $$3 \backslash x \and 3 \backslash y$$.

Then $$x \equiv 0 \left({\bmod \, 3}\right)$$ and $$y \equiv 0 \left({\bmod \, 3}\right)$$.

From the main proof, $$x^2 \equiv 0 \left({\bmod \, 3}\right)$$ and $$y^2 \equiv 0 \left({\bmod \, 3}\right)$$.

Then $$\left({x^2 + y^2}\right) \equiv 0 \left({\bmod \, 3}\right)$$ from Modulo Addition is Well-Defined.

Thus $$3 \backslash \left({x^2 + y^2}\right)$$.

Now suppose $$3 \backslash \left({x^2 + y^2}\right)$$.

That is, $$\left({x^2 + y^2}\right) \equiv 0 \left({\bmod \, 3}\right)$$.

From the main result: and
 * $$x^2 \equiv 0 \left({\bmod \, 3}\right)$$ or
 * $$x^2 \equiv 1 \left({\bmod \, 3}\right)$$
 * $$y^2 \equiv 0 \left({\bmod \, 3}\right)$$ or
 * $$y^2 \equiv 1 \left({\bmod \, 3}\right)$$

The only way $$\left({x^2 + y^2}\right) \equiv 0 \left({\bmod \, 3}\right)$$ is for $$x^2 \equiv 0 \left({\bmod \, 3}\right)$$ and $$y^2 \equiv 0 \left({\bmod \, 3}\right)$$.

Proof of Corollary 2
Proof by the Method of Infinite Descent:

Suppose $$u, v, w$$ are the smallest non-zero integers such that $$u^2 + v^2 = 3 w^2$$.

Then from Corollary 1 each of $$u, v, w$$ are multiples of $$3$$.

So we have $$u', v', w'$$ such that $$3 u'= u, 3 v' = v, 3 w' = w$$.

Then:
 * $$\left({3 u'}\right)^2 + \left({3 v'}\right)^2 = 3 \left({3 w'}\right)^2$$

which leads to:
 * $$\left({u'}\right)^2 + \left({v'}\right)^2 = 3 \left({w'}\right)^2$$

contradicting the supposition that $$u, v, w$$ are the smallest non-zero integers such that $$u^2 + v^2 = 3 w^2$$.

Thus $$x^2 + y^2 = 3 z^2 \implies x = y = z = 0$$.

If $$x = y = z = 0$$ then it trivially follows that $$x^2 + y^2 = 3 z^2$$.