Monoid

In algebra, a monoid is a set equipped with a binary operation satisfying certain properties similar to but less stringent than those of a group. A motivating example of a monoid is the set of positive integers with multiplication as the operation.

Formally, a monoid is set M with a binary operation $$\star$$ satisfying the following conditions:
 * M is closed under $$\star$$;
 * The operation $$\star$$ is associative
 * There is an identity element $$I \in M$$ such that
 * $$I \star x = x = x \star I$$ for all x in M.

A commutative monoid is one which satisfies the further property that $$x \star y = y \star x$$ for all x and y in M. Commutative monoids are often written additively.

An element x of a monoid is invertible if there exists an element y such that $$x \star y = y \star x = I$$: the inverse may be written as $$x^{-1}$$. The product of invertible elements is invertible,


 * $$(xy)^{-1} = y^{-1} x^{-1} \, $$

and so the invertible elements form a group, the unit group of M.

A submonoid of M is a subset S of M which contains the identity element I and is closed under the binary operation.

A monoid homomorphism f from monoid $$(M,{\star})$$ to $$(N,{\circ})$$ is a map from M to N satisfying
 * $$f(x \star y) = f(x) \circ f(y) \, $$;
 * $$f(I_M) = I_N . \, $$

Examples

 * The non-negative integers under addition form a commutative monoid, with zero as identity element.
 * The positive integers under multiplication form a commutative monoid, with one as identity element.
 * Square matrices under matrix multiplication form a monoid, with the identity matrix as the identity element: this monoid is not in general commutative.
 * Every group is a monoid, by "forgetting" the inverse operation.

Cancellation property
A monoid satisfies the cancellation property if


 * $$xz = yz \Rightarrow x = y \, $$ and
 * $$zx = zy \Rightarrow x = y . \, $$

A monoid is a submonoid of a group if and only if it satisfies the cancellation property.