The function takes a natural number and:
- If n is odd: f(n)=2n+1
- If n is even: f(n)=2n
Examples:
f(1)=21+1=1
f(2)=22=1
f(3)=23+1=2
f(4)=24=2
f(5)=25+1=3
To check if the function is injective, consider whether different inputs can produce the same output.
f(1)=1
f(2)=1
Since f(1)=f(2) but 1=2, the function is not injective.
To check if the function is surjective, determine whether every natural number k can be reached as an output.
For any natural number k, let n=2k.
Then f(2k)=22k=k
Examples:
For k=1: f(2)=1
For k=5: f(10)=5
For k=100: f(200)=100
Every natural number is reachable as an output, so the function is surjective.
The function is surjective but not injective.