I remember being asked by a student many years ago if I could think of an example of an algebraic structure that was commutative but not associative. Introductory undergraduate algebra courses abound with examples in the other direction: matrix multiplication, multiplication of quaternions, in fact “most” groups. To recall: if S is a set and ∗ is a binary operation on S (i.e. an operation that picks up any two elements of S and outputs another element of S), then ∗ is called associative if, for all x, y, z ∈ S,
x∗(y∗z) = (x∗y)∗z;
and ∗ is called commutative if, for all x, y ∈ S,
x∗y = y∗x.
I scratched my head for a little while and then realized that the game of rock-paper-scissors provides a nice example of what my student sought.
The idea is this. Consider the set S consisting of the three moves in a game of rock-paper-scissors: r for rock, p for paper, and s for scissors. Now define the product m1∗m2 of two moves m1, m2 ∈ S to be whichever of the moves would win according to the usual rule that rock beats scissors, scissors beats paper, and paper beats rock; a rock-rock draw counts as a win for rock, and so on. The multiplication table for (S, ∗) is
This multiplication table is symmetric about the diagonal, so commutativity holds. However, associativity fails:
r∗(p∗s) = r∗s = r ≠ s = p∗s = (r∗p)∗s.
Simple! In general, starting with any finite “cyclically ordered” set, one could proceed just as above to define a commutative but non-associative magma.