Relation (mathematics)

In mathematics, a binary relation is a general concept that defines some relation between the elements of two sets. It is a generalization of the more commonly understood idea of a mathematical function, but with fewer restrictions. A binary relation over sets X and Y is a set of ordered pairs (x, y) consisting of elements x in X and y in Y.[1] It encodes the common concept of relation: an element x is related to an element y, if and only if the pair (x, y) belongs to the set of ordered pairs that defines the binary relation. A binary relation is the most studied special case n = 2 of an n-ary relation over sets X1, ..., Xn, which is a subset of the Cartesian product X1 × ... × Xn.[1]

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

A function may be defined as a special kind of binary relation.[2] Binary relations are also heavily used in computer science, such as in a relational database management system (RDBMS).

A binary relation over sets X and Y is an element of the power set of X × Y. Since the latter set is ordered by inclusion (⊆), each relation has a place in the lattice of subsets of X × Y. A binary relation is either a homogeneous relation or a heterogeneous relation depending on whether X = Y or not.

Since relations are sets, they can be manipulated using set operations, including union, intersection, and complementation, and satisfying the laws of an algebra of sets. Beyond that, operations like the converse of a relation and the composition of relations are available, satisfying the laws of a calculus of relations, for which there are textbooks by Ernst Schröder,[3] Clarence Lewis,[4] and Gunther Schmidt.[5] A deeper analysis of relations involves decomposing them into subsets called concepts, and placing them in a complete lattice.

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.

The terms correspondence,[6] dyadic relation and two-place relation are synonyms for binary relation, though some authors use the term "binary relation" for any subset of a Cartesian product X × Y without reference to X and Y, and reserve the term "correspondence" for a binary relation with reference to X and Y.

A binary relation R over sets X and Y is a subset of X × Y.[1][7] The set X is called the domain[1] or set of departure of R, and the set Y the codomain or set of destination of R. In order to specify the choices of the sets X and Y, some authors define a binary relation or correspondence as an ordered triple (X, Y, G), where G is a subset of X × Y called the graph of the binary relation. The statement (x, y) ∈ R reads "x is R-related to y" and is written in infix notation as xRy.[3][4][5][note 1] The domain of definition or active domain[1] of R is the set of all x such that xRy for at least one y. The codomain of definition, active codomain,[1] image or range of R is the set of all y such that xRy for at least one x. The field of R is the union of its domain of definition and its codomain of definition.[9][10][11]

When X = Y, a binary relation is called a homogeneous relation (or endorelation). Otherwise it is a heterogeneous relation.[12][13]

In a binary relation, the order of the elements is important; if xy then yRx can be true or false independently of xRy. For example, 3 divides 9, but 9 does not divide 3.

Examples of four types of binary relations over the real numbers: one-to-one (in green), one-to-many (in blue), many-to-one (in red), many-to-many (in black).

Some important types of binary relations R over sets X and Y are listed below.

Injective and functional. For example, the green binary relation in the diagram is one-to-one, but the red, blue and black ones are not.
Injective and not functional. For example, the blue binary relation in the diagram is one-to-many, but the red, green and black ones are not.
Functional and not injective. For example, the red binary relation in the diagram is many-to-one, but the green, blue and black ones are not.
Not injective nor functional. For example, the black binary relation in the diagram is many-to-many, but the red, green and blue ones are not.

Totality properties (only definable if the domain X and codomain Y are specified):

Uniqueness and totality properties (only definable if the domain X and codomain Y are specified):

A binary relation that is functional and serial. For example, the red and green binary relations in the diagram are functions, but the blue and black ones are not.
A function that is injective. For example, the green binary relation in the diagram is an injection, but the red, blue and black ones are not.
A function that is surjective. For example, the green binary relation in the diagram is a surjection, but the red, blue and black ones are not.
A function that is injective and surjective. For example, the green binary relation in the diagram is a bijection, but the red, blue and black ones are not.

The identity element is the empty relation. For example, ≤ is the union of < and =, and ≥ is the union of > and =.

The identity element is the universal relation. For example, the relation "is divisible by 6" is the intersection of the relations "is divisible by 3" and "is divisible by 2".

The identity element is the identity relation. The order of R and S in the notation SR, used here agrees with the standard notational order for composition of functions. For example, the composition "is mother of" ∘ "is parent of" yields "is maternal grandparent of", while the composition "is parent of" ∘ "is mother of" yields "is grandmother of". For the former case, if x is the parent of y and y is the mother of z, then x is the maternal grandparent of z.

For example, = is the converse of itself, as is ≠, and < and > are each other's converse, as are ≤ and ≥. A binary relation is equal to its converse if and only if it is symmetric.

For example, = and ≠ are each other's complement, as are ⊆ and ⊈, ⊇ and ⊉, and ∈ and ∉, and, for total orders, also < and ≥, and > and ≤.

If a relation is reflexive, irreflexive, symmetric, antisymmetric, asymmetric, transitive, total, trichotomous, a partial order, total order, strict weak order, total preorder (weak order), or an equivalence relation, then so too are its restrictions.

However, the transitive closure of a restriction is a subset of the restriction of the transitive closure, i.e., in general not equal. For example, restricting the relation "x is parent of y" to females yields the relation "x is mother of the woman y"; its transitive closure doesn't relate a woman with her paternal grandmother. On the other hand, the transitive closure of "is parent of" is "is ancestor of"; its restriction to females does relate a woman with her paternal grandmother.

Also, the various concepts of completeness (not to be confused with being "total") do not carry over to restrictions. For example, over the real numbers a property of the relation ≤ is that every non-empty subset S of R with an upper bound in R has a least upper bound (also called supremum) in R. However, for the rational numbers this supremum is not necessarily rational, so the same property does not hold on the restriction of the relation ≤ to the rational numbers.

A homogeneous relation(also called endorelation) over a set X is a binary relation over X and itself, i.e. it is a subset of the Cartesian product X × X.[17][18] It is also simply called a (binary) relation over X. An example of a homogeneous relation is the relation of kinship, where the relation is over people.

A homogeneous relation R over a set X may be identified with a directed simple graph permitting loops, or if it is symmetric, with an undirected simple graph permitting loops, where X is the vertex set and R is the edge set (there is an edge from a vertex x to a vertex y if and only if xRy). It is called the adjacency relation of the graph.

Some important properties that a homogeneous relation R over a set X may have are:

The previous 2 alternatives are not exhaustive; e.g., the red binary relation y = x2 given in the section § Special types of binary relations is neither irreflexive, nor reflexive, since it contains the pair (0, 0), but not (2, 2), respectively.

Again, the previous 3 alternatives are far from being exhaustive; as an example over the natural numbers, the relation xRy defined by x > 2 is neither symmetric nor antisymmetric, let alone asymmetric.

A relation that is irreflexive, antisymmetric, transitive and connected.
A relation that is reflexive, symmetric, and transitive. It is also a relation that is symmetric, transitive, and serial, since these properties imply reflexivity.

If R is a homogeneous relation over a set X then each of the following is a homogeneous relation over X:

All operations defined in the section § Operations on binary relations also apply to homogeneous relations.