-2

Do $a$ and $b$ always exist? If not, for what conditions do they exist?

2 Answers2

2

Note that $a^2-b^2 = (a+b)(a-b)$ and see that $a+b$ and $a-b$ differ by $2b$ (an even number). So an $a$ and $b$ exist such that $a^2-b^2 = x$ if and only if you can factor $x$ as the product of two integers which are both odd or both even. In fact, then $x$ has to be an odd number (since product of two integers is both odd) or it has to be divisible by $4$ (since it must be divisible by two even numbers).

user2825632
  • 2,881
2

Generally:

  • If $x=4k$, then $(k+1)^2-(k-1)^2=x$
  • If $x=2k+1$, then $(k+1)^2-k^2=x$
  • If $x=4k+2$ then there are no solutions, because $a^2\equiv 0 \;\text{or}\; 1\pmod 4$, similar for $b^2$, so $a^2-b^2\equiv 0, 1 \;\text{or}\; 3\pmod 4$.