In mathematics, a finitary relation over sets X1, ..., Xn is a subset of the Cartesian product X1 × ⋯ × Xn; that is, it is a set of n-tuples (x1, ..., xn) consisting of elements xi in Xi. Typically, the relation describes a possible connection between the elements of an n-tuple. For example, the relation "x is divisible by y and z" consists of the set of 3-tuples such that when substituted to x, y and z, respectively, make the sentence true.
The non-negative integer n giving the number of "places" in the relation is called the arity, adicity or degree of the relation. A relation with n "places" is variously called an n-ary relation, an n-adic relation or a relation of degree n. Relations with a finite number of places are called finitary relations (or simply relations if the context is clear). It is also possible to generalize the concept to infinitary relations with infinite sequences.
An n-ary relation over sets X1, ..., Xn is an element of the power set of X1 × ⋯ × Xn.
0-ary relations count only two members: the one that always holds, and the one that never holds. This is because there is only one 0-tuple, the empty tuple (). They are sometimes useful for constructing the base case of an induction argument.
Unary relations can be viewed as a collection of members (such as the collection of Nobel laureates) having some property (such as that of having been awarded the Nobel prize).
Binary relations are the most commonly studied form of finitary relations. When X1 = X2 it is called a homogeneous relation, for example:
Equality and inequality, denoted by signs such as = and < in statements such as "5 < 12", or
Divisibility, denoted by the sign | in statements such as "13|143".
Otherwise it is a heterogeneous relation, for example:
Set membership, denoted by the sign ∈ in statements such as "1 ∈ N".
Consider the ternary relation R "x thinks that y likes z" over the set of people P = {Alice, Bob, Charles, Denise}, defined by:
R = {(Alice, Bob, Denise), (Charles, Alice, Bob), (Charles, Charles, Alice), (Denise, Denise, Denise)}.