0
$\begingroup$

The function $f: \{ 0,1,2,3... \} \to B$ where $f(n)=\left \lfloor \frac{n-1}{2} \right \rfloor$.Prove that it is an onto function if the codomain is $\{-1,0,1,2,3,...\}$ .

My work:

I use the flooring property but I am stuck.

Lets $\left \lfloor \frac{n-1}{2} \right \rfloor$=b,

$b ≤ \frac{n-1}{2} < b+1$

$2b+1 ≤ n <2b+2$

$n∈[2b+1,2b+2)$

Then how to determine $n=2b+1$ or $n=2b+2$ should i take to substitute to $\left \lfloor \frac{n-1}{2} \right \rfloor$ to prove that it is an onto function. Are there have a method can prove onto function strictly?

$\endgroup$
2
  • 1
    $\begingroup$ Hint: $f(2n)=n-1$ $\endgroup$ Commented Mar 20, 2020 at 11:28
  • $\begingroup$ @PeterForeman How does it help? $\endgroup$
    – user743730
    Commented Mar 20, 2020 at 11:32

1 Answer 1

0
$\begingroup$

What is $B$? Assuming $B$ to be the range/codomain of $f$ I have an answer.

Let the codomain $B=\{-1,0,1,2,...\}$ then for each $m\in B$ and $m>0$ choose $n=2m+1$ then $f(n)=\left \lfloor\frac{n-1}{2}\right \rfloor=\left \lfloor\frac{2m+1-1}{2}\right \rfloor=m$. So $f$ is onto in this case.

For zero we have $1$ as it's preimage (Trivially visible).

For $-1$ simply take zero.

Thus for all elements $$m in the codomain which is $B={-1,0,1,2,...}$ we have an element from the domain $n$ so that $f(n)=m$. Thus $f$ is onto if the codomain is ${-1,0,1,2,...}$

$\endgroup$
1
  • $\begingroup$ Can we take 2b+2? then we will have underfloor(b+1/2)=b,so that means we can take 2b+1 or 2b+2 trivially? $\endgroup$
    – user743730
    Commented Mar 20, 2020 at 11:38

You must log in to answer this question.