Skip to main content
Logo image

Section 1.2 Sets and Equivalence Relations

Subsection Set Theory

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 aA.
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
X={x1,x2,,xn}
for a set containing elements x1,x2,,xn or
X={x:x satisfies P}
if each x in X satisfies a certain property P. For example, if E is the set of even positive integers, we can describe E by writing either
E={2,4,6,}orE={x:x is an even integer and x>0}.
We write 2E when we want to say that 2 is in the set E, and 3E to say that 3 is not in the set E.
Some of the more important sets that we will consider are the following:
N={n:n is a natural number}={1,2,3,};Z={n:n is an integer}={,1,0,1,2,};Q={r:r is a rational number}={p/q:p,qZ where q0};R={x:x is a real number};C={z:z is a complex number}.
We can find various relations between sets as well as perform operations on sets. A set A is a subset of B, written AB or BA, if every element of A is also an element of B. For example,
{4,5,8}{2,3,4,5,6,7,8,9}
and
NZQRC.
Trivially, every set is a subset of itself. A set B is a proper subset of a set A if BA but BA. If A is not a subset of B, we write AB; for example, {4,7,9}{2,4,5,8,9}. Two sets are equal, written A=B, if we can show that AB and BA.
It is convenient to have a set with no elements in it. This set is called the empty set and is denoted by . 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 AB of two sets A and B is defined as
AB={x:xA or xB};
the intersection of A and B is defined by
AB={x:xA and xB}.
If A={1,3,5} and B={1,2,3,9}, then
AB={1,2,3,5,9}andAB={1,3}.
We can consider the union and the intersection of more than two sets. In this case we write
i=1nAi=A1An
and
i=1nAi=A1An
for the union and intersection, respectively, of the sets A1,,An.
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 AB=.
Sometimes we will work within one fixed set U, called the universal set. For any set AU, we define the complement of A, denoted by A, to be the set
A={x:xU and xA}.
We define the difference of two sets A and B to be
AB=AB={x:xA and xB}.

Example 1.1.

Let R be the universal set and suppose that
A={xR:0<x3}andB={xR:2x<4}.
Then
AB={xR:2x3}AB={xR:0<x<4}AB={xR:0<x<2}A={xR:x0 or x>3}.

Proof.

We will prove (1) and (3) and leave the remaining results to be proven in the exercises.
(1) Observe that
AA={x:xA or xA}={x:xA}=A
and
AA={x:xA and xA}={x:xA}=A.
Also, AA=AA=.
(3) For sets A, B, and C,
A(BC)=A{x:xB or xC}={x:xA or xB, or xC}={x:xA or xB}C=(AB)C.
A similar argument proves that A(BC)=(AB)C.

Proof.

(1) If AB=, then the theorem follows immediately since both A and B are the empty set. Otherwise, we must show that (AB)AB and (AB)AB. Let x(AB). Then xAB. So x is neither in A nor in B, by the definition of the union of sets. By the definition of the complement, xA and xB. Therefore, xAB and we have (AB)AB.
To show the reverse inclusion, suppose that xAB. Then xA and xB, and so xA and xB. Thus xAB and so x(AB). Hence, (AB)AB and so (AB)=AB.
The proof of (2) is left as an exercise.

Example 1.4.

Other relations between sets often hold true. For example,
(AB)(BA)=.
To see that this is true, observe that
(AB)(BA)=(AB)(BA)=AABB=.

Subsection Cartesian Products and Mappings

Given sets A and B, we can define a new set A×B, called the Cartesian product of A and B, as a set of ordered pairs. That is,
A×B={(a,b):aA and bB}.

Example 1.5.

If A={x,y}, B={1,2,3}, and C=, then A×B is the set
{(x,1),(x,2),(x,3),(y,1),(y,2),(y,3)}
and
A×C=.
We define the Cartesian product of n sets to be
A1××An={(a1,,an):aiAi for i=1,,n}.
If A=A1=A2==An, we often write An for A××A (where A would be written n times). For example, the set R3 consists of all of 3-tuples of real numbers.
Subsets of A×B are called relations. We will define a mapping or function fA×B from a set A to a set B to be the special type of relation where each element aA has a unique element bB such that (a,b)f. Another way of saying this is that for every element in A, f assigns a unique element in B. We usually write f:AB or AfB. Instead of writing down ordered pairs (a,b)A×B, we write f(a)=b or f:ab. The set A is called the domain of f and
f(A)={f(a):aA}B
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.

Example 1.6.

