# Prove that every odd prime number can be written as a difference of two squares.

1. Prove that every odd prime number can be written as a difference of two squares.
2. Prove also that this presentation is unique.
3. Is such presentation possible if p is just an odd natural number?
4. Can 2 be represented this way?

\3. Yes the presentation (i.e. odd numbers being written as differences of two squares) is possible for all odd natural number however the presentation may not be unique. For example, $57=11^2-8^2=29^2-28^2$.

\4. 2 can't be written as a difference of two squares because 4-1=3 and 1-1=0 and the difference of squares grows to integers larger that 3.

Can I get some help in proving questions 1 and 2?

• Something to help you better visualize the problem. – Lucian May 27 '14 at 3:54
• Do remark that for every odd integer $2n+1$, we have $$2n+1 = (n+1)^2 - n^2$$ Thus not only can every odd prime be represented as the difference of two squares, but every odd integer can be written as the difference of two squares.  However, for uniqueness, one needs $n$ to be a prime. For example, $25 = 7^2 + 24^2 = 15^2 + 20^2$ – Gamma Function May 27 '14 at 7:12
• @GammaFunction You meant $625 = 7^2 + 24^2 = 15^2 + 20^2$. – user26486 May 27 '14 at 14:03

$1$. Let $(x+y)(x-y) = p$

Since $p$ is prime, the smaller divisor has to be one, ie. $(x-y) = 1$, giving $2y+1 = p \implies y = \frac{p-1}{2}$ (you're guaranteed y is an integer because $p$ is an odd number).

So the only possible solution set is $x = \frac{p+1}{2}, y = \frac{p-1}{2}$

$2$. Uniqueness already established via reasoning above.

$3$. Possible, but it will be non-unique as $(x-y)$ can take on multiple values, e.g. $1$ or a single prime divisor of $p$ or a product of some (but not all) prime divisors of $p$.

$4$. No, because again $(x-y)$ = 1 is forced. But now you get $x = \frac{3}{2}$ which is non-integral. So no integer solution sets exist.

• Note that for $4$, if $n=(x+y)(x-y)$ the two factors differ by $2y$ and hence have the same parity. If one is even, the other is even, so if $2|n$ then $4|n$ - so $2, 6, 10, 14 \dots$ cannot be the difference of two squares. – Mark Bennet May 27 '14 at 9:38
• Giving a +1 for the answer to part 4, because it is interesting that all the math works for even numbers as well, except that instead of integer solutions, you get $\frac{1}{2}$ solutions. – Joel Rondeau May 27 '14 at 14:10
• @MarkBennet You could generalize it. A number can be expressed as the difference of two squares if it belongs to the set $$S = \{x \in \mathbb{Z} | x \equiv 0, 1, 3\pmod 4\}$$ – TheRandomGuy Apr 8 '16 at 15:31

Hint. If $p$ is prime and $p\ne2$, can you solve $$p=(x+y)(x-y)\ ?$$ Is there more than one solution?

I found some thing very useful, the product of any two odd numbers can always be expressed as the difference of squares of two integers.

Let a,b belongs to Z+ , are two odd numbers,

Now a+b is always even, and [a+b]/2 certainly generates an integer and also [a-b]/2 generates another integer.

Now {[a+b]^2/4} -{[a-b]^2/4} = ab

Now consider the case of any odd prime number

Any prime number can be written as P X 1 since it cant be decomposed further.

So {[p+1]^2/4}-{[p-1]^2/4} = p

Any odd prime number can be expressed as the difference of squares of two integers. Of course its unique !!! as the numbers [P+1]/2 and [P-1]/2 are unique for a given prime number. .