The composition $\mathcal{R_2}\circ \mathcal{R_1}$ of the relations $\mathcal{R_1}$ and $\mathcal{R_2}$ is defined as follows:
$\mathcal{R_2}\circ \mathcal{R_1}:=\{(x,z)\ |\exists\ y(x\mathcal{R_1}y\land y\mathcal{R_2}z)\}$.
In particular if $\mathcal{R_1}\subset X\times Y $ and $\mathcal{R_2}\subset Y\times Z$, then $\mathcal{R}=\mathcal{R_2}\circ \mathcal{R_1}\subset X\times Z$, and
$x\mathcal{Rz}:=\exists\ y\ ((y\in Y)\land(x\mathcal{R_1y)\land(y\mathcal{R_2z}))}$.
Let $\Delta_X$ be the diagonal of $X^2$ and $\Delta_Y$ be the diagonal of $Y^2$. Show that if the relations $\mathcal{R_1}\subset X\times Y$ and $\mathcal{R_2}\subset Y\times X$ are such that $(\mathcal{R_2}\circ \mathcal{R_1}=\Delta_X)\land(\mathcal{R_1}\circ \mathcal{R_2}=\Delta_Y)$, then both relations are functional and define mutually inverse mappings of $X$ and $Y$.
My working thus far:
$(x,x)\in \Delta_X\Rightarrow (x,x)\in \mathcal{R_2}\circ \mathcal{R_1}\Rightarrow \mathcal{R_2}\circ \mathcal{R_1}\subset X^2$.
Similarly,
$(y,y)\in \Delta_Y\Rightarrow (y,y)\in \mathcal{R_1}\circ \mathcal{R_2}\Rightarrow \mathcal{R_1}\circ \mathcal{R_2}\subset Y^2$.
This is the furthest I got. I am not sure if I have any errors in my working and how to show that the relations are functional.
Two things need to be established.
1) $\mathcal{R_1}$ and $\mathcal{R_2}$ are functional relationships. This can be done by showing that for every first element in the set of ordered pairs, there is a unique second element.
2) $\mathcal{R_1}$ and $\mathcal{R_2}$ define mutually inverse mappings of $X$ and $Y$. This can be done by showing that both composite relations are identity mappings. This will lead to proving that they are bijective, and hence, mutually inverse.
1) $x_1 \in X \Rightarrow x_1 \Delta_X x_1 \Rightarrow x_1 {\mathcal{R_1} \circ {}\mathcal{R_2} x_1}$.
A/Q, $\mathcal{R_1} \circ \mathcal{R_2}:= \{(x_1,y_1)|\exists y_1(x_1\mathcal{R_1}y_1 \land y_1\mathcal{R_2}x_1)\}$.
This means that there exists at least one unique $y_1$ such that $x_1\mathcal{R_1}y_1 \land y_1\mathcal{R_2}x_1$.
Need to show that $y$s are unique for every $x$. Try to prove by contradiction.
Suppose $\exists x_1\mathcal{R_1}y_2$.
This means
$x_1\mathcal{R_1}y_1 \land x_1\mathcal{R_1}y_2$ [There are two $y$s for some $x$] $\Rightarrow y_1\mathcal{R_2}x_1 \land x_1\mathcal{R_1}y_2 \Rightarrow y_1\mathcal{R_1}\circ \mathcal{R_2}y_2 \Rightarrow y_1\Delta_Y y_2\Rightarrow y_1=y_2$.
This means that for each ordered pair the second elemt for each first element in $\mathcal{R_1}$ is unique. This proves that $\mathcal{R_1}$ is a functional relation.
An analogous argument can be used to prove that $\mathcal{R_2}$ is a functional relation.
2) $x\mathcal{R_1}y$ and $y\mathcal{R_2}x$ are functions.
$x\mathcal{R_1}y:=f_1:X\to Y$.
$y\mathcal{R_2}x:=f_2:Y\to X$.
A/Q, $f_2\circ f_1=e_X$ and $f_1\circ f_2=e_Y$ where $e_X$ and $e_Y$ are identity mappings. i.e., they map the domain to itself.
$X=e_X(X)=(f_2\circ f_1)(X)=f_2(f_1(X))\subset f_2(Y)$.
Therefore, $f_2$ is surjective.
Further, if $x_1\in X$ and $x_2\in X$ then
$x_1\neq x_2\Rightarrow e_X(x_1)\neq e_X(x_2)\Rightarrow (f_2\circ f_1)(x_1)\neq (f_2\circ f_1)(x_2)\Rightarrow f_2(f_1(x_1))\neq f_2(f_1(x_2))\Rightarrow f_1(x_1)\neq f_1(x_2)$
Therefore, $f_1$ is injective.
An analogous argument can be used to show that in the case of $f_1\circ f_1=e_Y$, $f_1$ is surjective and $f_2$ is injective.
This implies that $f_1$ and $f_2$ are mutually inverse mappings.