For example

$$x^2+7y=9$$I'm thinking something maybe along the lines of Pell's equation but not sure. Any help appreciated, been several years since I've last dealt with Pell equations and quadratic recipriocity.


1 Answer 1


We have $$-7y=x^2-9=(x+3)(x-3)$$ Hence we need either $x+3$ to be a multiple of $7$, or $x-3$ to be a multiple of $7$. Thus $x\equiv \pm 3\pmod{7}$. Any such $x$ will work, with $y$ specified uniquely given $x$.

More generally, if $C$ is a square modulo $A$, i.e. $C\equiv D^2\pmod{A}$ for some $D\in\mathbb{Z}$, then for some $k\in\mathbb{Z}$ we have $C=D^2+kA$ and hence $$x^2+Ay=D^2+kA$$ which we rewrite as $$A(k-y)=(x-D)(x+D)$$ Now we need $A$ to divide $(x-D)(x+D)$. If $A$ is prime, it must divide one or the other, but if $A$ is composite it might partly divide each. Once $x$ is chosen so that $A|(x-D)(x+D)$, $y$ is determined uniquely. In particular, solutions will always exist, by taking $x\equiv \pm D\pmod{A}$ (but other $x$'s might work too).

If $C$ is not a square modulo $A$ I dunno.

  • $\begingroup$ yes, that's easy, but the post requires a "general" method (= C is not square) $\endgroup$
    – G Cab
    May 26, 2016 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .