As the title says I'm looking for a general solution to a Diophantine equation of the form:
$y^2 = x^2 + kx - m$
Where $x$ and $y$ are both positive integers. I know that $k$ and $m$ will always be a multiple of 2 if that helps.
Here are a few examples that I solved through brute force.
- $y^2 = x^2 + 30 x - 28$
$x = 2$
$y = 6$
- $y^2 = x^2 + 474 x - 554$
$x = 45$
$y = 151$
- $y^2 = x^2 + 1802 x - 3018$
$x = 37$
$y = 255$
I'm a bit of a dummy so a thorough explanation would be much appreciated. Thanks in advance!
Hint: Write $k=2b$. Then $y^2 = (x+b)^2 -b^2 - m$ and so $m+b^2=(x+b)^2 -y^2$ is a difference of two squares. Now use this well-known fact, which is easy to prove:
To be explicit, if $N=uv$ with $u$ and $v$ of the same parity, then $$ N=uv=\left(\dfrac{u+v}2\right)^2 - \left(\dfrac{u-v}2\right)^2 $$
Therefore, the general solution of $y^2 = x^2 + kx - m$ follows from factoring $N=m+(\frac k2)^2$ as two factors of the same parity and using the formula above to find $x+\frac k2$ and $y$.
Let's see how this works for your first example: $m+b^2=28+15^2=253=11\cdot 23=17^2-6^2$. Therefore, $x+15=17, y=6$. This is the only solution.