# Does this semigroup have an identity element?

Let G be the set of functions that map {1,2,3,4} into {1,2}, the binary operation is the usual composition of mappings and G is a semigroup.

From my knowledge, I would say that it doesn't have an identity since it would need to be f(x)=x where x is an element of {1,2,3,4}. But f(x)=x maps {1,2,3,4} into {1,2,3,4} so f(x)=x is not an element of G and therefore an identity doesn't exit.

Can someone please tell me if I am correct or if I'm wrong please explain why? Thanks.

• Something is fishy here. Set $A=\{1,2,3,4\}, B=\{1,2\}$. Two functions $f,g:A\to B$ cannot be composed, because the codomain of one is not the domain of the other. – vadim123 Oct 25 '15 at 0:13
• Thanks for your reply. The codomain is a subset of the domain so I don't see how they can't be composed. – Desmoz Oct 25 '15 at 0:21

You are right that this semigroup does not have an identity but it is not true that if a semigroup of functions from $A$ to $A$ has an identity $e$, then $e(x) = x$ for all $x \in A$. Here's a way of constructing examples:
Suppose $A$ is a non-empty set and $G$ is a semigroup functions from $A$ to $A$ that has an identity $e$. Choose $a \in A$ and $b \notin A$ and let $B = A \cup \{b\}$. For each $f \in G$ define $\bar f:B \to B$ by $\bar f(b) = f(a)$ and $\bar f(x) = f(x)$ for all $x \in A$, and let $\bar G = \{\bar f\mid f \in G\}$.
Then $\bar G$ is a semigroup and $f \mapsto \bar f$ is a semigroup isomorphism. In particular, $\bar e$ is an identity of $\bar G$ but $\bar e(b) \neq b$.