Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How can I define a function which takes as an only parameter a real number and gives as a result the closest smaller natural number? E.g. $f(3.554)=3, f(4.95485)=4, f(2.001)=2$.

share|improve this question
The function is called $floor$ and written as $\lfloor x\rfloor$ –  Shard Jan 12 '13 at 11:56
If you're looking for a function that can be expressed in terms of elementary functions, you're out of luck. Floor and ceiling functions can be represented as infinite series that converge, but only in part of the domain. You can't use those representations in practice. –  Greg Ros Jan 12 '13 at 12:12
Yes, exactly what I wanted to know. I asked my Mathematics teacher(I'm in High school) and he told me that I got the definiton of the function with my question. So I decided to search or ask how it could be defined in pure math notation, not in a specific language. –  user1113314 Jan 12 '13 at 12:46
add comment

2 Answers

First, if your real number $k < 1$, then the function $f$ is not defined at $k$ since there is no natural number lesser than the value of $k$.

The function $f$ you are trying to define is just a subset of the floor function where $f:\{x|x\ge 1\} \mapsto \mathbb{N}$. Thus we can define your function as $f(x) = \max (y\in \mathbb{N}|y\le x), x \in [1,\infty)$.

share|improve this answer
Phew, I needed too many corrections on this one. –  Parth Kohli Jan 12 '13 at 12:09
Thank you, really comprehensive answer. –  user1113314 Jan 12 '13 at 13:04
@user1113314: No problem! –  Parth Kohli Jan 12 '13 at 13:34
add comment

You can define such a function directly by it's desired properties, i.e. for $x\geq 1$, define $$ f(x) :=\max \left\{ n\in\mathbb{N}:n\leq x \right\}. $$ As has already been pointed out, $f(x)$ is commonly denoted by $\lfloor x\rfloor$. Clearly $f$ is discontinuous, so it cannot be expressed as a finite composition of continuous functions (which probably is what you've actually been looking for) or a power series.

One obvious representation of $f$ would be to write it as a limit of step functions: $$ f = \lim_{n\rightarrow \infty}\sum_{k=1}^n k \cdot\chi_{[k,k+1)}$$ where $\chi_I$ is the characteristic function of the interval $I$, but this is really nothing more than toying with the definition.

share|improve this answer
Thank you for the answer. the representation is too complicated for me. I'll take a look at the floor(x) implementation in Wikipedia. –  user1113314 Jan 12 '13 at 13:06
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.