Suppose A={1,2,3} and B={a,b,c}. In Figure 1.7 we define relations f and g from A to B. The relation f is a mapping, but g is not because 1A is not assigned to a unique element in B; that is, g(1)=a and g(1)=b.
Two sets of ovals, A and B, relating 1, 2, 3 to a, b, c.  The first mapping, f, sends 1 to b and 2 and 3 to c.  The second relation, g, sends 1 to a and b, 2 to c, and 3 to a
Figure 1.7. Mappings and relations
Given a function f:AB, 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:RR that sends each real number to its cube is a mapping that must be described by writing f(x)=x3 or f:xx3.
Consider the relation f:QZ 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:AB 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 aA for each bB such that f(a)=b, then f is onto. A map is one-to-one or injective if a1a2 implies f(a1)f(a2). Equivalently, a function is one-to-one if f(a1)=f(a2) implies a1=a2. A map that is both one-to-one and onto is called bijective.

Example 1.8.

Let f:ZQ be defined by f(n)=n/1. Then f is one-to-one but not onto. Define g:QZ 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:AB and g:BC be mappings. Define a new map, the composition of f and g from A to C, by (gf)(x)=g(f(x)).
Two sets of ovals, A and B, relating 1, 2, 3 to a, b, c and a, b, c to X, Y, Z.  The first mapping, f, sends 1 to b, 2  2 to c, and 3 to a.  The second relation, g, sends a and b to Z and c to X.  The bottom map, g circle f, sends 1 and 3 to Z and 2 to X.
Figure 1.9. Composition of maps

Example 1.10.

Consider the functions f:AB and g:BC that are defined in Figure 1.9 (top). The composition of these functions, gf:AC, is defined in Figure 1.9 (bottom).

Example 1.11.

Let f(x)=x2 and g(x)=2x+5. Then
(fg)(x)=f(g(x))=(2x+5)2=4x2+20x+25
and
(gf)(x)=g(f(x))=2x2+5.
In general, order makes a difference; that is, in most cases fggf.

Example 1.12.

Sometimes it is the case that fg=gf. Let f(x)=x3 and g(x)=x3. Then
(fg)(x)=f(g(x))=f(x3)=(x3)3=x
and
(gf)(x)=g(f(x))=g(x3)=x33=x.

Example 1.13.

Given a 2×2 matrix
A=(abcd),
we can define a map TA:R2R2 by
TA(x,y)=(ax+by,cx+dy)
for (x,y) in R2. This is actually matrix multiplication; that is,
(abcd)(xy)=(ax+bycx+dy).
Maps from Rn to Rm given by matrices are called linear maps or linear transformations.

Example 1.14.

Suppose that S={1,2,3}. Define a map π:SS by
π(1)=2,π(2)=1,π(3)=3.
This is a bijective map. An alternative way to write π is
(123π(1)π(2)π(3))=(123213).
For any set S, a one-to-one and onto mapping π:SS is called a permutation of S.

Proof.

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
h(gf)=(hg)f.
For aA we have
(h(gf))(a)=h((gf)(a))=h(g(f(a)))=(hg)(f(a))=((hg)f)(a).
(3) Assume that f and g are both onto functions. Given cC, we must show that there exists an aA such that (gf)(a)=g(f(a))=c. However, since g is onto, there is an element bB such that g(b)=c. Similarly, there is an aA such that f(a)=b. Accordingly,
(gf)(a)=g(f(a))=g(b)=c.
If S is any set, we will use idS or id to denote the identity mapping from S to itself. Define this map by id(s)=s for all sS. A map g:BA is an inverse mapping of f:AB if gf=idA and fg=idB; 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 f1 for the inverse of f.

Example 1.17.

The natural logarithm and the exponential functions, f(x)=lnx and f1(x)=ex, are inverses of each other provided that we are careful about choosing domains. Observe that
f(f1(x))=f(ex)=lnex=x
and
f1(f(x))=f1(lnx)=elnx=x
whenever composition makes sense.

Example 1.18.

Suppose that
A=(3152).
Then A defines a map from R2 to R2 by
TA(x,y)=(3x+y,5x+2y).
We can find an inverse map of TA by simply inverting the matrix A; that is, TA1=TA1. In this example,
A1=(2153);
hence, the inverse map is given by
TA1(x,y)=(2xy,5x+3y).
It is easy to check that
TA1TA(x,y)=TATA1(x,y)=(x,y).
Not every map has an inverse. If we consider the map
TB(x,y)=(3x,0)
given by the matrix
B=(3000),
then an inverse map would have to be of the form
TB1(x,y)=(ax+by,cx+dy)
and
(x,y)=TBTB1(x,y)=(3ax+3by,0)
for all x and y. Clearly this is impossible because y might not be 0.

Example 1.19.

Given the permutation
π=(123231)
on S={1,2,3}, it is easy to see that the permutation defined by
π1=(123312)
is the inverse of π. In fact, any bijective mapping possesses an inverse, as we will see in the next theorem.

Proof.

