# Equivalence Relations and Partitions

First, I'll recall the definition of an equivalence relation on a set X.

Definition. An equivalence relation on a set X is a relation on X such that:

1. for all . (The relation is reflexive.)

2. If , then . (The relation is symmetric.)

3. If and , then . (The relation is transitive.)

Example. Define a relation on by if and only if is divisible by 3.

For example:

, since , and 24 is divisible by 3.

, since , and -9 is divisible by 3.

However, , since , and 34 is not divisible by 3.

I'll check that this is an equivalence relation. In this proof, two of the parts might be a little tricky for you, so I'll work through the thought process rather than just giving the proof. (You might see if you can work this out yourself before you read on.)

If x is an integer, is divisible by 3. Therefore, for all , and is reflexive.

Suppose x and y are integers. If , then is divisible by 3. Say , where . Now

Therefore, is divisible by 3, so . Hence, is symmetric.

You might be wondering how I knew to start with " ". I reasoned backwards on scratch paper this way.

To prove symmetry, I had to show that if , then .

By the definition of , that's the same as showing: If is divisible by 3, then is divisible by 3.

If being divisible by 3 is going to force to be divisible by 3, there's probably be some connection involving 3, , and .

As in many proofs, you often reach a point where you need to play around with the stuff you have. You don't know in advance what will work, and there isn't a step-by-step method for finding out. You have to experiment.

