Solve this quadratic congruent equation by inspection

elementary-number-theorymodular arithmeticnumber theoryquadratics

I found a systematic way (c.f. How to solve this quadratic congruence equation) to solve all congruent equations of the form of $ax^2+bx+c=0\pmod{p}$, or to determine that they have no solution.

But I wonder if there is some easy way to find solutions of simple quadratic congruent equations by inspection, for example, for this equation $$x^2+x+47=0\pmod{7}.$$

My textbook gave the solutions $x\equiv 5\pmod{7}$ and $x\equiv 1\pmod{7}$ directly, without any proof. So I think there must be some easier way to inspect the solutions.

Any help will be appreciated.

Best Answer

The good old quadratic equation works just fine if $p\neq2$. If $a\not\equiv 0\pmod{p}$ and $b^2-4ac$ is a quadratic residue mod $p$, then the solutions to the quadratic congruence $$ax^2+bx+c\equiv0\pmod{p},$$ are precisely $$-\frac{b\pm\sqrt{b^2-4ac}}{2a}.$$

In this particular case we have $p=7$ and $a\equiv b\equiv1\pmod{7}$ and $c\equiv47\equiv5\pmod{7}$. Then $$b^2-4ac\equiv2\equiv3^2\pmod{7},$$ so the congruence has the two solutions $$-\frac{1+3}{2}=5\qquad\text{ and }\qquad-\frac{1-3}{2}=1.$$


On the other hand, if you want to solve it purely by inspection, note that there are only $7$ possible solutions to check. Clearly $x=0$ is not a solution, and plugging in $x=1$ yields the first solution. The product of the solutions is congruent to $47\equiv5\pmod{7}$, so the other solution is $x=5$.