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 and is a set of ordered pairs , where is an element of and is an element of . It encodes the common concept of relation: an element is related to an element if and only if the pair 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 and the set of integers , in which each prime is related to each integer that is a multiple of , but not to an integer that is not a multiple of . In this relation, for instance, the prime number is related to numbers such as , , , , but not to or , just as the prime number is related to , , and , but not to or .
A binary relation is called a homogeneous relation when . A binary relation is also called a heterogeneous relation when it is not necessary that .
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 and can be identified with an element of the power set of the Cartesian product Since a powerset is a lattice for set inclusion (), 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 of an -ary relation over sets , which is a subset of the Cartesian product
Definition Given sets and , the Cartesian product is defined as and its elements are called ordered pairs.
A over sets and is a subset of The set is called the or of , and the set the or of . In order to specify the choices of the sets and , some authors define a or as an ordered triple , where is a subset of called the of the binary relation. The statement reads " is -related to " and is denoted by .Ernst Schröder (1895) Algebra und Logic der Relative, via Internet ArchiveC. I. Lewis (1918) A Survey of Symbolic Logic, pages 269–279, via internet ArchiveGunther Schmidt, 2010. Relational Mathematics. Cambridge University Press, , Chapt. 5 The or of is the set of all such that for at least one . The codomain of definition, , or of is the set of all such that for at least one . The of is the union of its domain of definition and its codomain of definition.
When a binary relation is called a (or ). To emphasize the fact that and are allowed to be different, a binary relation is also called a heterogeneous relation. The prefix hetero is from the Greek ἕτερος (heteros, "other, another, different").
A heterogeneous relation has been called a rectangular relation, suggesting that it does not have the square-like 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 or , i.e. as relations where the normal case is that they are relations between different sets."G. Schmidt, Claudia Haltensperger, and Michael Winter (1997) "Heterogeneous relation algebra", chapter 3 (pages 37 to 53) in Relational Methods in Computer Science, Advances in Computer Science, Springer books
The terms correspondence,Jacobson, Nathan (2009), Basic Algebra II (2nd ed.) § 2.1. 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 without reference to and , and reserve the term "correspondence" for a binary relation with reference to and .
In a binary relation, the order of the elements is important; if then can be true or false independently of . For example, divides , but does not divide .
Operations Union
If and are binary relations over sets and then is the of and over and .
The identity element is the empty relation, in which no is related to any .
For example, is the union of and , and is the union of and .
Intersection If and are binary relations over sets and then is the of and over and .
The identity element is the universal relation, in which every is related to every .
For example, the relation "is divisible by 6" is the intersection of the relations "is divisible by 3" and "is divisible by 2".
Composition
If is a binary relation over sets and , and is a binary relation over sets and then (also denoted by ) is the of and over and .
If , the identity element w.r.t. composition is the identity relation on , in which is related only to itself.
The order of and 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 grandmother of), while the composition (is mother of)(is parent of) yields (is maternal grandparent of). For the latter case, if is the parent of and is the mother of , then is the maternal grandparent of .
Converse
If is a binary relation over sets and then is the ,Garrett Birkhoff & Thomas Bartee (1970) Modern Applied Algebra, page 35, McGraw-Hill also called ,Mary P. Dolciani (1962) Modern Algebra: Structure and Method, Book 2, page 339, Houghton Mifflin of over and .
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.
Complement
If is a binary relation over sets and then (also denoted by ) is the of over and .
For example, and are each other's complement, as are 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 a relation is symmetric, then so is the complement. The complement of a reflexive relation is irreflexive—and vice versa. The complement of a strict weak order is a total preorder—and vice versa.
Restriction
If is a binary homogeneous relation over a set and is a subset of then is the of to over .
If is a binary relation over sets and and if is a subset of then is the of to over 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 " is parent of " to females yields the relation " is mother of the woman "; 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 non-empty 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 over sets and is said to be a relation over and , written if is a subset of , that is, for all and if , then . If is contained in and is contained in , then and are called written . If is contained in but is not contained in , then is said to be than , written For example, on the rational numbers, the relation is smaller than , and equal to the composition .
Matrix representation Binary relations over sets and can be represented algebraically by logical matrices indexed by and 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 and and a relation over and ), 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 ) form a matrix semiring (indeed, a matrix semialgebra over the Boolean semiring) where the identity matrix corresponds to the identity relation.Droste, M., & Kuich, W. (2009). Semirings and Formal Power Series. Handbook of Weighted Automata, 3–28. , pp. 7-10
Examples + 2nd example relation ball car doll cup John + − − − Mary − − + − Venus − + − − + 1st example relation ball car doll cup John + − − − Mary − − + − Ian − − − − Venus − + − −
Types of binary relations
Some important types of binary relations over sets and are listed below.
Uniqueness properties: InjectiveVan Gasteren 1990, p. 45. (also called left-uniqueKilp, Knauer, Mikhalev 2000, p. 3.): for all and all if and then . In other words, every element of the codomain has at most one preimage element. For such a relation, is called a primary key of . For example, the green and blue binary relations in the diagram are injective, but the red one is not (as it relates both and to ), nor the black one (as it relates both and to ). Functional (also called right-unique or univalentSchmidt 2010, p. 49.): for all and all if and then . In other words, every element of the domain has at most one image element. Such a binary relation is called a or .Kilp, Knauer, Mikhalev 2000, p. 4. For such a relation, is called of . For example, the red and green binary relations in the diagram are functional, but the blue one is not (as it relates to both and ), nor the black one (as it relates to both and ). One-to-one: 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. One-to-many: 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. Many-to-one: 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. Many-to-many: 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 and codomain are specified):