## Outline Mathematics

Number Theory

# Primes as differences of squares

Here's a problem to tackle:

**Which primes can be expressed as the difference of two squares?****Which primes can be so expressed in two or more different ways?**

|Up| |Contact| |Front page| |Contents| |Algebra|

Copyright © 1996-2018 Alexander Bogomolny

### Solution

**Which primes can be expressed as the difference of two squares?****Which primes can be so expressed in two or more different ways?**

Since the gaps between consecutive squares increase 1 3 5 ...,1 3 5 ...,1 2 3 ...,2 4 6 ... it is impossible to express the prime 2 as a difference of two squares,two primes,two squares,two whole numbers. However, any odd prime can be so expressed. Indeed, for any n,

(n + 1)^2 = n^2 + 2n + 1,2n - 1,2n,2n + 1,2n + 3.

If, for a given odd,odd,even prime p, we choose n such that p = 2n + 1, then p will be equal to the difference of two squares, (n + 1)^2 and n^2,(n - 1)^2,n^2,(n + 1)^2. This solves the first part of the problem. For the second part, assume that p is a prime and p = a^2 - b^2. Then

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

But p being a prime, it has no factors other than 1 and itself. Of the two numbers, a - b and a + b, the second is larger,larger,smaller. Which leads to two equations:

a + b = p and

a - b = 1.

By adding the two equation we see that 2a = p + 1,p + 1,p - 1,2p, or a = (p + 1)/2. Since from the second equation b = a - 1,a + 1,a,a - 1, b = (p - 1)/2,p + 1,p - 1,(p - 1)/2,(p + 1)/2.

It appears that p = a^2 - b^2 defines a and b uniquely. We thus conclude that any odd prime number can be represented as a difference of two squares in a unique way.

### References

- T. Gardiner,
*More Mathematical Challenges*, Cambridge University Press, 2003, pp. 92-93.

|Up| |Contact| |Front page| |Contents| |Algebra|

Copyright © 1996-2018 Alexander Bogomolny

67013402