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]

A trivial example of a binary relation over set X of all real numbers (${\displaystyle \mathbb {R} }$) and set Y of all real numbers (${\displaystyle \mathbb {R} }$) is the set of all pairs for which elements ${\displaystyle x=y}$. This is equivalent to the function ${\displaystyle y=f(x)=x}$.

Another example of a binary relation is the "divides" relation over the set of prime numbers ${\displaystyle \mathbb {P} }$ and the set of integers ${\displaystyle \mathbb {Z} }$, 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 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.

## Definition

Given sets X and Y, the Cartesian product X × Y is defined as {(x, y) | xX and yY}, and its elements are called ordered pairs.

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][14]

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.

### Example

2nd example relation
A
B
ball car doll cup
John +
Mary +
Venus +
1st example relation
A
B
ball car doll cup
John +
Mary +
Ian
Venus +

The following example shows that the choice of codomain is important. Suppose there are four objects A = {ball, car, doll, cup} and four people B = {John, Mary, Ian, Venus}. A possible relation on A and B is the relation "is owned by", given by R = {(ball, John), (doll, Mary), (car, Venus)}. That is, John owns the ball, Mary owns the doll, and Venus owns the car. Nobody owns the cup and Ian owns nothing, see 1st example. As a set, R does not involve Ian, and therefore R could have been viewed as a subset of A × {John, Mary, Venus}, i.e. a relation over A and {John, Mary, Venus}, see 2nd example. While the 2nd example relation is surjective (see below), the 1st is not.

## Special types of binary relations

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.

Uniqueness properties:

Injective (also called left-unique)[15]
For all x, zX and all yY, if xRy and zRy then x = z. For such a relation, {Y} is called a primary key of R.[1] For example, the green and blue binary relations in the diagram are injective, but the red one is not (as it relates both −1 and 1 to 1), nor the black one (as it relates both −1 and 1 to 0).
Functional (also called right-unique,[15]right-definite[16] or univalent)
[5] For all xX and all y, zY, if xRy and xRz then y = z. Such a binary relation is called a partial function. For such a relation, {X} is called a primary key of R.[1] For example, the red and green binary relations in the diagram are functional, but the blue one is not (as it relates 1 to both −1 and 1), nor the black one (as it relates 0 to both −1 and 1).
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 X and codomain Y are specified):

Total (also called left-total)
For all x in X there exists a y in Y such that xRy. In other words, the domain of definition of R is equal to X. This property is different from the definition of connected (also called total by some authors)[citation needed] in the section Properties. Such a binary relation is called a multivalued function. For example, the red and green binary relations in the diagram are total, but the blue one is not (as it does not relate −1 to any real number), nor the black one (as it does not relate 2 to any real number).
Surjective (also called right-total[15] or onto)
For all y in Y, there exists an x in X such that xRy. In other words, the codomain of definition of R is equal to Y. For example, the green and blue binary relations in the diagram are surjective, but the red one is not (as it does not relate any real number to −1), nor the black one (as it does not relate any real number to 2).

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

A function
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.
An injection
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 surjection
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 bijection
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.

## Operations on binary relations

### Union

If R and S are binary relations over sets X and Y then RS = {(x, y) | xRy or xSy} 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 =.

### Intersection

If R and S are binary relations over sets X and Y then RS = {(x, y) | xRy and xSy} 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".

### Composition

 Main article: Composition of relations

