TITLE: Given a projection $p$, find the largest subset $G(p) \subset Map(S,S)$ that is a group under composition
QUESTION [7 upvotes]: I want to show, that given a set $S$ and a projection $p: S \rightarrow S$ (i. e. $p = p \circ p$), there exists a largest subset $G(p) \subset Map(S, S)$, which contains $p$ and is closed under composition and $(G(p), \circ)$ is a group.
I have no idea, how this $G(p)$ looks like - $p$ is of course the identity, but how to define $G(p)$? Any idea?

REPLY [4 votes]: First, a natural idea that doesn't quite work but almost: $$H(p)=\{f:S\to S\mid f\circ p=p\circ f=f\}$$
This is guided by the fact that $p$ has to be the identity, so in any case $G(p)$ has to be a subset of the above.
It is clear that $H(p)$ closed under composition, contains an identity element, and that $\circ$ is associative.
The non-trivial part is to find inverses. $$f\circ g=g\circ f=p$$ implies that $f$ does not lose more information than $p$ does. Precisely, $f\mid_{\operatorname{Im}p}:\operatorname{Im}p\to \operatorname{Im}p$ has to be a bijection. So let's add this requirement.
$$G(p)=\left\{f:S\to S\left|\, \begin{array}[l]\bullet f\circ p=p\circ f=f\\ f\mid_{\operatorname{Im}p}:\operatorname{Im}p\to \operatorname{Im}p\text{ is bijective}\end{array}\right\}\right.$$
Finding inverses is again the only possibly non-trivial part. Let $f\in G(p)$ and $g:S\to S$ be defined by $g\mid_{\operatorname{Im}p}=(f\mid_{\operatorname{Im}p})^{-1}$. This doesn't quite define $g$ yet. Since inverses are unique, it is likely that not any extension to $S$ will work. In fact, to be an element of $G(p)$ $g$ needs to satisfy $$g\circ p=g$$
And there you have it: for $s\in S\setminus \operatorname{Im}p$, set $$g(s):=g(p(s)).$$
By definition now, $\operatorname{Im}g\subset \operatorname{Im}p$, therefore $p\circ g=g$ is satisfied, and $g\in G(p)$.
Finally, for any $s\in S$: $$f\circ g(s)=f\circ g(p(s))=p(s)$$ and $$g\circ f(s)=g\circ f(p(s))=p(s)$$