Integers, matrices, polynomials and residues mod n can all be added and multiplied. A ring is the structure with both operations, linked by the distributive law. Everything you learned about groups applies to the addition.
Definition. A ring is a set $R$ with two operations, $+$ and $\cdot$, such that
- $(R, +)$ is an abelian group (identity $0$, inverses $-a$);
- multiplication is associative: $(ab)c = a(bc)$;
- multiplication distributes over addition: $a(b + c) = ab + ac$ and $(a + b)c = ac + bc$.
A ring is commutative if $ab = ba$ always, and has an identity (or unity) if some $1 \ne 0$ has $1a = a1 = a$. A unit is an element with a multiplicative inverse; the units form a group $U(R)$ under multiplication. Examples: $\mathbb{Z}$, $\mathbb{Q}$, $\mathbb{R}$, $\mathbb{Z}_{n}$ (units $U(n)$), polynomials $\mathbb{R}[x]$, the $2 \times 2$ real matrices (not commutative; units are the invertible matrices), and $2\mathbb{Z}$ (no identity).
Why it works
Proof. $0a = (0 + 0)a = 0a + 0a$ by distributivity; adding $-(0a)$ to both sides gives $0 = 0a$. Next, $ab + (-a)b = (a + (-a))b = 0b = 0$, so $(-a)b$ is the additive inverse of $ab$. $\square$ So "a negative times a positive is negative" is not a convention: it is forced by distributivity. Applying the second rule twice gives $(-a)(-b) = ab$.
Worked example: Units of a product ring
- $(a, b)$ has an inverse exactly when $a$ is a unit of $\mathbb{Z}_{4}$ and $b$ is a unit of $\mathbb{Z}_{9}$.
- $|U(4)| = 2$ and $|U(9)| = 6$.
Answer: $2 \cdot 6 = 12$.
Worked example: Matrices over $\mathbb{Z}_{2}$ do not commute
- $AB = \begin{pmatrix} 2 & 1 \\ 1 & 1 \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ 1 & 1 \end{pmatrix}$ (mod 2).
- $BA = \begin{pmatrix} 1 & 1 \\ 1 & 2 \end{pmatrix} = \begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}$.
Answer: $AB \ne BA$: a finite noncommutative ring.
The characteristic of a ring with identity is the least $n \ge 1$ with $n \cdot 1 = 1 + \cdots + 1 = 0$, or $0$ if there is none: $\mathbb{Z}_{n}$ has characteristic $n$, $\mathbb{Z}$ and $\mathbb{Q}$ have characteristic $0$, and $\mathbb{Z}_{4} \times \mathbb{Z}_{6}$ has characteristic $\operatorname{lcm}(4, 6) = 12$.
Common mistake
Key idea