devarshi-dt-logo

Question:

Show that f: N → N, given by f(x) = x + 1, if x is odd; f(x) = x/2, if x is even, is both one-one and onto.

Solution:

For one-one:
If f(a) = f(b) ⇒ a + 1 = b + 1 or a/2 = b/2, if both are even or odd.
Note : f(a), f(b) are not equal if one is even and other is odd, since if a is even and b is odd, a/2 is odd and b + 1 is even.
⇒ a = b. So, one-one function
Now, for onto:
For all x ∈ odd nos. f(x) gives all the even nos.
And all x ∈ even nos. f(x) gives all the odd nos.
⇒ range = codomain
So, onto function.