I have been solving similar questions and got them right, except this one where the answer in the back of the book doesn't match mine. The question goes:
Exercise. Find $f\circ g$, where $f, g : A \to A$ with $A=\{x, y, z\}$ and $f,g$ are defined by $f = \{(x,y),(y,z),(z,x)\}$ and $g = \{(x,y),(y,x),(z,z)\}$.
Answer in the back says, it's $\{(x,x),(y,z),(z,y)\}$ whereas I'm getting $\{(x,z),(y,y),(z,x)\}$. Could someone please help?
If $f\circ g=f(g(x))$, then
and hence $f\circ g=\{(x,z),(y,y),(z,x)\}$. And if $f\circ g=g(f(x))$, then
and hence $f\circ g=\{(x,x),(y,z),(z,y)\}$. So the result depends on the definition of $f\circ g$. By the way, we usually define $f\circ g=f(g(x))$.