Equivalence Relations

We intuitively know what it means to be "equivalent", and some relations satisfy these intuitions, while others do not.

Consider the usual "$=$" relation. This is a perfectly good relation: we usually write $1=1$, for example, but can define $R = \{ (a,b) \;|\; a=b \}$ on $\mathbb{Z}$, and write $(1,1) \in R$ or $1R1$.

Why do we say the "$=$" relation expresses equivalence?

Other examples include logical equivalence, set equivalence, and many others.

A relation is an equivalence relation if it is reflexive, symmetric and transitive.

To show something is an equivalence relation, just show that it has all of these properties. To show a relation is not an equivalence relation, show it does not satisfy at least one of these properties.

Here are some examples of determining if relations are equivalence relations:

Equivalence Classes

Equivalence relations naturally partition the elements of the set they are defined on into several classes.

For example, let $R = \{ (a,b) \;|\; a \text{ got the same grade as } b \text{ in this course} \}$ over the set of students in this course. It is clear that $R$ is an equivalence relation. Observe that it also partitions the students in this course into classes: A+, A, A-, B+, and so on.

Let $R$ be an equivalence relation on a set $A$. The set of all elements related by $R$ to $a$ is called the equivalence class of $a$ and is denoted $[a]_R$ (or $[a]$ when $R$ is clear from context): $$[a]_R = \{ b \;|\; (a,b) \in R \}$$

If $b \in [a]_R$, then $b$ is called a representative of the equivalence class. Any member of the class can be chosen to be a representative.

Here are some examples of working with equivalence classes:

In the grades example we saw before, the equivalence classes were the students who achieved the same grade. Notice that this is a partition: two equivalence classes are either equal or disjoint, and the union of all equivalence classes is the set over which the relation is defined.

This works the other way, too: given a partition of a set $A$, we can always construct an equivalence relation $R$ on $A$ with those equivalence classes.

Partial Orders

A relation $R$ on a set $A$ is called a partial ordering or partial order if it is reflexive, antisymmetric, and transitive. A set $A$ together with a partial order $R$ on that set is called a partially ordered set or poset and is denoted $(A,R)$. Members of $A$ are called elements of the poset.

Here are some examples:

In a partial order, we cannot always compare two elements. The elements $a,b$ of a poset $(S,\preceq)$ are comparable if either $a \preceq b$ or $b \preceq a$. When neither is true, they are incomparable.

The fact that we can have incomparable elements is why the relations are called partial orderings.

If $(S,\preceq)$ is a poset and every two elements of $S$ are comparable, $S$ is called a totally ordered set or a linearly ordered set and $\preceq$ is called a total order or linear order. A totally ordered set is also called a chain.

Hasse Diagrams

We can represent a partial order graphically using a tool called a Hasse diagram. The idea is to draw the relation as a graph consisting of a vertex for every element in the set and edges denote which elements of the set are related by the partial order. For the sake of conciseness, edges which must appear (because of reflexivity and transitivity) are omitted.

For example, consider the poset $(\{1,2,3,4\}, \le)$. We start with all information.

A complete graphical representation of a poset

We now remove all self-loops:

A graphical representation of a poset with self-loops removed

We then remove the edges required for transitivity:

A graphical representation of a poset with self-loops and edges required for transitivity removed

We now remove the arrows by placing all of the initial elements below the terminal elements:

A graphical representation of a poset with self-loops and edges required for transitivity removed, and all edges oriented upwards

This is the Hasse diagram.

Here are some more examples of Hasse diagrams:

The other benefit of Hasse diagrams is that it is easier to pick out certain special elements.

An element $a$ is maximal in a poset $(S,\preceq)$ if there is no $b \in S$ with $a \prec b$ (that is, $a \preceq b$ but $a \neq b$).

An element $a$ is minimal in a poset $(S,\preceq)$ if there is no $b \in S$ with $b \prec a$.

In a Hasse diagram, the maximal element(s) are at the top and the minimal element(s) are at the bottom, but only in the sense of where the edges enter and leave, not their location on the diagram!

Sometimes, there is an element greater than every other element. If $b \preceq a$ for all $b \in S$, then $a$ is the greatest element of $(S,\preceq)$. If $a \preceq b$ for all $b \in S$, then $a$ is the least element of $(S,\preceq)$. Both the greatest and least elements are unique when they exist.

You might want to bound some subset of the poset. Given a poset $(S,\preceq)$ and a subset $A \subseteq S$:

For example:

A Hasse diagram

If $a \preceq x$ for any $a \in A$ and $x \preceq z$ for any upper bound $z$ of $A$ then $a$ is the least upper bound of $A$.

If $y$ is a lower bound of $A$ and $z \preceq y$ whenever $z$ is a lower bound of $A$ then $y$ is the greatest lower bound of $A$.

If the least upper bound or greatest lower bound exist, then they are unique.

In the previous example:

Topological Sorting

Suppose you are building a house. We can define a partial order on the "must be done before" relation:

A Hasse diagram for constructing a house

This is a partial order and must be respected when constructing a house. But this does not specify a valid ordering. There could be many! For example, we don't care if we do exterior painting or plumbing first (since they are incomparable elements).

We need a total order that respects the partial order. A total ordering $\preceq$ is compatible with a partial ordering $R$ if $a \preceq b$ whenever $aRb$.

Observe that every finite, non-empty poset has at least one minimal element.

Therefore, to find a compatible ordering, remove a minimal element and place it at the front of the total order. Now the initial partial order is a partial order with one fewer element. Keep doing this until all elements are gone. This is called topological sorting.

Here is how to topologically sort the poset $(\{1,2,3,4,6,8,12\},|)$. Here is the initial Hasse diagram:

Step 1 of topologically sorting a poset

The minimal element is $1$, which is the first element of our total order. This leaves us with the following Hasse diagram:

Step 2 of topologically sorting a poset

Both $2$ and $3$ are minimal elements, so we can select either. Let's pick $3$, which will be the second element in our total order. This leaves us with the following Hasse diagram:

Step 3 of topologically sorting a poset

$2$ is now the minimal element, which will be the third element in our total order. This leaves us with the following Hasse diagram:

Step 4 of topologically sorting a poset

Both $4$ and $6$ are minimal elements, so we can select either. Let's pick $4$, which will be the fourth element in our total order. This leaves us with the following Hasse diagram:

Step 5 of topologically sorting a poset

Both $6$ and $8$ are minimal elements, so we can select either. Let's pick $8$, which will be the fifth element in our total order. This leaves us with the following Hasse diagram:

Step 6 of topologically sorting a poset

$6$ is now the minimal element, which will be the sixth element in our total order. This leaves us with the following Hasse diagram:

Step 7 of topologically sorting a poset

This means that the final element in the total order is $12$, giving us a total order of $1,3,2,4,8,6,12$. Other answers are possible!

A total order for house construction would be (for example) foundation, framing, roofing, exterior siding, plumbing, wiring, exterior painting, exterior fixtures, wallboard, flooring, interior painting, carpeting, interior fixtures, completion.