Functions and Relations
Last update:
.Relations
Let \( A \) and \( B \) be sets. A relation \( A \xrightarrow{R} B \) from \( A \) to \( B \) is a subset \( R \subseteq A \times B \).
We will sometimes say \( R \) is a relation on a set \( S \) to mean a that \( R \) is a relation \( S \xrightarrow{R} S \).
Here is a small example of a relation.
We have a relation \( \{1, 2, 3\} \xrightarrow{R} \{4, 5\} \) given by \( R = \{(1, 4), (2, 4), (1, 5)\} \).
Relations are a mathematical model of relationships between the elements of various sets. The following is a very concrete example illustrating this idea.
Let \( P = \set{x}{x\text{ is a person}} \). There are many meaningful relations on the set \( P \).
- The relation \( P \xrightarrow{sis} P \) is defined by \( (x, y) \in sis \) when \( x \) and \( y \) are sisters.
- The relation \( P \xrightarrow{mot} P \) is defined by \( (x, y) \in mot \) when \( x \) is the mother of \( y \).
- The relation \( P \xrightarrow{stu} P \) is defined by \( (x, y) \in stu \) when \( x \) was in a class taught by \( y \).
- The relation \( P \xrightarrow{fri} P \) is defined by \( (x, y) \in fri \) when \( x \) any \( y \) are mutually friends.
It is cumbersome to write "\( (x, y) \in R \)". We often abbreviate using infix notation \( x\, R\, y \) instead.
We will often depict relations using diagrams. For a relation \( A \xrightarrow{R} B \), we will arrange the elements of \( A \) at the left, the elements of \( B \) at the right, and draw a line segment between two elements \( a \in A \) and \( b \in B \) when \( a\, R\, b \). Doing so, we can depict the relation from Example 1 above in the following way.
Relations have very little structure; in particular, there are no requirements on the subset \( R \subseteq A \times B \). If we add some simple conditions on our relations, they often become more meaningful.
The following notion is a mathematical abstraction of some fundamental properties of equality.
An equivalence relation on set \( S \) is a relation \( R \subseteq S \times S \) such that
- Reflexive
- For all \( x \in S \) we have \( x\, R\, x \).
- Symmetric
- For all \( x, y \in S \) we have \( x\, R\, y \) implies \( y\, R\, x \).
- Transitive
- For all \( x, y, z \in S \) we have both \( x\, R\, y \) and \( y\, R\, z \) implies \( x\, R\, z \).
Notice that reflexivity, symmetry, and transitivity only make sense when we have a relation \( R \subseteq S \times S \).
The following are some examples of equivalence relations:
- Equality is an equivalence relation on any given set.
- Let \( P \) be the set of all people. The relation \( P \xrightarrow{BDay} P \) defined by \( x\, Bday\, y \) when \( x \) and \( y \) have the same birthday is an equivalence relation on \( P \).
The following set gives a relation on the set \( S = \{0, 1, 2, 3, 4\} \).
\begin{align*} \{ (0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 1), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4) \} \end{align*}Is this relation reflexive? Symmetric? Transitive?
For each subset \( X \subseteq \{\text{reflexive}, \text{symmetric}, \text{transitive}\} \) construct a relation which has precisely the properties in \( X \). Find minimal examples (in terms of cardinality of the relation \( R \) and the set \( S \)).
Let \( F \subseteq \powerset{S} \) for set \( S \), and suppose \( \emptyset \notin F \).
- Is the relation \( F \xrightarrow{I} F \) where \( (A, B) \in I \) when \( A \cap B \neq \emptyset \) always an equivalence relation?
- Is the relation \( F \xrightarrow{D} F \) where \( (A, B) \in D \) when \( A \cap B = \emptyset \) always an equivalence relation?
- Is the relation \( F \xrightarrow{R} F \) where \( (A, B) \in R \) when \( \#A = \#B \) always an equivalence relation?
We can visualize a relation \( R \subseteq S \times T \) is via a directed graph (we'll learn more about these later). Our directed graph has a point representing each element of \( S \cup T \) and an arrow pointing from \( s \) to \( t \) whenever \( s\, R\, t \).
The relation \( R = \{(1, 2), (2, 3), (3, 1), (1, 1)\} \) on \( [3] \) has the following directed graph:
Draw the directed graph for the relation from Example 1.
Another very important type of relation is called a partial ordering; this type of relation abstracts properties of the \( \leq \) relation on real numbers.
A partial order on a set \( S \) is a reflexive and transitive relation \( R \) on \( S \) such that
- Antisymmetric
- For all \( x, y \in S \) we have both \( x\, R\, y \) and \( y\, R\, x \) implies \( x = y \).
We have already seen some partial orders in the class. In particular, the following are partial orders.
- Usual ordering on \( \mathbb{R} \), \( \mathbb{Q} \), \( \mathbb{Z} \), \( \mathbb{N}_0 \).
- Divisibility Relation on \( \mathbb{N}_0 \).
- The subset relation on \( \powerset{S} \) is a partial ordering.