If R is a binary relation over sets X and Y, and S is a binary relation over sets Y and Z then SR = {(x, z) | there exists yY such that xRy and ySz} (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 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.

### Converse

 Main article: Converse relation

If R is a binary relation over sets X and Y then RT = {(y, x) | xRy} is the converse relation 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.

### Complement

 Main article: Complementary relation

If R is a binary relation over sets X and Y then R = {(x, y) | not xRy} (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 RT is the converse of the complement: ${\displaystyle {\overline {R^{\mathsf {T))))={\bar {R))^{\mathsf {T)).}$

If X = Y, 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

 Main article: Restriction (mathematics)

If R is a binary homogeneous relation over a set X and S is a subset of X then R|S = {(x, y) | xRy and xS and yS} 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 R|S = {(x, y) | xRy and xS} is the left-restriction relation of R to S over X and Y.

If R is a binary relation over sets X and Y and if S is a subset of Y then R|S = {(x, y) | xRy and yS} is the right-restriction 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 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 binary relation R over sets X and Y is said to be ((em|contained in a relation S over X and Y, written ${\displaystyle R\subseteq S,}$ if R is a subset of S, that is, for all ${\displaystyle x\in X}$ and ${\displaystyle y\in Y,}$ 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 RS. For example, on the rational numbers, the relation > is smaller than ≥, and equal to the composition > ∘ >.

## Homogeneous relation

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.[14][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.

The set of all homogeneous relations ${\displaystyle {\mathcal {B))(X)}$ over a set X is the set 2X × X 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 ${\displaystyle {\mathcal {B))(X)}$, it forms a semigroup with involution.

### Particular homogeneous relations

Some important particular homogeneous relations over a set X are:

The empty relation
E = X × X;
The universal relation
U = X × X;
The identity relation
I = {(x, x) | xX}.

For arbitrary elements x and y of X:

• xEy holds never;
• xUy holds always;
• xIy holds if and only if x = y.

### Properties

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

Reflexive
for all xX, xRx. For example, ≥ is a reflexive relation but > is not.
Irreflexive (or strict)
for all xX, not xRx. For example, > is an irreflexive relation, but ≥ is not.

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.

Symmetric
for all x, yX, if xRy then yRx. For example, "is a blood relative of" is a symmetric relation, because x is a blood relative of y if and only if y is a blood relative of x.
Antisymmetric
for all x, yX, if xRy and yRx then x = y. For example, ≥ is an antisymmetric relation; so is >, but vacuously (the condition in the definition is always false).[19]
Asymmetric
for all x, yX, if xRy then not yRx. A relation is asymmetric if and only if it is both antisymmetric and irreflexive.[20] For example, > is an asymmetric relation, but ≥ is not.

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.

Transitive
for all x, y, zX, if xRy and yRz then xRz. A transitive relation is irreflexive if and only if it is asymmetric.[21] For example, "is ancestor of" is a transitive relation, while "is parent of" is not.
Dense
for all x, yX such that xRy, there exists some zX such that xRz and zRy. This is used in dense orders.
Connected
for all x, yX, if xy then xRy or yRx. This property is sometimes called "total", which is distinct from the definitions of "total" given in the section Special types of binary relations.
Strongly connected
for all x, yX, xRy or yRx. This property is sometimes called "total", which is distinct from the definitions of "total" given in the section Special types of binary relations.
Trichotomous
for all x, yX, exactly one of xRy, yRx or x = y holds. For example, > is a trichotomous relation, while the relation "divides" over the natural numbers is not.[22]
Serial (or left-total)
for all xX, there exists some yX such that xRy. For example, > is a serial relation over the integers. But it is not a serial relation over the positive integers, because there is no y in the positive integers such that 1 > y.[23] However, < is a serial relation over the positive integers, the rational numbers and the real numbers. Every reflexive relation is serial: for a given x, choose y = x.
Well-founded
every nonempty subset S of X contains a minimal element with respect to R. Well-foundedness implies the descending chain condition (that is, no infinite chain ... xnR...Rx3Rx2Rx1 can exist). If the axiom of dependent choice is assumed, both conditions are equivalent.[24][25]
Preorder
A relation that is reflexive and transitive.
Total preorder (also, linear preorder or weak order)
A relation that is reflexive, transitive, and connected.
Partial order (also, order[citation needed])
A relation that is reflexive, antisymmetric, and transitive.
Strict partial order (also, strict order[citation needed])
A relation that is irreflexive, antisymmetric, and transitive.
Total order (also, linear order, simple order, or chain)
A relation that is reflexive, antisymmetric, transitive and connected.[26]
Strict total order (also, strict linear order, strict simple order, or strict chain)
A relation that is irreflexive, antisymmetric, transitive and connected.
Partial equivalence relation
A relation that is symmetric and transitive.
Equivalence relation
A relation that is reflexive, symmetric, and transitive. It is also a relation that is symmetric, transitive, and serial, since these properties imply reflexivity.

### Operations

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

Reflexive closure
R=, defined as R= = {(x, x) | xX} ∪ R or the smallest reflexive relation over X containing R. This can be proven to be equal to the intersection of all reflexive relations containing R.
Reflexive reduction
R, defined as R = R \ {(x, x) | xX} or the largest irreflexive relation over X contained in R.
Transitive closure
R+, defined as the smallest transitive relation over X containing R. This can be seen to be equal to the intersection of all transitive relations containing R.
Reflexive transitive closure
R*, defined as R* = (R+)=, the smallest preorder containing R.
Reflexive transitive symmetric closure
R, defined as the smallest equivalence relation over X containing R.

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

Homogeneous relations by property
Reflexivity Symmetry Transitivity Connectedness Symbol Example
Directed graph
Undirected graph Symmetric
Dependency Reflexive Symmetric
Tournament Irreflexive Antisymmetric Pecking order
Preorder Reflexive Yes Preference
Total preorder Reflexive Yes Yes
Partial order Reflexive Antisymmetric Yes Subset
Strict partial order Irreflexive Antisymmetric Yes < Strict subset
Total order Reflexive Antisymmetric Yes Yes Alphabetical order
Strict total order Irreflexive Antisymmetric Yes Yes < Strict alphabetical order
Partial equivalence relation Symmetric Yes
Equivalence relation Reflexive Symmetric Yes ∼, ≡ Equality

## Notes

1. ^ Authors who deal with binary relations only as a special case of n-ary relations for arbitrary n usually write Rxy as a special case of Rx1...xn (prefix notation).[8]

## References

1. Codd, Edgar Frank (June 1970). "A Relational Model of Data for Large Shared Data Banks" (PDF). Communications of the ACM. 13 (6): 377–387. doi:10.1145/362384.362685. S2CID 207549016. Retrieved 2020-04-29.
2. ^ "Relation definition – Math Insight". mathinsight.org. Retrieved 2019-12-11.
3. ^ a b
4. ^ a b C. I. Lewis (1918) A Survey of Symbolic Logic , pages 269 to 279, via internet Archive
5. ^ a b c Gunther Schmidt, 2010. Relational Mathematics. Cambridge University Press, ISBN 978-0-521-76268-7, Chapt. 5
6. ^ Jacobson, Nathan (2009), Basic Algebra II (2nd ed.) § 2.1.
7. ^ Enderton 1977, Ch 3. pg. 40
8. ^ Hans Hermes (1973). Introduction to Mathematical Logic. Hochschultext (Springer-Verlag). London: Springer. ISBN 3540058192. ISSN 1431-4657. Sect.II.§1.1.4
9. ^ Suppes, Patrick (1972) [originally published by D. van Nostrand Company in 1960]. Axiomatic Set Theory. Dover. ISBN 0-486-61630-4.
10. ^ Smullyan, Raymond M.; Fitting, Melvin (2010) [revised and corrected republication of the work originally published in 1996 by Oxford University Press, New York]. Set Theory and the Continuum Problem. Dover. ISBN 978-0-486-47484-7.
11. ^ Levy, Azriel (2002) [republication of the work published by Springer-Verlag, Berlin, Heidelberg and New York in 1979]. Basic Set Theory. Dover. ISBN 0-486-42079-5.
12. ^ Schmidt, Gunther; Ströhlein, Thomas (2012). Relations and Graphs: Discrete Mathematics for Computer Scientists. Definition 4.1.1.: Springer Science & Business Media. ISBN 978-3-642-77968-8.((cite book)): CS1 maint: location (link)
13. ^ Christodoulos A. Floudas; Panos M. Pardalos (2008). Encyclopedia of Optimization (2nd ed.). Springer Science & Business Media. pp. 299–300. ISBN 978-0-387-74758-3.
14. ^ a b Michael Winter (2007). Goguen Categories: A Categorical Approach to L-fuzzy Relations. Springer. pp. x–xi. ISBN 978-1-4020-6164-6.
15. ^ a b c Kilp, Knauer and Mikhalev: p. 3. The same four definitions appear in the following:
• Peter J. Pahl; Rudolf Damrath (2001). Mathematical Foundations of Computational Engineering: A Handbook. Springer Science & Business Media. p. 506. ISBN 978-3-540-67995-0.
• Eike Best (1996). Semantics of Sequential and Parallel Programs. Prentice Hall. pp. 19–21. ISBN 978-0-13-460643-9.
• Robert-Christoph Riemann (1999). Modelling of Concurrent Systems: Structural and Semantical Methods in the High Level Petri Net Calculus. Herbert Utz Verlag. pp. 21–22. ISBN 978-3-89675-629-9.
16. ^ Mäs, Stephan (2007), "Reasoning on Spatial Semantic Integrity Constraints", Spatial Information Theory: 8th International Conference, COSIT 2007, Melbourne, Australia, September 19–23, 2007, Proceedings, Lecture Notes in Computer Science, vol. 4736, Springer, pp. 285–302, doi:10.1007/978-3-540-74788-8_18
17. ^ M. E. Müller (2012). Relational Knowledge Discovery. Cambridge University Press. p. 22. ISBN 978-0-521-19021-3.
18. ^ Peter J. Pahl; Rudolf Damrath (2001). Mathematical Foundations of Computational Engineering: A Handbook. Springer Science & Business Media. p. 496. ISBN 978-3-540-67995-0.
19. ^ Smith, Douglas; Eggen, Maurice; St. Andre, Richard (2006), A Transition to Advanced Mathematics (6th ed.), Brooks/Cole, p. 160, ISBN 0-534-39900-2
20. ^ Nievergelt, Yves (2002), Foundations of Logic and Mathematics: Applications to Computer Science and Cryptography, Springer-Verlag, p. 158.
21. ^ Flaška, V.; Ježek, J.; Kepka, T.; Kortelainen, J. (2007). Transitive Closures of Binary Relations I (PDF). Prague: School of Mathematics – Physics Charles University. p. 1. Archived from the original (PDF) on 2013-11-02. Lemma 1.1 (iv). This source refers to asymmetric relations as "strictly antisymmetric".
22. ^ Since neither 5 divides 3, nor 3 divides 5, nor 3=5.
23. ^ Yao, Y.Y.; Wong, S.K.M. (1995). "Generalization of rough sets using relationships between attribute values" (PDF). Proceedings of the 2nd Annual Joint Conference on Information Sciences: 30–33..
24. ^ "Condition for Well-Foundedness". ProofWiki. Archived from the original on 20 February 2019. Retrieved 20 February 2019.
25. ^ Fraisse, R. (15 December 2000). Theory of Relations, Volume 145 - 1st Edition (1st ed.). Elsevier. p. 46. ISBN 9780444505422. Retrieved 20 February 2019.
26. ^ Joseph G. Rosenstein, Linear orderings, Academic Press, 1982, ISBN 0-12-597680-1, p. 4