# On surjective functions

I'm having trouble with this question involving surjective functions.

If $h(x)=2x+1$ and $h$ maps from the integers to the integers, does there exist a function $g$ that maps from the integers to the integers so that $(g \circ h)(x)$ is onto?

If this is true, can someone provide an example of such a $g$?

-
Nothing really. I'm kinda stuck on how to go. I'm assuming the answer is somewhat obvious. – user979616 Aug 2 '12 at 0:52

For example, let $g(n)=\frac{n-1}{2}$ if $n$ is odd, and let $g(n)=n$ (or more spectacularly, $0$) if $n$ is even. If one wants a "formula," one can concoct one using trigonometric functions, but a definition by cases is clearer.
The value of $g$ at even integers doesn't matter, as the post may have indicated. But if we want $g$ to be defined at every integer, as the question asks, we do need to specify what $g$ does, for example, at $8$, or $-20$. – André Nicolas Aug 2 '12 at 1:08
Maybe $g(n)=[(n-1)/2]$ (where $[x]$ is the integer part of $x$) gives a formula without trig functions and without (explicit) cases. – Gerry Myerson Aug 2 '12 at 3:36