Condition for Composite Relation with Inverse to be Identity

Theorem
Let $\mathcal R \subseteq S \times T$ be a relation on $S \times T$.

Let $\mathcal R \circ \mathcal R^{-1}$ be the composite of $\mathcal R$ with its inverse.

Let $I_T$ be the identity mapping on $T$.

Then:
 * $\mathcal R \circ \mathcal R^{-1} = I_T$

iff:
 * $\mathcal R$ is functional
 * $\mathcal R$ is right-total.

Example

 * CompositeWithInverseIdentity.png

Note in the above that:


 * $\mathcal R$ is functional
 * $\mathcal R$ is right-total
 * $\mathcal R \circ \mathcal R^{-1} = I_T$.

Note, however, that $\mathcal R^{-1}$ is neither functional nor right-total, and does not need to be for $\mathcal R \circ \mathcal R^{-1} = I_T$.

Necessary Condition
Let:
 * $\mathcal R$ be functional
 * $\mathcal R$ be right-total.

Let $\left({t_1, t_2}\right) \in \mathcal R \circ \mathcal R^{-1}$.

The composite of $\mathcal R^{-1}$ and $\mathcal R$ is defined as:


 * $\mathcal R \circ \mathcal R^{-1} = \left\{{\left({t_1, t_2}\right) \in T \times T: \exists s \in S: \left({t_1, s}\right) \in \mathcal R^{-1} \land \left({s, t_2}\right) \in \mathcal R}\right\}$

By definition of inverse:
 * $\mathcal R \circ \mathcal R^{-1} = \left\{{\left({t_1, t_2}\right) \in T \times T: \exists s \in S: \left({s, t_1}\right) \in \mathcal R \land \left({s, t_2}\right) \in \mathcal R}\right\}$

But $\mathcal R$ is functional, and so $t_1 = t_2$.

So:
 * $\forall \left({t_1, t_2}\right) \in \mathcal R \circ \mathcal R^{-1}: t_1 = t_2$

and so:
 * $\mathcal R \circ \mathcal R^{-1} \subseteq I_T$

Now let $t \in T$.

By definition of identity mapping on $T$, we have that $\left({t, t}\right) \in I_T$.

As $\mathcal R$ is right-total, we have that $\operatorname{Im} \left({\mathcal R}\right) = T$, and so:
 * $\exists s \in S: \left({s, t}\right) \in \mathcal R$

and so:
 * $\exists s \in S: \left({t, s}\right) \in \mathcal R^{-1}$

Hence by definition of the composite of $\mathcal R^{-1}$ and $\mathcal R$:
 * $\left({t, t}\right) \in \mathcal R \circ \mathcal R^{-1}$

So:
 * $\mathcal R \circ \mathcal R^{-1} \supseteq I_T$

and so:
 * $\mathcal R \circ \mathcal R^{-1} = I_T$

Sufficient Condition
Let $\mathcal R \circ \mathcal R^{-1} = I_T$.


 * Suppose $\exists t \in T: t \notin \operatorname{Im} \left({\mathcal R}\right)$.

Then $t \notin \operatorname{Im} \left({\mathcal R \circ \mathcal R^{-1}}\right)$.

But $t \in \operatorname{Im} \left({I_T}\right)$ by definition of the identity mapping on $T$.

Hence $\mathcal R \circ \mathcal R^{-1} \ne I_T$.

From this contradiction we deduce that:
 * $\mathcal R \circ \mathcal R^{-1} = I_T \implies T \setminus \operatorname{Im} \left({\mathcal R}\right) = \varnothing$

where $T \setminus \operatorname{Im} \left({\mathcal R}\right)$ denotes set difference.

So from Set Difference with Superset is Empty Set‎:
 * $T \subseteq \operatorname{Im} \left({\mathcal R}\right)$

But from Image is Subset of Codomain we have:
 * $T \supseteq \operatorname{Im} \left({\mathcal R}\right)$

and so:
 * $\operatorname{Im} \left({\mathcal R}\right) = T$

which means $\mathcal R$ is right-total.


 * Suppose $\mathcal R$ is not functional.

Then:
 * $\exists s \in S: \exists t_1, t_2 \in T: \left({s, t_1}\right) \in \mathcal R \land \left({s, t_2}\right) \in \mathcal R$

By definition of inverse relation:
 * $\exists s \in S: \exists t_1, t_2 \in T: \left({t_1, s}\right) \in \mathcal R^{-1} \land \left({t_2, s}\right) \in \mathcal R^{-1}$

The composite of $\mathcal R^{-1}$ and $\mathcal R$ is defined as:


 * $\mathcal R \circ \mathcal R^{-1} = \left\{{\left({x, z}\right) \in T \times T: \exists y \in S: \left({x, y}\right) \in \mathcal R^{-1} \land \left({y, z}\right) \in \mathcal R}\right\}$

Thus:

and so by definition of identity mapping $R \circ \mathcal R^{-1} \ne I_T$.

From this contradiction we deduce that $\mathcal R$ must be functional.

Hence the result.