Definition:Relation

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

A 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$$.

Two relations $$\mathcal{R}_1 \subseteq S_1 \times T_1, \mathcal{R}_2 \subseteq S_2 \times T_2$$ are equal iff:


 * $$S_1 = S_2$$
 * $$T_1 = T_2$$
 * $$\left({s, t}\right) \in \mathcal{R}_1 \iff \left({s, t}\right) \in \mathcal{R}_2$$.

Domain and Range
The domain of a relation $$\mathcal{R} \subseteq S \times T$$ is the set $$S$$ and can be denoted $$\mathrm {Dom} \left({\mathcal{R}}\right)$$.

The range of a relation $$\mathcal{R} \subseteq S \times T$$ is the set $$T$$ and is denoted $$\mathrm {Rng} \left({\mathcal{R}}\right)$$ or $$\mathrm {Ran} \left({\mathcal{R}}\right)$$.

Some authors use the term "codomain" instead of "range".

Image
The definition of a relation given here as a subset of the Cartesian product of two sets gives a "static" sort of feel to the concept.

However, we can also consider a relation as being an operator, where you feed an element $$s \in S$$ (or a subset $$S_1 \subseteq S$$) in at one end, and you get a set of elements $$T_s \subseteq T$$ out of the other.

Thus we arrive at the following definition.

The image (or image set) of $$\mathcal{R}$$ of a relation $$\mathcal{R} \subseteq S \times T$$ is the set:

$$\mathrm {Im} \left ({\mathcal{R}}\right) = \mathcal{R} \left ({S}\right) = \left\{ {t \in T: \exists s \in S: \left({s, t}\right) \in \mathcal{R}}\right\}$$

Similarly, we can talk about the image of an element or subset of the domain:

For any relation $$\mathcal{R} \subseteq S \times T$$, the image of $$s \in S$$ by $$\mathcal{R}$$ is defined as:

$$\mathrm {Im} \left ({s}\right) = \mathcal{R} \left ({s}\right) = \left\{ {t \in T: \left({s, t}\right) \in \mathcal{R}}\right\}$$

That is, $$\mathcal{R} \left ({s}\right)$$ is the set of all elements of $$\mathrm {Dom} \left({\mathcal{R}}\right)$$ related to $$s$$ by $$\mathcal{R}$$.

For any relation $$\mathcal{R} \subseteq S \times T$$, the image of $$A \subseteq S$$ by $$\mathcal{R}$$ is:

$$\mathrm {Im} \left ({A}\right) = \mathcal{R} \left ({A}\right) = \left\{ {t \in T: \exists s \in A: \left({s, t}\right) \in \mathcal{R}}\right\}$$

If $$A = \mathrm {Dom} \left({\mathcal{R}}\right)$$, we have:

$$\mathrm {Im} \left ({\mathrm {Dom} \left({\mathcal{R}}\right)}\right) = \mathcal{R} \left ({\mathrm {Dom} \left({\mathcal{R}}\right)}\right) = \mathrm {Im} \left ({\mathcal{R}}\right)$$

It is also clear that $$\forall s \in S: \mathcal{R} \left ({s}\right) = \mathcal{R} \left ({\left\{{s}\right\}}\right)$$.

While the use of $$\mathrm {Im} \left ({A}\right)$$ etc. can be useful, it is arguably preferable in some situations to use $$\mathcal{R} \left ({A}\right)$$, as this makes it more apparent to exactly what relation the image refers. This is the terminology which we are planning to use from here on in.

Also note: The two notations $$s \mathcal{R} t$$ and $$\mathcal{R} \left ({s}\right) = t$$ do not mean the same thing.

The first means: "$$s$$ is related to $$t$$ by $$\mathcal{R}$$" (which does not exclude the possibility of there being other elements of $$T$$ to which $$s$$ relates).

The second means "The complete set of elements of $$T$$ to which $$s$$ relates consists of $$\left\{ {t}\right\}$$" (and is technically an abuse of notation - it really ought to read "$$\mathcal{R} \left ({s}\right) = \left\{ {t}\right\}$$").

Preimage
Every $$s \in \mathrm {Dom} \left({\mathcal{R}}\right)$$ such that $$t \in \mathcal{R} \left ({s}\right)$$ is called a preimage of $$t$$.

This can be expressed in terms of the inverse of $$\mathcal{R}$$:

$$\mathcal{R}^{-1} \left ({t}\right) = \left\{{s \in \mathrm {Dom} \left({\mathcal{R}}\right): s \mathcal{R} t}\right\}$$

The preimage is therefore also known as the inverse image.

Note that:
 * $$t \in \mathrm {Im} \left ({\mathcal{R}}\right)$$ may have more than one preimage.
 * It is possible for $$t \in \mathrm {Rng} \left({\mathcal{R}}\right)$$ to have no preimages at all.

The preimage of $$Y \subset \mathrm {Rng} \left({\mathcal{R}}\right)$$ is:

$$\mathcal{R}^{-1} \left ({Y}\right) = \left\{{s \in \mathrm {Dom} \left({\mathcal{R}}\right): \exists y \in Y: s \mathcal{R}y}\right\}$$

If no element of $$Y$$ has a preimage, then $$\mathcal{R}^{-1} \left ({Y}\right) = \varnothing$$.

The preimage of a relation $$\mathcal{R}$$ is:

\mathcal{Im}^{-1} \left ({\mathcal{R}}\right) = \mathcal{R}^{-1} \left ({\mathrm {Rng} \left({\mathcal{R}}\right)}\right) = \left\{{s \in \mathrm {Dom} \left({\mathcal{R}}\right): \exists t \in \mathrm {Rng} \left({\mathcal{R}}\right): \tuple {s, t} \in \mathcal{R}}\right\}

Particular Relations
The Trivial Relation

The trivial relation is the relation $$\mathcal{R} = S \times T$$ in $$S$$ to $$T$$ such that every element of $$S$$ relates to every element in $$T$$:

$$\mathcal{R}: S \times T: \forall \left({s, t}\right) \in S \times T: s \mathcal{R} t$$

The Null Relation

The empty set $$\mathcal{R} = \varnothing$$ is a relation in $$S$$ to $$T$$ such that no element of $$S$$ relates to any element in $$T$$:

$$\mathcal{R}: S \times T: \forall \left({s, t}\right) \in S \times T: \lnot s \mathcal{R} t$$

This is also sometimes referred to as a "trivial relation" by some authors, but to save confusion it's better to use this term specifically to mean the one defined above.