A fixed finite monoid operation has a constant-size Boolean truth-table Boolean circuit on its constant-bit encodings. Reduce elements in a balanced binary tree to get linear size and logarithmic depth. Associativity ensures that tree grouping does not change the product. MOD3 uses addition in the three-element residue group, with input-position signs handled at the leaves.
Commutative monoid Created 2026-09-28 Updated 2026-10-03
A commutative monoid is a monoid whose operation is commutative. The natural numbers with addition form a commutative monoid that is not an abelian group, because positive elements have no additive inverses.
Endomorphism Created 2026-09-24 Updated 2026-10-14
An endomorphism is a morphism : its source and target are the same object, with the same specified structure. For a group it is an operation-preserving group homomorphism back into that group; for a vector space it is a linear endomorphism; for a ring it is a ring endomorphism. A self-map must satisfy the chosen compatibility conditions to qualify. The notation records the category in which these conditions are imposed. See Riehl, Category Theory in Context, Definition 1.1.10 and the following paragraph.
An endomorphism can lose information or miss part of its target. On the additive integers, preserves addition and is injective, but is not surjective: no integer maps to . On the vector space over the real numbers, the linear endomorphism loses the second coordinate, so it is neither injective nor surjective. Neither is an automorphism. The same doubling rule becomes a group isomorphism when its target is the additive even integers, as explained under isomorphism.
The finite cyclic group offers a small example of information loss that can be drawn completely. With addition in modular arithmetic, the endomorphism sends the inputs to . Its image of a group homomorphism is and its kernel of a group homomorphism is . Each reached output has two inputs; the other three outputs are missed.
Figure 1.
Two endomorphisms of the additive cyclic group modulo six
. Every arrow maps an input to its output, rather than taking one step of repeated addition. The endomorphism collapses pairs; the group automorphism is a bijection. Orange marks the kernel of a group homomorphism in each panel. Source. Details.
For an endomorphism of a group or ring with a finite underlying set, injectivity is equivalent to surjectivity by counting; either condition makes it an automorphism. The additive integers example shows why the finiteness assumption matters. A linear endomorphism of a finite-dimensional vector space also has equivalent injectivity and surjectivity, this time by the rank-nullity theorem even when its underlying set is infinite.
Self-maps can be iterated without changing the object: , , and so on. Composition in a category and the identity morphism make the endomorphisms of a fixed object in a locally small category into a monoid. This packages repeated compatible operations, including irreversible ones, into a single structure.
The general language has a documented historical milestone in the 1945 paper of Samuel Eilenberg and Saunders Mac Lane. They defined categories of objects and compatible maps, and distinguished maps admitting inverses within that category. Their examples included groups, vector spaces, and topological spaces. This gave a common framework for compatible self-maps and their invertible cases. See Eilenberg and Mac Lane, General Theory of Natural Equivalences, pp. 234 and 237–239.
For a group, evaluation at the identity identifies the monoid exponential with all set functions . Its inverse is , and the resulting function action is the displayed formula. Fixed functions are precisely equivariant maps. The inverse on the input is necessary for equivariance of evaluation and for the right-action law.
Give the diagonal right monoid action. On its equivariant maps into , define . The evaluation map of an exponential object is and currying of is . Both maps are equivariant, and they are inverse under evaluation. The left multiplication in this right action is essential in a noncommutative monoid.
Exponentiation by squaring Created 2026-10-03 Updated 2026-10-14
Exponentiation by squaring computes an integer power by reading the exponent's binary expansion. Appending a binary digit to a prefix of value replaces by , so the corresponding power changes by
Each new digit requires one squaring and, only for digit one, one further multiplication. The number of digits grows with the logarithm of the exponent, making this useful for modular exponentiation, primality testing, and powers of matrices using matrix multiplication.[ref]
For a concrete calculation, , so . The optimized left-to-right algorithm used here instead keeps one accumulated power: initialize from the leading digit one, then process only the remaining digits :
Thus , using three squarings and two further multiplications, instead of twelve successive multiplications starting at .
Figure 1.
Reading the same binary expansion computes and
. Each appended binary digit changes the prefix value by . The ordinary-power row grows to ; the modular exponentiation row stores only remainders . Both traces use three squarings and two further multiplications. Details.
For a general positive integer with leading digit , set and, for , first replace by , then multiply it by if . Return . This explicitly skips the leading digit's otherwise unnecessary operations on one. A Computational Introduction to Number Theory and Algebra by Victor Shoup (Section 3.4, pp. 65–66) presents the version initialized at one and processing every digit; the optimization here makes the counting convention unambiguous.
The loop invariant is , where is the value of the digits already read. Initially and . If the next digit is , then squaring and optionally multiplying give , exactly the next prefix. At termination . This proof uses associativity of multiplication; it works in any monoid, including matrices with the identity matrix as identity element, and needs no commutativity between different bases.
For , return the identity element without performing a multiplication. This is the empty-product convention ; if , the algorithm therefore returns one for by convention, rather than resolving its meaning in every mathematical setting. Negative integer exponents require an inverse element: compute , counting the inversion separately. Over the integers, such an inverse generally leaves the integers, and a zero base has no inverse.
Free monoid Created 2026-10-03 Updated 2026-10-14
The free monoid on an alphabet consists of all finite words over an alphabet, including the empty word , with concatenation as its binary operation. Distinct strings represent distinct elements: there are no imposed equalities between different sequences of letters. The empty word is its identity element, and concatenation has the associative property.[ref]
For , the elements begin . Both and give the same word , but , so this monoid is not commutative. The length of a word over an alphabet obeys ; it is a monoid homomorphism to the nonnegative integers with addition. A nonempty word has no inverse element, since joining it to any other word cannot decrease its length to zero.
The defining benefit of being free is that letters can stand for arbitrary elements of another monoid. Choose a value for each letter ; then , with , is the unique monoid homomorphism extending those choices. Associativity and the identity element make this evaluation consistent for every finite word. For example, interpreting the letters as self-maps evaluates a word as a composed transformation; interpreting them as nonnegative counts evaluates it by addition.
The full transformation monoid consists of every self-map of , with function composition as its binary operation. For , there are four functions: the identity function , the swap , and the constant functions . Their composition order matters: , whereas . Thus associativity does not imply commutativity.
Figure 1. . The arrow diagrams show each function. The Cayley table reads row , column as , applying first. Only and have inverse elements. The constant functions lose information and satisfy idempotence. Details.
Only and are bijections, and their inverse elements are themselves. They form a two-element group within this monoid. The constant functions instead satisfy and , so they are idempotent elements of a semigroup. Such irreversible transformations explain why the monoid setting is useful even when a group would be too restrictive.
Function composition Created 2026-09-24 Updated 2026-10-14
For functions and , their function composition is , defined by . The rightmost function is applied first. Matching the intermediate codomain and domain of a function makes the expression well-defined.
For self-maps of the real numbers, take and . Then , whereas . Thus function composition need not be commutative. It does have the associative property: both and evaluate to whenever each intermediate codomain matches the next domain of a function. The identity function leaves composition unchanged, making self-maps particularly useful as a monoid of transformations.
Identity element Created 2026-09-24 Updated 2026-10-14
An identity element for a binary operation satisfies for every element of the underlying set. It is a two-sided identity: merely satisfying one of the two equations is insufficient. It is unique when it exists, since two candidates satisfy . This uniqueness does not require the associative property.
The constant singleton functor must be a retract in a category of a covariant representable functor. Necessity follows by applying a colimit-preserving global-sections functor to the canonical coproduct of representables onto the terminal functor. Conversely its Hom functor is a retract of evaluation, preserves colimits and has a right adjoint. Such a retract is represented by an initial object in the idempotent completion. For an idempotent-complete category an actual initial object suffices; without this hypothesis an absorbing-zero monoid gives a counterexample to the unqualified claim.
Inverse element Created 2026-09-24 Updated 2026-10-14
An inverse element of in a monoid is an element satisfying , where is the identity element. Its notation is . Some elements of a monoid can lack an inverse element; a group requires one for every element. Associativity makes a two-sided inverse element unique: if both invert , then .
For the full transformation monoid, a self-map has an inverse element exactly when it is a bijection; that element is its inverse function. On , the swap is its own inverse element, while a constant function has none because it merges the two inputs.
List monad Created 2026-10-06 Updated 2026-10-14
On the Category of sets, the list monad sends to all finite ordered lists of elements of , including the empty list. Its unit inserts a singleton list and its multiplication concatenates a list of lists. Functoriality is entrywise application of functions. Ordered flattening proves the monad laws. This is the free-monoid monad, so order must not be discarded.
An algebra for a monad for the list monad is precisely a monoid. For an action , the identity is and multiplication is . The algebra laws force the unit and associativity laws and determine as ordered multiplication. Conversely ordered multiplication defines a list action. Algebra morphisms are exactly monoid homomorphisms, giving an isomorphism of categories .
Monoid Created 2026-09-28 Updated 2026-10-14
A monoid is a semigroup with a two-sided identity element : for every element . Associativity handles the grouping of a nonempty sequence; the identity element also supplies the result for an empty sequence. This makes the same rules apply to combining zero, one, or many contributions. [ref].
The nonnegative integers with addition form a commutative monoid, with identity element zero. They do not form a group: a positive integer has no additive inverse in that set. All words over an alphabet with concatenation form a free monoid, whose identity element is the empty word. The full transformation monoid consists of all self-maps of a set, with function composition and the identity function.
These examples explain why monoids are useful: accumulation needs an operation and a starting value, but it need not be reversible. Adding counts, joining strings, and composing transformations all share the same grouping and identity laws. Requiring every element to have an inverse element gives a group, a stronger structure suitable for reversible operations.