Definition:Relation

Definition
Let $S \times T$ be the cartesian product of two sets $S$ and $T$.

A relation (in this context, technically speaking, a binary relation) on $S \times T$ is an arbitrary subset $\mathcal R \subseteq S \times T$.

What this means is that a binary relation relates (certain) elements of one set with (certain) elements of another.

Not all elements in $S$ need to be related to every relation in $T$ (but see Trivial Relation, which is a relation in which they are).

When $\left({s, t}\right) \in \mathcal R$, we can write:
 * $s \mathcal R t$

or:
 * $\mathcal R \left({s, t}\right)$.

and can say $s$ bears $\mathcal R$ to $t$.

If $\left({s, t}\right) \notin \mathcal R$, we can write: $s \not \mathcal R t$, that is, by drawing a line through the relation symbol. See Complement of Relation.

Relation as a Mapping
It is possible to define a relation as a mapping from the cartesian product $S \times T$ to a boolean domain $\left\{{\text{true}, \text{false}}\right\}$:


 * $\mathcal R: S \times T \to \left\{{\text{true}, \text{false}}\right\}: \forall \left({s, t}\right) \in S \times T: \mathcal R \left({s, t}\right) = \begin{cases}

\text{true} & : \left({s, t}\right) \in \mathcal R \\ \text{false} & : \left({s, t}\right) \notin \mathcal R \end{cases}$

but this is too unwieldy and overcomplicated to be practical. It also relies on a circular definition. However, it can have the advantage of making the concept clear.

This approach is made in.

General Definition
Let $\displaystyle \mathbb S = \prod_{i \mathop = 1}^n S_i = S_1 \times S_2 \times \ldots \times S_n$ be the cartesian product of $n$ sets $S_1, S_2, \ldots, S_n$.

An arbitrary subset $\mathcal R \subseteq \Bbb S$ is a called an $n$-ary relation on $\Bbb S$.

To indicate that $\left({s_1, s_2, \ldots, s_n}\right) \in \mathcal R$, we write $\mathcal R \left({s_1, s_2, \ldots, s_n}\right)$.

Unary Relation
As a special case of an $n$-ary relation on $S$, note that when $n = 1$ we define a unary relation on $S$ as:
 * $\mathcal R \subseteq S$

... that is, as a subset of $S$.

Also defined as
Some sources define a relation between $S$ and $T$ as an ordered pair:
 * $\left({S \times T, P \left({s, t}\right)}\right)$

where:
 * $S \times T$ is the Cartesian product of $S$ and $T$
 * $P \left({s, t}\right)$ is a propositional function on ordered pairs $\left({s, t}\right)$ of $S \times T$.

Such sources then define the graph of the relation as:
 * $\mathcal R = \left\{{\left({s, t}\right) \in S \times T: P \left({s, t}\right)}\right\}$

that is, the set of all $\left({s, t}\right)$ in $S \times T$ for which $P \left({s, t}\right)$ holds.

Hence the graph of a relation is simply what is defined on this page as a relation.

Whether there are any advantages to this form of treatment is debatable. In general, this website will not use this somewhat more elaborate terminology.

Also see

 * Mapping


 * Relational Structure


 * Domain
 * Range


 * Entourage

Linguistic Note
In natural language what we have defined as a relation is usually understood as a relationship.