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) in $$S$$ to $$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 On a Set
Let $$\mathcal R \subseteq S \times T$$ be a relation.

Then $$\mathcal R$$ is a relation on $$S$$ iff:
 * $$\forall s \in S: \exists t \in T: \left({s, t}\right) \in \mathcal R$$

That is, iff every element of $$S$$ is related to at least one element of $$T$$.

Truth Set
Let $$\mathcal R \subseteq S \times T$$ be a relation.

The truth set of $$\mathcal R$$ is the set of all ordered pairs of $$\mathcal R$$:
 * $$\mathcal T \left({\mathcal R}\right) = \left\{{\left({s, t}\right): s \mathcal R t}\right\}$$

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.

Endorelation
If $$S = T$$, then $$\mathcal R \subseteq S \times S$$, and $$\mathcal R$$ is referred to as an endorelation, or a relation in $$S$$, or a relation on $$S$$.

Some sources use the term binary relation exclusively to refer to a binary endorelation.

Generalized Definition
Let $$\mathbb S = \prod_{i=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 \mathbb S$$ is a called an $n$-ary relation on $$\mathbb 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)$$.

A subset of a cartesian space $$S^n$$ is simply called an $$n$$-ary relation on $$S$$.

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 see

 * Mapping


 * Relational Structure

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