Find all even numbers that can be represented as a difference of squares in only two ways
Solution 1:
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$?
Solution 2:
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.
Solution 3:
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.
Solution 4:
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.
Solution 5:
The first counterexample for which $8k+16$ is not uniquely described by a difference in squares in only two ways is $48$.
$$\begin{align}48&=8\cdot4+16\\&=7^2-1^2\\&=8^2-4^2\\&=13^2-11^2\end{align}$$