So you think: "3?" " ?" " ?" You might try various ways of combining the expressions ... and maybe you realize that and (notice the 3's!), and then:

Since the "then" part of what I want to prove involves , I'll solve the last equation for :

And there's the equation I started with.

Now suppose x, y, and z are integers. Assume and . This means that is divisible by 3, and is divisible by 3. I'll express these as equations:

I want to show that is divisible by 3. My proof looks like this so far, with the assumptions at the top and the conclusion at the bottom.

How can I get from and to ? Make what you've got look like what you want. What I have involves x, y, and z, but what I want seems to involve only x and z. It looks like I want to get rid of the y's. How can I do that? One way is to solve the second equation for y:

Then plug into the first:

I look at my target equation . Make what you've got look like what you want. I need on the left side, so I'll just do algebra to force it to happen:

The left side is what I want ( ), but I need on the right ... oh, just factor out 3:

I'll plug this derivation into the proof outline above:

This is a complete proof of transitivity, though some people might prefer more words. Thus, is an equivalence relation.

Notice that if you were presented with this proof without any of the scratchwork or backward reasoning, it might look a little mysterious: You can see each step is correct, but you might wonder how anyone would think of doing those things in that order. This is an unfortunate consequence of the way math is often presented: After the building is finished, the scaffolding is removed, and you may then wonder how the builders managed to get the materials up to the roof!

The lesson here is that you should not look at a finished proof and assume that the person who wrote it had a flash of genius and then wrote the thing down from start to finish. While that can happen, more often proofs involve messing around and attempts that don't work and lots of scratch paper!

Example. If and n is a fixed positive integer, define if n divides --- that is, if , for some integer k. This relation is called congruence mod n.

Instead of writing , it's customary to write . For example, , because 3 divides . Likewise, , because 17 divides .

Here are the three equivalence relation axioms written in this notation:

(a) Let . Then .

(b) Let . If , then .

(c) Let . If and , then .

As an example, I'll prove (b). Suppose . Then n divides , so

Multiplying this equation by -1, I get

Since is also an integer, this means that n divides , and so .

Try to work out the proofs of (a) and (d) yourself.

You can see that these look like equations --- and in fact, you can work with them the way you'd work with equations. For example, you can add a number to both sides of an equation, and this works for congruences mod n as well.

To see this, suppose . Let . I'll prove that .

Since , for some integer k. Then

This proves that .

Equivalence relations give rise to partitions. Here's an example before I give the definition. Consider the equivalence relation of congruence mod 3 on . The integers break up into three disjoint sets:

All the elements of a given set are congruent mod 3, and no element in one set is congruent mod 3 to an element of another. The sets divide up the integers like three puzzle pieces. The three sets are called the equivalence classes corresponding to the equivalence relation.

In general, if is an equivalence relation on a set X and , the equivalence class of x consists of all the elements of X which are equivalent to x.

Definition. Let X be a set. A partition of X is a collection of subsets of X such that:

1. .

2. If and , then .

Thus, the elements of a partition are like the pieces of a jigsaw puzzle:

Example. The four suits (spades, hearts, diamonds, clubs) partition a deck of playing cards (not counting the Joker). Every card is in one of these suits, and no card is in more than one suit.

Example.

do not partition the set of integers: Every integer is in one of these sets, but the two sets overlap.

Example. The set of real numbers is partitioned by the set of rational numbers and the set of irrational numbers. Every real number is either rational or irrational, and no real number is both.

In general, if X is a set and S is a subset of X, then is a partition of X.

Example. If n is a nonzero integer and , define

I'll show that these sets are equivalence classes for the congruence mod n relation. This means that I need to show that if and only if .

Suppose , so . I want to show . If , then , so . Hence, , so . This means that , and I've shown that . The same argument with x and y switched shows that , so .

Suppose . I want to show . But , so .

I've shown that the sets are equivalence classes under congruence mod n; is called the congruence class of a mod n.

When , the equivalence classes under congruence mod 2 are the even integers and the odd integers.

When , the equivalence classes under congruence mod 5 are integers which leave a remainder of 0, 1, 2, 3, or 4 upon division by 5. In the picture below, the elements in the grey circles in a given line are the elements in a congruence class mod 5.

For example, the first line with the elements -5, 0, 5 shows that elements which leave a remainder of 0 when divided by 5. The whole equivalence class is the infinite set .

Here is how equivalence relations are related to partitions.

Theorem. Let X be a set. An equivalence relation on X gives rise to a partition of X into equivalence classes. Conversely, a partition of X gives rise to an equivalence relation on X whose equivalence classes are exactly the elements of the partition.

Proof. Suppose is an equivalence relation on X. If , let

denote the equivalence class of x. , so . Clearly, .

Now some of the 's may be identical; throw out the duplicates. This means that I have 's where , and Y is a subset of X --- and if and , then . Since I've just thrown out duplicates, I still have . I will have a partition if I show that the remaining 's don't intersect.

Suppose , , but . I'll show that this gives a contradiction. By definition, and , so by symmetry and transitivity, .

Now I'll show . The standard way to show two sets are equal is to show each is contained in the other. Suppose . Then , but , so , and . This shows . But the argument clearly works the other way around, so . Hence, .

Since I threw out all the duplicates earlier, this is a contradiction. Hence, there is no such z: . This means that the 's for partition X.

Conversely, suppose is a partition of X. Define a relation on X by saying if and only if for some .

If , for some i because . Now x is in the same as itself --- --- so . It's reflexive.

If , then for some i. Obviously, , so . It's symmetric.

Finally, if and , then and for some i and j. Now , but this can only happen if . Then , so . It's transitive, and hence it's an equivalence relation.

The equivalence classes of are exactly the 's, by construction.

Example. Suppose . Consider the following partition of X:

The equivalence relation defined by this partition is

In other words, 1, 4, and 5 are equivalence to each other, 2 and 6 are equivalent, and 3 is only equivalent to itself.

Example. Consider the equivalence relation on defined by if and only if --- that is, if is an integer.

Let . Then . Therefore, , and is reflexive.

Suppose , so . Since the negative of an integer is an integer, . Hence, , and is symmetric.

Suppose and . Then and . But the sum of integers is an integer, so

Therefore, , and is transitive. Thus, is an equivalence relation.

Here's a typical equivalence class for :

A little thought shows that all the equivalence classes look like like one: All real numbers with the same "decimal part". Each class will contain one element --- 0.3942 in the case of the class above --- in the interval . Therefore, the set of equivalence classes of looks like . Moreover, since , it's as if this interval had its ends "glued together":

This is an important use of equivalence relations in mathematics --- to "glue together" or identify parts of a set to create a new set.

Example. Let S be the set of integers from 1 to 50. Define if the product of the digits in x is the same as the product of the digits in y.

To make the proofs of the axioms simpler, let

Thus, means .

Since , it follows that , and is reflexive.

Suppose , so . Then , so . Hence, is symmetric.

Suppose and . Then

Therefore, . Hence, is transitive. Therefore, is an equivalence relation.

Here are the equivalence classes:

Thus, the equivalence class consisting of elements of S whose digits multiply to give 24 consists of 38 ( ) and 46 ( ). The largest equivalence class consists of elements whose digits multiply to 0: It has 6 elements. A number of equivalence classes consist of a single element.

Example. Let , the x-y plane. Define to mean that

In words, this means that and are the same distance from the origin.

Since , it follows that . Hence, the relation is reflexive.

Suppose , so

Then

Hence, . Hence, the relation is symmetric.

Suppose and . Then

Hence,

Therefore, . Hence, the relation is transitive. This show that is an equivalence relation.

The resulting partition of into equivalence classes consists of circles centered at the origin. The origin is in an equivalence class by itself.

Notice that the axioms for a partition are satisfied: Every point in the plane lies in one of the circles, and no point lies in two of the circles.

Example. Consider the partition of the x-y plane consisting of the sets

for .

Here's a picture of : It consists of the points between and , together with the line :

You can see that these sets fill up the plane, and no point lies in more than one of the sets.

This partition induces an equivalence relation on the plane: Two points are equivalent if they lie in the same .

For example, consider and .

0.8 and 0.6 both lie between 0 and 1, so and lie in . Therefore, .

On other other hand, consider and . , so . , so . Therefore, .

Example. Define a relation on by

Which of the axioms for an equivalence relation does satisfy?

For all ,

Therefore, for all x, and is reflexive.

Suppose . This means that . By commutativity of addition, . Hence, . Therefore, is symmetric.

Transitivity does not hold.

However, , because

Therefore, and do not imply .