A monoid is a semigroup with an identity element. More formally, given a set M and an operation +, we say that (M, +) is a monoid if it satisfies the following properties for any x, y, z ∈ M:

  • Closure: x + y ∈ M
  • Associativity: (x + y) + z = x + (y + z)
  • Identity: There exists an e ∈ M such that e + x = x + e = x

We also say that M is a monoid under +.

Examples of Monoids

  • The natural numbers N are monoids under addition
  • N is a monoid under multiplication.
  • Strings form a monoid under concatenation ("" is the identity element)

Documentation Help

We’d love your help fleshing out this documentation! You can edit this page in your browser by clicking this link. These links might be helpful: