Exercise from J.H.Howie:Why is the transformation semigroup regular?
Let $S$ be a set .By the transformation semigroup $T(S)$ we mean the set of all mappings from $S$ to $S$.
In order to show that it is regular we take any $f\in T(S)$ .We need to show that there exists a $g\in T(S)$ such that $f=fgf$.
I am unable to construct such a function.
Please give some hints.
Suppose that $S\neq\varnothing$ and let $t_0\in S$.
For $s\in\text{im}f$ define $g(s):=t$ where $t\in S$ denotes some (chosen) element that satisfies $f(t)=s$. The fact that $s\in\text{im}f$ guarantees that we such $t$ exists.
This can be done if the axiom of choice is accepted.
For $s\notin\text{im}f$ define $g(s):=t_0$.
Check yourself that we have $f=fgf$.
If $S=\varnothing$ then there is only one choice for $f$ and $g$ wich is the empty map, and we automatically have $f=fgf$. That's why the axiom of choice mentioned in my answer.