Canonical: https://knowlpedia.com/algebra-groups/monoid/

# Monoid

A semigroup with an identity element

A **monoid** is a [semigroup](https://knowlpedia.com/algebra-groups/semigroup/) \((M,\cdot)\) with an **identity element** \(e\in M\), meaning that for every \(a\in M\),
\[
e\cdot a = a \quad\text{and}\quad a\cdot e = a.
\]

Monoids generalize [groups](https://knowlpedia.com/algebra-groups/group/) by dropping the requirement that elements have inverses. Many monoids arise from [composition](https://knowlpedia.com/shared-foundations/composition/) of endomorphisms (self-maps).

## Examples

- \((\mathbb{N},+,0)\) is a monoid.
- \((\mathbb{N},\times,1)\) is a monoid.
- For any set \(X\), the set of all [functions](https://knowlpedia.com/shared-foundations/function/) \(X\to X\) is a monoid under composition, with identity \(\mathrm{id}_X\).
- The set of all \(n\times n\) real matrices is a monoid under multiplication, with identity matrix \(I_n\); it is not a group because not every matrix is invertible.
