Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 a proof and this turns out to be true from $n=1$ to $n=20$. After that I didn't try, but I would like to see if a counter example exists for a greater value of $n$.

share|cite|improve this question
up vote 1 down vote accepted

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...

share|cite|improve this answer
$\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 $$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.