Let $A$ and $B$ be sets; $f: A \times B \rightarrow B \times A$ is given by $f(x,y)=(y,x)$ and $g: B \times A \rightarrow B$ is given by $g(y,x)=y$. Find $g \circ f$.
I'm not sure how to do the composition when dealing with $(y,x)$ or $(x,y)$ instead of just $x$. I know that $(y,x)=f(x,y)$ so $g(f(x,y))=g(y,x)=y$.
Your solution is correct: $g\circ f:A\times B\to B$ mapping $$(x,y)\mapsto y\,.$$