Inverse of Composite Relation

Theorem
Let $\mathcal R_2 \circ \mathcal R_1 \subseteq S_1 \times S_3$ be the composite of the two relations $\mathcal R_1 \subseteq S_1 \times S_2$ and $\mathcal R_2 \subseteq S_2 \times S_3$.

Then:
 * $\left({\mathcal R_2 \circ \mathcal R_1}\right)^{-1} = \mathcal R_1^{-1} \circ \mathcal R_2^{-1}$

Proof
Let $\mathcal R_1 \subseteq S_1 \times S_2$ and $\mathcal R_2 \subseteq S_2 \times S_3$ be relations.

We assume that:
 * $\operatorname{Dom} \left({\mathcal R_2}\right) = \operatorname{Cdm} \left({\mathcal R_1}\right)$

where $\operatorname{Dom}$ denotes domain and $\operatorname{Cdm}$ denotes codomain.

This is necessary for $\mathcal R_2 \circ \mathcal R_1$ to exist.

From the definition of an inverse relation, we have:


 * $\operatorname{Dom} \left({\mathcal R_2}\right) = \operatorname{Cdm} \left({\mathcal R_2^{-1}}\right)$
 * $\operatorname{Cdm} \left({\mathcal R_1}\right) = \operatorname{Dom} \left({\mathcal R_1^{-1}}\right)$

So we confirm that $\mathcal R_1^{-1} \circ \mathcal R_2^{-1}$ is defined.