Consider the mapping f:n→N, where is the set of natural

Consider the mapping f:n→N, where N is the set of natural numbers is defined as,

fn=n2, for n=odd

fn=2n+1, for n=even

For n∈N, which of the following is true about f?

  1. A.

    Bijective

  2. B.

    Surjective but not Injective

  3. C.

    Injective but not surjective

  4. D.

    Neither surjective nor injective

Attempted by 180 students.

Show answer & explanation

Correct answer: D

Answer: The function is neither injective nor surjective.

Definition: f(n) = n^2 for odd n, and f(n) = 2n+1 for even n.

  • Not injective: distinct inputs can give the same output. For example, f(3)=3^2=9 and f(4)=2·4+1=9.

  • Not surjective: every output is congruent to 1 modulo 4. If n is even (n=2k), then f(n)=2n+1=4k+1≡1 (mod 4). If n is odd (n=2k+1), then f(n)=(2k+1)^2=4k(k+1)+1≡1 (mod 4). Thus the image is a subset of numbers congruent to 1 mod 4, and numbers such as 2, 3, and 4 have no preimage.

Conclusion: Since the function fails to be one-to-one and fails to be onto, it is neither injective nor surjective.

Explore the full course: Dsssb Tgt Computer Science Paper 2