Relation (between two sets)
Let and be sets, a binary relation from to is a subset of . Given an ordered pair in , is related to by , or is -related to .
Relation on a Set
A relation on set is a relation from to It is a subset of () Note: the arrow diagram of such a relation can be modified so that it becomes a directed graph
Notation
is related to by means means
Domain, Co-domain, Range
Let and be sets and be a relation from to
Domain
is the set
Elements in that are “part of”
Co-domain
is the set
Range
is the set
Elements in A that are “part of”
Inverse Relation
If is a relation from to , then a relation from to can be defined by interchanging the elements of all the ordered pairs of Either Or
N-ary Relations
A -ary relation involves sets. Given sets , an -are relation on is a subset of 2-ary, 3-ary and 4-ary relations are called binary, ternary and quatenary relations respectively
Examples
1: Relation
Let and Suppose we define the relation R such that iff Then, but
2: Defining Relations
Let and Relation is defined from to as: State explicitly which ordered pairs are in and which are in
3: Domain, Co-domain, Range
Let and , and define a relation from to as follows:
Properties of Relations
Properties of Set Relations Note: These are properties of relations, not elements of sets (“element 0 is reflexive” is wrong, “the relation is reflexive”)
Reflexive
Definition
is reflexive iff all elements in the set are related to themselves

Symmetric
Definition
is symmetric iff for all elements that is related to , is also related to

Not Symmetric
Negation of definition of symmetric
Antisymmetric
There does not exist elements where is related to and is related to Let be a relation on set . is antisymmetric iff
Different from not symmetric
- Not symmetric
- At least one pair of elements is only related one way
- Asymmetric
- Not a single pair of elements are related “two-way”, including two of the same element (i.e. no element is related to itself)
- Antisymmetric
- Not a single pair of elements are related “two-way”
Asymmetric
Transitive
Definition
is transitive iff for all elements that is related to , and is related to , is related to

Transitive Closure
The transitive closure of a relation , denoted as , is the smallest superset of that is transitive i.e. To find , add the least number of arrows to the directed graph of to make it transitive Note: when trying to find the transitive closure, keep checking for transitivity after each round of adding arrows Formally, it satisfies all the following:
- is transitive
- If is any other transitive relation that contains (), then
- This means that is the smallest possible relation that is transitive
Example
Set Relation Properties 2024-10-04 02.56.54.excalidraw
⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’
Excalidraw Data
Text Elements
Embedded Files
cbab65d6da187952222c5b0a286ec6ae3bf5e847:
1e4bb51a12f788d49cec5e422dae640587999f05:
95c5e3e3e5745bb8853e43e00feaabf3653d520d: image_1.png
4dbe37140d70d8134521bd5e2738f6238f412955: image_2.png
Link to original
Relation Induced by a Partition
Given a partition of a set , the relation induced by the partition is defined on as: , a component of such that A partition is the same as an Equivalence Relations, but from different perspectives.
Properties
A relation induced by a partition is reflexive, symmetric and transitive
Example
Let set Let partition of the set Relation induced by the partition is:
Relation Diagrams
Arrow Diagram
Let and . Define relations and from to as follows: ,
Set Relations 2024-10-03 17.49.49.excalidraw
⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’
Excalidraw Data
Text Elements
1
2
3
1
3
5
S
1
2
3
1
3
5
T
Link to original
Directed Graph
Only for relations on a set. Let , and define on as:
Set Relations 2024-10-03 20.23.45.excalidraw
⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’
Excalidraw Data
Text Elements
3
4
6
5
Link to original
Relation Composition
Definition
Let , and be sets. Let be a relation, and be a relation. The composition of with () is the relation from to such that: i.e. and are "" related iff there s a “path” from to via some intermediate element in the arrow diagram
Laws
Let , , and be sets. Let , and be relations.
Associative
Inverse
Partial Order Relations
Definition
A relation is a partial order relation (or partial order) iff it is reflexive, antisymmetric and transitive. is used to denote a partial order relation (it replaces in , so ), read ” is curly less than or equal to “
Partially Ordered Set
A set is a partially ordered set or poset with respect to a partial order relation on , denoted by A set with a partial order relation defined on it can be represented and be called a poset
Hasse Diagram
Partial order relations can be represented as hasse diagrams
- Start with a directed graph
- Remove loops on nodes (because reflexive)
- Arrange nodes such that all arrows are pointing up, then remove arrow heads (because antisymmetric)
- Remove arrows that are implied by transitivity
- If there is an arrow from to and to , remove the arrow from to
- Keep repeating to remove as many arrows as possible
Example
For the “divides” relation on set
Partial Order Relations 2024-10-05 06.21.24.excalidraw
⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’
Excalidraw Data
Text Elements
Directed Graph
Hasse Diagram
Embedded Files
200bb00677aa83342ccef1087c52e673c454aa82: image.png
acb4d4eb3d78d42155a9149398dea983c5eba8d5: image_0.png
Link to original
Formal Definition
Let be a partial order on a set . A Hasse diagram of satisfies the following condition for all distinct : If and no is such that , then is placed below with a line joining them, else no line joins and
Analogy
Putting on socks and shoes (ignore reflexivity)
- left sock must go on before left shoe, same for right
- but whether the left or right sock goes on first does not matter
- whether the left shoe goes on before the right sock does not matter
- left sock left shoe
- right sock right shoe
- the order is “partial” because there may not be an order between certain elements
- left sock and right sock are not comparable
Common Examples
- The “divides” relation, , on a set of positive integers
- on a set of real numbers
- on a set of sets
Properties of Poset Elements
Suppose is a partial order relation on a set
For example, the hasse diagram of on

