2. Methodical guidelines / Методичні вказівки
This section is self-contained: it develops the theory of the work’s theme — binary relations on a set and their properties — together with algorithms for the tasks in 4task.md. No outside material is required.
2.1 Relations on a set
A binary relation on a set is a subset of ordered pairs. We write (or ) to mean “ is related to .” The three properties below each quantify over the elements of or the pairs of .
2.2 Reflexivity
is reflexive if every element is related to itself:
To check it, verify that the pair is present for each . Note this needs the underlying set , not just the pair list — a missing is what makes a relation non-reflexive. Example: on the relation is reflexive.

2.3 Symmetry
is symmetric if every pair’s reverse is also present:
Example: is symmetric — is matched by , and is its own reverse.

2.4 Transitivity
is transitive if related pairs can be chained:
Example: is transitive — the only chain, then , is closed by .

2.5 Antisymmetry, irreflexivity, and asymmetry
Three further properties complete the classification and lead to partial orders.
- is antisymmetric if the only way to have both and is
:
Equivalently, no two distinct elements are related both ways. This is not the negation of symmetry — the identity relation is both, and many relations are neither. Example: on numbers, or .
- is irreflexive if no element is related to itself: — the diagonal is empty. (Not the same as “not reflexive”: a relation can be neither reflexive nor irreflexive.)
- is asymmetric if ; equivalently, asymmetric irreflexive antisymmetric. A strict order such as is the archetype.
2.6 Equivalence relations
is an equivalence relation if it is reflexive, symmetric, and transitive. An equivalence relation splits into disjoint equivalence classes : every element belongs to exactly one class, and two elements are related precisely when they share a class.
For instance, on the relation is an equivalence relation with classes and . Beware: if a relation relates to and to , transitivity forces to be related to (and, with symmetry, to ) — otherwise it is not an equivalence relation.
Partial orders. A relation that is reflexive, antisymmetric, and transitive is a partial order (for example on numbers, or on sets); unlike an equivalence relation it need not relate every pair — where an equivalence relation groups elements into classes, a partial order ranks them.
2.7 The inverse relation
The inverse of reverses every pair:
For example, the inverse of is . A relation is symmetric exactly when .
2.8 Algorithms
Below, member(R, p) tests whether pair p is in the relation (a list scan).
function isReflexive(R, A):
for a in A:
if not member(R, (a, a)): return false
return true
function isSymmetric(R):
for (a, b) in R:
if not member(R, (b, a)): return false
return true
function isTransitive(R):
for (a, b) in R:
for (c, d) in R:
if b == c and not member(R, (a, d)): return false
return true
function isAntisymmetric(R):
for (a, b) in R:
if a != b and member(R, (b, a)): return false
return true
function isEquivalence(R, A):
return isReflexive(R, A) and isSymmetric(R) and isTransitive(R)
function isPartialOrder(R, A):
return isReflexive(R, A) and isAntisymmetric(R) and isTransitive(R)
function inverse(R):
result ← empty list
for (a, b) in R:
append (b, a) to result
return result
2.9 Complexity
With a list-based member (cost ): isReflexive is
, isSymmetric and isAntisymmetric are , and isTransitive is
(a pair of nested loops over , each inner test scanning ).
Storing the pairs in a hash set reduces member to , giving
, , and respectively. inverse is .