Suppose $R$ is a relation from $A$ to $B$, $S$ is a relation from $B$ to $C$, and $T$ is a relation from $C$ to $D$. Prove
$$T \circ [S \circ R] = [T \circ S] \circ R .$$
We will prove that equality holds the following way:
$(\rightarrow)$ Consider arbitrary element $p$. Suppose $p \in T \circ [S \circ R]$. Show $p \in [T \circ S] \circ R$.
$(\leftarrow)$ Consider arbitrary element $p$. Suppose $p \in [T \circ S] \circ R$. Show $p \in T \circ [S \circ R]$.
I will only show $(\rightarrow)$, because if this part of the proof is correct, then $(\leftarrow)$ will be identical, but just going backwards.
Consider arbitrary ordered pair $(a,b)$.
Suppose $(a,b) \in T \circ [S \circ R]$.
Then there is an element, $(a,x)$, such that $(a,x) \in S \circ R$, and one more element, $(x,b)$, such that $(x,b) \in T$.
If $(a,x) \in S \circ R$, then there must be at least two elements, say $ (a,y)$ and $(y,x)$, such that $(a,y) \in R$ and $(y,x) \in S$.
Since $(y,x) \in S$ and $(x,b) \in T$, then $(y,b) \in T \circ S$. And since $(a,y) \in R$, we conclude that $(a,b) \in [T \circ S] \circ R$.
The $(\leftarrow)$ is nearly identical. $\Box$
Is it correct?
Yes this is definitely correct. What in it made you feel unsure about it?