A relation is a simple structure that can be placed on a pair or collection of sets to give a notion of "relatedness" to the elements of those sets.

Examples of relations include the relation of similarity on the set of triangles in a plane, the relation on the real numbers that indicates that a first number is exactly one larger than a second number, or the relation betweem the integers and the set $\{0, 1, 2, \ldots, m - 1 \}$ that the two numbers are congruent modulo $m$.

Relations (also known as predicates) are one of the most important fundamental concepts of set theory. The most common kind of relations (including all of those mentioned in the preceding paragraph) are the binary relations, so we begin with them.

Binary Relations

A binary relation $\mathfrak{R}$ between a set $A$ and a set $B$ is formally defined as a subset of the Cartesian product $A \times B$. If $a \in A$ and $b \in B$, we say $a$ is related to $b$ under $\mathfrak{R}$ if $(a, b) \in \mathfrak{R}$. We write this as $\mathfrak{R}(a,b)$, or, more commonly, $a\mathfrak{R}b$. If $(a, b) \not \in \mathfrak{R}$, we say that $a$ and $b$ are not related under $\mathfrak{R}$.

For a more detailed treatment, see Binary relation.

$n$-ary Relations

An $n$-ary relation $\mathfrak{R}$ over the sets $A_1,\ldots,A_n$ is a subset of the Cartesian product $A_1 \times A_2 \times \ldots \times A_n$. If $a_i \in A_i$ for $i=1,\ldots,n$, we say $a_1, \ldots, a_n$ are related under $\mathfrak{R}$, and write $\mathfrak{R}(a_1,...,a_n)$ (unfortunately though, the other short hand breaks down here) if $(a_1,\ldots,a_n) \in \mathfrak{R}$. If $A_1 = \ldots = A_n = A$, we say $\mathfrak{R}$ is an $n$-ary relation over $A$.

A very common example of an $n$-ary relation is a linear constraint over a vector space $\mathbb{F}^n$ for some field $\mathbb{F}$: $\sum^n_{i=1}c_ix_i = c$, where $(x_1,...,x_n)$ is an element of the vector space and $c_1,...,c_n,c$ are scalars.