Quadratic diophantine equations

The quadratic diophantine equations are equations of the type: $$ax^2+bxy+cy^2=d$$ where $$a$$, $$b$$, $$c$$ and $$d$$ are integers, and we ask the solutions $$x$$ and $$y$$ to be integers.

Nevertheless, we are only going to see quadratic diophantine equations of this kind here: $$x^2-y^2=n$$ with $$n$$ as any integer.

In this case, just as before,the equation may either have no solution or more than one solution. Nevertheless, the condition for this diophantine equation to have a solution is simpler: if $$n$$ can be written as the product of two numbers that both even, or both odd, then there will be solution. For example:

If $$n = 4$$ we have $$n = 2 \cdot 2$$, and both are even, therefore the equation $$x^2-y^2=4$$ has a solution.

If $$n = 15$$, we have $$n = 3 \cdot 5$$, $$3$$ and $$5$$ are odd both, therefore the equation $$x^2-y^2=15$$ has solution.

If $$n = 6$$, and the divisors of $$6$$ are $$1, 2, 3$$ and $$6$$.

Besides, for the result of multiplying them to be $$6$$, we either have to use $$1\cdot 6$$, or $$2 \cdot 3$$, since no other way of writing $$6$$ as product of $$2$$ (positive) integers is possible.

In neither case is it satisfied that both numbers are even or odd, so the equation $$x^2-y^2=6$$ has no solution.

Let's suppose now that $$n = a \cdot b$$, where $$a$$ and $$b$$ even or odd both. Then a solution is given by: $$$\displaystyle \begin{array}{c} x=\frac{a+b}{2} & y=\frac{a-b}{2}\end{array}$$$

For example, in the case that has been seen before $$n = 4 = 2 \cdot 2$$, we see that $$a= 2$$ and $$b = 2$$, therefore a solution is: $$$\displaystyle \begin{array} {c}x=\frac{2+2}{2}=2 & y=\frac{2-2}{2}=0\end{array}$$$

Let's observe that in the case there is a solution, it cannot be unique, since it is possible that $$n$$ admits another decomposition as the product of two even or odd numbers.

For example, if $$n = 16$$, we know that $$n = 2 \cdot 8$$ (both are even) but also $$n = 4 \cdot 4$$ (both are even), and each of these two representations of $$n$$ gives a solution other than the diophantine equation.