TITLE: Every nonzero element in a finite ring is either a unit or a zero divisor
QUESTION [57 upvotes]: Let $R$ be a finite ring with unity. Prove that every nonzero element of $R$ is either a unit or a zero-divisor.

REPLY [3 votes]: Let $a$ in $R$ be non-zero and suppose that $a$ is not a zero-divisor. 
First I will prove the cancellation property just for $a$. If $ab = ac$, then $ab-ac = 0$ and $a(b-c) = 0$. Since $a$ is not a zero-divisor, then $b-c = 0$ so $b = c$.
Consider the set $\{a^n\mid n \in\mathbb N\}=\{1,a^1,a^2,...\}$ 
Since $R$ is finite, we must have $a^i = a^j$ for some $i$, $j$ with $i \gt j$. Then since we have the cancellation property for $a$ and we have $a^{i-j}a^j = 1a^j$ (remember we have unity), then cancellation gives us $a^{i-j} = 1$. If $a = 1$ then $a$ is clearly a unit.
If $a\ne 1$, then $i-j \gt 1$ so we can factor out one copy of $a$ to get $a^{i-j-1}a^1 = 1$.
Thus the element $a^{i-j-1}$ is the multiplicative inverse of $a$, so $a$ is a unit.
Thus every nonzero element of this ring that is not a zero-divisor is a unit. In other words, every nonzero element is either a zero-divisor or a unit.
If we drop the finite condition then the result does not hold true. For example, $\mathbb Z$ is a commutative ring with unity, but $2$ is neither a zero-divisor nor a unit.