Suppose first that f:AB is invertible with inverse g:BA. Then gf=idA is the identity map; that is, g(f(a))=a. If a1,a2A with f(a1)=f(a2), then a1=g(f(a1))=g(f(a2))=a2. Consequently, f is one-to-one. Now suppose that bB. To show that f is onto, it is necessary to find an aA such that f(a)=b, but f(g(b))=b with g(b)A. Let a=g(b).
Conversely, let f be bijective and let bB. Since f is onto, there exists an aA 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.

Subsection Equivalence Relations and Partitions

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 RX×X such that
  • (x,x)R for all xX (reflexive property);
  • (x,y)R implies (y,x)R (symmetric property);
  • (x,y) and (y,z)R imply (x,z)R (transitive property).
Given an equivalence relation R on a set X, we usually write xy instead of (x,y)R. If the equivalence relation already has an associated notation such as =, , or , we will use that notation.

Example 1.21.

Let p, q, r, and s be integers, where q and s are nonzero. Define p/qr/s if ps=qr. Clearly is reflexive and symmetric. To show that it is also transitive, suppose that p/qr/s and r/st/u, with q, s, and u all nonzero. Then ps=qr and ru=st. Therefore,
psu=qru=qst.
Since s0, pu=qt. Consequently, p/qt/u.

Example 1.22.

Suppose that f and g are differentiable functions on R. We can define an equivalence relation on such functions by letting f(x)g(x) if f(x)=g(x). It is clear that is both reflexive and symmetric. To demonstrate transitivity, suppose that f(x)g(x) and g(x)h(x). From calculus we know that f(x)g(x)=c1 and g(x)h(x)=c2, where c1 and c2 are both constants. Hence,
f(x)h(x)=(f(x)g(x))+(g(x)h(x))=c1+c2
and f(x)h(x)=0. Therefore, f(x)h(x).

Example 1.23.

For (x1,y1) and (x2,y2) in R2, define (x1,y1)(x2,y2) if x12+y12=x22+y22. Then is an equivalence relation on R2.

Example 1.24.

Let A and B be 2×2 matrices with entries in the real numbers. We can define an equivalence relation on the set of 2×2 matrices, by saying AB if there exists an invertible matrix P such that PAP1=B. For example, if
A=(1211)andB=(18331120),
then AB since PAP1=B for
P=(2513).
Let I be the 2×2 identity matrix; that is,
I=(1001).
Then IAI1=IAI=A; therefore, the relation is reflexive. To show symmetry, suppose that AB. Then there exists an invertible matrix P such that PAP1=B. So
A=P1BP=P1B(P1)1.
Finally, suppose that AB and BC. Then there exist invertible matrices P and Q such that PAP1=B and QBQ1=C. Since
C=QBQ1=QPAP1Q1=(QP)A(QP)1,
the relation is transitive. Two matrices that are equivalent in this manner are said to be similar.
A partition P of a set X is a collection of nonempty sets X1,X2, such that XiXj= for ij and kXk=X. Let be an equivalence relation on a set X and let xX. Then [x]={yX:yx} 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.

Proof.

Suppose there exists an equivalence relation on the set X. For any xX, the reflexive property shows that x[x] and so [x] is nonempty. Clearly X=xX[x]. Now let x,yX. We need to show that either [x]=[y] or [x][y]=. Suppose that the intersection of [x] and [y] is not empty and that z[x][y]. Then zx and zy. By symmetry and transitivity xy; hence, [x][y]. Similarly, [y][x] and so [x]=[y]. Therefore, any two equivalence classes are either disjoint or exactly the same.
Conversely, suppose that P={Xi} 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 xy implies yx. 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.
Let us examine some of the partitions given by the equivalence classes in the last set of examples.

Example 1.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.

Example 1.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.

Example 1.29.

We defined an equivalence class on R2 by (x1,y1)(x2,y2) if x12+y12=x22+y22. Two pairs of real numbers are in the same partition when they lie on the same circle about the origin.

Example 1.30.

Let r and s be two integers and suppose that nN. We say that r is congruent to s modulo n, or r is congruent to s mod n, if rs is evenly divisible by n; that is, rs=nk for some kZ. In this case we write rs(modn). For example, 4117(mod8) since 4117=24 is divisible by 8. We claim that congruence modulo n forms an equivalence relation of Z. Certainly any integer r is equivalent to itself since rr=0 is divisible by n. We will now show that the relation is symmetric. If rs(modn), then rs=(sr) is divisible by n. So sr is divisible by n and sr(modn). Now suppose that rs(modn) and st(modn). Then there exist integers k and l such that rs=kn and st=ln. To show transitivity, it is necessary to prove that rt is divisible by n. However,
rt=rs+st=kn+ln=(k+l)n,
and so rt is divisible by n.
If we consider the equivalence relation established by the integers modulo 3, then
[0]={,3,0,3,6,},[1]={,2,1,4,7,},[2]={,1,2,5,8,}.
Notice that [0][1][2]=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.