If $R$ and $S$ are continuous relations in a topological space, Is $R\circ S$ continuous? Let $(X,\mathcal T)$ be a Hausdorff topological space and $R,S\subseteq X\times X$ be compact. Is $R\circ S$ compact?
(It seems to be true when $R$ and $S$ are functions).
 A: $\newcommand{\cl}{\operatorname{cl}}$I’m answering the question in the body, not the one in the title.
$R\circ S$ is compact. Let $\pi_0,\pi_1:X\times X\to X$ be the usual projection maps. They are continuous, so $\pi_0[R]$ and $\pi_1[S]$ are compact. Moreover, $R\circ S\subseteq\pi_0[R]\times\pi_1[S]$, so it suffices to show that $R\circ S$ is closed. Let $p=\langle x,y\rangle\in\cl(R\circ S)$. Let $\mathscr{N}$ be the family of open nbhds of $p$, and for $U\in\mathscr{N}$ fix a point $p_U=\langle x_U,y_U\rangle\in U\cap(R\circ S)$. Then $\mathbf{p}=\langle p_U:U\in\mathscr{N}\rangle$ is a net in $R\circ S$ based on the directed set $\langle\mathscr{N},\supseteq\rangle$ and converging to $p$.
For each $U\in\mathscr{N}$ there is a $z_U\in X$ such that $\langle x_U,z_U\rangle\in R$ and $\langle z_U,y_U\rangle\in S$. Then $\mathbf{z}=\langle z_U:U\in\mathscr{N}\rangle$ is a net in the compact set $\pi_1[R]\cap\pi_0[S]$, so it has a convergent subnet. That is, there are a directed set $\langle D,\preceq\rangle$ and a function $H:D\to\mathscr{N}$ such that


*

*for each $U\in\mathscr{N}$ there is a $d_U\in D$ such that $U\supseteq H(d)$ whenever $d_U\preceq d$, and  

*the net $\langle z_{H(d)}:d\in D\rangle$ converges.


Note that $\langle p_{H(d)}:d\in D\rangle$ is a subnet of $\mathbf{p}$ and therefore converges to $p$, so $\langle x_{H(d)}:d\in D\rangle\to x$ and $\langle y_{H(d)}:d\in D\rangle\to y$. 
Let $z$ be the limit of the net $\langle z_{H(d)}:d\in D\rangle$. Then $\big\langle\langle x_{H(d)},z_{H(d)}\rangle:d\in D\big\rangle$ is a net in $R$ converging to $\langle x,z\rangle$, and $\big\langle\langle z_{H(d)},y_{H(d)}\rangle:d\in D\big\rangle$ is a net in $S$ converging to $\langle z,y\rangle$. It follows that $\langle x,z\rangle\in R$ and $\langle z,y\rangle\in S$ and hence that $p=\langle x,y\rangle\in R\circ S$.
