Definition:Relation

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 need to be related.

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

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

Categories of Relations
Many-to-One

A relation $$\mathcal{R}$$ is many-to-one if:

$$\mathcal{R}\subseteq S \times T: \forall x \in \mathrm{Dom} \left({\mathcal{R}}\right): \left({x, y_1}\right) \in \mathcal{R}\land \left({x, y_2}\right) \in \mathcal{R} \Longrightarrow y_1 = y_2$$

That is, every element of the domain of $$\mathcal{R}$$ relates to no more than one element of its range.

If in addition, every element of the domain relates to one element in the range, the many-to-one relation is known as a mapping (or function).

One-to-Many

A relation $$\mathcal{R}$$ is one-to-many if:

$$\mathcal{R} \subseteq S \times T: \forall y \in \mathrm{Im} \left({\mathcal{R}}\right): \left({x_1, y}\right) \in \mathcal{R} \land \left({x_2, y}\right) \in \mathcal{R} \Longrightarrow x_1 = x_2$$

That is, every element of the image of $$\mathcal{R}$$ is related to by exactly one element of its domain.

Note that the condition on $$t$$ concerns the elements in the image, not the range - so a one-to-many relation may leave some element(s) of the range unrelated.

It is clear that the inverse of a one-to-many relation is a many-to-one relation, and vice versa.

One-to-One

A relation $$\mathcal{R}$$ is one-to-one if it is both many-to-one and one-to-many.

That is, every element of the domain of $$\mathcal{R}$$ relates to no more than one element of its range, and every element of the image is related to by exactly one element of the domain.

Compare this with a one-to-one mapping, in which every element of the domain is mapped to an element of the range.

Many-to-Many

A relation $$\mathcal{R}$$ is many-to-many if it is neither many-to-one nor one-to-many.

That is, there is no restriction to the number of elements relating to or being related to by any individual element.