 QUESTION

# A function f from the set of natural numbers to integers defined by f\left( n \right)=\left\{ \begin{align} & \dfrac{n-1}{2}\text{ if n is odd} \\ & \dfrac{-n}{2}\text{ if n is even} \\ \end{align} \right. is:(a) Onto but not one-one(b) One-one and onto both(c) Neither one-one nor both(d) One-one but not onto

Hint: In this question, as the function is a mapping from natural numbers to integers. Let us consider some natural numbers and substitute them in the given function and then from the functional values obtained we can comment about one-one and onto.

Let us look at the definitions of one-one and onto functions
ONE-ONE FUNCTION: The mapping $f:A\to B$ is called a one-one function, if different elements in A have different images in B. Such a mapping is known as a one-one function or injective function.
ONTO FUNCTION: If the function $f:A\to B$ is such that each element in B is the image of at least one element of A, then we say that f is a function of A onto B. Thus, $f:A\to B$, such that $f\left( A \right)=B$.
Now, from the given function in the question we have,
f\left( n \right)=\left\{ \begin{align} & \dfrac{n-1}{2}\text{ if n is odd} \\ & \dfrac{-n}{2}\text{ if n is even} \\ \end{align} \right.
Let us calculate the functional values for some of the numbers.
Given, that f is a mapping from natural numbers to integers.
$f:N\to I$
So, let us consider the values of n as 1, 2, 3, 4, 5.
Now, for $n=1$, as it is a odd number
$\Rightarrow f\left( n \right)=\dfrac{n-1}{2}$
By substituting the value of n we get,
\begin{align} & \Rightarrow f\left( 1 \right)=\dfrac{1-1}{2} \\ & \therefore f\left( 1 \right)=0 \\ \end{align}
Let us now consider $n=2$, as it is a even number we get,
$\Rightarrow f\left( n \right)=\dfrac{-n}{2}$
Now, on substituting the value of n we get,
\begin{align} & \Rightarrow f\left( 2 \right)=\dfrac{-2}{2} \\ & \therefore f\left( 2 \right)=-1 \\ \end{align}
Similarly for the other values of n we get functional values as:
For, $n=3$ we get,
\begin{align} & \Rightarrow f\left( 3 \right)=\dfrac{3-1}{2}=\dfrac{2}{2} \\ & \therefore f\left( 3 \right)=1 \\ \end{align}
For, $n=4$ we get,
\begin{align} & \Rightarrow f\left( 4 \right)=\dfrac{-4}{2} \\ & \therefore f\left( 4 \right)=-2 \\ \end{align}
For, $n=5$ we get,
\begin{align} & \Rightarrow f\left( 5 \right)=\dfrac{5-1}{2}=\dfrac{4}{2} \\ & \therefore f\left( 5 \right)=2 \\ \end{align}
Thus, we can observe that every element of set A has a unique image in set B and there is no element left in set B.
Hence, the given function is both one-one and onto.
The correct option is (b).

Note: Instead of substituting the numbers and finding their functional values we can also check about one-one and onto by assuming two variables and then on substituting then and equating both the functional values if we get that both the variables are equal then the function is said to be one-one.
If ${{x}_{1}},{{x}_{2}}\in A$, then $f\left( {{x}_{1}} \right)=f\left( {{x}_{2}} \right)\Rightarrow {{x}_{1}}={{x}_{2}}$
It is important to note that for the function to be one-one all the functional values to be obtained should be different and not even one image should be same which means that the functional value when we substitute a and b are same then it is not said to be a one-one function.