# Form a compositional identity function

If we have two functions, $f:\mathbb{Z}\rightarrow\mathbb{Z}$ and $g:\mathbb{Z}\rightarrow\mathbb{Z}$ where $g(f(a))=a$ for every integer $a$, how do we satisfy these conditions so that $f$ and $g$ are not bijective?

-
The question is not really clear. Which conditions are you referring to? – smanoos Nov 17 '11 at 23:35
It should not be that hard to find such an example. Similar example was given for N instead of Z in another your question: math.stackexchange.com/questions/82961/… – Martin Sleziak Nov 17 '11 at 23:41
I apologize for my ambiguity. What I mean to ask is: can we find functions $f$ and $g$ in which neither is bijective so that $f:\mathbb{Z}\rightarrow\mathbb{Z}$ and $g:\mathbb{Z}\rightarrow\mathbb{Z}$ where $g(f(a))=a$ for every integer $a$ – johnnymath Nov 17 '11 at 23:45
@MartinSleziak: it seems much tougher to find examples for $\mathbb{Z}$ because of the difficulty of dealing with negative numbers. So far I have come up empty – johnnymath Nov 17 '11 at 23:46
What about taking the maps from that answer and extend them by putting $f(a)=g(a)=a$ for each $a\le 0$? – Martin Sleziak Nov 17 '11 at 23:50

First, $f$ will have to be injective. If $f$ is not injective then two integers $n$ and $m$, have $f(n)=f(m)$ and so $g(f(n))=g(f(m))$. Similarly $g$ has to be surjective, or else for some $n$, $g(f(n))\neq n$. But, $f$ can fail to be surjective and $g$ can fail to be injective. Suppose that $f(n)=2n$ and $g(n)=\frac{n}{2}$ if $n$ is even and $g(n)=0$ if $n$ is odd. Then $g(f(n))=n$.

-