Skip to Content
Welcome to my more educational website. Head back to more fun stuff here!

Relations

What is a Relation?

Let AA, and BB be sets. A relation RR from set AA to set BB is a subset of the Cartesian product A×BA \times B. Given an ordered pair (a,b)A×B(a,b) \in A \times B, we say that ”aa is related to bb by RR” if and only if (a,b)R(a,b) \in \mathrel{R}. We denote this by aRba \mathrel{R} b. We refer to AA as the domain of the relation, and to BB as the codomain of the relation.

Formally, a relation defined like so is called a binary relation as there are two sets involved. More generally, an nn-ary relation on sets A1,A2,,AnA_1, A_2, \ldots, A_n is a subset of the Cartesian product A1×A2××AnA_1 \times A_2 \times \cdots \times A_n.

Examples

Simple Explicit Given Relation

We can explicit relation by specifying the pairs that belong to it.

Let A={1,2,3}A = \{1, 2, 3\} and B={1,2,3}B = \{1, 2, 3\}.

The Cartesian product A×BA \times B is then given by {(1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)}.\{(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1), (3,2), (3,3)\}.

Let’s define a relation R\mathrel{R} from AA to BB as follows: R={(1,2),(2,3),(3,1)}.\mathrel{R} = \{(1,2), (2,3), (3,1)\}.

In this case, we can say that:

  • 1R21 \mathrel{R} 2 (1 is related to 2 by R)
  • 2R32 \mathrel{R} 3 (2 is related to 3 by R)
  • 3R13 \mathrel{R} 1 (3 is related to 1 by R)

Since those pairs are in the relation RR.

And we can say that:

  • 111 \not\mathrel{R} 1
  • 131 \not\mathrel{R} 3
  • 212 \not\mathrel{R} 1
  • 222 \not\mathrel{R} 2
  • 323 \not\mathrel{R} 2
  • 333 \not\mathrel{R} 3

Since those pairs are not in the relation RR.

Relation Defined by a Condition

We can also define a relation using a specific condition. Let’s define a relation on Z\mathbb{Z} where two integers are related if they share a common prime factor.

Let RR be a relation on Z\mathbb{Z} defined as follows: for any integers aa and bb, aRba \mathrel{R} b if and only if there exists a prime integer k>1k > 1 such that kk divides both aa and bb.

We can say that:

  • 6R96 \mathrel{R} 9 because both 6 and 9 are divisible by the prime number 3.
  • 10R1510 \mathrel{R} 15 because both 10 and 15 are divisible by the prime number 5.
  • 898 \not\mathrel{R} 9 because there is no prime number that divides both 8 and 9.

Relations on Single Set

When a relation is defined on a single set, it is often referred to as a relation on that set. We simply consider the relation as a subset of the Cartesian product of the set with itself. We could have defined Example 1 as a relation on set AA instead of from AA to BB since both sets are the same.

Inverse Relations

Given a relation R\mathrel{R} from set AA to set BB, the inverse relation of R\mathrel{R}, denoted by R1\mathrel{R}^{-1}, is a relation from set BB to set AA defined as follows:

R1={(b,a)B×A(a,b)R}.\mathrel{R}^{-1} = \{(b,a) \in B \times A \mid (a,b) \in \mathrel{R}\}.

Examples

Divisibility Relations

Let R\mathrel{R} be a relation on the set of positive integers Z+\mathbb{Z}^+ defined by aRba \mathrel{R} b if and only if aa divides bb (denoted as aba \mid b).

Some of the pairs in this relation are: {(1,1),(1,2),(1,3),(2,2),(2,4),(3,6),(4,8),}.\{(1,1), (1,2), (1,3), (2,2), (2,4), (3,6), (4,8), \ldots\}.

The inverse relation R1\mathrel{R}^{-1} would then be defined by bR1ab \mathrel{R}^{-1} a if and only if aa divides bb, that is, bb is divisible by aa. Some of the pairs in this inverse relation are: {(1,1),(2,1),(3,1),(2,2),(4,2),(6,3),(8,4),}.\{(1,1), (2,1), (3,1), (2,2), (4,2), (6,3), (8,4), \ldots\}.

Graphs for Relations

A relation can be visually represented using a directed graph or a bipartite graph.

In a directed graph, each element of the sets involved in the relation is represented as a vertex, and a directed edge is drawn from vertex aa to vertex bb if aRba \mathrel{R} b.

In a bipartite graph, the vertices are divided into two disjoint sets, one for each set involved in the relation. An edge is drawn between vertex aa in the first set and vertex bb in the second set if aRba \mathrel{R} b.

Properties of Relations: Reflexivity, Symmetry, and Transitivity

Relations can have various properties. We will discuss three important properties: reflexivity, symmetry, and transitivity in this section.

Reflexivity

