# Thread: Positive integers that are differences of squares

1. ## 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 $n$ be a positive integer such that $n = x^2 - y^2 = (x+y)(x-y)$. Also I believe I am safe in assuming that $x, y \geq 0$ because the squares of the negatives are the same as the squares of the positives, and $x > y$ because if $x \leq y$ then $n$ is not a positive integer.

We have two cases.

Case 1) $n$ is even.

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

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

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

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

Case 2) $n$ is odd.

This is where I am weak, I think.

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

$n\geq 3$ if $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.

2. ## Re: Positive integers that are differences of squares

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 $n$ be a positive integer such that $n = x^2 - y^2 = (x+y)(x-y)$. Also I believe I am safe in assuming that $x, y \geq 0$ because the squares of the negatives are the same as the squares of the positives, and $x > y$ because if $x \leq y$ then $n$ is not a positive integer.

We have two cases.

Case 1) $n$ is even.

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

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

So if $(x-y)$ is even then $(x+y)$ is also even. So $(x+y)$ is even no matter if $(x-y)$ is even or not. Satisfying that $n$ is even.
the above said statement is correct but a concise and precise statement would be $2|(x-y) \iff 2|(x+y)$.

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

Case 2) $n$ is odd.

This is where I am weak, I think.

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

$n\geq 3$ if $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'.

3. ## Re: Positive integers that are differences of squares

Hello, Zalren!

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

My approach differs slightly.
Note: all variables are positive integers.

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

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

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

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

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

$\text{Since }x,y\text{ are integers, both }p+q\text{ and } p-q\text{ must be even.}$
$\text{That is, }p\text{ and }q\text{ have the same parity (both odd or both even).}$

$\text{Both odd: }\,p = \text{(odd)},\:q = \text{(odd)}$
. . . $\text{Then: }\:n \:=\:\text{(odd)(odd)} \:=\:\text{(odd)}$

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

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