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.
In the game of rock paper scissors, let
M:=\{r,p,s\}
⋅ :M x M\toM
For all
x,y\inM
x ≠ y
x
y
x ⋅ y=y ⋅ x=x
x ⋅ x=x
x
So that for example:
r ⋅ p=p ⋅ r=p
s ⋅ s=s
This results in the Cayley table:
\begin{array}{c|ccc} ⋅ &r&p&s\\ \hline r&r&p&r\\ p&p&p&s\\ s&r&s&s \end{array}
By definition, the magma
(M, ⋅ )
r ⋅ (p ⋅ s)=r ⋅ s=r
but
(r ⋅ p) ⋅ s=p ⋅ s=s
i.e.
r ⋅ (p ⋅ s) ≠ (r ⋅ p) ⋅ 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.
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.