How to get a group from a semigroup

I am sorry if my question is too simple.

Is every semigroup associated to a group? If no, what conditions should be satisfied for a semigroup to have an associated group? If yes, how can I find the group?

I thought of the universal property. Let $X$ be a semigroup, define $G$ to be the group with a morphism of semigroups $\tau: X \rightarrow G$, such that if $H$ is any group having similar morphism $\phi: X \rightarrow H$, there is a group homomorphism $\psi: G \rightarrow H$, such that $\phi = \psi \circ \tau$.

Uniqueness is obtained from the universal property. But existence needs construction. When there is no element $x$ in $X$ such that for any $a \in X$, $xa = ax = a$, i.e., $X$ doesn't contain an identity element, I define $G = \{ 1 \} \cup \{ x_1^{k_1} \cdots x_n^{k_n} | x_i \in X, k_i \in \{ \pm 1 \}, i = 1, \cdots, n; k_jk_{j+1} = -1, 1 \leq j <n \}$ with equivalence relations: $x^{k}x^{-k} \equiv 1$, $x_1^{k_1} \cdots x_{i-1}^{k_{i-1}}x_i^kx_i^{-k}x_{i+2}^{k_{i+2}} \cdots x_n^{k_n} \equiv x_1^{k_1} \cdots x_{i-1}^{k_{i-1}}x_{i+2}^{k_{i+2}} \cdots x_n^{k_n}$ and group operations

Multiplication: $\begin{cases} 1 \cdot x_1^{k_1} \cdots x_n^{k_n} = x_1^{k_1} \cdots x_n^{k_n} \cdot 1 =x_1^{k_1} \cdots x_n^{k_n}, \\ x_1^{k_1} \cdots x_n^{k_n} \cdot y_1^{l_1} \cdots y_m^{l_m}= \begin{cases} x_1^{k_1} \cdots x_n^{k_n}y_1^{l_1} \cdots y_m^{l_m} & \text{ if } k_nl_1=-1, \\ x_1^{k_1} \cdots (x_ny_1)^{l_1} \cdots y_m^{l_m}& \text{ if } k_nl_1=1; \end{cases} \end{cases}$

Inverse: $1^{-1} =1$, $(x_1^{k_1} \cdots x_n^{k_n})^{-1} = x_n^{-k_n} \cdots x_1^{-k_1}$.

Then clearly, the morphism $\tau: X \rightarrow G$ can be defined to send every $x \in X$ to $x \in G$.

Beside possible leaks, this construction is not precise, and doesn't work in case when $G$ already has an identity, or even is a group.

So, when are semigroups associated with a group, and how can I construct a group from a semigroup?

Thanks in advance.


What you are describing is the left adjoint of the forgetful functor from Group to Semigroup.

In the case of monoids and monoid homomorphisms, such a group is called the enveloping group of a monoid. You can find the description in George Bergman's Invitation to General Algebra and Universal Constructions, Chapter 3, Section 3.11, pages 65 and 66.

However, you don't always get embeddings.

For semigroups, the most natural thing is to adjoin a $1$, even if the semigroup already has one, and then perform the construction. If $S$ already had an identity, the construction will naturally collapse the new, adjoined, identity into the original one, and give you "the most general group into which you can map the semigroup".

Added. In fact, what the last construction is doing (for semigroups) is simply composing the two right adjoints: the right adjoint of the forgetful functor from Monoid to Semigroup is the functor that adjoins an identity (since even between monoids there are generally more semigroup homomorphisms than monoid homomorphisms). So if we look at the composition of the forgetful functors Group $\longrightarrow$ Monoid $\longrightarrow$ Semigroup, we obtain a right adjoint by composing the adjoints going the other way, Semigroup $\longrightarrow$ Monoid (adjoin a $1$), and Monoid $\longrightarrow$ Group (enveloping group). So: first adjoin a $1$, then construct the enveloping group.

(Interestingly, there is another functor from monoids to groups, namely the functor that assigns to every monoid its group of units, $M^*$. This functor is the right adjoint of the forgetful functor: given any monoid $M$ and any group $G$, there is a natural corespondence between $\mathbf{Monoid}(G,M)$ and $\mathbf{Group}(G,M^*)$).


Update: I was initially wrong thinking that Grothendieck construction can be applied for any semigroup. Below a corrected version of my post.

If you start from a commutative monoid there is an easy way to construct a group, called Grothendieck construction. See http://en.wikipedia.org/wiki/Grothendieck_group. By the way, it's not always true that the monoid embeds into its Grothendieck group, but it suffices that it verifies the cancelation property: $a+b=a+c$ implies $b=c$.