Proving a floor function is injective/surjective Is the function $\lfloor x/2\rfloor$ injective or surjective? If so why? The domain is $\mathbb R$ and the co-domain is $\mathbb Z$. I think it is not injective as if we take x to be $20$ and $y$ to be $21$, we end up with $f(x)=10=f(y)$, but $x$ is not equal to $y$. I know that to check for surjection, we have to solve in terms of $x$, but since this is a floor function, I'm not sure what to do with the floor symbol while solving for $x$.
Thanks in advance.
 A: 
"I'm not sure what to do with the floor symbol while solving for x."

Ah! Subtle point.  As $f$ is not injective you CAN'T solve for a unique $x$.  You must solve for a set of possible values.  And it's easy to do once you "wrap your head around it".
=======
To show serject you let $k$ be an arbitrary elemet of $\mathbb Z$ and see if $[\frac x2] = k$ is always possible.
It's possible if $k \le \frac x2 < k+1$ is possible.
And that is possible if $2k \le x < 2k + 2$ is possible.
So for any $k$ is it always the case that there exist real numbers that between $2k$ (inclusive) and $2k+2$ (exclusive)?  The answer is, of course.  $2k$ is a  possible value so is $2k + 1$ so is $2k + .75$ and $2k + 1.415273860$ etc.
tl;dr
For every $k\in \mathbb Z$ then for $x =2k$ then $f(x) = [\frac {2k}2] = [k] = k$ so yes it is surjective.

To prove (non)injective you try to see if $f(x) = y$ always has a unique solution.
If $f(x) = [\frac x2] = y$ then
$y\le \frac x2 < y+1$ and $2y \le x < 2y+2$.  But that's as far as we can go. Any $x' \in [2y, 2y+2)$ could give us that.  So for example:
$f(x) = 10\implies 20 \le x < 22$ and $x_1 = 20$ and $x_2 = 21$ we have $f(x_1) = f(x_2)$ but $x_1\ne x_2$ so not injective.
A: You do not need, in this case, to invert the floor function explicitly to determine if it is or is not surjective. Just ask yourself: "can I find something in its codomain that the floor function cannot produce as an output?"
And the answer is right there in the definition:

the floor function is that function, from reals to reals, which produces from its single input argument the integer which is no greater than that input.

So, given that, what sorts of numbers can it not produce? Are any of these in the given codomain (the reals)? You might also note that the answer here depends on what we choose the codomain to be. What if we choose it to be the integers, instead? How does the answer change, if it does? Why?
A: Noting $f(x)=\lfloor(x/2)\rfloor$ we have, for example $f(3)=f(3.7)$ then $f$ is not injective. Besides $f(\mathbb R)=\mathbb Z$ then none real non integer can have un inverse image by $f$ so $f$ is not surjective.
A: Your argument about injection is correct.
Hint: For surjection you should figure out whether you can get every integer as a value somehow. No need to think formally about "solving for $x$".
