I am currently working on this proof. I am looking to find (with proof) all even numbers that can be represented as a difference of squares in only two ways.

My thoughts thus far.

I examined the first 40 natural numbers and found that 16, 24, 32, 40 have exactly two representations as a difference of squares. My claim is that all numbers $x$ for which $x=8k+16$ will have exactly two representations.

$8k+16=(k+a)^2 - (k+b)^2$ $\rightarrow$ $8k+16=(k+4)^2 - k^2$ which is the first representation.

My idea for finding the second representation is to express $8k+16$ as

$8k+16=(ak+b)^2 - (ck+d)^2$

Expanding and attempting to solve I get:

$$\left.\begin{matrix} a^2 - c^2 = 0\\ 2ab - 2cd= 8\\ b^2 - d^2= 16 \end{matrix}\right\}$$

This is where my problem arises, $b^2-c^2=(b-c)(b+c)=16=4^2$, I cannot seem to move on from here.

If anyone can offer a hint that would help with my understanding of the problem and the attempt at the proof, that would be extremely helpful. Thank you.

  • 1
    $\begingroup$ Note that $36=6^2-0^2=10^2-8^2$. $\endgroup$ – André Nicolas Jul 14 '16 at 19:40

We have $$2n=a^2-b^2=(a-b)(a+b)$$ $a-b$, $a+b$ must be of the same parity, and that parity must be even, since otherwise their product wouldn't be the even number $2n$. Hence $n$ is even, so we may as well have $$4m=(a-b)(a+b)$$ or $$m=\frac{a-b}{2}\frac{a+b}{2}$$

Hence, we factor $m=st$, with $s\le t$, and set $\frac{a-b}{2}=s$, $\frac{a+b}{2}=t$, or $a=s+t$, $b=t-s$.

For $16$, we have $4=1\cdot 4=2\cdot 2$. This leads to $\{a=5, b=3\}$ and $\{a=4,b=0\}$.

For $24$, we have $6=1\cdot 6=2\cdot 3$.

For $32$, we have $8=1\cdot 8=2\cdot 4$.

It appears that the desired $n$ are of the form $4pq$, for $p,q$ not necessarily distinct primes, and of the form $4p^3$. $pq$ has factorizations $1\cdot pq=p\cdot q$, and $p^3$ has factorizations $1\cdot p^3=p\cdot p^2$. It's a bit tedious to look at various cases, but I'm fairly sure that all other forms for $n$ will have more than two factorizations, leading to more than two $\{a,b\}$ pairs. Also not proved (but I think not too hard) is that two different factorizations must lead to different $\{a,b\}$ pairs.

  • $\begingroup$ Amusing, we used the same letters, $m$, $s$, $t$. A uniform culture! $\endgroup$ – André Nicolas Jul 14 '16 at 20:02
  • $\begingroup$ Could another form be $4p^2$ since the only factorizations are $1 \cdot p^2$ and $p \cdot p$. $\endgroup$ – Joe Jul 14 '16 at 20:52
  • 1
    $\begingroup$ @Joseph that's covered by the $4pq$ case; it is even made explicit that the primes $p,q$ need not be distinct. $\endgroup$ – quid Jul 14 '16 at 22:17

Outline: As you know, we are solving $(a-b)(a+b)=n$, with the side requirement that $a+b$ (and therefore $a-b$), are even.

So $n$ is of the shape $4m$. If $st=m$, we get the solution $a-b=2s$, $a+b=2t$. Thus the number of representations is the number of ways to express $m$ as a product $st$ with $0\lt s\le t$.

Now there is some work for you to do. What numbers $m$ can be expressed in precisely two ways as $st$, where $0\lt s\le t$?

  • $\begingroup$ @Henry: Thanks, need to interchange. $\endgroup$ – André Nicolas Jul 15 '16 at 16:20

My claim is that all numbers $x$ for which $x=8k+16$ will have exactly two representations.

Counterexample: \begin{align} 120 &= 31^2-29^2 \\ &= 17^2 - 13^2 \\ &= 13^2-7^2 \\ &= 11^2-1^2 \end{align}

Note that while I just picked a number divisible by $8$ with plenty of factors, the claim actually falls at $48$: \begin{align} 48 &= 13^2-11^2 \tag{from (12,1)}\\ &= 8^2 - 4^2 \tag{from (6,2)}\\ &= 7^2-1^2 \tag{from (4,3)}\\ \end{align} because $48/4=12$ has three pairs of factors.


As Joffan pointed out, your conjecture isn't true. Here's my attempt at finding the correct condition for a positive even integer $n$ to be represented by a difference of squares in exactly 2 ways.

Suppose $n= a^2-b^2=(a+b)(a-b)$. This suggests that factorizations of $n$ can be linked to representations as a difference of squares. Clearly each representation of $n$ as a difference of squares gives us a factorization of $n$. Which factorizations of $n$ give us a difference of squares?

Suppose $n=xy, x<y$, then we want to find $a,b$ such that $a+b=x,a-b=y$. We get $a=\frac{x+y}{2},b=\frac{x-y}{2}$. Since you said n is even, we know that $x,y$ must both be even.

Therefore, every factorization of $n$ such that each factor is even gives us a representation of $n$ as a difference of squares. So how many such factorizations does $n$ have?

Firstly, note that this is equal to the number of factorizations (without any restrictions on the factors) of $n/4$. The number of factorizations of any number is the number of factors that number has divided by two, rounded up (only needed in the case of squares).

There is a nice formula for the number of factors of $n/4$ in terms of its prime factorization. If $n/4=\Pi_{i=1}^n p_i^{e_i}$ then there are $\Pi_{i=1}^n (e_i+1)$ factorizations

We want 2 representations, and so we want 3 or 4 factorizations. With some casework, this gives: $n=4p^2,4p^3,4pq$ for $p,q$ prime.

  • $\begingroup$ Is it sufficient to say that we can conclude that $n=4p^k$ for $k \geq 4$ will not have exactly two factorizations since $p^k$ for $k \geq 4$ can always be written as $p^2p^{k-2}$. Moreover, for $p^k$ for $k \in \mathbb{N}$, each $p^k$ will always have factorizations $1 \cdot p^k$ and $p^{k-1}p^k$. Thus $n$ = $4pq$, $4p^2$, $4p^3$ are the only even numbers $n$ that have exactly two factorizations and hence have two representations. $\endgroup$ – Joe Jul 14 '16 at 21:08

The first counterexample for which $8k+16$ is not uniquely described by a difference in squares in only two ways is $48$.



All product $(a+b)(a-b)$ is a such a difference $a^2-b^2$ so if your claim were true, the infinity of diophantine equations $$(x+y)(x-y)= 8k+16\text{ where }k\ge 1$$ would always have just two solutions; it is doubtful, in particular for $k$ even with many prime factors. Taking for example $k=2n$ one has $$(x+y)(x-y)=16(n+1)$$ Choose now $n+1=abc$ with $a,b,c$ even so you have the equation $$(x+y)(x-y)=16abc$$ This way you have several couples of even factors $A,B$ with $AB=16abc$ and for each of them the system $$\begin{cases}x+y=A\\x-y=B\end{cases}$$ gives a solution $(x,y)$ for which you have $$x^2-y^2=16abc$$ (don't forget, of course that our $16abc$ is by construction, of the form $8k+16$).


As others have pointed out, the conjecture is not true. I really enjoyed reading how Euler investigated the topic:

Euler Archive

E228 - On the numbers which are the sum of two squares (1758)

E134 - Theorems on the divisors of numbers (1750)

Subject, Number Theory, English


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.