Problem: Let $R$ be a relation over $X$, i.e. let $R = \left\{ (x,y) \in X \times X \mid x \in X \wedge y \in X \right\}$. Prove that $R$ is transitive if and only if $R \circ R \subset R$.
Attempt at proof: I proved one direction already. This is what I did: Suppose $R$ is transitive. Let $q \in R \circ R$ be arbitrary. Then $q = (x,y) \in X \times X$. By definition of composition there then exists a $z \in X$ such that $(x,z) \in R$ and $(z,y) \in R$. From transitivity it then follows that $(x,y) \in R$. Since $q$ was arbitrary, this proves that $R \circ R \subset R$.
Now, suppose that $R \circ R \subset R$. Let $(x,y) \in R$. Now, I don't know how to proceed since I don't know how to use my assumption this time. Any help?
The second part should rather start "Now, suppose that $R\circ R\subseteq R$. Let $(x,y)\in R$ and $(y,z)\in R$." Then you want to show that $ (x,z)\in R$.