The integers mod \(n\) have become indispensable in the theory and applications of algebra. In mathematics they are used in cryptography, coding theory, and the detection of errors in identification codes.

We have already seen that two integers \(a\) and \(b\) are equivalent mod \(n\) if \(n\) divides \(a - b\). The integers mod \(n\) also partition \({\mathbb Z}\) into \(n\) different equivalence classes; we will denote the set of these equivalence classes by \({\mathbb Z}_n\). Consider the integers modulo 12 and the corresponding partition of the integers:
\begin{align*}
{[0]} & = \{ \ldots, -12, 0, 12, 24, \ldots \},\\
{[1]} & = \{ \ldots, -11, 1, 13, 25, \ldots \},\\
& \vdots\\
{[11]} & = \{ \ldots, -1, 11, 23, 35, \ldots \}.
\end{align*}
When no confusion can arise, we will use \(0, 1, \ldots, 11\) to indicate the equivalence classes \({[0]}, {[1]}, \ldots, {[11]}\) respectively. We can do arithmetic on \({\mathbb Z}_n\). For two integers \(a\) and \(b\), define addition modulo \(n\) to be \((a + b) \pmod{n}\); that is, the remainder when \(a + b\) is divided by \(n\). Similarly, multiplication modulo \(n\) is defined as \((a b) \pmod{ n}\), the remainder when \(a b\) is divided by \(n\).

Example3.1

The following examples illustrate integer arithmetic modulo \(n\):
\begin{align*}
7 + 4 & \equiv 1 \pmod{ 5} & 7 \cdot 3 & \equiv 1 \pmod{ 5}\\
3 + 5 & \equiv 0 \pmod{ 8} & 3 \cdot 5 & \equiv 7 \pmod{ 8}\\
3 + 4 & \equiv 7 \pmod{ 12} & 3 \cdot 4 & \equiv 0 \pmod{ 12}
\end{align*}
In particular, notice that it is possible that the product of two nonzero numbers modulo \(n\) can be equivalent to \(0 \) modulo \(n\).

Example3.2

Most, but not all, of the usual laws of arithmetic hold for addition and multiplication in \({\mathbb Z}_n\). For instance, it is not necessarily true that there is a multiplicative inverse. Consider the multiplication table for \({\mathbb Z}_8\) in Table 3.3. Notice that 2, 4, and 6 do not have multiplicative inverses; that is, for \(n = 2\), 4, or 6, there is no integer \(k\) such that \(k n \equiv 1 \pmod{ 8}\).

Proposition3.4

Let \({\mathbb Z}_n\) be the set of equivalence classes of the integers mod \(n\) and \(a, b, c \in {\mathbb Z}_n\).

Addition and multiplication are commutative:
\begin{align*}
a + b & \equiv b + a \pmod{ n}\\
a b & \equiv b a \pmod{ n}.
\end{align*}

Addition and multiplication are associative:
\begin{align*}
(a + b) + c & \equiv a + (b + c)\pmod{ n}\\
(a b) c & \equiv a (b c) \pmod{ n}.
\end{align*}

There are both additive and multiplicative identities:
\begin{align*}
a + 0 & \equiv a \pmod{ n}\\
a \cdot 1 & \equiv a \pmod{ n}.
\end{align*}

Multiplication distributes over addition:
\begin{equation*}a (b + c) \equiv a b + a c \pmod{ n}.\end{equation*}

For every integer \(a\) there is an additive inverse \(-a\):
\begin{equation*} a + (-a) \equiv 0 \pmod{ n}. \end{equation*}

Let \(a\) be a nonzero integer. Then \(\gcd(a,n) = 1\) if and only if there exists a multiplicative inverse \(b\) for \(a \pmod{n}\); that is, a nonzero integer \(b\) such that \begin{equation*} a b \equiv 1 \pmod{ n}.\end{equation*}

We will prove (1) and (6) and leave the remaining properties to be proven in the exercises.

(1) Addition and multiplication are commutative modulo \(n\) since the remainder of \(a + b\) divided by \(n\) is the same as the remainder of \(b + a\) divided by \(n\).

