TITLE: Proving that an integral domain has at most two elements that satisfy the equation $x^2 = 1$.
QUESTION [5 upvotes]: I like to be thorough, but if you feel confident you can skip the first paragraph.
Review: A ring is a set $R$ endowed with two operations of + and $\cdot$ such that $(G,+)$ is an additive abelian group, multiplication is associative, $R$ contains the multiplicative identity (denoted with 1), and the distributive law holds.  If multiplication is also commutative, we say $R$ is a commutative ring. A ring that has no zero divisors (non-zero elements whose product is zero) is called an integral domain, or just a domain.
We want to show that for a domain, the equation $x^2 = 1$ has at most 2 solutions in $R$ (one of which is the trivial solution 1).  
Here's what I did: 
For simplicity let $1,a,b$ and $c$ be distinct non-zero elements in $R$.  Assume $a^2 = 1$.  We want to show that letting $b^2 = 1$ as well will lead to a contradiction.  So suppose $b^2 = 1$, then it follows that $a^2b^2 = (ab)^2 = 1$, so $ab$ is a solution as well, but is it a new solution?  If $ab = 1$, then $abb = 1b \Rightarrow a = b$ which is a contradiction.  If $ab = a$, then $aab = aa \Rightarrow b = 1$ which is also a contradiction.  Similarly, $ab = b$ won't work either.  So it must be that $ab = c$.  So by "admitting" $b$ as a solution, we're forced to admit $c$ as well.
So far we have $a^2 = b^2 = c^2 = 1$ and $ab = c$.  We can procede as before as say that $(abc)^2 = 1$, so $abc$ is a solution, but once again we should check if it is a new solution.  From $ab = c$, we get $a = cb$ and $b = ac$, so $abc = (cb)(ac)(ab) = (abc)^2 = 1$.  So $abc$ is not a new solution; it's just one.
At this point I'm stuck.  I've shown that it is in fact possible to have a ring with 4 distinct elements, namely $1,a,b$ and $c$ such that each satisfies the equation $x^2 = 1$ and $abc = 1$.  What am I missing?

REPLY [2 votes]: More generally, overy any ring, a nonzero polynomial  has no more roots than its degree if the difference of any two distinct roots is not a zero-divisor (which is true in any integral domain).
THEOREM $\ $ Let $\rm R$ be a ring and let $\rm\:f\in R[x].\:$ If $\rm\:f\:$ has more roots than its degree, and if the difference of any two distinct roots is not a zero-divisor, then $\rm\: f = 0.$
Proof $\ $ Clear if $\rm\:deg\: f = 0\:$ since the only constant polynomial with a root is the zero polynomial. Else $\rm\:deg\: f \ge 1\:$ so by hypothesis $\rm\:f\:$ has a root $\rm\:s\in R.\:$ Factor Theorem $\rm\Rightarrow\: f(x) = (x-s)\:g ,$ $\rm\: g\in R[x].$ Every root $\rm\:r\ne s\:$ is a root of $\rm\: g\:$ by $\rm\: f(r) = (r-s)g(r) = 0\ \Rightarrow\ g(r) = 0, \ by\ \ r-s\ $ not a zero-divisor. So $\rm\:g\:$ satisfies  hypotheses, so induction on degree $\rm\:\Rightarrow\:g=0\:\Rightarrow\:f=0.\ $ QED
Here's a nice constructive application: if a polynomial $\rm\:f(x)\:$ over $\rm\:\mathbb Z/n\:$ has more roots than its degree, then we can quickly compute a nontrivial factor of $\rm\:n\:$ by a simple $\rm\:gcd\:$ calculation.
The quadratic case of this is at the heart of many integer factorization algorithms, which attempt to factor $\rm\:n\:$ by searching for a nontrivial square root in $\rm\: \mathbb Z/n,\:$ e.g. a square root of $1$ that's not $\pm 1$.