I found this problem in my professor's set theory notes:
$"$Let $R \subseteq A \times A$. Prove
$$I_{A} \subseteq R \circ R^{-1} \quad \text{ and } \quad I_{A} \subseteq R^{-1} \circ R."$$
First off, while I did attempt a solution (shown below), this problem doesn't even sound right. If anything I would think $R \circ R^{-1}, R^{-1} \circ R \subseteq I_{A}$. By definition $$I_{A}=\{ (a,a) \in A \times A | a \in A\},$$ ergo it seems to be capable of containing many elements not found in $R \circ R^{-1}, R^{-1} \circ R$. Anyways, here is my attempt at a solution:
Take $(x,x),(y,y) \in I_{A}$ such that $xRy$. Note $xRy$ implies $yR^{-1}x$. Note also that $xRy$ and $yR^{-1}x$ imply $$(x,x) \in R^{-1} \circ R$$ and $$(y,y) \in R \circ R^{-1} \text{.}$$ Hence, if $(x,x),(y,y) \in I_{A}$, then $(x,x) \in R^{-1} \circ R$ and $(y,y) \in R \circ R^{-1}$. Thus $I_{A} \subseteq R^{-1} \circ R, R \circ R^{-1}$.
Anyways, he's got the phD and I don't so I'm probably wrong somewhere in my thinking. Any help would be appreciated guys, thank you!
Neither inclusion holds in general: for instance, if $A=\{1,2\}$ and $R=\{(1,1)\}$, then $R^{-1}\circ R = R\circ R^{-1} = \{(1,1)\} = R$, but it neither composition contains $I_A$.
Now, what is true is the following: let $R$ be a relation on $A$, and let the domain and codomain of $R$ be given by: $$\begin{align*} D=\mathrm{dom}(R) &= \{a\in A\mid \exists b\in A\text{ such that }(a,b)\in R\}\\ \text{and }E=\mathrm{codom}(R) &= \{a\in A\mid \exists c\in A\text {such that }(c,a)\in R\}. \end{align*}$$ Then $I_D\subseteq R^{-1}\circ R$ and $I_E\subseteq R\circ R^{-1}$
Indeed: let $d\in D$; then there exists $b\in A$ such that $(d,b)\in R$, and hence $(b,d)\in R^{-1}$. Therefore, $(d,d)\in R^{-1}\circ R$. Thus, $I_D\subseteq R^{-1}\circ R$.
And let $e\in E$. Then there exists $a\in A$ such that $(a,e)\in R$. Hence $(e,a)\in R^{-1}$, $(a,e)\in R$, hence $(e,e)\in R\circ R^{-1}$. Thus, $I_E\subseteq R\circ R^{-1}$. (Alternatively, $\mathrm{dom}(R)=\mathrm{codom}(R^{-1})$ and $\mathrm{codom}(R)=\mathrm{dom}(R^{-1})$, so the second inclusion follows from the first by swapping the roles of $R$ and $R^{-1}$.
In fact, this is the best that can be said in this direction: suppose $R\subseteq A\times A$ is a relation, and $a\in A\setminus \mathrm{dom}(R)$. I claim that $(a,a)\notin R^{-1}\circ R$; that is, if $I_X\subseteq R^{-1}\circ R$, then $X\subseteq D$:
Indeed, suppose that $(a,a)\in R^{-1}\circ R$; then there exists $b\in A$ such that $(a,b)\in R$ and $(b,a)\in R^{-1}$. But then $a\in D$. Thus, if $I_{X}\subseteq R^{-1}\circ R$, then $X\subseteq D$. The domain of $R$ is the largest subset of $A$ whose identity relation is contained in $R^{-1}\circ R$.
Symmetrically, $E$ is the largest subset of $A$ whose identity relation is contained in $R^{-1}\circ R$.
Your argument is correct as far as it goes up to the "Thus $I_A\subseteq R^{-1}\circ R$, $R\circ R^{-1}$", because you did not show that every element of $I_A$ lies in $R^{-1}\circ R$, you only showed that an element of $I_A$ that satisfies some extra conditions (namely, its first entry being $R$-related to someone) lies in $R^{-1}\circ R$. To reach your conclusion, you would need to either show that every element of $I_A$ satisfies this extra condition, or else deal with the case in which the element of $I_A$ does not satisfy the condition.
Finally, on your "if anything. $R^{-1}\circ R\subseteq I_A$"... I'm not sure why that would be; imagine that $R$ is everything: $R=A\times A$, so that $R^{-1}=A\times A$. Then the composition is again everything, and not merely some pairs with identical first and last entry. Perhaps you are thinking of functions, where $f^{-1}\circ f = \mathrm{id}_A$. But if so, you should think that with relations you should get at least as much as you get with functions, but often more (because the same element of $A$ may be $R$-related to many elements in a relation, whereas only to one element in a function). So you may guess that you get at least $I_A$, but not that you get at most $I_A$.