Comparability
Elements and of are said to be comparable iff either or . Otherwise, and are noncomparable Hasse diagram: Comparable means having a path between the elements that only goes up In the example and are comparable, but and are not
Compatibility
Elements and of are said to be compatible iff there exists such that and
Hasse diagram: The elements have have a path upwards to the same elements
In the example, and , and are compatible but and are not
Maximal Element
Element of is a maximal element of iff , either or and are noncomparable Hasse diagram: There are no lines upward from the element In the example are the maximal elements
Minimal Element
Element of is a minimal element of iff , either or and are noncomparable Hasse diagram: There are no lines downward from the element In the example is the maximal elements
Largest Element
Element of is the largest element of iff A largest element is always also maximal Note: largest element = greatest element = maximum Hasse diagram: There is a path downwards to all other elements In the example there is no largest element
Smallest Element
Element of is the smallest element of iff A smallest element is always also minimal Note: smallest element = least element = minimum Hasse diagram: There is a path upwards to all other elements In the example is the smallest element
Linearisation
Creating a Total Order Relations from a partial order, without violating the partial order relation Let be a partial order on a set . A linearisation of is a total order on such that
Example
For the “divides” relation on
Linearisations will include:
- etc.
Kahn’s Algorithm
An algorithm that takes a finite set and a partial order on , and outputs a linearisation of Informally:
- Find the a minimal element of
- Remove the element from
- Repeat until
- The linearisation is the elements that were removed, in the order of removal
Total Order Relations
If is a partial order relation on set , and for any two elements and in , either or , then is a total order relation (or total order) on is a total order iff is a partial order and Also called a linear order
Example
The relation on is a total order because
Well-Ordered Set
Let be a total order on a set . is well-ordered iff every non-empty subset of contains a smallest element
Equivalence Relations
A relation is an equivalence relation iff it is reflexive, symmetric and transitive. is commonly used to denote an equivalence relation (it replaces in , so ) This is the same as a partition, but from a different perspective
Equivalence Class
The equivalence class of an element is the component of the partition that contains the element e.g. Partition , the equivalence class of , denoted is Formally, Suppose is a set and is an equivalence relation on . For each , the equivalence class of , denoted , called the class of for short, is the set of all elements such that is -related to . Symbolically,
Lemma Rel.1 Equivalence Classes
Let be a equivalence relation on a set . The following are equivalent for all .
Set of equivalence classes
For set and equivalence relation on , the set of all equivalence classes with respect to is denoted (“the quotient of by “) This is a partition of (Theorem Rel.2)
Theorem Rel.2
Equivalence classes form a partition Let be an equivalence relation on set , then is a partition of
Common Example: Congruence Relations
Congruence
Let and is congruent to modulo iff ( is divisible by ) can be written as
Congruence Relation
Congruence modulo (mod-) relation :
The quotient where is the congruence-mod-n relation on is denoted
Properties
Congruence modulo relation is an Equivalence Relation, i.e. it splits the set of integers into partitions.
Divisibility
Definition
If and are integers and , then is divisible by iff equals times some integer
Notation
means ” divides ”, if and such that
Quotient-remainder Theorem
Given any integer and positive integer , there exist unique integers and such that and , with remainder
Example Use
let: Is a partition of ?
Yes. By the quotient-remainder theorem, every integer can be written in exactly one of the three forms: , , or for some integer . This means that are mutually disjoint and