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\text{.}\) 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\text{.}\) Consider the integers modulo 12 and the corresponding partition of the integers:

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\text{.}\) For two integers \(a\) and \(b\text{,}\) define addition modulo \(n\) to be \((a + b) \pmod{n}\text{;}\) that is, the remainder when \(a + b\) is divided by \(n\text{.}\) Similarly, multiplication modulo \(n\) is defined as \((a b) \pmod{ n}\text{,}\) the remainder when \(a b\) is divided by \(n\text{.}\)

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

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

Addition and multiplication are commutative:

\begin{align*}
a + b & \equiv b + a \pmod{ n}\\
a b & \equiv b a \pmod{ n}\text{.}
\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}\text{.}
\end{align*}

There are both additive and multiplicative identities:

\begin{align*}
a + 0 & \equiv a \pmod{ n}\\
a \cdot 1 & \equiv a \pmod{ n}\text{.}
\end{align*}

Multiplication distributes over addition:

\begin{gather*}
a (b + c) \equiv a b + a c \pmod{ n}\text{.}
\end{gather*}

For every integer \(a\) there is an additive inverse \(-a\text{:}\)

\begin{gather*}
a + (-a) \equiv 0 \pmod{ n}\text{.}
\end{gather*}

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}\text{;}\) that is, a nonzero integer \(b\) such that

\begin{equation*}
a b \equiv 1 \pmod{ n}\text{.}
\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\text{.}\)

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

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

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 1.1.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\text{.}\) To find a symmetry of \(\bigtriangleup ABC\text{,}\) we must first examine the permutations of the vertices \(A\text{,}\)\(B\text{,}\) 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\text{.}\) 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\text{,}\)\(B\) to \(C\text{,}\) and \(C\) to \(A\text{,}\) we write the array

\begin{equation*}
\begin{pmatrix} A & B & C \\ B & C & A \end{pmatrix}\text{.}
\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 1.1.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\text{;}\) that is, what happens when we do the permutation \(\rho_1\) and then the permutation \(\mu_1\text{?}\)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\text{.}
\end{align*}

This is the same symmetry as \(\mu_2\text{.}\) Suppose we do these motions in the opposite order, \(\rho_1\) then \(\mu_1\text{.}\) It is easy to determine that this is the same as the symmetry \(\mu_3\text{;}\) hence, \(\rho_1 \mu_1 \neq \mu_1 \rho_1\text{.}\) A multiplication table for the symmetries of an equilateral triangle \(\bigtriangleup ABC\) is given in Figure 1.1.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 = id\text{;}\) that is, for every motion there is another motion that takes the triangle back to its original orientation.