# The Ring of Z/nZ

Recall from the Rings page that if $+$ and $*$ are binary operations on the set $R$, then $R$ is called a ring under $+$ and $*$ denoted $(R, +, *)$ when the following are satisfied:

**1.**For all $a, b \in R$ we have that $(a + b \in R)$ (Closure under $+$).

**2.**For all $a, b, c \in R$, $a + (b + c) = (a + b) + c$ (Associativity of elements in $R$ under $+$).

**3.**There exists an $0 \in R$ such that for all $a \in R$ we have that $a + 0 = a$ and $0 + a = a$ (The existence of an identity element $0$ of $R$ under $+$).

**4.**For all $a \in R$ there exists a $-a \in R$ such that $a + (-a) = 0$ and $(-a) + a = 0$ (The existence of inverses for each element in $R$ under $+$).

**5.**For all $a, b \in R$ we have that $a + b = b + a$ (Commutativity of elements in $R$ under $+$).

**6.**For all $a, b \in R$ we have that $a * b = b * a$ (Closure under $*$).

**7.**For all $a, b, c \in R$, $a * (b * c) = (a * b) * c$ (Associativity of elements in $R$ under $*$).

**8.**There exists a $1 \in R$ such that for all $a \in R$ we have that $a * 1 = a$ and $1 * a = a$ (The existence of an identity element $1$ of $R$ under $*$).

**9.**For all $a, b, c \in R$ we have that $a * (b + c) = (a * b) + (b * c)$ and $(a + b) * c = (a * c) + (b * c)$ (Distributivity of $*$ over $+$).

We will now look at the ring of $\mathbb{Z} / n\mathbb{Z}$ for $n \in \{ 2, 3, ... \}$. On The Ring of Z/2Z page, we defined $\mathbb{Z} / 2\mathbb{Z}$ to be the following set of sets:

(1)The set $[0]_2$ denotes the set of integers $z \in \mathbb{Z}$ such that $z \equiv 0 \pmod 2$ and the set $[1]_2$ denotes the set of integers $z \in \mathbb{Z}$ such that $z \equiv 1 \pmod 2$. In set-builder notation we have that:

(2)We saw that $(\mathbb{Z} / 2 \mathbb{Z}, +, *)$ formed a ring with respect to the addition $+$ and multiplication $*$ which we defined on it. We will now look more generally at the collection of sets $\mathbb{Z} / n\mathbb{Z}$ for $n \in \{ 2, 3, ... \}$. Define this set to be the set of sets where:

(3)For each $k \in \{1, 2, ..., n-1 \}$ we define the set $[k]_n$ as the set of integers $z \in \mathbb{Z}$ such that $z$ has the remainder $k$ upon division by $n$, that is:

(4)Note that if $k \in \mathbb{Z}$ and $k > n - 1$ then $[k]_n = [i]_n$ for some $i = \{ 0, 1, 2, ..., n-1 \}$. This is due to the fact that the remainder when $z \in \mathbb{Z}$ is divided by $n$ must be either $0$, $1$, …, or $n - 1$ as we saw on The Division Algorithm page. Therefore if $k > n - 1$ then $k$ can be written in the form $k = nq + r$ where $0 \leq r < n$ and so $[k]_n = [r]_n$ for $r \in \{0, 1, 2, ..., n-1 \}$. We will now define the operations $+$ and $*$ to make $\mathbb{Z} / n \mathbb{Z}$ a ring.

We define the operation of addition, $+$, for all $[k]_n, [j]_n \in \mathbb{Z} / n\mathbb{Z}$ by:

(5)Similarly we define the operation of multiplication, $*$, for all $[k]_n, [j]_n \in \mathbb{Z} / n \mathbb{Z}$ by:

(6)We will now show that $\mathbb{Z} / n \mathbb{Z}$ is a ring under the operations $+$ and $*$.

Clearly $\mathbb{Z} / n \mathbb{Z}$ is closed under $+$ because the sum $k + j \equiv r \pmod n$ and so $k + j]_n = [r]_n$ for some $r \in \{0, 1, 2, ..., n-1\}$.

Furthermore, $+$ is associative since $(i + (j + k)) \equiv ((i + j) + k) \pmod n$ and so:

(7)The identity element of $+$ is $[0]_n$ since:

(8)The inverse element for each $[k]_n$ is $[n-k]_n$ since $n-k \equiv r \pmod n$ for some $r \in \{ 0, 1, 2, ..., n-1 \}$. Noting that $n \equiv 0 \pmod n$ we have that:

(10)The operation $+$ is commutative since $(k + j) \equiv (j + k) \pmod n$, so:

(11)The set $\mathbb{Z} / n\mathbb{Z}$ is closed under $*$ since the product $kj \equiv r \pmod n$ for some $r \in \{0, 1, 2, ..., n- 1\}$.

The operation $*$ is also associative since $i * (j * k) \equiv (i * j) *k \pmod n$ so:

(12)The identity for $*$ is $[1]_n$.

Lastly, the distributivity property holds since $(i \cdot (j + k)) \equiv (i \cdot j + i \cdot k) \pmod n$ and $((i + j) \cdot k) \equiv (i \cdot k + j \cdot k) \pmod n$ and so for left distributivity we have:

(13)And for right distributivity we have:

(14)Therefore we have verified all of the ring axioms and so $(\mathbb{Z} / n \mathbb{Z}, +, *)$ is a ring.