The given function f:W→W is defined by,
f( n )={ n−1, if n is odd n+1, if n is even
Consider that f( n )=f( m ).
If n is odd and m is even, then,
n−1=m+1 n−m=2
This cannot be possible.
If n is even and m is odd, then,
n+1=m−1 m−n=2
This shows that both n and m should be either even or odd.
If both n and m are odd, then,
n−1=m−1 n=m
If both n and m are even, then,
n+1=m+1 n=m
Thus, f is one-one.
It can be observed that any odd number 2k+1 in the co-domain N is the image of 2k in domain N. Also, any even number 2k in the co-domain N is the image of 2k+1 in domain N.
Thus, f is onto.
Therefore, f is an invertible function.
Now, assume that the function g:W→W is defined as,
g( r )={ r+1, if r is even r−1, if r is odd
When n is odd,
gοf( n )=g( f( n ) ) =g( n−1 ) =n−1+1 =n
When n is even,
gοf( n )=g( f( n ) ) =g( n+1 ) =n+1−1 =n
When r is odd,
fοg( r )=f( g( r ) ) =f( r−1 ) =r−1+1 =r
When r is even,
fοg( r )=f( g( r ) ) =f( r+1 ) =r+1−1 =r
Thus, gοf=I and fοg=I.
This shows that f is invertible and the inverse of f is f −1 =g, that is same as f.
Therefore, the inverse of f is f itself.