Transitive binary relations .mwparseroutput .hlist dl,.mwparseroutput .hlist ol,.mwparseroutput .hlist ul{margin:0;padding:0}.mwparseroutput .hlist dd,.mwparseroutput .hlist dt,.mwparseroutput .hlist li{margin:0;display:inline}.mwparseroutput .hlist.inline,.mwparseroutput .hlist.inline dl,.mwparseroutput .hlist.inline ol,.mwparseroutput .hlist.inline ul,.mwparseroutput .hlist dl dl,.mwparseroutput .hlist dl ol,.mwparseroutput .hlist dl ul,.mwparseroutput .hlist ol dl,.mwparseroutput .hlist ol ol,.mwparseroutput .hlist ol ul,.mwparseroutput .hlist ul dl,.mwparseroutput .hlist ul ol,.mwparseroutput .hlist ul ul{display:inline}.mwparseroutput .hlist .mwemptyli{display:none}.mwparseroutput .hlist dt::after{content:": "}.mwparseroutput .hlist dd::after,.mwparseroutput .hlist li::after{content:" · ";fontweight:bold}.mwparseroutput .hlist dd:lastchild::after,.mwparseroutput .hlist dt:lastchild::after,.mwparseroutput .hlist li:lastchild::after{content:none}.mwparseroutput .hlist dd dd:firstchild::before,.mwparseroutput .hlist dd dt:firstchild::before,.mwparseroutput .hlist dd li:firstchild::before,.mwparseroutput .hlist dt dd:firstchild::before,.mwparseroutput .hlist dt dt:firstchild::before,.mwparseroutput .hlist dt li:firstchild::before,.mwparseroutput .hlist li dd:firstchild::before,.mwparseroutput .hlist li dt:firstchild::before,.mwparseroutput .hlist li li:firstchild::before{content:" (";fontweight:normal}.mwparseroutput .hlist dd dd:lastchild::after,.mwparseroutput .hlist dd dt:lastchild::after,.mwparseroutput .hlist dd li:lastchild::after,.mwparseroutput .hlist dt dd:lastchild::after,.mwparseroutput .hlist dt dt:lastchild::after,.mwparseroutput .hlist dt li:lastchild::after,.mwparseroutput .hlist li dd:lastchild::after,.mwparseroutput .hlist li dt:lastchild::after,.mwparseroutput .hlist li li:lastchild::after{content:")";fontweight:normal}.mwparseroutput .hlist ol{counterreset:listitem}.mwparseroutput .hlist ol>li{counterincrement:listitem}.mwparseroutput .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mwparseroutput .hlist dd ol>li:firstchild::before,.mwparseroutput .hlist dt ol>li:firstchild::before,.mwparseroutput .hlist li ol>li:firstchild::before{content:" ("counter(listitem)"\a0 "}.mwparseroutput .navbar{display:inline;fontsize:88%;fontweight:normal}.mwparseroutput .navbarcollapse{float:left;textalign:left}.mwparseroutput .navbarboxtext{wordspacing:0}.mwparseroutput .navbar ul{display:inlineblock;whitespace:nowrap;lineheight:inherit}.mwparseroutput .navbarbrackets::before{marginright:0.125em;content:"[ "}.mwparseroutput .navbarbrackets::after{marginleft:0.125em;content:" ]"}.mwparseroutput .navbar li{wordspacing:0.125em}.mwparseroutput .navbar a>span,.mwparseroutput .navbar a>abbr{textdecoration:inherit}.mwparseroutput .navbarmini abbr{fontvariant:smallcaps;borderbottom:none;textdecoration:none;cursor:inherit}.mwparseroutput .navbarctfull{fontsize:114%;margin:0 7em}.mwparseroutput .navbarctmini{fontsize:114%;margin:0 4em}v  

 
indicates that the column's property is always true the row's term (at the very left), while ✗ indicates that the property is not guaranteed in general (it might, or might not, hold). For example, that every equivalence relation is symmetric, but not necessarily antisymmetric, is indicated by in the "Symmetric" column and ✗ in the "Antisymmetric" column, respectively. All definitions tacitly require the homogeneous relation be transitive: for all if and then 
In mathematics, a binary relation associates elements of one set, called the domain, with elements of another set, called the codomain.^{[1]} A binary relation over sets X and Y is a set of ordered pairs (x, y) consisting of elements x from X and y from Y.^{[2]} It is a generalization of the more widely understood idea of a unary function. 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 nary relation over sets X_{1}, ..., X_{n}, which is a subset of the Cartesian product ^{[2]}
An example of a binary relation is the "divides" relation over the set of prime numbers and the set of integers , in which each prime p is related to each integer z that is a multiple of p, but not to an integer that is not a multiple of p. In this relation, for instance, the prime number 2 is related to numbers such as −4, 0, 6, 10, but not to 1 or 9, just as the prime number 3 is related to 0, 6, and 9, but not to 4 or 13.
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 binary relation that meets additional constraints.^{[3]} Binary relations are also heavily used in computer science.
A binary relation over sets X and Y is an element of the power set of Since the latter set is ordered by inclusion (⊆), each relation has a place in the lattice of subsets of A binary relation is called a homogeneous relation when X = Y. A binary relation is also called a heterogeneous relation when it is not necessary that X = Y.
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,^{[4]} Clarence Lewis,^{[5]} and Gunther Schmidt.^{[6]} 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,^{[7]} dyadic relation and twoplace relation are synonyms for binary relation, though some authors use the term "binary relation" for any subset of a Cartesian product without reference to X and Y, and reserve the term "correspondence" for a binary relation with reference to X and Y.^{[citation needed]}
Given sets X and Y, the Cartesian product is defined as and its elements are called ordered pairs.
A binary relation R over sets X and Y is a subset of ^{[2]}^{[8]} The set X is called the domain^{[2]} 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 called the graph of the binary relation. The statement reads "x is Rrelated to y" and is denoted by xRy.^{[4]}^{[5]}^{[6]}^{[note 1]} The domain of definition or active domain^{[2]} of R is the set of all x such that xRy for at least one y. The codomain of definition, active codomain,^{[2]} 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.^{[10]}^{[11]}^{[12]}
When a binary relation is called a homogeneous relation (or endorelation). To emphasize the fact that X and Y are allowed to be different, a binary relation is also called a heterogeneous relation.^{[13]}^{[14]}^{[15]}
In a binary relation, the order of the elements is important; if then yRx can be true or false independently of xRy. For example, 3 divides 9, but 9 does not divide 3.
If R and S are binary relations over sets X and Y then is the union relation of R and S over X and Y.
The identity element is the empty relation. For example, is the union of < and =, and is the union of > and =.
If R and S are binary relations over sets X and Y then is the intersection relation of R and S over X and Y.
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".
If R is a binary relation over sets X and Y, and S is a binary relation over sets Y and Z then (also denoted by R; S) is the composition relation of R and S over X and Z.
The identity element is the identity relation. The order of R and S in the notation used here agrees with the standard notational order for composition of functions. For example, the composition (is parent of) (is mother of) yields (is maternal grandparent of), while the composition (is mother of) (is parent 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.
If R is a binary relation over sets X and Y then is the converse relation,^{[16]} also called inverse relation,^{[17]} of R over Y and X.
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.
If R is a binary relation over sets X and Y then (also denoted by R or ¬ R) is the complementary relation of R over X and Y.
For example, and are each other's complement, as are and and and and and, for total orders, also and and and
The complement of the converse relation is the converse of the complement:
If the complement has the following properties:
If R is a binary homogeneous relation over a set X and S is a subset of X then is the restriction relation of R to S over X.
If R is a binary relation over sets X and Y and if S is a subset of X then is the leftrestriction relation of R to S over X and Y.^{[clarification needed]}
If R is a binary relation over sets X and Y and if S is a subset of Y then is the rightrestriction relation of R to S over X and Y.
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 does not 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 nonempty subset with an upper bound in has a least upper bound (also called supremum) in 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 binary relation R over sets X and Y is said to be contained in a relation S over X and Y, written if R is a subset of S, that is, for all and if xRy, then xSy. If R is contained in S and S is contained in R, then R and S are called equal written R = S. If R is contained in S but S is not contained in R, then R is said to be smaller than S, written For example, on the rational numbers, the relation is smaller than and equal to the composition
Binary relations over sets X and Y can be represented algebraically by logical matrices indexed by X and Y with entries in the Boolean semiring (addition corresponds to OR and multiplication to AND) where matrix addition corresponds to union of relations, matrix multiplication corresponds to composition of relations (of a relation over X and Y and a relation over Y and Z),^{[18]} the Hadamard product corresponds to intersection of relations, the zero matrix corresponds to the empty relation, and the matrix of ones corresponds to the universal relation. Homogeneous relations (when X = Y) form a matrix semiring (indeed, a matrix semialgebra over the Boolean semiring) where the identity matrix corresponds to the identity relation.^{[19]}
A B′

ball  car  doll  cup 

John  +  −  −  − 
Mary  −  −  +  − 
Venus  −  +  −  − 
A B

ball  car  doll  cup 

John  +  −  −  − 
Mary  −  −  +  − 
Ian  −  −  −  − 
Venus  −  +  −  − 
NA  SA  AF  EU  AS  AU  AA  

Indian  0  0  1  0  1  1  1 
Arctic  1  0  0  1  1  0  0 
Atlantic  1  1  1  1  0  0  1 
Pacific  1  1  0  0  1  1  1 
Some important types of binary relations over sets and are listed below.
Uniqueness properties:
Totality properties (only definable if the domain and codomain are specified):
Uniqueness and totality properties (only definable if the domain and codomain are specified):
If relations over proper classes are allowed:
Certain mathematical "relations", such as "equal to", "subset of", and "member of", cannot be understood to be binary relations as defined above, because their domains and codomains cannot be taken to be sets in the usual systems of axiomatic set theory. For example, to model the general concept of "equality" as a binary relation take the domain and codomain to be the "class of all sets", which is not a set in the usual set theory.
In most mathematical contexts, references to the relations of equality, membership and subset are harmless because they can be understood implicitly to be restricted to some set in the context. The usual workaround to this problem is to select a "large enough" set A, that contains all the objects of interest, and work with the restriction =_{A} instead of =. Similarly, the "subset of" relation needs to be restricted to have domain and codomain P(A) (the power set of a specific set A): the resulting set relation can be denoted by Also, the "member of" relation needs to be restricted to have domain A and codomain P(A) to obtain a binary relation that is a set. Bertrand Russell has shown that assuming to be defined over all sets leads to a contradiction in naive set theory, see Russell's paradox.
Another solution to this problem is to use a set theory with proper classes, such as NBG or Morse–Kelley set theory, and allow the domain and codomain (and so the graph) to be proper classes: in such a theory, equality, membership, and subset are binary relations without special comment. (A minor modification needs to be made to the concept of the ordered triple (X, Y, G), as normally a proper class cannot be a member of an ordered tuple; or of course one can identify the binary relation with its graph in this context.)^{[27]} With this definition one can for instance define a binary relation over every set and its power set.
A homogeneous relation over a set X is a binary relation over X and itself, i.e. it is a subset of the Cartesian product ^{[15]}^{[28]}^{[29]} It is also simply called a (binary) relation over X.
A homogeneous relation R over a set X may be identified with a directed 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). The set of all homogeneous relations over a set X is the power set which is a Boolean algebra augmented with the involution of mapping of a relation to its converse relation. Considering composition of relations as a binary operation on , it forms a semigroup with involution.
Some important properties that a homogeneous relation R over a set X may have are:
A partial order is a relation that is reflexive, antisymmetric, and transitive. A strict partial order is a relation that is irreflexive, asymmetric, and transitive. A total order is a relation that is reflexive, antisymmetric, transitive and connected.^{[33]} A strict total order is a relation that is irreflexive, asymmetric, transitive and connected. An equivalence relation is a relation that is reflexive, symmetric, and transitive. For example, "x divides y" is a partial, but not a total order on natural numbers "x < y" is a strict total order on and "x is parallel to y" is an equivalence relation on the set of all lines in the Euclidean plane.
All operations defined in section § Operations also apply to homogeneous relations. Beyond that, a homogeneous relation over a set X may be subjected to closure operations like:
In mathematics, a heterogeneous relation is a binary relation, a subset of a Cartesian product where A and B are possibly distinct sets.^{[34]} The prefix hetero is from the Greek ἕτερος (heteros, "other, another, different").
A heterogeneous relation has been called a rectangular relation,^{[15]} suggesting that it does not have the squarelike symmetry of a homogeneous relation on a set where Commenting on the development of binary relations beyond homogeneous relations, researchers wrote, "... a variant of the theory has evolved that treats relations from the very beginning as heterogeneous or rectangular, i.e. as relations where the normal case is that they are relations between different sets."^{[35]}
Developments in algebraic logic have facilitated usage of binary relations. The calculus of relations includes the algebra of sets, extended by composition of relations and the use of converse relations. The inclusion meaning that aRb implies aSb, sets the scene in a lattice of relations. But since the inclusion symbol is superfluous. Nevertheless, composition of relations and manipulation of the operators according to Schröder rules, provides a calculus to work in the power set of
In contrast to homogeneous relations, the composition of relations operation is only a partial function. The necessity of matching target to source of composed relations has led to the suggestion that the study of heterogeneous relations is a chapter of category theory as in the category of sets, except that the morphisms of this category are relations. The objects of the category Rel are sets, and the relationmorphisms compose as required in a category.^{[citation needed]}
Binary relations have been described through their induced concept lattices: A concept C ⊂ R satisfies two properties:
For a given relation the set of concepts, enlarged by their joins and meets, forms an "induced lattice of concepts", with inclusion forming a preorder.
The MacNeille completion theorem (1937) (that any partial order may be embedded in a complete lattice) is cited in a 2013 survey article "Decomposition of relations on concept lattices".^{[36]} The decomposition is
Particular cases are considered below: E total order corresponds to Ferrers type, and E identity corresponds to difunctional, a generalization of equivalence relation on a set.
Relations may be ranked by the Schein rank which counts the number of concepts necessary to cover a relation.^{[37]} Structural analysis of relations with concepts provides an approach for data mining.^{[38]}
The idea of a difunctional relation is to partition objects by distinguishing attributes, as a generalization of the concept of an equivalence relation. One way this can be done is with an intervening set of indicators. The partitioning relation is a composition of relations using univalent relations Jacques Riguet named these relations difunctional since the composition F G^{T} involves univalent relations, commonly called partial functions.
In 1950 Rigeut showed that such relations satisfy the inclusion:^{[39]}
In automata theory, the term rectangular relation has also been used to denote a difunctional relation. This terminology recalls the fact that, when represented as a logical matrix, the columns and rows of a difunctional relation can be arranged as a block matrix with rectangular blocks of ones on the (asymmetric) main diagonal.^{[40]} More formally, a relation R on is difunctional if and only if it can be written as the union of Cartesian products , where the are a partition of a subset of X and the likewise a partition of a subset of Y.^{[41]}
Using the notation {y: xRy} = xR, a difunctional relation can also be characterized as a relation R such that wherever x_{1}R and x_{2}R have a nonempty intersection, then these two sets coincide; formally implies ^{[42]}
In 1997 researchers found "utility of binary decomposition based on difunctional dependencies in database management."^{[43]} Furthermore, difunctional relations are fundamental in the study of bisimulations.^{[44]}
In the context of homogeneous relations, a partial equivalence relation is difunctional.
A strict order on a set is a homogeneous relation arising in order theory. In 1951 Jacques Riguet adopted the ordering of an integer partition, called a Ferrers diagram, to extend ordering to binary relations in general.^{[45]}
The corresponding logical matrix of a general binary relation has rows which finish with a sequence of ones. Thus the dots of a Ferrer's diagram are changed to ones and aligned on the right in the matrix.
An algebraic statement required for a Ferrers type relation R is
If any one of the relations is of Ferrers type, then all of them are. ^{[34]}
Suppose B is the power set of A, the set of all subsets of A. Then a relation g is a contact relation if it satisfies three properties:
The set membership relation, ε = "is an element of", satisfies these properties so ε is a contact relation. The notion of a general contact relation was introduced by Georg Aumann in 1970.^{[46]}^{[47]}
In terms of the calculus of relations, sufficient conditions for a contact relation include
Every relation R generates a preorder which is the left residual.^{[49]} In terms of converse and complements, Forming the diagonal of , the corresponding row of and column of will be of opposite logical values, so the diagonal is all zeros. Then
To show transitivity, one requires that Recall that is the largest relation such that Then
The inclusion relation Ω on the power set of U can be obtained in this way from the membership relation on subsets of U:
Given a relation R, a subrelation called its fringe is defined as
When R is a partial identity relation, difunctional, or a block diagonal relation, then fringe(R) = R. Otherwise the fringe operator selects a boundary subrelation described in terms of its logical matrix: fringe(R) is the side diagonal if R is an upper right triangular linear order or strict order. Fringe(R) is the block fringe if R is irreflexive ( ) or upper right block triangular. Fringe(R) is a sequence of boundary rectangles when R is of Ferrers type.
On the other hand, Fringe(R) = ∅ when R is a dense, linear, strict order.^{[48]}
Given two sets A and B, the set of binary relations between them can be equipped with a ternary operation where b^{T} denotes the converse relation of b. In 1953 Viktor Wagner used properties of this ternary operation to define semiheaps, heaps, and generalized heaps.^{[50]}^{[51]} The contrast of heterogeneous and homogeneous relations is highlighted by these definitions:
There is a pleasant symmetry in Wagner's work between heaps, semiheaps, and generalised heaps on the one hand, and groups, semigroups, and generalised groups on the other. Essentially, the various types of semiheaps appear whenever we consider binary relations (and partial oneone mappings) between different sets A and B, while the various types of semigroups appear in the case where A = B.
— Christopher Hollings, "Mathematics across the Iron Curtain: a history of the algebraic theory of semigroups"^{[52]}