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:
 * $\paren {\mathcal R_2 \circ \mathcal R_1}^{-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:
 * $\Dom {\mathcal R_2} = \Cdm {\mathcal R_1}$

where $\Dom {\mathcal R}$ denotes domain and $\Cdm {\mathcal R}$ denotes codomain of a relation $\mathcal R$.

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

From the definition of an inverse relation, we have:


 * $\Dom {\mathcal R_2} = \Cdm {\mathcal R_2^{-1} }$
 * $\Cdm {\mathcal R_1} = \Dom {\mathcal R_1^{-1} }$

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