We are given, f : W → W, defined as
\(\left\{\begin{array}{ll} n-1, & n \text { is odd } \\ n+1, & n \text { is even } \end{array}\right.\)
Let f(n1) =f(n2). If n1 is odd and n2 is even,
then n1 – 1 = n2 + 1, i.e., n1 – n2 = 2, which is not possible as n1 is odd and n2 is even.
When n1 and n2 both are odd, then
f(n1) =f(n2) ⇒ n1 – 1 = n2 – 1 ⇒ n1 = n2
When n1 and n2 both are even
f(n1) = f(n2) ⇒ n1 + 1 = n2 + 1 ⇒ n1 = n2.
This shows f is one-one.
Any odd number 2r + 1 in codomain is the image of 2r and any even number 2r in the codomain W is the image of 2r + 1.
⇒ f is one-one and onto.
∴ f is invertible.
Further, when n is odd, y = n – 1, n = y + 1, y is even.
When n is even, y = n + l, n = y y is odd.
Hence, f-1(y) = g(y) defined as
g : W → W, such that g(y) = \(\left\{\begin{array}{ll}
y-1, & y \text { is odd } \\
y+1, & y \text { is even }
\end{array}\right.\)
⇒ The inverse of f is f itself.