Proof of range of piecewise function

77 Views Asked by At

Let $f: \mathbb{Z} \rightarrow \mathbb{Z}$ be defined by, for all $n \in \mathbb{N}$

$$f(n)=$$ $$ \begin{cases} n-1 & \text{if n is even}\\ n+5 & \text{if n is odd} \end{cases}$$

Prove that ran $f = \mathbb{Z}$

Is it not enough to simply plug in and show using definitions of odd and even? How would you prove this?

1

There are 1 best solutions below

3
On BEST ANSWER

Let $m$ be any integer. It is either even or odd. In either case we shall show that $f(n)=m$ for some integer $n$. If $m$ is odd then $f(m+1)=m$ and if $m$ is even then $f(m-5)=m$. Thus we can take $n=m+1$ when $m$ is odd and $n=m-5$ when $m$ is even.