Question:
Find the inverse of $f(x)=x+(-1)^{x-1}$ where $f:N\to N$ ($N$ denotes set of natural numbers)
Usually, when I am asked to find inverse of a given function, I use to express the dependant variable $x$ in terms of the independent variable $y$ as $x=g(y)$ where $g$ is a function, from the equation $y=f(x)$ where f is a function. Then I will replace $y$ by $x$ and $x$ by $f^{-1}(x)$, to get $f^{-1}x=g(x)$.
But in this problem, I am unable to do so. Is there any other method to find the inverse of such complex functions? How to find the inverse of the given function?
Best Answer
Let $f:\mathbb{N}\to\mathbb{N}$ be defined by $f(x)=x+(-1)^{x-1}$
If $x$ is odd, then $f(x)=x+1$, and if $x$ is even, then $f(x)=x-1$.
To invert $f$, just reverse the process . . .
If $x$ is even, then $f^{-1}(x)=x-1$, and if $x$ is odd, then $f^{-1}(x)=x+1$.
Thus, $f^{-1}(x)=f(x)$.
The basic idea when inverting a piecewise function is to invert each of the pieces.
Since $f$ maps the set of odd positive integers to the set of even positive integers by adding one, $f^{-1}$ maps the set of even positive integers to the set of odd positive integers by subtracting one.
Similarly, since $f$ maps the set of even positive integers to the set of odd positive integers by subtracting one, $f^{-1}$ maps the set of odd positive integers to the set of even positive integers by adding one.
Thus, $f^{-1}$ is also a piecewise function, and in this particular case, it turns out that $f^{-1}$ is the same as $f$.