In abstract algebra, a medial magma, or medial groupoid, is a set with a binary operation which satisfies the identity
using the convention that juxtaposition denotes the same operation but has higher precedence. A magma or groupoid is an algebraic structure that generalizes a group. This identity has been variously called medial, abelian, alternation, transposition, interchange, bi-commutative, bisymmetric, surcommutative, entropic etc.
Any commutative semigroup is a medial magma, and a medial magma has an identity element if and only if it is a commutative monoid. Another class of semigroups forming medial magmas are the normal bands. Medial magmas need not be associative: for any nontrivial abelian group and integers m ≠ n, replacing the group operation with the binary operation yields a medial magma which in general is neither associative nor commutative.