A set is a well-defined collection of objects; that is, it is defined in such a manner that we can determine for any given object \(x\) whether or not \(x\) belongs to the set. The objects that belong to a set are called its elements or members. We will denote sets by capital letters, such as \(A\) or \(X\); if \(a\) is an element of the set \(A\), we write \(a \in A\).

A set is usually specified either by listing all of its elements inside a pair of braces or by stating the property that determines whether or not an object \(x\) belongs to the set. We might write
\begin{equation*}X = \{ x_1, x_2, \ldots, x_n \}\end{equation*}
for a set containing elements \(x_1, x_2, \ldots, x_n\) or
\begin{equation*}X = \{ x :x \text{ satisfies }{\mathcal P}\}\end{equation*}
if each \(x\) in \(X\) satisfies a certain property \({\mathcal P}\). For example, if \(E\) is the set of even positive integers, we can describe \(E\) by writing either
\begin{equation*}E = \{2, 4, 6, \ldots \} \quad \text{or} \quad E = \{ x : x \text{ is an even integer and } x \gt 0 \}.\end{equation*}
We write \(2 \in E\) when we want to say that 2 is in the set \(E\), and \(-3 \notin E\) to say that \(-3\) is not in the set \(E\).

Some of the more important sets that we will consider are the following:
\begin{gather*}
{\mathbb N} = \{n: n \text{ is a natural number}\} = \{1, 2, 3, \ldots \};\\
{\mathbb Z} = \{n : n \text{ is an integer} \} = \{\ldots, -1, 0, 1, 2, \ldots \};\\
{\mathbb Q} = \{r : r \text{ is a rational number}\} = \{p/q : p, q \in {\mathbb Z} \text{ where } q \neq 0\};\\
{\mathbb R} = \{ x : x \text{ is a real number} \};\\
{\mathbb C} = \{z : z \text{ is a complex number}\}.
\end{gather*}

We can find various relations between sets as well as perform operations on sets. A set \(A\) is a subset of \(B\), written \(A \subset B\) or \(B \supset A\), if every element of \(A\) is also an element of \(B\). For example,
\begin{equation*}\{4,5,8\} \subset \{2, 3, 4, 5, 6, 7, 8, 9 \}\end{equation*}
and
\begin{equation*}{\mathbb N} \subset {\mathbb Z} \subset {\mathbb Q} \subset {\mathbb R} \subset {\mathbb C}.\end{equation*}
Trivially, every set is a subset of itself. A set \(B\) is a proper subset of a set \(A\) if \(B \subset A\) but \(B \neq A\). If \(A\) is not a subset of \(B\), we write \(A \notsubset B\); for example, \(\{4, 7, 9\} \notsubset \{2, 4, 5, 8, 9 \}\). Two sets are equal, written \(A = B\), if we can show that \(A \subset B\) and \(B \subset A\).

It is convenient to have a set with no elements in it. This set is called the empty set and is denoted by \(\emptyset\). Note that the empty set is a subset of every set.

To construct new sets out of old sets, we can perform certain operations: the union \(A \cup B\) of two sets \(A\) and \(B\) is defined as
\begin{equation*}A \cup B = \{x : x \in A \text{ or } x \in B \};\end{equation*}
the intersection of \(A\) and \(B\) is defined by
\begin{equation*}A \cap B = \{x : x \in A \text{ and } x \in B \}.\end{equation*}
If \(A = \{1, 3, 5\}\) and \(B = \{ 1, 2, 3, 9 \}\), then
\begin{equation*}A \cup B = \{1, 2, 3, 5, 9 \} \quad \text{and} \quad A \cap B = \{ 1, 3 \}.\end{equation*}
We can consider the union and the intersection of more than two sets. In this case we write
\begin{equation*}\bigcup_{i = 1}^{n} A_{i} = A_{1} \cup \ldots \cup A_n\end{equation*}
and
\begin{equation*}\bigcap_{i = 1}^{n} A_{i} = A_{1} \cap \ldots \cap A_n\end{equation*}
for the union and intersection, respectively, of the sets \(A_1, \ldots, A_n\).

When two sets have no elements in common, they are said to be disjoint; for example, if \(E\) is the set of even integers and \(O\) is the set of odd integers, then \(E\) and \(O\) are disjoint. Two sets \(A\) and \(B\) are disjoint exactly when \(A \cap B = \emptyset\).

