Skip to content

A subset of the Cartesian product of two sets — a collection of ordered pairs specifying which elements of one set are related to which elements of another.

A binary relation from a set A to a set B is a subset RA×BR \subseteq A \times B. It is a collection of ordered pairs (a,b)(a, b) where aAa \in A and bBb \in B. When (a,b)R(a, b) \in R, we say a is related to b by R, written aRba \mathrel{R} b.

A relation is more general than a function. A function requires that each element of A appears in exactly one pair. A relation has no such constraint. An element of A may be related to many elements of B, to one, or to none. An element of B may be related to by many elements of A, one, or none.

A relation on a single set — a subset RA×AR \subseteq A \times A — is called a relation on A. Relations on a single set can have properties that relations between two different sets cannot:

  • Reflexive: every element is related to itself. aA:aRa\forall a \in A : a \mathrel{R} a.
  • Symmetric: if a is related to b then b is related to a. aRbbRaa \mathrel{R} b \Rightarrow b \mathrel{R} a.
  • Antisymmetric: if a is related to b and b is related to a, then they are the same. aRbbRaa=ba \mathrel{R} b \wedge b \mathrel{R} a \Rightarrow a = b.
  • Transitive: if a is related to b and b is related to c, then a is related to c. aRbbRcaRca \mathrel{R} b \wedge b \mathrel{R} c \Rightarrow a \mathrel{R} c.

These properties combine into named structures. A relation that is reflexive, symmetric, and transitive is an equivalence relation — it partitions A into classes of equivalent elements. A relation that is reflexive, antisymmetric, and transitive is a partial order.

The identity relation on A is {(a,a):aA}\{(a, a) : a \in A\} — every element related only to itself. The empty relation is \emptyset — no element related to any other. The total relation is A×AA \times A — every element related to every other.

Relations compose. If RA×BR \subseteq A \times B and SB×CS \subseteq B \times C, the composition SRA×CS \circ R \subseteq A \times C contains (a,c)(a, c) whenever there exists bBb \in B with (a,b)R(a, b) \in R and (b,c)S(b, c) \in S. Composition is associative. The identity relation is neutral under composition.

In the category Set, a relation from A to B is equivalently a function A×B{0,1}A \times B \to \{0, 1\} — a characteristic function that says yes or no for each pair. In a topos, this generalizes: a relation is a morphism A×BΩA \times B \to \Omega into the subobject classifier, where Ω\Omega may have more truth values than just true and false.

Relations

Between
Set, set
Characterizes via
Subobject classifier
Composes with
Binary relation
Date created
Defines
Binary relation
Generalizes
Function
Made of
Ordered pair
Properties
Reflexive, symmetric, antisymmetric, transitive
Specializes to
Function, equivalence relation, partial order
Referenced by