Composite functions equal to identity problem

discrete mathematicselementary-set-theoryfunctions

Find example of functions f,g : N → N (N= {0, 1, 2, . . . }), so that f ◦ g = idN and simultaneously g ◦ f ≠ idN (or justify, why those functions don't exist.)

I'm having problem solving this one. I know this tells us that function f is the inverse function of g. But let's say we pick some g that is injective but not surjective, for example g = 2x, then I can't find an f that works. So the part g ◦ f ≠ idN is correct, because I can't compose two functions to be equal to idN. So bottom line is, I can't find any examples of functions f,g.

I may be mistaken so if someone could correct me, I would be more than grateful.

Best Answer

As a hint, if $f\circ g$ is injective, then $g$ is injective. If $f\circ g$ is surjective, then $f$ is surjective. So if there is an example, you will need $g$ injective and $f$ surjective.

See what happens when $g(x)=2x$. You can construct a function $f$ which "undoes $g$" by dividing by $2$, but this only works for even numbers. So extend $f$ however you like to get a function $\Bbb N\to\Bbb N$.