This should be simple, but for some reason I get stuck on this.
Let $G = \{x_1, \ldots x_n\}$ be a set equipped with operation $*$ satisfying the following :
1) $G$ has an identity element $e$ with $e *x = x = x * e$ for all $x \in G$.
2) All elements are self-inverse (i.e. $x * x = e$ for all $x \in G$).
Prove that $*$ is associative if and only if for all $i,j,k$, $(x_i * x_j) * (x_j * x_k) = x_i * x_k$.
It's the $\Leftarrow$ part that's bugging me.
From 2) I can show that the multiplication matrix of $G$ is a Latin Square.
And I think $*$ is commutative since $(x_i * x_j) * (x_j * x_i) = x_i * x_i = e \Rightarrow x_i * x_j = x_j * x_i$.
But I can't see how this leads to associativity.
I use multiplicative notation for simplicity ($x y$ instead of $x * y$) Suppose that the property $[x y] [y z] = x z$ holds for all $x, y, z$
Lemma 1 : $x (x y) = y$ and $(x y) y = x$ for all $x, y$
This is because we have $x (x y) = [e x] [x y] = e y = y$.
Lemma 2 : $x y = y x$ for all $x, y$.
This is because $[x y] [y x] = x x = e$ on the one hand, and multiplying on the left by $x y$ gives $y x = (x y) e = x y$ thanks to Lemma 1.
Thus, for all $x, y, z$, $(x y) z = x (y z)$ iff $(x y) z = x (z y)$ iff $[(x y) z] [z y] = x$ iff $(x y) y = x$.