In
mathematics, more specifically in
set theory, a relation is any set of
pairs. The relation relates the left and right elements in the pair.
In set theory, relations are often used to model more complex concepts.
A two-place predicate is a relation.
A function can be defined as a relation such that no different pairs share the same left element. (The function maps every left element of a pair onto the right element of the pair.)
Mathematical reasoning about relations often uses certain properties that relations can possess. For example, it is often of interest when a relation is
-
reflexive (every element relates to itself)
-
symmetric (whenever the relation relates x to y, it also relates y to x)
-
transitive (whenever the relation relates x to y and y to z, it also relates x to z)
-
equivalence relations (i.e. reflexive, symmetric, and transitive)
-
antisymmetric (whenever the relation relates x to y, it does not relate y to x)
-
antireflexive (no element is related to itself)
-
functional (the relation is a function)
There are also some well-known operations that build relations out of relations. For example,
- the converse of a relation is the relation obtained by swapping the left and the right in every pair
- the join of two relations R1 and R2 is the relation that relates all x and z whenever R1 relates x to some y and R2 relates that y to z
- the union of two relations relates all pairs in either
- the intersection of two relation relates all pairs in both
- the difference of two relations relates all pairs in the first that are not on the second
- the closure of a relation w.r.t. some property is the smallest relation including it that possesses the property; for example, the symmetric closure of a relation is its union with its converse
For example, consider relationships by birth:
- is (natural) child of: antireflexive, antisymmetric
- is parent of: the converse of the previous
- is ancestor of: the transitive closure of the previous
- has the same parents as: an equivalence relation
- has the same children as: reflexive, symmetric, but not transitive
- is grandparent of: the join of is parent of with itself