# Quadratic Diophantine equations in two variables

I am interested in integer solutions of the following bivariate quadratic equation

$$x^2-y^2=(x+y)(x-y)=c,$$ with $$x>y$$. I know that the usual way is for one to assume that if there exist two positive integers $$c_1$$ and $$c_2$$ such that $$c=c_1c_2$$, then by setting $$x+y=c_1\\ x-y=c_2$$ or vice versa, one obtains $$x=\frac{c_1+c_2}{2}$$, from which the value of $$y$$ can also be obtained. For very large $$c$$, this method of factorizing is not efficient. My question is whether there are some quick ways to solve equations of the above form.

Every integral solution corresponds to a factorization $$c=u\cdot v$$ with $$u\equiv v\pmod{2}$$. Finding all integral solutions is therefore (nearly) equivalent to factoring $$c$$ completely, which is hard for large $$c$$. However, finding some integral solutions is easy:

First note that if $$c\equiv2\pmod{4}$$ then there are no integral solutions. If $$c$$ is odd then $$c=c\cdot1$$ and so $$x:=\tfrac{c+1}{2},\qquad y:=\tfrac{c-1}{2},$$ is an integral solution. If $$c\equiv0\pmod{4}$$ then $$c=(2d)\cdot2$$ for some integer $$d$$, and so $$x:=d+1,\qquad y=d-1,$$ is an integral solution.

Hint: If your main equation is $$x^2 - y^2 = c$$ , express $$y$$ in terms of $$x$$ (you'll get $$y = \pm\sqrt{x^2-c}$$ ). If you can express $$c$$ as $$2xm$$ for integers $$x$$ and $$m$$, you get: $$y = \pm\sqrt{(x-m)^2-m^2}$$

Now , from a constant $$x$$ (for eg., $$x = 1$$ or whatever), you can one way or the other deduce the solution by varying $$m$$.

This is what I believe as a 15 year old. Please correct me if I went wrong anywhere, or even if the whole answer is useless.

Here's what I did on Geogebra. This kind of thought may also work, I think.

NB : I used that circle to see what value of $$x$$ would be feasible to begin with as per the above method.

• Hasn't this been of any use ? Commented Sep 15, 2020 at 3:20