# Thread: Any odd prime number can be written as the difference of two squares.

1. ## Any odd prime number can be written as the difference of two squares.

Hi,
this is an old exam question dealing with some trivial number theory. I'm not sure if this question should go in the "Number Theory" section. I don't feel this is "university level" material though. Please forgive me if this is the wrong section.

Give a proof that any odd prime number can be written as the difference between two squares. E.g. 5 = 3^2 - 2^2

Attempt at proof:

Let p be a prime number > 2.

We wish to show that p = a^2 - b^2, where a and b are integers.

p = a^2 - b^2 = (a + b)(a - b)

I know that p should only have the factors p and 1. Therefore I can reduce the expression to be p = a + b?
From simply a Google search I see that I should also be able to conclude that a - b = 1. How do I reach that conclusion?

Therefore, we have that a = (p + 1)/2 and b = (p - 1)/2

p = (p + 1)/2 - (p - 1)/2 = a^2 - b^2

In addition to the questions above in the attempt it is not clear to me that this is a proof. Could someone explain it to me?

Thanks for any help.

2. ## Re: Any odd prime number can be written as the difference of two squares.

Yes, the only way to factor a prime number is 1 times itself. So if $p= a^2- b^2= (a+ b)(a- b)$, you must have a- b= 1 and a+ b= p. Adding those two equations, 2a= p+1 so a= (p+1)/2. Subtracting them, 2b= p- 1 so b= (p-1)/2. Of course, because the condition is that p be an odd prime number, both p+1 and p-1 are even and so a and b are integers- that's the only thing you were missing.

3. ## Re: Any odd prime number can be written as the difference of two squares.

of course, mathematicians like to hide the evidence, and appear all-knowing, so a proof might run as follows:

let p be an odd prime. then p-1 and p+1 are even integers, so (p-1)/2 and (p+1)/2 are integers, and:

[(p+1)/2]2 - [(p-1)/2]2 = (1/4)(p2 + 2p + 1 - p2 + 2p - 1) = (1/4)(4p) = p.

4. ## Re: Any odd prime number can be written as the difference of two squares.

Hello, mathlearner100!

Give a proof that any odd prime number can be written as the difference of two squares.

This is a strange and misleading question.

Fact: Every odd number can be expressed as the difference of two consecutive squares.

We see that: . $(n+1)^2 - n^2 \;=\;n^2 + 2n + 1 - n^2 \;=\;2n+1$

Given an odd number, say, 17.
Subtract 1, divide by 2: . $(17 - 1) \div 2 \:=\:8$
This gives us the smaller of the two consecutive squares.

. . Check: . $9^2 - 8^2 \;=\;81 - 64 \;=\;17$

,

,

,

,

,

,

,

,

# differents of two squares when there is a prime number

Click on a term to search for related topics.