How to determine a floor function is inverse or not?

1k Views Asked by At

from Z to Z: f(n)=2*floor(n/2)
How to determine if this function one-to-one and onto? In other words, how to determine a floor function is inverse or not?

1

There are 1 best solutions below

2
On BEST ANSWER
  • So your $f(n) = 2 \cdot \lfloor{\frac{n}{2}\rfloor}$. If $f$ was one one then different elements will have different images. But $f(2) = 2$ and $f(3)=2$. But $2 \neq 3$. So $2$ and $3$ go to the same elements and hence $f$ can't be $1-1$.

  • To check $f$ that $f$ isn't onto take an element say $7 \in\mathbb{Z}$. You want to find a $y \in\mathbb{Z}$ such that $f(y) = 2 \cdot\lfloor{\frac{y}{2}\rfloor}=7$. This says $\lfloor{\frac{y}{2}\rfloor} =\frac{7}{2}$ which can't happen since $\lfloor{\frac{y}{2}\rfloor}$ is always an integer where as $\frac{7}{2}$ is a rational.