composition of functions - one-way inverse

27 Views Asked by At

Construct functions $f: \mathbb{N} \rightarrow \mathbb{N}$ and $g: \mathbb{N} \rightarrow \mathbb{N}$ such that $g \circ f = \textrm{id}_{\mathbb{N}}$ but $f \circ g \neq \textrm{id}_{\mathbb{N}}$. Couldn't think of any... Help!

1

There are 1 best solutions below

5
On BEST ANSWER

Let $f(x) = x + 1$ and let $g$ be the function defined by $g(0) =0$ and $g(x) = x-1$ if $x > 0$. Then $g(f(x)) = g(x+1) = x$ but $f(g(0))=f(0)=1$.