Solve the congruence by using the method of completing the square

elementary-number-theorymodular arithmeticnumber theory

Actually, I found a open problem which is the same as my problem, see Solve quadratic congruence equation by completing square. But I can not understand the answers…they are too brief…

My typical method to solve a prime power $p^r$ modulus congruence is first solve the corresponding $p$ modulus congruence and then rise the solution in some way. For example, to solve the congruence $x^2 +x+7=0$ (mod $27)$, I will first solve the congruence $x^2 +x+7=0$ (mod $3)$ and the only solution is $1$. Then, with the same trick used in the open problem, we can rise the solution, and finally get the solutions of the congruence modulo $27$.

But my textbook requires me to solve this problem with the method of completing the square. And it provides me of a hint that $4x^2+4x+28=(2x+1)^2+27.$ However, I have no idea about this hint. And the textbook never mentions the method of completing the square.

Thanks in advance.

Best Answer

Completing the square is simply adding some amount and subtracting it in order to get partially a square. Consider for instance $x^2+2x=x^2+2x\underbrace{\color{green}{+1-1}}_{=+0}=(x\color{green}{+1})^2-1$...

Your textbook suggests that $$x^2+x+7\equiv 0\bmod{27}\stackrel{\cdot 4}{\iff}4x^2+4x+28\equiv0\bmod {27}$$ $$\iff \underbrace{(2x+1)^2}_{=4x^2+4x+1}+27\equiv(2x+1)^2+0\equiv(2x+1)^2\equiv0\bmod 27\iff \ldots$$ I obtained $$x\equiv\begin{cases}4\\13\\22\end{cases}\bmod 27$$