In abstract algebra, a magma is a particularly simple kind of algebraic structure.

Specifically, a magma consists of a set with a single binary operation on it, which is usually (but not always) interpreted as a kind of multiplication. No axioms are required of the operation for it to define a magma. Magmas are not often studied as such; instead there are several different kinds of magmas, depending on what axioms one might require of the operation. Commonly studied types of magmas include:

  • quasigroups -- nonempty magmas where division is always possible;
  • loopss -- quasigroups with identity elements;
  • semigroups -- magmas where the operation is associative;
  • monoids -- semigroups with identity elements;
  • groupss -- monoids with inverse elements, or equivalently, associative quasigroups (which are always loops);
  • abelian groups -- groups where the operation is commutative.

The term "magma" was introduced by Bourbaki. Previously, the term "groupoid" was common, and it is sometimes still used. In this encyclopedia, however, we reserve "groupoid" for a different algebraic concept, described at Groupoid.

There is such a thing as a free magma on any set X. It can be described, in terms familiar in computer science, as the magma of binary trees with leaves labelled by elements of X, with operation the joining of trees at the root. It therefore has a foundational role in syntax.