# The sum of two integers is a square. The sum of their squares is also a square.

The sum of two integers is a square. The sum of their squares is also a square. E.g. $$-3 + 4 = 1^2, \ (-3)^2 + 4^2 = 5^2$$

$$9 + 40 = 7^2, \ 9^2 + 40^2 = 41^2$$

Question: General solution/form of all such pairs.

Clarification: By general form we mean a parametric form like Euclid's solution for Pythagorean triplets $a = r^2 - s^2, \ b = 2rs$ and $c = r^2 + s^2$ which covers all Pythagorean triplets.

• $$r^2+2rs-s^2=t^2$$ $$r=p^2-2pk+2k^2$$ $$s=2pk$$ $$t=p^2-2k^2$$ – individ Oct 26 '16 at 8:19

WLOG for $d^2=a^2+b^2, a=2mn, b=m^2-n^2$

$a+b=m^2-n^2+2mn$

Let $m^2-n^2+2mn=(m+pn)^2\iff n(p^2+1)=2m(1-p)$

$\dfrac n{2(1-p)}=\dfrac m{1+p^2}=r$(say)

Now $(1+p^2,1-p)|(1+p^2,1-p^2)$ which must divide $1+p^2+1-p^2=2$

Case $\#1:$ $(1+p^2,2(1-p))=1$ if $p$ is even

$n=2r(1-p^2),m=r(1+p^2)$

Case $\#2:$ For odd $p, p^2\equiv1\pmod8, 1+p^2\equiv2$

In that case, $(1+p^2,2(1-p))=2$

$n=r(1-p)$ and $m=\dfrac{r(1+p^2)}2$

• what did you mean by $(1+p^2,1-p)|(1+p^2,1-p^2)$? pair divisibility? – hypergeometric Oct 27 '16 at 17:18
• @hypergeometric, $(a,b)=$gcd$(a,b)$ and $a|b$ means $a$ divides $b$ – lab bhattacharjee Oct 28 '16 at 0:44
• I know what $|$ stands for but wasn't sure that the parentheses was referring to $\gcd$. Thanks for clarifying. – hypergeometric Oct 28 '16 at 13:56