I have function $u(x) = \lfloor x \rfloor$ mapped from $\mathbb{R}$ to $\mathbb{Z}$ which I need to prove is onto.

I know that standard way of proving a function is onto requires that for every $Y$ in the co-domain there should exist an $x$ in the domain such that $u(x) = y$

I usually go about this by finding the inverse of the function and then plugging the inverse into the function itself to show that the function $u(x) = y$

Intuitively, I know that $u$ is onto because for every integer $y$, there exists a real number $x$ that can plugged into $u$ that returns $y$,

I just have no clue how to prove this since I don't understand how one would take the inverse of a floor function. How should I approach this problem in order to prove it?

  • $\begingroup$ You don't need an inverse function (and there isn't one). The end of your sentence that begins "intuitively" IS a proof. Just tell the reader what $x$ gives a floor of an integer $y$. $\endgroup$ Commented Feb 15, 2018 at 1:12
  • $\begingroup$ $\forall z\in \mathbb Z, u(z) = z$ $\endgroup$
    – Doug M
    Commented Feb 15, 2018 at 1:14
  • $\begingroup$ Can you find an $x$ that maps to $2?$ to $-2$? $\endgroup$
    – saulspatz
    Commented Feb 15, 2018 at 1:15
  • $\begingroup$ @EthanBolker any function that is surjective automatically has a right-inverse $\endgroup$ Commented Jun 23 at 11:31
  • 1
    $\begingroup$ @SeekingAMathGeekGirlfriend Yes, there is a right inverse. But there is no inverse, and you don't need the right inverse to prove surjectivity. In this case proving surjectivity is the best way to find a right inverse. $\endgroup$ Commented Jun 23 at 14:21

2 Answers 2


You cannot take the inverse of the floor function because it is not injective. For example, the floor function of 1.1 and 1.2 are both 1.

To prove surjectivity, as you have said, for any number $n\in \mathbb{Z}$, you need a real number such that its floor function is $n$. Notice that the floor function of an integer is itself, so you would be done.


Note that for an integer $z$, $$ \lfloor z \rfloor=z$$

Thus the function $$u(z) = \lfloor z \rfloor$$ is onto.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .