A (binary) relation R from a set X to a set Y is a subset of the cartesian product X × Y. Two elements x, y are said to be related if the pair (x, y) is in R. As a shorthand, we can write x R y. This is the sense the word that is used in the relational database model. A function is a special case of a relation, namely one where every x in X is related to exactly one y in Y.

A particulary important case is when X and Y is the same set. Then the relation is said to be on X. (Note that a finite set with a relation defined on it is an ordered graph, except some definitions of graphs allow more than one edge between a given pair of nodes). A relation R on a set X might be:

(Note that symmetry and antisymmetry are not mutually exclusive: e.g. the relation {(1,1), (2,2), (3,3)} on the set {1,2,3} has both properties.)

These properties can be used to classify relations: a relation that is reflexive, transitive and symmetric is called an equivalence relation, while one that is reflexive, transitive and antisymmetric is a partial order. For example, "x ≤ y" and "x divides y" are partial orders on the integers, while "x = y" and "x = y (modulo N)" are equivalence relations.

One can also view an relation f from X to Y as a function f:X→℘(Y) from X to the power set of Y: it maps each element x in X to a subset of Y (namely the set of elements that are related to x). This is sometimes written f:X→→Y.