Check whether the given function is injective or surjective

485 Views Asked by At

Let $f : \mathbb N \to \mathbb Z$ be defined by

$$ f(x) = \left\{\begin{array}{lr} \frac{n+1}{2}, & \text{if } n \text{ is odd}\\ \frac{-n}{2}, & \text{if } n \text{ is even}\\ \end{array}\right. $$

Here $\mathbb N$ denotes the set of natural numbers and $\mathbb Z$ denotes set of integers.

I have proved the injective part as true but the surjective part is coming out to be false (answer is true according to book). At first I made cases according to even/odd. Then I equated $f(n) = y$ so as to get value of $n$ for which there is a image '$y$' for $n$ (according to cases). But it turned out to be true for some values as domain of '$n$' is natural numbers whereas $y$ is integer. Is the approach correct?

2

There are 2 best solutions below

3
On BEST ANSWER

For surjectivity, you need to ask yourself whether every $z \in \mathbb{Z}$ is the image of some $n \in \mathbb{N}$.

Scratch work: for $n$ odd, you have $f(n)=\tfrac{n+1}{2}$, which is clearly positive. How do you need to pick $n$ to get a fixed, positive $z$-value? $$\frac{n+1}{2} = z \iff n=2z-1$$ Note that for $z > 0$, $n=2z-1$ is odd so... Similar scratchwork for $n$ even, corresponding to the negative $z$-values. Concluding:

  • for $z > 0$, take $n=2z-1$, then $n$ is odd and $f(n) = \ldots$
  • for $z \le 0$, take $n=-2z$, then $n$ is even and $f(n) = \ldots$
0
On

Hints:

For any positive $\;z\in\Bbb Z\;$, we can write

$$z=\frac{(2z-1)+1}2$$

and for any negative $\;z\in\Bbb Z\;$ , we can write

$$z=\frac{-2(-z)}2$$