Elementary Number Theory – Formula for Solving Congruence Equation

elementary-number-theory

Using the quadratic formula, we have either 0, 1, or 2 solutions. I wonder if we could use it this formula for congruence? Or is there a formula to solve quadratic equation for congruence?

Edit
Assume that $ax^2 + bx + c \equiv 0 \pmod{p}$, where $p$ is prime with $(a, p) = 1$, then is there a formula for this equation?

Thanks,

Best Answer

If $n = p$ is prime, the situation is straightforward. When $p = 2$ there are a small number of cases, and when $p > 2$ the quadratic formula holds. (Note that the quadratic formula fails when $p = 2$ because you can't divide by $2$. This is because you can't complete the square $\bmod 2$.)

If $n$ is composite, the situation is more complicated. $x$ is a solution if and only if $x$ is a solution $\bmod p^k$ for every prime power factor of $n$ by the Chinese Remainder Theorem, so in particular if, say, $n$ is a product of $k$ distinct primes there can be as many as $2^k$ solutions obtained by combining roots modulo the prime factors of $n$.

After the above step the problem reduces to the prime power case $n = p^k$. In this case the question of what solutions look like is completely answered by Hensel's lemma. Again the case $p = 2$ is special.

Related Question