Commutative magma

In mathematics, there exist magmas that are commutative but not associative. A simple example of such a magma may be derived from the children's game of rock, paper, scissors. Such magmas give rise to non-associative algebras.

A magma which is both commutative and associative is a commutative semigroup.

Example: rock, paper, scissors
In the game of rock paper scissors, let $$M := \{ r, p, s \}$$, standing for the "rock", "paper" and "scissors" gestures respectively, and consider the binary operation $$\cdot : M \times M \to M$$ derived from the rules of the game as follows:
 * For all $$x, y \in M$$:
 * If $$x \neq y$$ and $$x$$ beats $$y$$ in the game, then $$x \cdot y = y \cdot x = x$$
 * $$x \cdot x = x$$    I.e. every $$x$$ is idempotent.
 * So that for example:
 * $$r \cdot p = p \cdot r = p$$  "paper beats rock";
 * $$s \cdot s = s$$  "scissors tie with scissors".

This results in the Cayley table:


 * $$\begin{array}{c|ccc}

\cdot & r & p & s\\ \hline r & r & p & r\\ p & p & p & s\\ s & r & s & s \end{array}$$

By definition, the magma $$(M, \cdot)$$ is commutative, but it is also non-associative, as shown by:


 * $$r \cdot (p \cdot s) = r \cdot s = r$$

but


 * $$(r \cdot p) \cdot s = p \cdot s = s$$

i.e.


 * $$r \cdot (p \cdot s) \neq (r \cdot p) \cdot s$$

It is the simplest non-associative magma that is conservative, in the sense that the result of any magma operation is one of the two values given as arguments to the operation.

Applications
The arithmetic mean, and generalized means of numbers or of higher-dimensional quantities, such as Frechet means, are often commutative but non-associative.

Commutative but non-associative magmas may be used to analyze genetic recombination.