TITLE: Polynomial modulus
QUESTION [5 upvotes]: Can anyone explain why the two solutions to $n^2+7n-2 = 0$ modulo $43$ are $n=13$ and $n=23$ and how they are found?

REPLY [4 votes]: The congruence is equivalent to $4n^2+28n-8\equiv 0\pmod{43}$ (we multiplied through by $4$.) This can be rewritten as 
$$(2n+7)^2-49-8\equiv 0\pmod{43}.$$
Equivalently, we want to solve $(2n+7)^2\equiv 14\pmod{43}$.
Since $86+14=100$, We can probably spot immediately the solution $2n+7\equiv 10\pmod{43}$ and then by symmetry $2n+7\equiv -7\pmod{43}$.
Now we have two linear congruences to solve for $n$, namely $2n+7\equiv 10\pmod{43}$ and $2n+7\equiv -10\pmod{43}$.
To solve the first, rewrite as $2n\equiv 3\equiv 46\pmod{43}$, giving solution $n\equiv 23\pmod{43}$. The other calculation is very similar.
Note that we have essentially used a version of the Quadratic Formula.
Generalizations: The procedure we used is general. Let $p$ be an odd prime, and consider the quadratic congruence $an^2+bn+c\equiv 0\pmod{p}$, where $p$ does not divide $a$. Rewrite the congruence as $4a^2+4ab+4ac\equiv 0\pmod{p}$, and complete the square as above.
But we are left with a congruence of shape $x^2\equiv d\pmod{p}$. There are easy computational methods to check whether this congruence has a solution. (Half the time it doesn't, and then the original congruence does not have a solution.)
For primes of the form $4k+3$, there is an easy way to compute the solutions when they exist, essentially by using Fermat's Theorem. For other primes $p$, there are good algorithms for solving the congruence $x^2\equiv d\pmod{p}$, even for very large $p$. For details, you may want to look at the Wikipedia article on the Tonelli-Shanks algorithm.
Remark: We multiplied through by $4$ to prepare for the generalization. However, in our case we can complete the square somewhat more simply, by replacing $7$ by $50$. Then note that $n^2+50n-2=(n+25)^2-627$, and we can replace $627$ by $25$, making the solutions obvious.