It is easy to decide if a given integer $n$ is the sum of two squares, and in fact there is a simple formula (based on the prime factorization) to compute the number of ways that $n$ can be written as the sum of two squares (see for example Wikipedia). But I cannot find a discussion of how two different representations will be related. In other words, suppose that we find a representation $a^2+b^2=n$. Is there a way to find another pair $(c,d)$ from $(a,b)$ so that $n=c^2+d^2$? I am thinking of something similar to the solutions of $ax-by=1$ for relatively prime $a,b$. It is easy to see that all other solutions will be of the form $(x+bk, y+ak)$, where $k$ is any integer. Is there something similar for the sum of two squares?
Asked
Active
Viewed 96 times
0
-
1nothing magic, nothing quicker or completely independent of factoring, as finding distinct representations leads immediately to a factoring. http://zakuski.math.utsa.edu/~jagy/Brillhart_Euler_factoring_2009.pdf – Will Jagy Mar 24 '24 at 02:34
-
As explained here in the dupe, it is easy by factorization refinement in the UFD $, \Bbb Z[i],$ = Gaussian integers, which can be done via gcd compuitation (which is constructive since $, \Bbb Z[i],$ has a Euclidean algorithm. – Bill Dubuque Mar 24 '24 at 06:05
1 Answers
1
It's easy, if factorization in the Gaussian integers is easy. E.g., from $65=8^2+1^2$ you get $65=(8+i)(8-i)$. Now if you can factor $8+i=(2-i)(3+2i)$, whence $8-i=(2+i)(3-2i)$, then you can calculate $(2+i)(3+2i)=4+7i$, yielding $65=4^2+7^2$.
Gerry Myerson
- 185,413
-
1It may be easier to first factor $65=5\times13$, then $5=2^2+1^2=(2+i)(2-i)$ and $13=3^2+2^2=(3+2i)(3-2i)$, and so on. – Gerry Myerson Mar 24 '24 at 02:25
-
I note that in your example both pairs are relatively prime. I am especially interested in decompositions $n=a^2+b^2$ with $a$ and $b$ relatively prime. For example, $125=11^2+2^2=5^2+10^2$ but the second pair is not relatively prime. There is a simple formula to find the number of all decompositions, but is there one that counts only relatively prime pairs? – Math101 Mar 24 '24 at 05:22
-
The not-relatively-prime decomposition of $125$ comes from the decomposition $5=1^2+2^2$ (by multiplying through by $5^2$). I'm sure there's a formula for what you want; it might be as simple as computing the number of representations of $n/d^2$ where $d$ is the biggest integer whose square divides $n$. I take that back, that's too simple, it doesn't work, but something along those lines should. I'd recommend a search for "proper" representations as a sum of two squares. – Gerry Myerson Mar 24 '24 at 06:15
-
See https://math.stackexchange.com/questions/684909/representation-as-a-sum-of-two-squares or https://www.jstor.org/stable/2968441?seq=3 – Gerry Myerson Mar 24 '24 at 06:25