Monoid
In abstract algebra, a monoid is an algebraic structure with a single associative binary operation and an identity element. It essentially captures the notion of composition with a neutral element.
A monoid is a set M together with an operation ⋅ (usually referred to as "multiplication" or "composition") that satisfies the following two axioms:
-
Closure: For all a, b in M, the result of the operation a ⋅ b is also in M.
-
Associativity: For all a, b, c in M, the equation (a ⋅ b) ⋅ c = a ⋅ (b ⋅ c) holds.
-
Identity Element: There exists an element e in M, called the identity element, such that for all a in M, the equations e ⋅ a = a ⋅ e = a hold.
The identity element is unique.
A monoid can be seen as a semigroup with an identity element, or as a category with a single object.
If the binary operation is also commutative (i.e., a ⋅ b = b ⋅ a for all a, b in M), then the monoid is called a commutative monoid (or an abelian monoid).
Monoids are widely used in mathematics and computer science, providing a formal framework for describing compositions and accumulations. Common examples include the set of strings with concatenation, the set of numbers with addition or multiplication, and the set of functions with composition.