Sometimes we will work within one fixed set \(U\), called the universal set. For any set \(A \subset U\), we define the complement of \(A\), denoted by \(A'\), to be the set
\begin{equation*}A' = \{ x : x \in U \text{ and } x \notin A \}.\end{equation*}

We define the difference of two sets \(A\) and \(B\) to be
\begin{equation*}A \setminus B = A \cap B' = \{ x : x \in A \text{ and } x \notin B \}.\end{equation*}

Example1.1

Let \({\mathbb R}\) be the universal set and suppose that
\begin{equation*}A = \{ x \in {\mathbb R} : 0 \lt x \leq 3 \} \quad \text{and} \quad B = \{ x \in {\mathbb R} : 2 \leq x \lt 4 \}.\end{equation*}
Then
\begin{align*}
A \cap B & = \{ x \in {\mathbb R} : 2 \leq x \leq 3 \}\\
A \cup B & = \{ x \in {\mathbb R} : 0 \lt x \lt 4 \}\\
A \setminus B & = \{ x \in {\mathbb R} : 0 \lt x \lt 2 \}\\
A' & = \{ x \in {\mathbb R} : x \leq 0 \text{ or } x \gt 3 \}.
\end{align*}

Proposition1.2

Let \(A\), \(B\), and \(C\) be sets. Then

\(A \cup A = A\), \(A \cap A = A\), and \(A \setminus A = \emptyset\);

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

(1) Observe that
\begin{align*}
A \cup A & = \{ x : x \in A \text{ or } x \in A \}\\
& = \{ x : x \in A \}\\
& = A
\end{align*}
and
\begin{align*}
A \cap A & = \{ x : x \in A \text{ and } x \in A \}\\
& = \{ x : x \in A \}\\
& = A.
\end{align*}
Also, \(A \setminus A = A \cap A' = \emptyset\).

(3) For sets \(A\), \(B\), and \(C\),
\begin{align*}
A \cup (B \cup C) & = A \cup \{ x : x \in B \text{ or } x \in C \}\\
& = \{ x : x \in A \text{ or } x \in B, \text{ or } x \in C \}\\
& = \{ x : x \in A \text{ or } x \in B \} \cup C\\
& = (A \cup B) \cup C.
\end{align*}
A similar argument proves that \(A \cap (B \cap C) = (A \cap B) \cap C\).

(1) If \(A \cup B = \emptyset\), then the theorem follows immediately since both \(A\) and \(B\) are the empty set. Otherwise, we must show that \((A \cup B)' \subset A' \cap B'\) and \((A \cup B)' \supset A' \cap B'\). Let \(x \in (A \cup B)'\). Then \(x \notin A \cup B\). So \(x\) is neither in \(A\) nor in \(B\), by the definition of the union of sets. By the definition of the complement, \(x \in A'\) and \(x \in B'\). Therefore, \(x \in A' \cap B'\) and we have \((A \cup B)' \subset A' \cap B'\).

To show the reverse inclusion, suppose that \(x \in A' \cap B'\). Then \(x \in A'\) and \(x \in B'\), and so \(x \notin A\) and \(x \notin B\). Thus \(x \notin A \cup B\) and so \(x \in (A \cup B)'\). Hence, \((A \cup B)' \supset A' \cap B'\) and so \((A \cup B)' = A' \cap B'\).

The proof of (2) is left as an exercise.

Example1.4

Other relations between sets often hold true. For example,
\begin{equation*}( A \setminus B) \cap (B \setminus A) = \emptyset.\end{equation*}
To see that this is true, observe that
\begin{align*}
( A \setminus B) \cap (B \setminus A) & = ( A \cap B') \cap (B \cap A')\\
& = A \cap A' \cap B \cap B'\\
& = \emptyset.
\end{align*}

SubsectionCartesian Products and Mappings¶ permalink

Given sets \(A\) and \(B\), we can define a new set \(A \times B\), called the Cartesian product of \(A\) and \(B\), as a set of ordered pairs. That is,
\begin{equation*}A \times B = \{ (a,b) : a \in A \text{ and } b \in B \}.\end{equation*}

Example1.5

If \(A = \{ x, y \}\), \(B = \{ 1, 2, 3 \}\), and \(C = \emptyset\), then \(A \times B\) is the set
\begin{equation*}\{ (x, 1), (x, 2), (x, 3), (y, 1), (y, 2), (y, 3) \}\end{equation*}
and
\begin{equation*}A \times C = \emptyset.\end{equation*}

We define the Cartesian product of \(n\) sets to be
\begin{equation*}A_1 \times \cdots \times A_n = \{ (a_1, \ldots, a_n): a_i \in A_i \text{ for } i = 1, \ldots, n \}.\end{equation*}
If \(A = A_1 = A_2 = \cdots = A_n\), we often write \(A^n\) for \(A \times \cdots \times A\) (where \(A\) would be written \(n\) times). For example, the set \({\mathbb R}^3\) consists of all of 3-tuples of real numbers.

Subsets of \(A \times B\) are called relations. We will define a mapping or function \(f \subset A \times B\) from a set \(A\) to a set \(B\) to be the special type of relation where \((a, b) \in f\) if for every element \(a \in A\) there exists a unique element \(b \in B\). Another way of saying this is that for every element in \(A\), \(f\) assigns a unique element in \(B\). We usually write \(f:A \rightarrow B\) or \(A \stackrel{f}{\rightarrow} B\). Instead of writing down ordered pairs \((a,b) \in A \times B\), we write \(f(a) = b\) or \(f : a \mapsto b\). The set \(A\) is called the domain of \(f\) and
\begin{equation*}f(A) = \{ f(a) : a \in A \} \subset B\end{equation*}
is called the range or image of \(f\). We can think of the elements in the function's domain as input values and the elements in the function's range as output values.

Example1.7

Suppose \(A = \{1, 2, 3 \}\) and \(B = \{a, b, c \}\). In Figure 1.6 we define relations \(f\) and \(g\) from \(A\) to \(B\). The relation \(f\) is a mapping, but \(g\) is not because \(1 \in A\) is not assigned to a unique element in \(B\); that is, \(g(1) = a\) and \(g(1) = b\).

Given a function \(f : A \rightarrow B\), it is often possible to write a list describing what the function does to each specific element in the domain. However, not all functions can be described in this manner. For example, the function \(f: {\mathbb R} \rightarrow {\mathbb R}\) that sends each real number to its cube is a mapping that must be described by writing \(f(x) = x^3\) or \(f:x \mapsto x^3\).

Consider the relation \(f : {\mathbb Q} \rightarrow {\mathbb Z}\) given by \(f(p/q) = p\). We know that \(1/2 = 2/4\), but is \(f(1/2) = 1\) or 2? This relation cannot be a mapping because it is not well-defined. A relation is well-defined if each element in the domain is assigned to a unique element in the range.

If \(f:A \rightarrow B\) is a map and the image of \(f\) is \(B\), i.e., \(f(A) = B\), then \(f\) is said to be onto or surjective. In other words, if there exists an \(a \in A\) for each \(b \in B\) such that \(f(a) = b\), then \(f\) is onto. A map is one-to-one or injective if \(a_1 \neq a_2\) implies \(f(a_1) \neq f(a_2)\). Equivalently, a function is one-to-one if \(f(a_1) = f(a_2)\) implies \(a_1 = a_2\). A map that is both one-to-one and onto is called bijective.

Example1.8

Let \(f:{\mathbb Z} \rightarrow {\mathbb Q}\) be defined by \(f(n) = n/1\). Then \(f\) is one-to-one but not onto. Define \(g : {\mathbb Q} \rightarrow {\mathbb Z}\) by \(g(p/q) = p\) where \(p/q\) is a rational number expressed in its lowest terms with a positive denominator. The function \(g\) is onto but not one-to-one.

Given two functions, we can construct a new function by using the range of the first function as the domain of the second function. Let \(f : A \rightarrow B\) and \(g : B \rightarrow C\) be mappings. Define a new map, the composition of \(f\) and \(g\) from \(A\) to \(C\), by \((g \circ f)(x) = g(f(x))\).

Example1.10

Consider the functions \(f: A \rightarrow B\) and \(g: B \rightarrow C\) that are defined in Figure 1.9 (top). The composition of these functions, \(g \circ f: A \rightarrow C\), is defined in Figure 1.9 (bottom).

Example1.11

Let \(f(x) = x^2\) and \(g(x) = 2x + 5\). Then
\begin{equation*}(f \circ g)(x) = f(g(x)) = (2x + 5)^2 = 4x^2 + 20x + 25\end{equation*}
and
\begin{equation*}(g \circ f)(x) = g(f(x)) = 2x^2 + 5.\end{equation*}
In general, order makes a difference; that is, in most cases \(f \circ g \neq g \circ f\).

Example1.12

Sometimes it is the case that \(f \circ g= g \circ f\). Let \(f(x) = x^3\) and \(g(x) = \sqrt[3]{x}\). Then
\begin{equation*}(f \circ g )(x) = f(g(x)) = f( \sqrt[3]{x}\, ) = (\sqrt[3]{x}\, )^3 = x\end{equation*}
and
\begin{equation*}(g \circ f )(x) = g(f(x)) = g( x^3) = \sqrt[3]{ x^3} = x.\end{equation*}

Example1.13

Given a \(2 \times 2\) matrix
\begin{equation*}A =
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix},\end{equation*}
we can define a map \(T_A : {\mathbb R}^2 \rightarrow {\mathbb R}^2\) by
\begin{equation*}T_A (x,y) = (ax + by, cx +dy)\end{equation*}
for \((x,y)\) in \({\mathbb R}^2\). This is actually matrix multiplication; that is,
\begin{equation*}\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
\begin{pmatrix}
x \\ y
\end{pmatrix}
=
\begin{pmatrix}
ax + by \\
cx +dy
\end{pmatrix}.\end{equation*}
Maps from \({\mathbb R}^n\) to \({\mathbb R}^m\) given by matrices are called linear maps or linear transformations.

Example1.14

Suppose that \(S = \{ 1,2,3 \}\). Define a map \(\pi :S\rightarrow S\) by
\begin{equation*}\pi( 1 ) = 2, \qquad \pi( 2 ) = 1, \qquad \pi( 3 ) = 3.\end{equation*}
This is a bijective map. An alternative way to write \(\pi\) is
\begin{equation*}\begin{pmatrix}
1 & 2 & 3 \\
\pi(1) & \pi(2) & \pi(3)
\end{pmatrix}
=
\begin{pmatrix}
1 & 2 & 3 \\
2 & 1 & 3
\end{pmatrix}.\end{equation*}
For any set \(S\), a one-to-one and onto mapping \(\pi : S \rightarrow S\) is called a permutation of \(S\).

Theorem1.15

Let \(f : A \rightarrow B\), \(g : B \rightarrow C\), and \(h : C \rightarrow D\). Then

The composition of mappings is associative; that is, \((h \circ g) \circ f = h \circ (g \circ f)\);

If \(f\) and \(g\) are both one-to-one, then the mapping \(g \circ f\) is one-to-one;

If \(f\) and \(g\) are both onto, then the mapping \(g \circ f\) is onto;

If \(f\) and \(g\) are bijective, then so is \(g \circ f\).

We will prove (1) and (3). Part (2) is left as an exercise. Part (4) follows directly from (2) and (3).

(1) We must show that
\begin{equation*}h \circ (g \circ f) = (h \circ g) \circ f.\end{equation*}
For \(a \in A\) we have
\begin{align*}
(h \circ (g \circ f))(a) & = h((g \circ f)(a))\\
& = h(g(f(a))) \\
& = (h \circ g)(f(a))\\
& = ((h \circ g) \circ f)(a).
\end{align*}

(3) Assume that \(f\) and \(g\) are both onto functions. Given \(c \in C\), we must show that there exists an \(a \in A\) such that \((g \circ f)(a) = g(f(a)) = c\). However, since \(g\) is onto, there is an element \(b \in B\) such that \(g(b) = c\). Similarly, there is an \(a \in A\) such that \(f(a) = b\). Accordingly,
\begin{equation*}(g \circ f)(a) = g(f(a)) = g(b) = c.\end{equation*}

If \(S\) is any set, we will use \(id_S\) or \(id\) to denote the identity mapping from \(S\) to itself. Define this map by \(id(s) = s\) for all \(s \in S\). A map \(g: B \rightarrow A\) is an inverse mapping of \(f: A \rightarrow B\) if \(g \circ f = id_A\) and \(f \circ g = id_B\); in other words, the inverse function of a function simply “undoes” the function. A map is said to be invertible if it has an inverse. We usually write \(f^{-1}\) for the inverse of \(f\).

Example1.16

The function \(f(x) = x^3\) has inverse \(f^{-1}(x) = \sqrt[3]{x}\) by Example 1.12.

Example1.17

The natural logarithm and the exponential functions, \(f(x) = \ln x\) and \(f^{-1}(x) = e^x\), are inverses of each other provided that we are careful about choosing domains. Observe that
\begin{equation*}f(f^{-1}(x)) = f(e^x) = \ln e^x = x\end{equation*}
and
\begin{equation*}f^{-1}(f(x)) = f^{-1}(\ln x) = e^{\ln x} = x\end{equation*}
whenever composition makes sense.

Example1.18

Suppose that
\begin{equation*}A =
\begin{pmatrix}
3 & 1 \\
5 & 2
\end{pmatrix}.\end{equation*}
Then \(A\) defines a map from \({\mathbb R}^2\) to \({\mathbb R}^2\) by
\begin{equation*}T_A (x,y) = (3x + y, 5x + 2y).\end{equation*}
We can find an inverse map of \(T_A\) by simply inverting the matrix \(A\); that is, \(T_A^{-1} = T_{A^{-1}}\). In this example,
\begin{equation*}A^{-1} =
\begin{pmatrix}
2 & -1 \\
-5 & 3
\end{pmatrix};\end{equation*}
hence, the inverse map is given by
\begin{equation*}T_A^{-1} (x,y) = (2x - y, -5x + 3y).\end{equation*}
It is easy to check that
\begin{equation*}T^{-1}_A \circ T_A (x,y) = T_A \circ T_A^{-1} (x,y) = (x,y).\end{equation*}
Not every map has an inverse. If we consider the map
\begin{equation*}T_B (x,y) = (3x , 0 )\end{equation*}
given by the matrix
\begin{equation*}B =
\begin{pmatrix}
3 & 0 \\
0 & 0
\end{pmatrix},\end{equation*}
then an inverse map would have to be of the form
\begin{equation*}T_B^{-1} (x,y) = (ax + by, cx +dy)\end{equation*}
and
\begin{equation*}(x,y) = T \circ T_B^{-1} (x,y) = (3ax + 3by, 0)\end{equation*}
for all \(x\) and \(y\). Clearly this is impossible because \(y\) might not be 0.

Example1.19

Given the permutation
\begin{equation*}\pi =
\begin{pmatrix}
1 & 2 & 3 \\
2 & 3 & 1
\end{pmatrix}\end{equation*}
on \(S = \{ 1,2,3 \}\), it is easy to see that the permutation defined by
\begin{equation*}\pi^{-1} =
\begin{pmatrix}
1 & 2 & 3 \\
3 & 1 & 2
\end{pmatrix}\end{equation*}
is the inverse of \(\pi\). In fact, any bijective mapping possesses an inverse, as we will see in the next theorem.

Theorem1.20

A mapping is invertible if and only if it is both one-to-one and onto.

Suppose first that \(f:A \rightarrow B\) is invertible with inverse \(g: B \rightarrow A\). Then \(g \circ f = id_A\) is the identity map; that is, \(g(f(a)) = a\). If \(a_1, a_2 \in A\) with \(f(a_1) = f(a_2)\), then \(a_1 = g(f(a_1)) = g(f(a_2)) = a_2\). Consequently, \(f\) is one-to-one. Now suppose that \(b \in B\). To show that \(f\) is onto, it is necessary to find an \(a \in A\) such that \(f(a) = b\), but \(f(g(b)) = b\) with \(g(b) \in A\). Let \(a = g(b)\).

Conversely, let \(f\) be bijective and let \(b \in B\). Since \(f\) is onto, there exists an \(a \in A\) such that \(f(a) = b\). Because \(f\) is one-to-one, \(a\) must be unique. Define \(g\) by letting \(g(b) = a\). We have now constructed the inverse of \(f\).

SubsectionEquivalence Relations and Partitions¶ permalink

A fundamental notion in mathematics is that of equality. We can generalize equality with equivalence relations and equivalence classes. An equivalence relation on a set \(X\) is a relation \(R \subset X \times X\) such that

\((x, x) \in R\) for all \(x \in X\) (reflexive property);

Given an equivalence relation \(R\) on a set \(X\), we usually write \(x \sim y\) instead of \((x, y) \in R\). If the equivalence relation already has an associated notation such as \(=\), \(\equiv\), or \(\cong\), we will use that notation.

Example1.21

Let \(p\), \(q\), \(r\), and \(s\) be integers, where \(q\) and \(s\) are nonzero. Define \(p/q \sim r/s\) if \(ps = qr\). Clearly \(\sim\) is reflexive and symmetric. To show that it is also transitive, suppose that \(p/q \sim r/s\) and \(r/s \sim t/u\), with \(q\), \(s\), and \(u\) all nonzero. Then \(ps = qr\) and \(ru = st\). Therefore,
\begin{equation*}psu = qru = qst.\end{equation*}
Since \(s \neq 0\), \(pu = qt\). Consequently, \(p/q \sim t/u\).

Example1.22

Suppose that \(f\) and \(g\) are differentiable functions on \({\mathbb R}\). We can define an equivalence relation on such functions by letting \(f(x) \sim g(x)\) if \(f'(x) = g'(x)\). It is clear that \(\sim\) is both reflexive and symmetric. To demonstrate transitivity, suppose that \(f(x) \sim g(x)\) and \(g(x) \sim h(x)\). From calculus we know that \(f(x) - g(x) = c_1\) and \(g(x)- h(x) = c_2\), where \(c_1\) and \(c_2\) are both constants. Hence,
\begin{equation*}f(x) - h(x) = ( f(x) - g(x)) + ( g(x)- h(x)) = c_1 - c_2\end{equation*}
and \(f'(x) - h'(x) = 0\). Therefore, \(f(x) \sim h(x)\).

Example1.23

For \((x_1, y_1 )\) and \((x_2, y_2)\) in \({\mathbb R}^2\), define \((x_1, y_1 ) \sim (x_2, y_2)\) if \(x_1^2 + y_1^2 = x_2^2 + y_2^2\). Then \(\sim\) is an equivalence relation on \({\mathbb R}^2\).

Example1.24

Let \(A\) and \(B\) be \(2 \times 2\) matrices with entries in the real numbers. We can define an equivalence relation on the set of \(2 \times 2\) matrices, by saying \(A \sim B\) if there exists an invertible matrix \(P\) such that \(PAP^{-1} = B\). For example, if
\begin{equation*}A =
\begin{pmatrix}
1 & 2 \\
-1 & 1
\end{pmatrix}
\quad \text{and} \quad
B =
\begin{pmatrix}
-18 & 33 \\
-11 & 20
\end{pmatrix},\end{equation*}
then \(A \sim B\) since \(PAP^{-1} = B\) for
\begin{equation*}P =
\begin{pmatrix}
2 & 5 \\
1 & 3
\end{pmatrix}.\end{equation*}
Let \(I\) be the \(2 \times 2\) identity matrix; that is,
\begin{equation*}I =
\begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix}.\end{equation*}
Then \(IAI^{-1} = IAI = A\); therefore, the relation is reflexive. To show symmetry, suppose that \(A \sim B\). Then there exists an invertible matrix \(P\) such that \(PAP^{-1} = B\). So
\begin{equation*}A = P^{-1} B P = P^{-1} B (P^{-1})^{-1}.\end{equation*}
Finally, suppose that \(A \sim B\) and \(B \sim C\). Then there exist invertible matrices \(P\) and \(Q\) such that \(PAP^{-1} = B\) and \(QBQ^{-1} = C\). Since
\begin{equation*}C = QBQ^{-1} = QPAP^{-1} Q^{-1} = (QP)A(QP)^{-1},\end{equation*}
the relation is transitive. Two matrices that are equivalent in this manner are said to be similar.

A partition \({\mathcal P}\) of a set \(X\) is a collection of nonempty sets \(X_1, X_2, \ldots\) such that \(X_i \cap X_j = \emptyset\) for \(i \neq j\) and \(\bigcup_k X_k = X\). Let \(\sim\) be an equivalence relation on a set \(X\) and let \(x \in X\). Then \([x] = \{ y \in X : y \sim x \}\) is called the equivalence class of \(x\). We will see that an equivalence relation gives rise to a partition via equivalence classes. Also, whenever a partition of a set exists, there is some natural underlying equivalence relation, as the following theorem demonstrates.

Theorem1.25

Given an equivalence relation \(\sim\) on a set \(X\), the equivalence classes of \(X\) form a partition of \(X\). Conversely, if \({\mathcal P} = \{ X_i\}\) is a partition of a set \(X\), then there is an equivalence relation on \(X\) with equivalence classes \(X_i\).

Suppose there exists an equivalence relation \(\sim\) on the set \(X\). For any \(x \in X\), the reflexive property shows that \(x \in [x]\) and so \([x]\) is nonempty. Clearly \(X = \bigcup_{x \in X} [x]\). Now let \(x, y \in X\). We need to show that either \([x] = [y]\) or \([x] \cap [y] = \emptyset\). Suppose that the intersection of \([x]\) and \([y]\) is not empty and that \(z \in [x] \cap [y]\). Then \(z \sim x\) and \(z \sim y\). By symmetry and transitivity \(x \sim y\); hence, \([x] \subset [y]\). Similarly, \([y] \subset [x]\) and so \([x] = [y]\). Therefore, any two equivalence classes are either disjoint or exactly the same.

Conversely, suppose that \({\mathcal P} = \{X_i\}\) is a partition of a set \(X\). Let two elements be equivalent if they are in the same partition. Clearly, the relation is reflexive. If \(x\) is in the same partition as \(y\), then \(y\) is in the same partition as \(x\), so \(x \sim y\) implies \(y \sim x\). Finally, if \(x\) is in the same partition as \(y\) and \(y\) is in the same partition as \(z\), then \(x\) must be in the same partition as \(z\), and transitivity holds.

Corollary1.26

Two equivalence classes of an equivalence relation are either disjoint or equal.

Let us examine some of the partitions given by the equivalence classes in the last set of examples.

Example1.27

In the equivalence relation in Example 1.21, two pairs of integers, \((p,q)\) and \((r,s)\), are in the same equivalence class when they reduce to the same fraction in its lowest terms.

Example1.28

In the equivalence relation in Example 1.22, two functions \(f(x)\) and \(g(x)\) are in the same partition when they differ by a constant.

Example1.29

We defined an equivalence class on \({\mathbb R}^2\) by \((x_1, y_1 ) \sim (x_2, y_2)\) if \(x_1^2 + y_1^2 = x_2^2 + y_2^2\). Two pairs of real numbers are in the same partition when they lie on the same circle about the origin.

Example1.30

Let \(r\) and \(s\) be two integers and suppose that \(n \in {\mathbb N}\). We say that \(r\) is congruent to \(s\) modulo \(n\), or \(r\) is congruent to \(s\) mod \(n\), if \(r - s\) is evenly divisible by \(n\); that is, \(r - s = nk\) for some \(k \in {\mathbb Z}\). In this case we write \(r \equiv s \pmod{n}\). For example, \(41 \equiv 17 \pmod{ 8}\) since \(41 - 17=24\) is divisible by 8. We claim that congruence modulo \(n\) forms an equivalence relation of \({\mathbb Z}\). Certainly any integer \(r\) is equivalent to itself since \(r - r = 0\) is divisible by \(n\). We will now show that the relation is symmetric. If \(r \equiv s \pmod{ n}\), then \(r - s = -(s -r)\) is divisible by \(n\). So \(s - r\) is divisible by \(n\) and \(s \equiv r \pmod{ n}\). Now suppose that \(r \equiv s \pmod{ n}\) and \(s \equiv t \pmod{ n}\). Then there exist integers \(k\) and \(l\) such that \(r -s = kn\) and \(s - t = ln\). To show transitivity, it is necessary to prove that \(r - t\) is divisible by \(n\). However,
\begin{equation*}r - t = r - s + s - t = kn + ln = (k + l)n,\end{equation*}
and so \(r - t\) is divisible by \(n\).

If we consider the equivalence relation established by the integers modulo 3, then
\begin{align*}
{[0]} & = \{ \ldots, -3, 0, 3, 6, \ldots \},\\
{[1]} & = \{ \ldots, -2, 1, 4, 7, \ldots \},\\
{[2]} & = \{ \ldots, -1, 2, 5, 8, \ldots \}.
\end{align*}
Notice that \([0] \cup [1] \cup [2] = {\mathbb Z}\) and also that the sets are disjoint. The sets \([0]\), \([1]\), and \([2]\) form a partition of the integers.

The integers modulo \(n\) are a very important example in the study of abstract algebra and will become quite useful in our investigation of various algebraic structures such as groups and rings. In our discussion of the integers modulo \(n\) we have actually assumed a result known as the division algorithm, which will be stated and proved in Chapter 2.