Question:medium

Let \( f:\mathbb{N} \to \mathbb{N} \) be defined as \[ f(n)= \begin{cases} \frac{n+1}{2}, & \text{if } n \text{ is odd} \\ \frac{n}{2}, & \text{if } n \text{ is even} \end{cases} \] Then \( f \) is:

Show Hint

Check injectivity using counterexample.
Updated On: Apr 17, 2026
  • injective but not surjective
  • surjective but not injective
  • both injective and surjective
  • neither injective nor surjective
Show Solution

The Correct Option is B

Solution and Explanation

Step 1: Understanding the Concept:
A function is injective if distinct inputs give distinct outputs. It is surjective if every element in the codomain (\(\mathbb{N}\)) is an image of at least one element in the domain (\(\mathbb{N}\)).
Step 2: Detailed Explanation:
1. Check for Injectivity:
Calculate values:
\(f(1) = \frac{1+1}{2} = 1\) (since 1 is odd)
\(f(2) = \frac{2}{2} = 1\) (since 2 is even)
Since \(f(1) = f(2) = 1\) but \(1 \neq 2\), the function is not injective.
2. Check for Surjectivity:
For any natural number \(m \in \mathbb{N}\):
Consider the even number \(n = 2m\).
\(f(2m) = \frac{2m}{2} = m\).
This shows that every natural number \(m\) in the codomain has at least one pre-image (\(2m\)) in the domain. Thus, the function is surjective.
Step 3: Final Answer:
The function is surjective but not injective.
Was this answer helpful?
0