TITLE: If $x * (y * z) = (x * z) * y$ for all $x, y, z \in S$, then $*$ is both associative and commutative
QUESTION [5 upvotes]: This is not an assignment question. I have been self teaching myself abstract algebra from this book and this is one of the exercise questions which I could n't solve.
Suppose $e$ is the identity element for a binary operation $*$ defined on S. If $*$ satisfies the identity $x * (y * z) = (x * z) * y$ where $x,y,z$ are elements of $S$, then show that $*$ is both commutative and associative.
In all my attempts I started with the left hand side of the identity but kept getting stuck at how to can $z$ jump across $y$. The only other known piece of information I was considering was that $e * a = a * e = a$, where $a$ belongs to $S$ and this holds for all elements of $S$.
Any help would be highly appreciated.

REPLY [8 votes]: Set $x=e$ and you have commutativity.
Once you have that, you can commute $y$ and $z$ to get
$$x*(z*y)=(x*z)*y$$
and there's your associativity.