Finding out if a function is invertible: $f,g:\mathbb N\to \mathbb N$, $g(x)=2x$ and $f$ with cases

46 Views Asked by At

Let $f,g:\mathbb N\to \mathbb N$ such that $g(x)=2x$ and $f(x)=\begin{cases}\frac x 2 &, x\in\mathbb N_{even}\\ x+9 &,x\in\mathbb N_{odd}\end{cases}$ Are the functions invertible?

I think I just need to find a function for each of them $f^{-1},g^{-1}$ such that $f^{-1}\circ f= f\circ f^{-1}= id_{\mathbb N}$ and the same for $g$.

So is it enough to just build the functions like so:

$$g^{-1}(x)=\begin{cases}\frac x 2 &, x\in\mathbb N_{even}\\ 1 &,x\in\mathbb N_{odd}\end{cases}$$ $$f^{-1}=\begin{cases} 2x &, x\in\mathbb N_{even} \\ x-9&,x\in\mathbb N_{odd}\end{cases}$$

And then show that $f^{-1}\circ f= f\circ f^{-1}= id_{\mathbb N}$ and likewise for $g$?