Find two integers $a, b$ for given integer $c$, so that $c=a^2\pm b^2$

130 Views Asked by At

Given a positive integer $c$: Find two other positive integers $a$ and $b$, so that $c=a^2 + b^2$ and/or $c=a^2 - b^2$.

I've already got a solution for any odd $c$:

$c = (x+1)^2 - x^2 = 2x + 1$

so $x=\dfrac{c-1}{2}$ and the solution is $c = \left(\dfrac{c+1}{2}\right)^2 - \left(\dfrac{c-1}{2}\right)^2$

Is there a way to solve this for any positive integer $c$? And if not, is it possible to describe all possible solutions and also describe all $c$ for which no solution exists?