# Multiples of 4 as sum or difference of 2 squares

Is it true that for $n \in \mathbb{N}$ we can have $4n = x^{2} + y^{2}$ or $4n = x^{2} - y^{2}$ for $x,y \in \mathbb{N} \cup (0)$.

I was just working out and this came out to be true from $n=1$ to $n=20$. After that i didn't try, but i would like to see as what will be a counter example.

-

Here is a hint: the form $x^2-y^2$ factors as $(x+y)(x-y)$. Therefore, if you want to represent an integer $N$ as $x^2-y^2$, you can attempt to do so by choosing a factorization $N = ab$ and solving the linear system

$x+y = a$
$x-y = b$.

This system has the unique rational solution $x = \frac{a+b}{2}$, $y = \frac{a-b}{2}$. This gives an integral solution iff $a$ and $b$ have the same parity. Use this to show:

A positive integer $N$ is of the form $x^2 - y^2$ for $x,y \in \mathbb{Z}$ (possibly $0$) iff $N$ is odd or $N$ is divisible by $4$.

In particular, $4n$ is always of the form $x^2-y^2$. You want a little more: that $x$ and $y$ are both nonzero. Clearly $x$ cannot be zero, so you need to analyze the case $y = 0$ and show that whenever all possible solutions to $n = x^2 - y^2$ have $y = 0$, then there are nonzero $X$ and $Y$ such that $4n = X^2 + Y^2$. This is not so hard...

-
$\mathbb Z$ can be typeset with \mathbb{Z}. –  kennytm Aug 14 '10 at 14:11
@Kenny TM: How do you generally but this bracket {} –  anonymous Aug 14 '10 at 14:17
@Chandru: But what? I don't understand the comment. –  kennytm Aug 14 '10 at 14:20
@Kenny TM: It something regarding TeX as to how to insert curly brackets $\{$ command doesn't work. –  anonymous Aug 14 '10 at 14:34
@Chandru: Try \\{ with 2 backslashes. –  kennytm Aug 14 '10 at 15:03

It is true because

$$(n+1)^2 - (n-1)^2 = 4n$$

-