(6) Suppose that \(\gcd(a, n) = 1\). Then there exist integers \(r\) and \(s\) such that \(ar + ns = 1\). Since \(ns = 1 - ar\), it must be the case that \(ar \equiv 1 \pmod{n}\). Letting \(b\) be the equivalence class of \(r\), \(a b \equiv 1\pmod{n}\).

Conversely, suppose that there exists an integer \(b\) such that \(ab \equiv 1 \pmod{ n}\). Then \(n\) divides \(ab -1\), so there is an integer \(k\) such that \(ab - nk = 1\). Let \(d = \gcd(a,n)\). Since \(d\) divides \(ab - nk\), \(d\) must also divide 1; hence, \(d = 1\).

A symmetry of a geometric figure is a rearrangement of the figure preserving the arrangement of its sides and vertices as well as its distances and angles. A map from the plane to itself preserving the symmetry of an object is called a rigid motion. For example, if we look at the rectangle in Figure 3.5, it is easy to see that a rotation of \(180^{\circ}\) or \(360^{\circ}\) returns a rectangle in the plane with the same orientation as the original rectangle and the same relationship among the vertices. A reflection of the rectangle across either the vertical axis or the horizontal axis can also be seen to be a symmetry. However, a \(90^{\circ}\) rotation in either direction cannot be a symmetry unless the rectangle is a square.

Let us find the symmetries of the equilateral triangle \(\bigtriangleup ABC\). To find a symmetry of \(\bigtriangleup ABC\), we must first examine the permutations of the vertices \(A\), \(B\), and \(C\) and then ask if a permutation extends to a symmetry of the triangle. Recall that a permutation of a set \(S\) is a one-to-one and onto map \(\pi :S \rightarrow S\). The three vertices have \(3! = 6\) permutations, so the triangle has at most six symmetries. To see that there are six permutations, observe there are three different possibilities for the first vertex, and two for the second, and the remaining vertex is determined by the placement of the first two. So we have \(3 \cdot 2 \cdot 1 = 3! = 6\) different arrangements. To denote the permutation of the vertices of an equilateral triangle that sends \(A\) to \(B\), \(B\) to \(C\), and \(C\) to \(A\), we write the array
\begin{equation*}\begin{pmatrix}
A & B & C \\
B & C & A
\end{pmatrix}.\end{equation*}
Notice that this particular permutation corresponds to the rigid motion of rotating the triangle by \(120^{\circ}\) in a clockwise direction. In fact, every permutation gives rise to a symmetry of the triangle. All of these symmetries are shown in Figure 3.6.

A natural question to ask is what happens if one motion of the triangle \(\bigtriangleup ABC\) is followed by another. Which symmetry is \(\mu_1 \rho_1\); that is, what happens when we do the permutation \(\rho_1\) and then the permutation \(\mu_1\)? Remember that we are composing functions here. Although we usually multiply left to right, we compose functions right to left. We have
\begin{align*}
(\mu_1 \rho_1)(A) & = \mu_1( \rho_1( A ) ) = \mu_1( B ) = C\\
(\mu_1 \rho_1)(B) & = \mu_1( \rho_1( B ) ) = \mu_1( C ) = B\\
(\mu_1 \rho_1)(C) & = \mu_1( \rho_1( C ) ) = \mu_1( A ) = A.
\end{align*}
This is the same symmetry as \(\mu_2\). Suppose we do these motions in the opposite order, \(\rho_1\) then \(\mu_1\). It is easy to determine that this is the same as the symmetry \(\mu_3\); hence, \(\rho_1 \mu_1 \neq \mu_1 \rho_1\). A multiplication table for the symmetries of an equilateral triangle \(\bigtriangleup ABC\) is given in Table 3.7.

Notice that in the multiplication table for the symmetries of an equilateral triangle, for every motion of the triangle \(\alpha\) there is another motion \(\beta\) such that \(\alpha \beta = \identity\); that is, for every motion there is another motion that takes the triangle back to its original orientation.