In mathematics, a semigroup is an algebraic structure consisting of a set together with an associative binary operation. The binary operation of a semigroup is most often denoted multiplicatively: x·y, or simply xy, denotes the result of applying the semigroup operation to the ordered pair (x, y). Associativity is formally expressed as that (x·y)·z = x·(y·z) for all x, y and z in the semigroup.
The name "semigroup" originates in the fact that a semigroup generalizes a group by preserving only associativity and closure under the binary operation from the axioms defining a group. From the opposite point of view (of adding rather than removing axioms), a semigroup is an associative magma. As in the case of groups or magmas, the semigroup operation need not be commutative, so x·y is not necessarily equal to y·x; a typical example of associative but non-commutative operation is matrix multiplication. If the semigroup operation is commutative, then the semigroup is called a commutative semigroup or (less often than in the analogous case of groups) it may be called an abelian semigroup.
In mathematics, particularly in abstract algebra, a semigroup with involution or a *-semigroup is a semigroup equipped with an involutive anti-automorphism, which—roughly speaking—brings it closer to a group because this involution, considered as unary operator, exhibits certain fundamental properties of the operation of taking the inverse in a group: uniqueness, double application "cancelling itself out", and the same interaction law with the binary operation as in the case of the group inverse. It is thus not a surprise that any group is a semigroup with involution. However, there are significant natural examples of semigroups with involution that are not groups.
An example from linear algebra is the multiplicative monoid of real square matrices of order n (called the full linear monoid). The map which sends a matrix to its transpose is an involution because the transpose is well defined for any matrix and obeys the law (AB)T = BTAT which has the same form of interaction with multiplication as taking inverses has in the general linear group (which is a subgroup of the full linear monoid). However, for an arbitrary matrix AAT does not equal the identity element (namely the diagonal matrix). Another example, coming from formal language theory, is the free semigroup generated by a nonempty set (an alphabet), with string concatenation as the binary operation, and the involution being the map which reverses the linear order of the letters in a string. A third example, from basic set theory, is the set of all binary relations between a set and itself, with the involution being the inverse relation, and the multiplication given by the usual composition of relations.