[proofplan]
We first define the residue-class operations and prove that they do not depend on the chosen integer representatives. The only non-formal point is well-definedness, which follows from [compatibility of congruence with addition and multiplication](/theorems/9334). Once the operations are well-defined, every ring identity in $\mathbb{Z}/n\mathbb{Z}$ is obtained by choosing representatives, using the corresponding integer identity in $\mathbb{Z}$, and passing back to congruence classes.
[/proofplan]
custom_env
admin
[step:Define the operations on residue classes and prove they are well-defined]For each $a \in \mathbb{Z}$, let $\bar a \in \mathbb{Z}/n\mathbb{Z}$ denote the congruence class of $a$ modulo $n$. Define binary operations
\begin{align*}
+: (\mathbb{Z}/n\mathbb{Z}) \times (\mathbb{Z}/n\mathbb{Z}) \to \mathbb{Z}/n\mathbb{Z}
\end{align*}
and
\begin{align*}
\cdot: (\mathbb{Z}/n\mathbb{Z}) \times (\mathbb{Z}/n\mathbb{Z}) \to \mathbb{Z}/n\mathbb{Z}
\end{align*}
by
\begin{align*}
(\bar a,\bar b) \mapsto \overline{a+b}
\end{align*}
and
\begin{align*}
(\bar a,\bar b) \mapsto \overline{ab}.
\end{align*}
We prove that these definitions are independent of representatives. Suppose $\bar a=\bar a'$ and $\bar b=\bar b'$, where $a,a',b,b' \in \mathbb{Z}$. Then $a \equiv a' \pmod n$ and $b \equiv b' \pmod n$. By [citetheorem:9334],
\begin{align*}
a+b \equiv a'+b' \pmod n
\end{align*}
and
\begin{align*}
ab \equiv a'b' \pmod n.
\end{align*}
Therefore
\begin{align*}
\overline{a+b}=\overline{a'+b'}
\end{align*}
and
\begin{align*}
\overline{ab}=\overline{a'b'}.
\end{align*}
Thus both operations are well-defined on $\mathbb{Z}/n\mathbb{Z}$.[/step]
custom_env
admin
[guided]The point that must be checked before any ring axiom is meaningful is that the formulas for addition and multiplication do not depend on the chosen representatives. A residue class such as $\bar a$ can also be written as $\bar a'$ whenever $a \equiv a' \pmod n$, so the formula $\bar a+\bar b=\overline{a+b}$ would be invalid unless replacing $a$ and $b$ by congruent integers gives the same output class.
Define the maps
\begin{align*}
+: (\mathbb{Z}/n\mathbb{Z}) \times (\mathbb{Z}/n\mathbb{Z}) \to \mathbb{Z}/n\mathbb{Z}
\end{align*}
and
\begin{align*}
\cdot: (\mathbb{Z}/n\mathbb{Z}) \times (\mathbb{Z}/n\mathbb{Z}) \to \mathbb{Z}/n\mathbb{Z}
\end{align*}
by sending $(\bar a,\bar b)$ to $\overline{a+b}$ and $\overline{ab}$, respectively. To prove these are well-defined maps, assume that the same input classes are represented in another way:
\begin{align*}
\bar a=\bar a'
\end{align*}
and
\begin{align*}
\bar b=\bar b'.
\end{align*}
By the definition of congruence classes, this means
\begin{align*}
a \equiv a' \pmod n
\end{align*}
and
\begin{align*}
b \equiv b' \pmod n.
\end{align*}
The compatibility theorem for congruence, [citetheorem:9334], applies exactly to these two congruences. It gives
\begin{align*}
a+b \equiv a'+b' \pmod n
\end{align*}
and
\begin{align*}
ab \equiv a'b' \pmod n.
\end{align*}
Passing from congruence to equality of residue classes, we obtain
\begin{align*}
\overline{a+b}=\overline{a'+b'}
\end{align*}
and
\begin{align*}
\overline{ab}=\overline{a'b'}.
\end{align*}
Hence the output of each operation depends only on the classes $\bar a$ and $\bar b$, not on the particular integers $a$ and $b$ used to represent them. This proves that addition and multiplication modulo $n$ are well-defined binary operations on $\mathbb{Z}/n\mathbb{Z}$.[/guided]
custom_env
admin
[step:Verify that addition makes $\mathbb{Z}/n\mathbb{Z}$ an abelian group]
Let $\bar a,\bar b,\bar c \in \mathbb{Z}/n\mathbb{Z}$ with $a,b,c \in \mathbb{Z}$. Using associativity of addition in $\mathbb{Z}$,
\begin{align*}
(\bar a+\bar b)+\bar c=\overline{(a+b)+c}=\overline{a+(b+c)}=\bar a+(\bar b+\bar c).
\end{align*}
Using commutativity of addition in $\mathbb{Z}$,
\begin{align*}
\bar a+\bar b=\overline{a+b}=\overline{b+a}=\bar b+\bar a.
\end{align*}
The class $\bar 0$ is an additive identity because
\begin{align*}
\bar a+\bar 0=\overline{a+0}=\bar a
\end{align*}
and
\begin{align*}
\bar 0+\bar a=\overline{0+a}=\bar a.
\end{align*}
Finally, $\overline{-a}$ is an additive inverse of $\bar a$ because
\begin{align*}
\bar a+\overline{-a}=\overline{a+(-a)}=\bar 0
\end{align*}
and
\begin{align*}
\overline{-a}+\bar a=\overline{(-a)+a}=\bar 0.
\end{align*}
Thus $(\mathbb{Z}/n\mathbb{Z},+)$ is an abelian group.
[/step]
custom_env
admin
[step:Verify that multiplication is associative, commutative, and has identity $\bar 1$]
Let $\bar a,\bar b,\bar c \in \mathbb{Z}/n\mathbb{Z}$ with $a,b,c \in \mathbb{Z}$. Using associativity of multiplication in $\mathbb{Z}$,
\begin{align*}
(\bar a\bar b)\bar c=\overline{(ab)c}=\overline{a(bc)}=\bar a(\bar b\bar c).
\end{align*}
Using commutativity of multiplication in $\mathbb{Z}$,
\begin{align*}
\bar a\bar b=\overline{ab}=\overline{ba}=\bar b\bar a.
\end{align*}
The class $\bar 1$ is a multiplicative identity because
\begin{align*}
\bar a\bar 1=\overline{a \cdot 1}=\bar a
\end{align*}
and
\begin{align*}
\bar 1\bar a=\overline{1 \cdot a}=\bar a.
\end{align*}
Therefore multiplication on $\mathbb{Z}/n\mathbb{Z}$ is associative and commutative, and has identity element $\bar 1$.
[/step]
custom_env
admin
[step:Verify distributivity and conclude the ring axioms]
Let $\bar a,\bar b,\bar c \in \mathbb{Z}/n\mathbb{Z}$ with $a,b,c \in \mathbb{Z}$. Using the distributive law in $\mathbb{Z}$,
\begin{align*}
\bar a(\bar b+\bar c)=\overline{a(b+c)}=\overline{ab+ac}=\bar a\bar b+\bar a\bar c.
\end{align*}
Similarly,
\begin{align*}
(\bar a+\bar b)\bar c=\overline{(a+b)c}=\overline{ac+bc}=\bar a\bar c+\bar b\bar c.
\end{align*}
The preceding steps show that addition is an abelian group operation, multiplication is associative with identity $\bar 1$, multiplication distributes over addition on both sides, and multiplication is commutative. Hence $\mathbb{Z}/n\mathbb{Z}$ is a commutative ring with identity $\bar 1$.
[/step]