How do you solve an algebraic equation over a ring? I have the following equation:
$$n^2-n+1=0$$
Where $n$ is an element of a ring over elements $\{-2,-1,0,1,2\}$, and addition and multiplication are defined modularly (e.g. $2+1=-2$). How would you go about solving this equation over a ring?
 A: As your ring is finite, you can always manually check which $n$ satisfy the equation, by plugging them in. Five cases are manageable.

If you are familiar with the ring, you are talking about, then you might know, that the ring is actually a field - the field with five elements $\mathbb F_5$. Here, you can use your standard techniques to solve a quadratic equation
(For convenience, we don't restrict ourselves to $\{-2,-1,0,1,2\}$, but allow all integers as symbols. Note, that different symbols might denote the same element, e. g. $-3=2=7$)
Now, let's complete the square as usual:
$$n^2-n+1=n^2-n+\frac14+\frac34=\left(n-\frac 12\right)^2+\frac34=(n-3)^2+2 $$
(As always, the fractional notation $\frac1a$ denotes the multiplicative inverse  of $a$. In finite fields, they can be calculated using the Euclidean Algorithm, but in this case you can find them by hand: 
$$\frac12=3, \quad \frac34=3\cdot\frac14=3\cdot 4=2$$
Now, this justifies the last equation)
So, it follows, that 
$$(n-3)^2=3$$
When using this method in $\mathbb R$, you would check if the sign of the right-hand side. If it were negative, you would stop, since there were no solutions, if it was positive you would get two equations (one for each root) and if it was zero, then $0$ would be the only root.
In arbitrary fields, this is similar, the only root of $0$ is $0$, other elements have either none or two roots. However, in general, the field is not ordered, so there is no simple criterion to decide whether roots exist.
In this case, we check, that
$$0^2=0,\; 1^2=1,\; 2^2=4,\; 3^2=4,\; 4^2=1$$
so $3$ has no roots and the equation has no solutions.
