3
$\begingroup$

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,

  • 0
    Regarding the modulus $\rm\:p=2\:$ see the [Parity Root Test.](http://math.stackexchange.com/questions/26837/do-odd-imaginary-numbers-exist/26843#26843)2011-04-04

3 Answers 3

4

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.

  • 0
    @Arturo Magidin: I meant $(a, p) = 1$. I remember now, the "invertible part". Many thanks ;)2011-04-04
1

The quadratic formula works just as well modulo n as long as $(2a,n) = 1$ and $b^2-4ac$ is a quadratic residue mod n. If either of those conditions do not hold, then there are no solutions.

Edit: as pointed out in the comments, this is not a complete answer; see Qiaochu Yuan's for a much better one.

  • 0
    Thank you both for pointing out it was incomplete. I have edited it accordingly.2011-04-04
1

Here (link) is a thorough discussion of the steps in reducing general moduli quadratic equation problems to those of prime moduli, including the case $p=2$.