# Solution of quadratic diophantine equations

Is there any algorithm so that solution to the following equation can be found?

$(x+a)^2-y^2=c$ where $c$ and $a$ is a constant.

It is similar to Pells eqution with a variation where $D=1$. I am new to this number theory problem. So can anyone please help me?

• purely by factoring $c$ – Will Jagy Oct 10 '15 at 20:42

I.e. you want to solve in integers, where $c$ is given (we can let $x$ be $x+a$):

$$x^2-y^2=c$$

The typical solution is factoring $(x-y)(x+y)=c$, noticing the factors of $c$ and checking cases, when $x-y=d$ and $x+y=\frac{c}{d}$. Note $\begin{cases}x-y=d\\x+y=\frac{c}{d}\end{cases}$ is solvable in integers if and only if $d$ and $\frac{c}{d}$ are of the same parity.

E.g., let's solve $x^2-y^2=36$. $(x-y)(x+y)=2^2\cdot 3^2$. Both $x-y, x+y$ must be even (since they're of the same parity, like I said). Cases:

$\begin{cases}x-y=2\\ x+y=2\cdot 3^2\end{cases}$, $\begin{cases}x-y=2\cdot 3^2\\x+y=2\end{cases}$,

$\begin{cases}x-y=-2\\ x+y=-2\cdot 3^2\end{cases}$, $\begin{cases}x-y=-2\cdot 3^2\\x+y=-2\end{cases}$

• I am sorry to add a constraint.if you are not allowed to factor c is the equation is still solvable? – Subhmay Barui Oct 11 '15 at 21:21