Is there a formula for solving the congruence equation $ax^2 + bx + c=0$? 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,
 A: 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. 
A: 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.
A: 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$. 
