When does a sum of squares uniquely define a pair of integers?

149 Views Asked by At

Given two positive integers $x,y$ ( $x \ne y$) the map $z=f(x,y)=x+y$ is many-to-one function. Given $z$, there are multiple of pairs that map under $f$ to the same image $z$. I'm interested in the map $z=g(x,y)=(x^2+y^2)$ and the conditions that make map $g$ one-to-one mapping (injection).

When does a sum of squares uniquely define a pair of integers?

Update: A reformulation is the following algorithmic problem:

Input: Given $z$ that is a sum of two squares,

Query: Are there two pairs $(x,y)$, $(a,b)$ such that $z=a^2+b^2=x^2+y^2$?

It would be interesting if there exist an efficient algorithm for this algorithmic problem.

Note that $x,y,a,b$ are all distinct positive integers.

1

There are 1 best solutions below

6
On

When you have a function which isn’t injective, it’s usually meaningless to ask generically for “conditions” that make it injective. Conditions on what?

In this case, the map $f(x,y)=x^2+y^2$ from $\mathbb{N}\times \mathbb{N}$ to $\mathbb{N}$ is not injective. It is finite-to-one, meaning the inverse image of any number in its range is at least finite, though it’s usually not a singleton.

One special case you may be interested in is that a prime number $p$ which is congruent to $1$ modulo $4$ can be represented as a sum of squares in exactly one way, ignoring order. For example, $f(2,3)=f(3,2)=13$ are the only two solutions of $f(x,y)=13$. Other primes cannot be represented as a sum of squares at all.

So you may let $Q\subseteq \mathbb{N}\times \mathbb{N}$ be the set of pairs $(x,y)$ such that $x\le y$ and $f(x,y)$ is prime. The function $f$ restricted to $Q$ is injective.

Note, however, that $Q$ is not maximal in that sense. There are larger sets that would work, but it’s not clear if this is what you’re searching for.

===

UPDATE: the question now asks for conditions under which a number is a sum of two squares in two distinct ways. This happens precisely when the prime factorization of the number contains two prime factors (not necessarily distinct) congruent to 1 mod 4.

The smallest such number is $25=5\times 5$ and indeed $25=0^2+5^2=3^2+4^2$. On the other hand, the numbers $10$ or $34$ do not possess two such factors yet they are still sums of squares, so they are sums of squares in a unique way.

See, for example, here.