Snippet from Wikipedia: Binary relation

In mathematics, a binary relation associates some elements of one set called the domain with some elements of another set (possibly the same) called the codomain. Precisely, a binary relation over sets X {\displaystyle X} and Y {\displaystyle Y} is a set of ordered pairs ( x , y ) {\displaystyle (x,y)} , where x {\displaystyle x} is an element of X {\displaystyle X} and y {\displaystyle y} is an element of Y {\displaystyle Y} . It encodes the common concept of relation: an element x {\displaystyle x} is related to an element y {\displaystyle y} , if and only if the pair ( x , y ) {\displaystyle (x,y)} belongs to the set of ordered pairs that defines the binary relation.

An example of a binary relation is the "divides" relation over the set of prime numbers P {\displaystyle \mathbb {P} } and the set of integers Z {\displaystyle \mathbb {Z} } , in which each prime p {\displaystyle p} is related to each integer z {\displaystyle z} that is a multiple of p {\displaystyle p} , but not to an integer that is not a multiple of p {\displaystyle p} . In this relation, for instance, the prime number 2 {\displaystyle 2} is related to numbers such as 4 {\displaystyle -4} , 0 {\displaystyle 0} , 6 {\displaystyle 6} , 10 {\displaystyle 10} , but not to 1 {\displaystyle 1} or 9 {\displaystyle 9} , just as the prime number 3 {\displaystyle 3} is related to 0 {\displaystyle 0} , 6 {\displaystyle 6} , and 9 {\displaystyle 9} , but not to 4 {\displaystyle 4} or 13 {\displaystyle 13} .

A binary relation is called a homogeneous relation when X = Y {\displaystyle X=Y} . A binary relation is also called a heterogeneous relation when it is not necessary that X = Y {\displaystyle X=Y} .

Binary relations, and especially homogeneous relations, are used in many branches of mathematics to model a wide variety of concepts. These include, among others:

  • the "is greater than", "is equal to", and "divides" relations in arithmetic;
  • the "is congruent to" relation in geometry;
  • the "is adjacent to" relation in graph theory;
  • the "is orthogonal to" relation in linear algebra.

A function may be defined as a binary relation that meets additional constraints. Binary relations are also heavily used in computer science.

A binary relation over sets X {\displaystyle X} and Y {\displaystyle Y} can be identified with an element of the power set of the Cartesian product X × Y . {\displaystyle X\times Y.} Since a powerset is a lattice for set inclusion ( {\displaystyle \subseteq } ), relations can be manipulated using set operations (union, intersection, and complementation) and algebra of sets.

In some systems of axiomatic set theory, relations are extended to classes, which are generalizations of sets. This extension is needed for, among other things, modeling the concepts of "is an element of" or "is a subset of" in set theory, without running into logical inconsistencies such as Russell's paradox.

A binary relation is the most studied special case n = 2 {\displaystyle n=2} of an n {\displaystyle n} -ary relation over sets X 1 , , X n {\displaystyle X_{1},\dots ,X_{n}} , which is a subset of the Cartesian product X 1 × × X n . {\displaystyle X_{1}\times \cdots \times X_{n}.}