# Trouble proving floor function is onto?

I'm trying to do a proof of a floor function being onto, but I'm not sure where to go from here. I don't want to ask the question outright because I want to figure it out myself, but I know that if you want to prove a function is onto, say: $$y = 3x+1$$ Would be to swap it to terms of x, and we'd get

$$x = (y-1)/3$$

But the equation I'm dealing with is:

$$y=\left \lfloor{\frac{x+1}{2}}\right \rfloor$$

How would I go about proving this is onto?

(Would have signed in, but stackexchange was not letting me today)

• What are the domain and codomain? – Umberto P. Mar 25 '15 at 21:43
• A function is onto when every element of the codomain is the image of some element in the domain. Since you have not specified the domain and codomain, your question is unanswerable. – David Mar 25 '15 at 21:44
• Here is one way: Pick an element of the range and check if applying the floor function returns that element. – copper.hat Mar 25 '15 at 21:44
• @UmbertoP. It amazes me how often people do not state the domain and codomain when trying to prove a function is injective/surjective/bijective. Maybe a flaw in the educational system(s), but it betrays a fundamental misunderstanding. – Daniel W. Farlow Mar 25 '15 at 21:45
• @crash It does betray a fundamental misunderstanding, but, sadly, it no longer amazes me..... – David Mar 25 '15 at 21:46

If the domain and codomain are both $\mathbb Z$, then $x = 2n-1$ gives you $y=n$. It is onto.