Positive integers that are differences of squares

Find all positive integers which can be written as the difference of squares.

This is what I have so far: Let $\displaystyle n$ be a positive integer such that $\displaystyle n = x^2 - y^2 = (x+y)(x-y)$. Also I believe I am safe in assuming that $\displaystyle x, y \geq 0$ because the squares of the negatives are the same as the squares of the positives, and $\displaystyle x > y$ because if $\displaystyle x \leq y$ then $\displaystyle n$ is not a positive integer.

We have two cases.

Case 1) $\displaystyle n$ is even.

$\displaystyle n = (x+y)(x-y)$ so either $\displaystyle (x+y)$ or $\displaystyle (x-y)$ is even.

If $\displaystyle (x-y)$ is even, then $\displaystyle (x-y)=2k$, for some $\displaystyle k\geq 1$. So $\displaystyle x=2k+y$

Then $\displaystyle (x+y)=(2k+y)+y=2k+2y=2(k+y)$.

So if $\displaystyle (x-y)$ is even then $\displaystyle (x+y)$ is also even. So $\displaystyle (x+y)$ is even no matter if $\displaystyle (x-y)$ is even or not. Satisfying that $\displaystyle n$ is even.

$\displaystyle n=(x+y)(x-y)=2(k+y)(2k)=4k(k+y)$ thus $\displaystyle n$ must be divisible by 4 if $\displaystyle n$ is even

Case 2) $\displaystyle n$ is odd.

This is where I am weak, I think.

$\displaystyle n = (x+y)(x-y)=2k+1$ for some $\displaystyle k\geq 1$. This implies $\displaystyle n\geq 3$.

$\displaystyle n\geq 3$ if $\displaystyle n$ is odd.

So I think I can conclude that all the positive integers that can be written as the difference of squares is divisible by 4, if even, and greater than 3, if odd.

Any help correcting and/or cleaning up what I have would be appreciated.

Re: Positive integers that are differences of squares

Quote:

Originally Posted by

**Zalren** Find all positive integers which can be written as the difference of squares.

This is what I have so far: Let $\displaystyle n$ be a positive integer such that $\displaystyle n = x^2 - y^2 = (x+y)(x-y)$. Also I believe I am safe in assuming that $\displaystyle x, y \geq 0$ because the squares of the negatives are the same as the squares of the positives, and $\displaystyle x > y$ because if $\displaystyle x \leq y$ then $\displaystyle n$ is not a positive integer.

We have two cases.

Case 1) $\displaystyle n$ is even.

$\displaystyle n = (x+y)(x-y)$ so either $\displaystyle (x+y)$ or $\displaystyle (x-y)$ is even.

If $\displaystyle (x-y)$ is even, then $\displaystyle (x-y)=2k$, for some $\displaystyle k\geq 1$. So $\displaystyle x=2k+y$

Then $\displaystyle (x+y)=(2k+y)+y=2k+2y=2(k+y)$.

So if $\displaystyle (x-y)$ is even then $\displaystyle (x+y)$ is also even. So $\displaystyle (x+y)$ is even no matter if $\displaystyle (x-y)$ is even or not. Satisfying that $\displaystyle n$ is even.

the above said statement is correct but a concise and precise statement would be $\displaystyle 2|(x-y) \iff 2|(x+y)$.

$\displaystyle n=(x+y)(x-y)=2(k+y)(2k)=4k(k+y)$ thus $\displaystyle n$ must be divisible by 4 if $\displaystyle n$ is even

Case 2) $\displaystyle n$ is odd.

This is where I am weak, I think.

$\displaystyle n = (x+y)(x-y)=2k+1$ for some $\displaystyle k\geq 1$. This implies $\displaystyle n\geq 3$.

$\displaystyle n\geq 3$ if $\displaystyle n$ is odd.

So I think I can conclude that all the positive integers that can be written as the difference of squares is divisible by 4, if even, and greater than 3, if odd.

Any help correcting and/or cleaning up what I have would be appreciated.

although the question is far from solved i could help you 'clean up'. :)

Re: Positive integers that are differences of squares

Hello, Zalren!

I agree with your conclusion.

Quote:

Find all positive integers which can be written as the difference of squares.

My approach differs slightly.

Note: all variables are positive integers.

$\displaystyle \text{Let }n\text{ be a positive integer such that: }\,n \,=\,x^2-y^2$

$\displaystyle \text{Let }n \,=\,p\!\cdot\!q,\:\text{ where }p > q.$

$\displaystyle \text{We have: }\:x^2-y^2 \:=\:pq \quad\Rightarrow\quad (x+y)(x-y) \:=\:p\cdot q$

$\displaystyle \text{Then: }\:\begin{Bmatrix} x+y &=& p \\ x-y &=& q \end{Bmatrix}$

$\displaystyle \text{Solve the system: }\:x \:=\:\frac{p+q}{2},\;y \:=\:\frac{p-q}{2}$

$\displaystyle \text{Since }x,y\text{ are integers, both }p+q\text{ and } p-q\text{ must be even.}$

$\displaystyle \text{That is, }p\text{ and }q\text{ have the same parity (both odd or both even).}$

$\displaystyle \text{Both odd: }\,p = \text{(odd)},\:q = \text{(odd)}$

. . . $\displaystyle \text{Then: }\:n \:=\:\text{(odd)(odd)} \:=\:\text{(odd)}$

$\displaystyle \text{Both even: }\:p = 2a,\;q = 2b$

. . . $\displaystyle \text{Then: }\:n \,=\,p\!\cdot\!q \:=\:(2a)(2b) \:=\:4ab$

$\displaystyle \text{Therefore: }n\text{ is odd }(n \ge 3)\text{ or a multiple of 4.}$