In

semigroup
In mathematics, a semigroup is an algebraic structure
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), an ...

may be turned into a monoid simply by adjoining an element not in and defining for all . This conversion of any semigroup to the monoid is done by the

Moreover, can be considered as a function on the points $\backslash $ given by :: $\backslash begin\; 0\; \&\; 1\; \&\; 2\; \&\; \backslash cdots\; \&\; n-2\; \&\; n-1\; \backslash \backslash \; 1\; \&\; 2\; \&\; 3\; \&\; \backslash cdots\; \&\; n-1\; \&\; k\backslash end$ :or, equivalently :: $f(i)\; :=\; \backslash begin\; i+1,\; \&\; \backslash text\; 0\; \backslash le\; i\; <\; n-1\; \backslash \backslash \; k,\; \&\; \backslash text\; i\; =\; n-1.\; \backslash end$ :Multiplication of elements in $\backslash langle\; f\backslash rangle$ is then given by function composition. :When $k\; =\; 0$ then the function is a permutation of $\backslash ,$ and gives the unique

^{−1} in ''M'' such that and . If an inverse monoid is cancellative, then it is a group.
In the opposite direction, a '' zerosumfree monoid'' is an additively written monoid in which implies that and : equivalently, that no element other than zero has an additive inverse.

_{''M''} and ''e''_{''N''} are the identities on ''M'' and ''N'' respectively. Monoid homomorphisms are sometimes simply called monoid morphisms.
Not every

^{∗}. One does this by extending (finite) ^{∗} to monoid congruences, and then constructing the quotient monoid, as above.
Given a binary relation , one defines its symmetric closure as . This can be extended to a symmetric relation by defining if and only if and for some strings with . Finally, one takes the reflexive and transitive closure of ''E'', which is then a monoid congruence.
In the typical situation, the relation ''R'' is simply given as a set of equations, so that $R=\backslash $. Thus, for example,
: $\backslash langle\; p,q\backslash ,\backslash vert\backslash ;\; pq=1\backslash rangle$
is the equational presentation for the

Encoding Map-Reduce As A Monoid With Left Folding

. MapReduce, in computing, consists of two or three operations. Given a dataset, "Map" consists of mapping arbitrary data to elements of a specific monoid. "Reduce" consists of folding those elements, so that in the end we produce just one element. For example, if we have a multiset, in a program it is represented as a map from elements to their numbers. Elements are called keys in this case. The number of distinct keys may be too big, and in this case the multiset is being sharded. To finalize reduction properly, the "Shuffling" stage regroups the data among the nodes. If we do not need this step, the whole Map/Reduce consists of mapping and reducing; both operation are parallelizable, the former due to its element-wise nature, the latter due to associativity of the monoid.

