The function is mapped from natural number to integer numbers

The function f is mapped from natural number to integer numbers and f(x) = x2 -2x + 3 . Consider N as a natural number and Z as Integer number , what is the function f : N -> Z ? 2, 4, 10, 28, 82, …

  1. A.

    Injective

  2. B.

    Surjective

  3. C.

    both a and b

  4. D.

    none of the above

Attempted by 226 students.

Show answer & explanation

Correct answer: A

Answer: Injective (assuming the standard convention N = {1,2,...}).

Rewrite the function:

f(x) = x^2 - 2x + 3 = (x-1)^2 + 2

  • Proof of injectivity: Assume f(m) = f(n). Then (m-1)^2 = (n-1)^2, so |m-1| = |n-1|. This gives either m = n or m + n = 2. If natural numbers are taken as 1,2,..., the equation m + n = 2 forces m = n = 1, so in all cases m = n. Therefore f is one-to-one on N = {1,2,...}.

  • Failure of surjectivity: Since (x-1)^2 >= 0, we have f(x) >= 2 for every natural x (with N = {1,2,...}). Thus integers such as 0, 1 and all negative integers are not in the image of f, so f is not onto Z.

  • Edge case about the definition of N: If N is defined to include 0, then f is not injective because f(0) = 3 = f(2). Under that convention the function would fail to be injective.

Conclusion: Under the common convention N = {1,2,...}, f is injective but not surjective onto Z.

Explore the full course: Dsssb Tgt Computer Science Paper 2