A relation R\mathrel{R} on a set AA is said to be reflexive if every element in AA is related to itself. That is, for all aAa \in A, we have aRaa \mathrel{R} a.

Symmetry

A relation R\mathrel{R} on a set AA is symmetric if for all a,bAa,b \in A, if aRba \mathrel{R} b, then bRab \mathrel{R} a.

Transitivity

A relation R\mathrel{R} on a set AA is transitive if for all a,b,cAa,b,c \in A, if aRba \mathrel{R} b and bRcb \mathrel{R} c, then aRca \mathrel{R} c.

Please note the conditional nature of Transitivity. The property states if both aRba \mathrel{R} b and bRcb \mathrel{R} c, then aRca \mathrel{R} c. That is, the every combination of the cartesian product need not be in the relation. The statement is vacously true if either aRba \mathrel{R} b or bRcb \mathrel{R} c is false.

Transitive Closure

We can find the transititive closure of a relation by adding the minimum number of pairs to make it transitive. For example, if we have a relation R={(1,2),(2,3)}\mathrel{R} = \{(1,2), (2,3)\}, we can add the pair (1,3)(1,3) to make it transitive. The transitive closure of R\mathrel{R} would then be {(1,2),(2,3),(1,3)}\{(1,2), (2,3), (1,3)\}.

Equivalence Relations & Partitions

The partition of a set is a way of dividing the set into non-overlapping subsets such that every element in the original set is included in exactly one subsets.

Provided the relation has been partitioned into these subsets, we can define an equivalence relation based on this partition. We say that two elements are related if they belong to the same subset in the partition. This relation will be always be reflexive, symmetric, and transitive, and forms an equivalence relation.

An equivalence relation is a relation that is reflexive, symmetric, and transitive.

Equivalence Classes

Suppose that there is an equivalace reation on a set AA. If aa is any particular element of AA, then the equivalence class of aa is the subset of AA consisting of all elements that are related to aa by the equivalence relation. We denote the equivalence class of aa by [a][a].

Formally, the equivalence class of aa is defined as follows: [a]={xAxRa}[a] = \{ x \in A \mid x \mathrel{R} a \}

Partial Orders

Let RR be a relation on a set AA. The relation RR is called a partial order if it is reflexive, antisymmetric, and transitive.

We say that a relation RR is antisymmetric if for all a,bAa,b \in A, if aRba \mathrel{R} b and bRab \mathrel{R} a, then a=ba = b.

We can say that a relation is not antisymmetric if we negate our definition of antisymmetry. If aba \neq b, then if aRba \mathrel{R} b, it must be that bab \not\mathrel{R} a.

Hasse Diagrams

We can create a Hasse diagram for a partially ordered relation. A Hasse diagram is a graphical representation of a finite partially ordered set, where the elements are represented as vertices and the order relations are represented as edges. In a Hasse diagram, we omit the edges that can be inferred by transitivity and we arrange the vertices such that if aRba \mathrel{R} b, then vertex aa is placed lower than vertex bb.

Starting with the directed graph of the relation, we can create the Hasse diagram by removing self-loops (to account for reflexivity), removing edges that can be inferred by transitivity, and arranging the vertices vertically according to the order relation.

Partially and Totally Ordered Sets

Suppose we have a partially order relation on a set AA. We say a pair of elements are comparable if either aRba \mathrel{R} b or bRab \mathrel{R} a. If every pair of elements in the set are comparable, then we say that the partially ordered set is a total order relation (or linear order).

Let AA be a set that is partially ordered by relation RR. A subset BAB \subseteq A is called a chain if every pair of elements in BB are comparable. A subset CAC \subseteq A is called an antichain if no two distinct elements in CC are comparable. The length of this chain will be one less than the number of elements in the chain since the length is defined by the number of edges connecting the elements.

Maximal, Minimal Elements, Greatest, and Least Elements

An element mAm \in A is called a maximal element if there is no element aAa \in A such that mRam \mathrel{R} a and mam \neq a. Similarly, an element nAn \in A is called a minimal element if there is no element aAa \in A such that aRna \mathrel{R} n and nan \neq a.

An element gAg \in A is called the greatest element if for all aAa \in A, we have aRga \mathrel{R} g. Similarly, an element lAl \in A is called the least element if for all aAa \in A, we have lRal \mathrel{R} a.

An element can be both maximal and greatest, or minimal and least, but not necessarily. A set can have multiple maximal or minimal elements, but at most one greatest or least element.

One can quickly use a Hasse diagram to identify maximal, minimal, greatest, and least elements. Maximal elements are those at the top of the diagram with no edges going upwards, while minimal elements are at the bottom with no edges going downwards. The greatest element, if it exists, is the single element at the very top of the diagram, and the least element, if it exists, is the single element at the very bottom.

Last updated on