abstract algebra
In algebra, which is a broad division of mathematics, abstract algebra (occasionally called modern algebra) is the study of algebraic structures. Algebraic structures include group (mathematics), groups, ring (mathematics), rings, field (mathema ...

, a branch of mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and their changes (cal ...

, a monoid is a set equipped with an associative
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...

binary operation
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

and an identity element
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and th ...

.
Monoids are semigroup
In mathematics, a semigroup is an algebraic structure
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), an ...

s with identity. Such algebraic structure
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

s occur in several branches of mathematics.
For example, the functions from a set into itself form a monoid with respect to function composition. More generally, in category theory
Category theory formalizes mathematical structure
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and ...

, the morphisms of an object
Object may refer to:
General meanings
* Object (philosophy)
An object is a philosophy, philosophical term often used in contrast to the term ''Subject (philosophy), subject''. A subject is an observer and an object is a thing observed. For mo ...

to itself form a monoid, and, conversely, a monoid may be viewed as a category with a single object.
In computer science
Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application.
Computer science is the study of , , and . Computer science ...

and computer programming
Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, generating algorithms, Profilin ...

, the set of strings
String or strings may refer to:
*String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects
Arts, entertainment, and media Films
* Strings (1991 film), ''Strings'' (1991 fil ...

built from a given set of characters
Character(s) may refer to:
Arts, entertainment, and media Literature
* Character (novel), ''Character'' (novel), a 1936 Dutch novel by Ferdinand Bordewijk
* Characters (Theophrastus), ''Characters'' (Theophrastus), a classical Greek set of cha ...

is a free monoid In abstract algebra
In algebra, which is a broad division of mathematics, abstract algebra (occasionally called modern algebra) is the study of algebraic structures. Algebraic structures include group (mathematics), groups, ring (mathematics), r ...

. Transition monoid In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and the ...

s and syntactic monoid In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and the ...

s are used in describing finite-state machine
A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation
A model is an informative representation of an object, person or system. ...

s. Trace monoid In computer science
Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application.
Computer science is the study of , , an ...

s and history monoidIn mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ha ...

s provide a foundation for process calculi
In computer science
Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application.
Computer science is the study of compu ...

and concurrent computing
Concurrent computing is a form of computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both compu ...

.
In theoretical computer science
Theoretical computer science (TCS) is a subset of general computer science
Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for the ...

, the study of monoids is fundamental for automata theory
Automata theory is the study of abstract machines and automaton, automata, as well as the computational problems that can be solved using them. It is a theory in theoretical computer science. The word ''automata'' (the plural of ''automaton'') com ...

(Krohn–Rhodes theory In mathematics and computer science, the Krohn–Rhodes theory (or algebraic automata theory) is an approach to the study of finite semigroups and automata theory, automata that seeks to decompose them in terms of elementary components. These compon ...

), and formal language theory
In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol (formal), letters are taken from an alphabet (computer science), alphabet and are well-formedness, well-formed ...

(star height problem
The star height problem in formal language theory is the question whether all regular languages can be expressed using Regular expression#Formal language theory, regular expressions of limited star height, i.e. with a limited nesting depth of Klee ...

).
See semigroup
In mathematics, a semigroup is an algebraic structure
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), an ...

for the history of the subject, and some other general properties of monoids.
Definition

Aset
Set, The Set, SET or SETS may refer to:
Science, technology, and mathematics Mathematics
*Set (mathematics)
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formul ...

''S'' equipped with a binary operation
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

, which we will denote •, is a monoid if it satisfies the following two axioms:
; Associativity: For all ''a'', ''b'' and ''c'' in ''S'', the equation holds.
; Identity element: There exists an element ''e'' in ''S'' such that for every element ''a'' in ''S'', the equations and hold.
In other words, a monoid is a semigroup
In mathematics, a semigroup is an algebraic structure
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), an ...

with an identity element
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and th ...

. It can also be thought of as a magma
Magma () is the molten or semi-molten natural material from which all igneous rock
Igneous rock (derived from the Latin word ''ignis'' meaning fire), or magmatic rock, is one of the three main The three types of rocks, rock types, the others ...

