Relations [0089]
- February 28, 2026
Relations [008A]
- February 28, 2026
Definition Relation [008B]
- February 28, 2026
Let A and B be sets. A relation from A to B is a subset of the Cartesian product A \times B.
We write a\; R \; b to denote (a,b) \in R (“a is related to b by R”).
Example [008C]
- February 28, 2026
Let S be set of students at Hendrix, and C the set of courses offered next year. Let R be the relation \{ (s,c) \mid \text {$s$ is preregistered for $c$} \}. We might visualize this relation by drawing dots for students on the left, and courses on the right, with a line connecting students to courses they are preregistered for.
Most relations we care about are actually from a set to itself.
Definition Relation on a set [008D]
- February 28, 2026
A relation on a set A is a relation from A to A (that is, a subset of A \times A).
Example Example relations [008E]
- February 28, 2026
Here are some example relations on \mathbb {N}:
R_1 = \{(a,b) \mid a \leq b\}
R_2 = \{(a,b) \mid a > b\}
R_3 = \{(a,b) \mid a = b\}
R_4 = \{(a,b) \mid a = b + 1\}
R_5 = \{(a,b) \mid a + b \leq 10\}
R_6 = \{(a,b) \mid a \text { evenly divides } b\}
R_7 = \{(a,b) \mid a, b \text { end with the same digit in base 10} \}
And a few more example relations over other sets:
R_8 = \{(P,Q) \mid P, Q \text { propositions }, P \to Q\}
R_9 = \{(P,Q) \mid P, Q \text { propositions }, P \leftrightarrow Q\}
R_{10} = \{(S,T) \mid S \subseteq T\}
Properties of relations [008S]
- March 2, 2026
Many relations we care about have one or more nice properties.
Reflexivity [008I]
- February 28, 2026
Definition Reflexive relation [008G]
- February 28, 2026
A relation R on a set A is reflexive if \forall a \in A.\, a\;R\;a, that is, every element is related to itself.
Example relations which are reflexive [008H]
- February 28, 2026
Of our example relations, the \leq (R_1), equality (R_3), divisibility (R_6), last digit (R_7), implication (R_8), biconditional (R_9) and subset (R_{10}) relations are reflexive, whereas the others are not. Note that there exist natural numbers which are related to themselves under R_5; for example, 2\;R_5\;2 since 2 + 2 \leq 10. However, it is not the case that every natural number is related to itself under R_5 (for example, 7 + 7 \nleq 10), so R_5 is not reflexive.
Symmetry [008J]
- February 28, 2026
Definition Symmetric relation [008K]
- February 28, 2026
A relation R on a set A is symmetric if \forall a,b \in A.\, a\;R\;b \rightarrow b\;R\;a, that is, whenever a and b are related, then b and a are also related.
Example relations which are symmetric [008L]
- February 28, 2026
The only symmetric relations among our examples are R_3 (equality), R_5, R_7, and R_9.
Antisymmetry [008M]
- February 28, 2026
Definition Antisymmetric relation [008N]
- February 28, 2026
A relation R on a set A is antisymmetric if \forall a,b \in A.\, (a\;R\;b) \land (b\;R\;a) \rightarrow a = b, that is, the only way we can possibly have both a\;R\;b and b\;R\;a is when a and b are actually the same. In other words, whenever a and b are different, at most one of a\;R\;b or b\;R\;a can hold. Intuitively, this says that the relation R is as far from being symmetric as possible: there’s not even a single pair of values that exhibits symmetry.
Example relations which are antisymmetric [008O]
- February 28, 2026
Let's consider which of our example relations are antisymmetric.
- R_1 (\leq ) is clearly antisymmetric: if a \leq b and b \leq a then we definitely have a = b.
- R_{10} (subset) is similarly antisymmetric.
- R_6 (divisibility) is also antisymmetric on the natural numbers: the only way to have both a divisible by b and b divisible by a is if a = b; we will be able to prove this later in the semester.
- R_3 (equality) is antisymmetric, though for a boring reason.
- It may require a bit more headscratching to see, but R_2 and R_4 are also antisymmetric. For example, take R_2 (>). For this to be antisymmetric, we must have \forall a,b \in \mathbb {N}.\, (a > b) \land (b > a) \rightarrow a = b. Is this true? In fact, it is, since it is impossible for (a > b) \land (b > a) to ever be true, and an implication is always trivially true when its premise is false.
- Note finally that R_8 is not antisymmetric: if P \to Q and Q \to P then they are logically equivalent, but it does not mean they are exactly the same.
Transitivity [008P]
- February 28, 2026
Definition Transitive relation [008Q]
- February 28, 2026
A relation R on a set A is transitive if \forall a,b,c \in A.\, (a\;R\;b) \land (b\;R\;c) \rightarrow (a\;R\;c).
Example relations which are transitive [008R]
- February 28, 2026
The only relations among our examples which are not transitive are R_4 and R_5. All the rest are transitive. We use the transitivity of these relations all the time! For example, transitivity of = is what allows us to prove X = Y by showing a chain of equalities X = X_1 = X_2 = \dots = Y.
Equivalence relations [008Y]
- March 4, 2026
A very important class of relations is equivalence relations, which in some suitable sense act like “a more general sort of equality”. We have used several of them this semester already!
Definition Equivalence relation [008Z]
- March 4, 2026
An equivalence relation (sometimes just an equivalence) on a set A is a reflexive, symmetric, transitive relation.
I don’t know of a good way to explain why these particular properties are the “right” ones to capture “equality-like” things. But hopefully as we see some examples you will be convinced.
Equivalence relation examples [0094]
- March 4, 2026
Example Equality [0090]
- March 4, 2026
Of course, equality itself is an equivalence relation. We can check that it is indeed reflexive, symmetric, and transitive.
Example Words by length [0091]
- March 4, 2026
Consider the relation L on the set of all English words, where two words are related if and only if they have the same number of letters. This is an equivalence relation:
Reflexive? Check, each word has the same number of letters as itself.
Symmetric? Check, if a has the same number of letters as b, then b has the same number of letters as a.
Transitive? Check, if a has the same number of letters as b, and b has the same number of letters as c, then a has the same number of letters as c.
Example Last digit in base 10 [0092]
- March 4, 2026
What about the example from last time where two numbers were related when they had the same last digit in base 10? This is an equivalence relation too. Reflexivity, symmetry, and transitivity follow straightforwardly from the definition. Later in the semester, we will explore a more general version of this relation.
Example If and only if [0093]
- March 4, 2026
If and only if, aka biconditional (\leftrightarrow ), is an equivalence relation on propositions.
Example Case-insensitive equality [009M]
- March 7, 2026
We can define a relation on strings where two strings are related if they have the same characters in the same order, except that letters may differ in whether they are upper- or lowercase. For example, Straw! would be related to sTRaW! but not to strawberry, nor to warts.
Example Lists up to reordering [009N]
- March 7, 2026
As another example, consider the relation on lists of elements, where two lists are related if they have exactly the same elements, but possibly in a different order. For example, [1,2,3,1] is related to [3,1,1,2], but not to [3,2,1].
Many equivalence relations that arise naturally in mathematics and computer science are like this: we start out with a bunch of things that are all different, but there is some aspect of them we don't care about. We want to consider things "the same" if the only difference bewteen them has to do with the part we don't care about.
Example Divisibility [0095]
- March 4, 2026
What about the divisibility relation R_6? It is reflexive and transitive; however, it is not symmetric, so it is not an equivalence relation.
Example Close integers [0096]
- March 4, 2026
Consider the relation on integers given by \{(a,b) \mid |a - b| \leq 1 \}. In other words, a and b are related when they are “very close”, that is, the distance between them is at most 1. This is reflexive and symmetric, but not transitive, so it is not an equivalence relation.
Equivalence classes [0098]
- March 4, 2026
So, what kinds of things can we say about equivalence relations in general? First, let’s define the important concept of an equivalence class.
Definition Equivalence class [0097]
- March 4, 2026
Let \sim be an equivalence relation on A, and let a \in A. The equivalence class of a, denoted [a], is the set of all elements of A which are related to a, that is, [a] = \{ b \in A \mid a \sim b \}.
Example Words by length [0099]
- March 4, 2026
Under the equivalence relation L (words are related if they have the same length), the equivalence class of “dog” is the set of all three-letter English words: [\text {dog}] = \{ \text {dog}, \text {cow}, \text {hat}, \text {eat}, \dots \}. This is a finite (but large) set.
Example Last digit in base 10 [009A]
- March 4, 2026
Under the equivalence relation R_7, where natural numbers are equivalent if they have the same last digit in base 10, the equivalence class of 1 is the infinite set [1] = \{ 1, 11, 21, 31, \dots \}.
Suppose we have two elements a, b \in A. What can we say about the potential relationship between their equivalence classes, [a] and [b]? It turns out there are only two possibilities: either they are exactly the same, or they do not overlap at all.
Theorem Equivalence classes are disjoint [009B]
- March 4, 2026
Let \sim be an equivalence relation on a set A. For any a, b \in A, the following three propositions are logically equivalent:
- a \sim b
- [a] = [b]
- [a] \cap [b] \neq \varnothing
Proof.
- March 4, 2026
Subproof. Equivalence classes are disjoint ›
- March 4, 2026
Subproof. Equivalence classes are disjoint ›
- March 4, 2026
Subproof. Equivalence classes are disjoint ›
- March 4, 2026
Subproof. Equivalence classes are disjoint ›
- March 4, 2026
Subproof. Equivalence classes are disjoint ›
- March 4, 2026
Example ★ The rational numbers as equivalence classes [009C]
- March 6, 2026
Why do we care about equivalence relations so much? It turns out that they show up all over mathematics and computer science. Here is just one example. Recall that we defined the set of rational numbers \mathbb {Q} like so:
Definition Rational number [005Q]
- February 11, 2026
A rational number is a number that is a ratio of two integers. That is, formally, \mathrm {Rational}(r) \equiv \exists {p}: {\Z }.\; \exists {q}: {\Z }.\; r = \frac {p}{q}.
However, we noted that this definition is not really complete, since it does not take into account the fact that, say, 1/2 = 2/4, or 6/10 = 9/15. Now we finally have the tools to see the real definition.
Definition \sim _{\mathbb {Q}} [009F]
- March 6, 2026
Define a relation \sim _{\mathbb {Q}} on \Z \times (\Z - \{0\}) as follows: (a,b) \sim _{\mathbb {Q}} (c,d) \leftrightarrow ad = cb.
Theorem \sim _{\mathbb {Q}} is an equivalence [009G]
- March 6, 2026
Proof.
- March 6, 2026
- Reflexivity: (a,b) \sim _{\mathbb {Q}} (a,b) for any (a,b) \in \Z \times (\Z - \{0\}), since ab = ab.
- Symmetry: If (a,b) \sim _{\mathbb {Q}} (c,d), then by definition ad = cb. Hence cb = ad, which means (c,d) \sim _{\mathbb {Q}} (a,b) also.
- Transitivity: Suppose (a,b) \sim _{\mathbb {Q}} (c,d), and (c,d) \sim _{\mathbb {Q}} (e,f). Then by definition ad = cb and cf = ed, and we know b \neq 0, d \neq 0, and f \neq 0. We wish to show (a,b) \sim _{\mathbb {Q}} (e,f), that is, af = eb. We have two cases to consider: either c = 0 or c \neq 0.
Subproof. \sim _{\mathbb {Q}} is an equivalence ›
- March 6, 2026
If c = 0, then ad = cb = 0, and the fact that d \neq 0 means we must have a = 0. Likewise, cf = ed implies e = 0. Hence, af = eb = 0 as desired.Subproof. \sim _{\mathbb {Q}} is an equivalence ›
- March 6, 2026
If c \neq 0, multiplying equals by equals yields adcf = cbed; we can cancel cd from both sides (since c \neq 0 and d \neq 0) to yield af = eb.
Equivalence classes of \sim _{\mathbb {Q}} [009H]
- March 6, 2026
What do the equivalence classes of \sim _{\mathbb {Q}} look like? Well, to pick an example, (1,2) \sim _{\mathbb {Q}} (2,4) since 1 \cdot 4 = 2 \cdot 2. Or again, (1,2) \sim _{\mathbb {Q}} (3,6) since 1 \cdot 6 = 3 \cdot 2. In general, if we start with the equation ad = cb and divide both sides by b and d, we get \frac {a}{b} = \frac {c}{d} That is, (a,b) \sim _{\mathbb {Q}} (c,d) exactly when \frac {a}{b} = \frac {c}{d} as fractions! So, intuitively, each equivalence class is the set of all the different pairs of numerators and denominators that correspond to a single rational number.
Using this insight we can finally give a completely sound, formal definition of the rational numbers:
Definition Rational number [009I]
- March 6, 2026
A rational number is an equivalence class of the \sim _{\mathbb {Q}} relation on \Z \times (\Z - \{0\}).