with associativity and identity. The identity element of a monoid is unique. For this reason the identity is regarded as a constant
Constant or The Constant may refer to:
Mathematics
* Constant (mathematics)
In mathematics, the word constant can have multiple meanings. As an adjective, it refers to non-variance (i.e. unchanging with respect to some other Value (mathematics ...

, i. e. 0-ary (or nullary) operation. The monoid therefore is characterized by specification of the triple
Triple is used in several contexts to mean "threefold" or a "Treble (disambiguation), treble":
Sports
* Triple (baseball), a three-base hit
* A basketball three-point field goal
* A figure skating jump with three rotations
* In bowling terms, thre ...

(''S'', • , ''e'').
Depending on the context, the symbol for the binary operation may be omitted, so that the operation is denoted by juxtaposition; for example, the monoid axioms may be written and . This notation does not imply that it is numbers being multiplied.
A monoid in which each element has an inverse
Inverse or invert may refer to:
Science and mathematics
* Inverse (logic), a type of conditional sentence which is an immediate inference made from another conditional sentence
* Additive inverse (negation), the inverse of a number that, when add ...

is a group
A group is a number of people or things that are located, gathered, or classed together.
Groups of people
* Cultural group, a group whose members share the same cultural identity
* Ethnic group, a group whose members share the same ethnic ident ...

.
Monoid structures

Submonoids

A submonoid of a monoid is asubset
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...

''N'' of ''M'' that is closed under the monoid operation and contains the identity element ''e'' of ''M''. Symbolically, ''N'' is a submonoid of ''M'' if , whenever , and . In this case, ''N'' is a monoid under the binary operation inherited from ''M''.
On the other hand, if ''N'' is subset of a monoid that is closed
Closed may refer to:
Mathematics
* Closure (mathematics), a set, along with operations, for which applying those operations on members always results in a member of the set
* Closed set, a set which contains all its limit points
* Closed interval, ...

under the monoid operation, and is a monoid for this inherited operation, then ''N'' is not always a submonoid, since the identity elements may differ. For example, the singleton set
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

is closed under multiplication, and is not a submonoid of the (multiplicative) monoid of the nonnegative integer
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...

s.
Generators

A subset ''S'' of ''M'' is said to ''generate'' ''M'' if the smallest submonoid of ''M'' containing ''S'' is ''M''. If there is a finite set that generates ''M'', then ''M'' is said to be a finitely generated monoid.Commutative monoid

A monoid whose operation iscommutative
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

is called a commutative monoid (or, less commonly, an abelian monoid). Commutative monoids are often written additively. Any commutative monoid is endowed with its ''algebraic'' preorder
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...

ing , defined by if there exists ''z'' such that . An ''order-unit'' of a commutative monoid ''M'' is an element ''u'' of ''M'' such that for any element ''x'' of ''M'', there exists ''v'' in the set generated by ''u'' such that . This is often used in case ''M'' is the positive cone of a partially ordered
In mathematics, especially order theory, a partially ordered set (also poset) formalizes and generalizes the intuitive concept of an ordering, sequencing, or arrangement of the elements of a Set (mathematics), set. A poset consists of a set toget ...

abelian group
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ...

''G'', in which case we say that ''u'' is an order-unit of ''G''.
Partially commutative monoid

A monoid for which the operation is commutative for some, but not all elements is atrace monoid In computer science
Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application.
Computer science is the study of , , an ...

; trace monoids commonly occur in the theory of concurrent computation
Concurrent computing is a form of computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both compu ...

.
Examples

* Out of the 16 possible binary Boolean operators, each of the four that has a two-sided identity is also commutative and associative and thus makes the set a commutative monoid. Under the standard definitions,AND
And or AND may refer to:
Logic, grammar, and computing
* Conjunction (grammar)
In grammar
In linguistics
Linguistics is the scientific study of language, meaning that it is a comprehensive, systematic, objective, and precise study o ...

and XNOR
The XNOR gate (sometimes ENOR, EXNOR or NXOR and pronounced as Exclusive NOR. Alternatively XAND, pronounced Exclusive AND) is a digital logic gate
A logic gate is an idealized model of computation
A model is an informative representation of ...

have the identity True while XOR
Exclusive or or exclusive disjunction is a logical operation
In logic
Logic is an interdisciplinary field which studies truth and reasoning
Reason is the capacity of consciously making sense of things, applying logic
Logic ...

and OR have the identity False. The monoids from AND and OR are also idempotent
Idempotence (, ) is the property of certain operations
Operation or Operations may refer to:
Science and technology
* Surgical operation
Surgery ''cheirourgikē'' (composed of χείρ, "hand", and ἔργον, "work"), via la, chirurgiae, ...

while those from XOR and XNOR are not.
* The set of natural number
In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and total order, ordering (as in "this is the ''third'' largest city in the country"). In common mathematical terminology, w ...

s $\backslash N\; =\; \backslash $ is a commutative monoid under addition (identity element ) or multiplication (identity element ). A submonoid of under addition is called a numerical monoid.
* The set of positive integer
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...

s $\backslash N\; \backslash setminus\; \backslash $ is a commutative monoid under multiplication (identity element 1).
* Given a set , the set of subsets of is a commutative monoid under intersection (identity element is itself).
* Given a set , the set of subsets of is a commutative monoid under union (identity element is the empty set #REDIRECT Empty set #REDIRECT Empty set#REDIRECT Empty set
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry ...

).
* Generalizing the previous example, every bounded semilattice In mathematics, a join-semilattice (or upper semilattice) is a partially ordered set that has a join (mathematics), join (a least upper bound) for any nonempty set, nonempty finite set, finite subset. Duality (order theory), Dually, a meet-semilatti ...

is an idempotent
Idempotence (, ) is the property of certain operations
Operation or Operations may refer to:
Science and technology
* Surgical operation
Surgery ''cheirourgikē'' (composed of χείρ, "hand", and ἔργον, "work"), via la, chirurgiae, ...

commutative monoid.
** In particular, any bounded lattice can be endowed with both a meet
Meet may refer to:
People with the name
* Janek Meet
Janek Meet (born 2 May 1974 in Viljandi) is a retired Estonians, Estonian football (soccer), footballer, who played in the Meistriliiga, for FC Kuressaare, whom he joined from JK Viljandi Tu ...

- and a - monoid structure. The identity elements are the lattice's top and its bottom, respectively. Being lattices, Heyting algebra
__notoc__
Arend Heyting (; 9 May 1898 – 9 July 1980) was a Dutch
Dutch commonly refers to:
* Something of, from, or related to the Netherlands
* Dutch people ()
* Dutch language ()
*Dutch language , spoken in Belgium (also referred as ''fl ...

s and Boolean algebra
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...

s are endowed with these monoid structures.
* Every singleton set
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

closed under a binary operation • forms the trivial (one-element) monoid, which is also the trivial group In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and the ...

.
* Every group
A group is a number of people or things that are located, gathered, or classed together.
Groups of people
* Cultural group, a group whose members share the same cultural identity
* Ethnic group, a group whose members share the same ethnic ident ...

is a monoid and every abelian group
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ...

a commutative monoid.
* Any free functor
In mathematics, the idea of a free object is one of the basic concepts of abstract algebra. It is a part of universal algebra, in the sense that it relates to all types of algebraic structure (with finitary operations). It also has a formulation in ...

between the category of semigroups and the category of monoids.
** Thus, an idempotent monoid (sometimes known as ''find-first'') may be formed by adjoining an identity element to the left zero semigroup over a set . The opposite monoid (sometimes called ''find-last'') is formed from the right zero semigroup over .
*** Adjoin an identity to the left-zero semigroup with two elements . Then the resulting idempotent monoid models the lexicographical order
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

of a sequence given the orders of its elements, with ''e'' representing equality.
* The underlying set of any ring
Ring most commonly refers either to a hollow circular shape or to a high-pitched sound. It thus may refer to:
*Ring (jewellery), a circular, decorative or symbolic ornament worn on fingers, toes, arm or neck
Ring may also refer to:
Sounds
* Ri ...

, with addition or multiplication as the operation. (By definition, a ring has a multiplicative identity 1.)
** The integer
An integer (from the Latin
Latin (, or , ) is a classical language
A classical language is a language
A language is a structured system of communication
Communication (from Latin ''communicare'', meaning "to share" or "to ...

s, rational number
In mathematics, a rational number is a number that can be expressed as the quotient or fraction (mathematics), fraction of two integers, a numerator and a non-zero denominator . For example, is a rational number, as is every integer (e.g. ) ...

s, real number
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...

s or complex number
In mathematics, a complex number is an element of a number system that contains the real numbers and a specific element denoted , called the imaginary unit, and satisfying the equation . Moreover, every complex number can be expressed in the for ...

s, with addition or multiplication as operation.
** The set of all by matrices
Matrix or MATRIX may refer to:
Science and mathematics
* Matrix (mathematics)
In , a matrix (plural matrices) is a array or table of s, s, or s, arranged in rows and columns, which is used to represent a or a property of such an object.
Fo ...

over a given ring, with matrix addition
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...

or matrix multiplication
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...

as the operation.
* The set of all finite strings
String or strings may refer to:
*String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects
Arts, entertainment, and media Films
* Strings (1991 film), ''Strings'' (1991 fil ...

over some fixed alphabet forms a monoid with string concatenation
In formal language theory
In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol (formal), letters are taken from an alphabet (computer science), alphabet and a ...

as the operation. The empty string
In formal language theory
In logic
Logic is an interdisciplinary field which studies truth and reasoning
Reason is the capacity of consciously making sense of things, applying logic
Logic (from Ancient Greek, Greek: grc, wikt: ...

serves as the identity element. This monoid is denoted and is called the ''free monoid In abstract algebra
In algebra, which is a broad division of mathematics, abstract algebra (occasionally called modern algebra) is the study of algebraic structures. Algebraic structures include group (mathematics), groups, ring (mathematics), r ...

'' over . It is not commutative.
* Given any monoid , the ''opposite monoid'' has the same carrier set and identity element as , and its operation is defined by . Any commutative monoid
In abstract algebra, a branch of mathematics, a monoid is a set equipped with an associative binary operation and an identity element.
Monoids are semigroups with identity. Such algebraic structures occur in several branches of mathematics. ...

is the opposite monoid of itself.
* Given two sets and endowed with monoid structure (or, in general, any finite number of monoids, , their cartesian product
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

is also a monoid (respectively, ). The associative operation and the identity element are defined pairwise.
* Fix a monoid . The set of all functions from a given set to is also a monoid. The identity element is a constant function
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ...

mapping any value to the identity of ; the associative operation is defined pointwise In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and the ...

.
* Fix a monoid with the operation and identity element , and consider its power set
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ...

consisting of all subset
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...

s of . A binary operation for such subsets can be defined by . This turns into a monoid with identity element . In the same way the power set of a group is a monoid under the product of group subsetsIn mathematics, one can define a product of group subsets in a natural way. If ''S'' and ''T'' are subsets of a group (mathematics), group ''G'', then their product is the subset of ''G'' defined by
:ST = \.
The subsets ''S'' and ''T'' need not be su ...

.
* Let be a set. The set of all functions forms a monoid under function composition
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...

. The identity is just the identity function
Graph of the identity function on the real numbers
In mathematics, an identity function, also called an identity relation, identity map or identity transformation, is a function (mathematics), function that always returns the same value that was ...

. It is also called the ''full transformation monoidIn algebra, a transformation semigroup (or composition semigroup) is a collection of Transformation (function), transformations (function (mathematics), functions from a set to itself) that is closure (mathematics), closed under function composition. ...

'' of . If is finite with elements, the monoid of functions on is finite with elements.
* Generalizing the previous example, let be a category
Category, plural categories, may refer to:
Philosophy and general uses
*Categorization
Categorization is the ability and activity to recognize shared features or similarities between the elements of the experience of the world (such as O ...

and an object of . The set of all endomorphism
In mathematics, an endomorphism is a morphism from a mathematical object to itself. An endomorphism that is also an isomorphism is an automorphism. For example, an endomorphism of a vector space is a linear map , and an endomorphism of a group ...

s of , denoted , forms a monoid under composition of morphism
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and th ...

s. For more on the relationship between category theory and monoids see below.
* The set of homeomorphism
In the mathematical
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantiti ...

classes
Class or The Class may refer to:
Common uses not otherwise categorized
* Class (biology), a taxonomic rank
* Class (knowledge representation), a collection of individuals or objects
* Class (philosophy), an analytical concept used differently f ...

of compact surface
In mathematics, a closed manifold is a manifold Manifold with boundary, without boundary that is compact space, compact.
In comparison, an open manifold is a manifold without boundary that has only ''non-compact'' components.
Examples
The only co ...

s with the connected sum In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and the ...

. Its unit element is the class of the ordinary 2-sphere. Furthermore, if denotes the class of the torus
In geometry, a torus (plural tori, colloquially donut) is a surface of revolution generated by revolving a circle in three-dimensional space about an axis that is coplanarity, coplanar with the circle.
If the axis of revolution does not to ...

, and ''b'' denotes the class of the projective plane, then every element ''c'' of the monoid has a unique expression the form where is a positive integer and , or . We have .
* Let $\backslash langle\; f\backslash rangle$ be a cyclic monoid of order , that is, $\backslash langle\; f\backslash rangle\; =\; \backslash left\backslash $. Then $f^n\; =\; f^k$ for some $0\; \backslash le\; k\; <\; n$. In fact, each such gives a distinct monoid of order , and every cyclic monoid is isomorphic to one of these.Moreover, can be considered as a function on the points $\backslash $ given by :: $\backslash begin\; 0\; \&\; 1\; \&\; 2\; \&\; \backslash cdots\; \&\; n-2\; \&\; n-1\; \backslash \backslash \; 1\; \&\; 2\; \&\; 3\; \&\; \backslash cdots\; \&\; n-1\; \&\; k\backslash end$ :or, equivalently :: $f(i)\; :=\; \backslash begin\; i+1,\; \&\; \backslash text\; 0\; \backslash le\; i\; <\; n-1\; \backslash \backslash \; k,\; \&\; \backslash text\; i\; =\; n-1.\; \backslash end$ :Multiplication of elements in $\backslash langle\; f\backslash rangle$ is then given by function composition. :When $k\; =\; 0$ then the function is a permutation of $\backslash ,$ and gives the unique

cyclic group
In group theory
The popular puzzle Rubik's cube invented in 1974 by Ernő Rubik has been used as an illustration of permutation group">Ernő_Rubik.html" ;"title="Rubik's cube invented in 1974 by Ernő Rubik">Rubik's cube invented in 1974 by Er ...

of order .
Properties

The monoid axioms imply that the identity element is unique: If and are identity elements of a monoid, then .Products and powers

For each nonnegative integer , one can define the product $p\_n\; =\; \backslash textstyle\; \backslash prod\_^n\; a\_i$ of any sequence $(a\_1,\backslash ldots,a\_n)$ of elements of a monoid recursively: let and let for . As a special case, one can define nonnegative integer powers of an element of a monoid: and for . Then for all .Invertible elements

An element is called invertible if there exists an element such that and . The element is called the inverse of . Inverses, if they exist, are unique: If and are inverses of , then by associativity . If is invertible, say with inverse , then one can define negative powers of by setting for each ; this makes the equation hold for all . The set of all invertible elements in a monoid, together with the operation •, forms agroup
A group is a number of people or things that are located, gathered, or classed together.
Groups of people
* Cultural group, a group whose members share the same cultural identity
* Ethnic group, a group whose members share the same ethnic ident ...

.
Grothendieck group

Not every monoid sits inside a group. For instance, it is perfectly possible to have a monoid in which two elements and exist such that holds even though is not the identity element. Such a monoid cannot be embedded in a group, because in the group multiplying both sides with the inverse of would get that , which is not true. A monoid has thecancellation property
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...

(or is cancellative) if for all , and in , the equality implies , and the equality implies .
A commutative monoid with the cancellation property can always be embedded in a group via the ''Grothendieck group construction''. That is how the additive group of the integers (a group with operation +) is constructed from the additive monoid of natural numbers (a commutative monoid with operation + and cancellation property). However, a non-commutative cancellative monoid need not be embeddable in a group.
If a monoid has the cancellation property and is ''finite'', then it is in fact a group.
The right- and left-cancellative elements of a monoid each in turn form a submonoid (i.e. are closed under the operation and obviously include the identity). This means that the cancellative elements of any commutative monoid can be extended to a group.
The cancellative property in a monoid is not necessary to perform the Grothendieck construction – commutativity is sufficient. However, if a commutative monoid does not have the cancellation property, the homomorphism of the monoid into its Grothendieck group is not injective. More precisely, if , then and have the same image in the Grothendieck group, even if . In particular, if the monoid has an absorbing element In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and the ...

, then its Grothendieck group is the trivial group In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and the ...

.
Types of monoids

An inverse monoid is a monoid where for every ''a'' in ''M'', there exists a unique ''a''Acts and operator monoids

Let ''M'' be a monoid, with the binary operation denoted by • and the identity element denoted by ''e''. Then a (left) ''M''-act (or left act over ''M'') is a set ''X'' together with an operation which is compatible with the monoid structure as follows: * for all ''x'' in ''X'': ; * for all ''a'', ''b'' in ''M'' and ''x'' in ''X'': . This is the analogue in monoid theory of a (left)group action
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ...

. Right ''M''-acts are defined in a similar way. A monoid with an act is also known as an '' operator monoid''. Important examples include transition system
In theoretical computer science
Theoretical computer science (TCS) is a subset of general computer science
Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as wel ...

s of semiautomata. A transformation semigroup In algebra, a transformation semigroup (or composition semigroup) is a collection of Transformation (function), transformations (function (mathematics), functions from a set to itself) that is closure (mathematics), closed under function composition ...

can be made into an operator monoid by adjoining the identity transformation.
Monoid homomorphisms

Ahomomorphism
In algebra
Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathematics, together with number theory, geometry and mathematical analysis, analysis. I ...

between two monoids and is a function such that
* for all ''x'', ''y'' in ''M''
* ,
where ''e''semigroup homomorphism
In mathematics, a semigroup is an algebraic structure consisting of a Set (mathematics), set together with an associative binary operation.
The binary operation of a semigroup is most often denoted multiplication, multiplicatively: ''x''·''y'', ...

between monoids is a monoid homomorphism, since it may not map the identity to the identity of the target monoid, even though the identity is the identity of the image of homomorphism. For example, consider $M\_n$, the set of residue class #REDIRECT Modular arithmetic #REDIRECT Modular arithmetic #REDIRECT Modular arithmetic#REDIRECT Modular arithmetic
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathem ...

es modulo $n$ equipped with multiplication. In particular, the class of $1$ is the identity. Function $f\backslash colon\; M\_3\backslash to\; M\_6$ given by $f(k)=3k$ is a semigroup homomorphism as $3k\backslash cdot\; 3l\; =\; 9kl\; =\; 3kl$ in $M\_6$. However, $f(1)=3\; \backslash neq\; 1$, so a monoid homomorphism is a semigroup homomorphism between monoids that maps the identity of the first monoid to the identity of the second monoid and the latter condition cannot be omitted.
In contrast, a semigroup homomorphism between groups is always a group homomorphism
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

, as it necessarily preserves the identity (because, in a group, the identity is the only element such that ).
A bijective
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

monoid homomorphism is called a monoid isomorphism
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

. Two monoids are said to be isomorphic if there is a monoid isomorphism between them.
Equational presentation

Monoids may be given a ''presentation'', much in the same way that groups can be specified by means of agroup presentation
In mathematics, a presentation is one method of specifying a group (mathematics), group. A presentation of a group ''G'' comprises a set ''S'' of generating set of a group, generators—so that every element of the group can be written as a produ ...

. One does this by specifying a set of generators Σ, and a set of relations on the free monoid In abstract algebra
In algebra, which is a broad division of mathematics, abstract algebra (occasionally called modern algebra) is the study of algebraic structures. Algebraic structures include group (mathematics), groups, ring (mathematics), r ...

Σbinary relation
Binary may refer to:
Science and technology
Mathematics
* Binary number
In mathematics and digital electronics
Digital electronics is a field of electronics
The field of electronics is a branch of physics and electrical engineeri ...

s on Σbicyclic monoid In mathematics, the bicyclic semigroup is an algebraic object important for the structure theory of semigroups. Although it is in fact a monoid, it is usually referred to as simply a semigroup. It is perhaps most easily understood as the syntactic m ...

, and
: $\backslash langle\; a,b\; \backslash ,\backslash vert\backslash ;\; aba=baa,\; bba=bab\backslash rangle$
is the plactic monoidIn mathematics, the plactic monoid is the monoid of all words in the alphabet of positive integers modulo Knuth equivalence. Its elements can be identified with semistandard Young tableau, Young tableaux. It was discovered by (who called it the t ...

of degree 2 (it has infinite order). Elements of this plactic monoid may be written as $a^ib^j(ba)^k$ for integers ''i'', ''j'', ''k'', as the relations show that ''ba'' commutes with both ''a'' and ''b''.
Relation to category theory

Monoids can be viewed as a special class ofcategories
Category, plural categories, may refer to:
Philosophy and general uses
*Categorization
Categorization is the human ability and activity of recognizing shared features or similarities between the elements of the experience of the world (such ...

. Indeed, the axioms required of a monoid operation are exactly those required of morphism
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and th ...

composition when restricted to the set of all morphisms whose source and target is a given object. That is,
: ''A monoid is, essentially, the same thing as a category with a single object.''
More precisely, given a monoid , one can construct a small category with only one object and whose morphisms are the elements of ''M''. The composition of morphisms is given by the monoid operation •.
Likewise, monoid homomorphisms are just functor
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no ge ...

s between single object categories. So this construction gives an equivalence of categories, equivalence between the category of monoids, category of (small) monoids Mon and a full subcategory of the category of (small) categories Cat. Similarly, the category of groups is equivalent to another full subcategory of Cat.
In this sense, category theory can be thought of as an extension of the concept of a monoid. Many definitions and theorems about monoids can be generalised to small categories with more than one object. For example, a quotient of a category with one object is just a quotient monoid.
Monoids, just like other algebraic structures, also form their own category, Mon, whose objects are monoids and whose morphisms are monoid homomorphisms.
There is also a notion of monoid (category theory), monoid object which is an abstract definition of what is a monoid in a category. A monoid object in category of sets, Set is just a monoid.
Monoids in computer science

In computer science, many abstract data types can be endowed with a monoid structure. In a common pattern, a sequence of elements of a monoid is "fold (higher-order function), folded" or "accumulated" to produce a final value. For instance, many iterative algorithms need to update some kind of "running total" at each iteration; this pattern may be elegantly expressed by a monoid operation. Alternatively, the associativity of monoid operations ensures that the operation can be parallelization, parallelized by employing a prefix sum or similar algorithm, in order to utilize multiple cores or processors efficiently. Given a sequence of values of type ''M'' with identity element $\backslash varepsilon$ and associative operation $\backslash bullet$, the ''fold'' operation is defined as follows: : $\backslash mathrm:\; M^\; \backslash rarr\; M\; =\; \backslash ell\; \backslash mapsto\; \backslash begin\; \backslash varepsilon\; \&\; \backslash mbox\; \backslash ell\; =\; \backslash mathrm\; \backslash \backslash \; m\; \backslash bullet\; \backslash mathrm\; \backslash ,\; \backslash ell\text{'}\; \&\; \backslash mbox\; \backslash ell\; =\; \backslash mathrm\; \backslash ,\; m\; \backslash ,\; \backslash ell\text{'}\; \backslash end$ In addition, any data structure can be 'folded' in a similar way, given a serialization of its elements. For instance, the result of "folding" a binary tree might differ depending on pre-order vs. post-order tree traversal.MapReduce

An application of monoids in computer science is so-called MapReduce programming model (seEncoding Map-Reduce As A Monoid With Left Folding

. MapReduce, in computing, consists of two or three operations. Given a dataset, "Map" consists of mapping arbitrary data to elements of a specific monoid. "Reduce" consists of folding those elements, so that in the end we produce just one element. For example, if we have a multiset, in a program it is represented as a map from elements to their numbers. Elements are called keys in this case. The number of distinct keys may be too big, and in this case the multiset is being sharded. To finalize reduction properly, the "Shuffling" stage regroups the data among the nodes. If we do not need this step, the whole Map/Reduce consists of mapping and reducing; both operation are parallelizable, the former due to its element-wise nature, the latter due to associativity of the monoid.

Complete monoids

A complete monoid is a commutative monoid equipped with an Finitary, infinitary sum operation $\backslash Sigma\_I$ for any index set such that:Droste, M., & Kuich, W. (2009). Semirings and Formal Power Series. ''Handbook of Weighted Automata'', 3–28. , pp. 7–10 : $\backslash sum\_\; =0;\backslash quad\; \backslash sum\_\; =\; m\_j;\backslash quad\; \backslash sum\_\; =\; m\_j+m\_k\; \backslash quad\; \backslash text\; j\backslash neq\; k$ and : $\backslash sum\_\; =\; \backslash sum\_(m\_i)\backslash quad\; \backslash text\; \backslash bigcup\_\; I\_j=I\; \backslash text\; I\_j\; \backslash cap\; I\_\; =\; \backslash emptyset\; \backslash quad\; \backslash text\; j\backslash neq\; j\text{'}$ A continuous monoid is an ordered commutative monoid in which every directed set has a least upper bound compatible with the monoid operation: : $a\; +\; \backslash sup\; S\; =\; \backslash sup(a\; +\; S)\; \backslash \; .$ These two concepts are closely related: a continuous monoid is a complete monoid in which the infinitary sum may be defined as : $\backslash sum\_I\; a\_i\; =\; \backslash sup\; \backslash sum\_E\; a\_i$ where the supremum on the right runs over all finite subsets of and each sum on the right is a finite sum in the monoid.See also

* Green's relations * Monad (functional programming) * Semiring and Kleene algebra * Star height problem * Vedic squareNotes

References

* * * * *External links

* * * {{PlanetMath, urlname=Monoid , title=Monoid , id=389 Algebraic structures Category theory Semigroup theory