Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm curious as to how the floor function can be defined using mathematical notation.

What I mean by this, is, instead of a word-based explanation (i.e. "The closest integer that is not greater than x"), I'm curious to see the mathematical equivalent of the definition, if that is even possible.

For example, a word-based explanation of the factorial function would be "multiply the number by all integers below it", whereas a mathematical equivalent of the definition would be $n! = \prod^n_{i=1}i$.

So, in summary: how can I show what $\lfloor x \rfloor$ means without words?

share|cite|improve this question
"instead of a word-based explanation" - it can happen that insisting on formal notation often hurts clarity more than helping it. In this case, since the textual definition is straightforward, why bother? – J. M. May 12 '13 at 3:53
For curiosity's sake; consider it a puzzle – Xenon May 12 '13 at 3:55
What do you mean by that big capital pi with all those other symbols around it? Can you describe that "without words" please? In your accepted answer, what does arctan mean? My point is, all notation was invented to describe some intellectual phenomenon, which may in turn have been based on some earlier idea, etc. until the whole thing ultimately boils down to cavemen telling how many mastadon had been successfully hunted by holding up fingers. – cobaltduck May 12 '13 at 18:06
@cobaltduck "hire or otherwise persuade a caveman to walk clockwise a circle of radius 0.5/pi until he has covered a distance of x. then have him walk counter-clockwise back to his starting point and subtract from x the distance he walked back" it helps to mark the starting point with a mastodon. ;p – agks mehx May 12 '13 at 20:46

12 Answers 12

up vote 80 down vote accepted

For a real number $x$, $$\lfloor x\rfloor=\max\{n\in\mathbb{Z}\mid n\leq x\}.$$ I'd like to add though, that "$\lfloor x\rfloor$" is mathematical notation, just as much as the right side of the above equation is; the right side might use more "basic" constructions, but you can then ask about $$\max,\qquad\in,\qquad \mathbb{Z},\qquad {}\mathbin{\mid}{},\qquad \leq$$ and so on. At some point you just have to start writing notation and explaining it in words and hope your readers understand. So I disagree with your phrasing of the question.

share|cite|improve this answer
I've always thought floor/ceiling to be basic themselves, so I suppose "basic" is in the eye of the beholder. (+1, of course.) – J. M. May 12 '13 at 3:54
that's one step closer to the set-theoretic definition. – Hal Canary May 12 '13 at 20:51
With the note that the $\max$ is well-defined because the set is bounded from above (by $x$), and every set of integers bounded above has a maximum element by the well-ordering principle. – asmeurer May 12 '13 at 22:34

$\lfloor x \rfloor = x - \arctan(\tan(\pi x))/\pi$ ?...

share|cite|improve this answer
@agksmehx: Zev's answer should be the accepted one - no chickening out there, just the plain professional definition. (Of course this answer is a nice idea, too.) – Hendrik Vogt May 12 '13 at 12:18
One tiny quibble is that $\arctan$ is a multi-valued function, and this relies on taking the principal value, otherwise the answer could be any integer. It's somewhat similar to defining $|x|$ as $\sqrt{x^2}$, which could technically be $|x|$ or $-|x|$. – Nathaniel May 12 '13 at 14:35
@Clayton: But which answer is clearer as to what $\lfloor x\rfloor$ means (which is usually the goal for things intended to be read by humans)? Besides, a computer seems far more likely to make round-off errors or mistakes trying to mimick $\pi$, an arbitrary real number $x$, subtraction, division, and the functions $\tan$ and $\arctan$, than in trying to compare numbers with $\leq$ (though I don't know anything about programming languages, so maybe I'm wrong about that). – Zev Chonoles May 12 '13 at 19:49
But there is a problem, should you use the function with an integer, the result would be its preceding integer. I.e., f(x) = (x - 0.5) - atan(tan(pi*(x - 0.5)))/pi, f(1) = 0. – Severo Raz May 12 '13 at 20:52

I am an engineer, perhaps this helps if you do not expect too much.

$x-(x$ mod $1$)

share|cite|improve this answer
Follow-up: "How to represent $\bmod$ using mathematical notation?" – J. M. May 12 '13 at 3:53
This is a notation that I think most mathematicians would not consider standard... – Mariano Suárez-Alvarez May 12 '13 at 5:05
@newzad: The notation $\lfloor x\rfloor$ also has no words, and is much more widely accepted by mathematicians. – Zev Chonoles May 12 '13 at 5:09
I would apply mod to the whole expression which would yield zero ... – Dominic Michaelis May 12 '13 at 5:43
did nobody notice the directly computable answer below? ⌊x⌋=(x−0.5)−arctan(tan(π(x−0.5)))π – agks mehx May 12 '13 at 8:36

Recursive way: $\lfloor x\rfloor \equiv \begin{cases} 1+\lfloor x-1\rfloor& x\ge1 \\ -1+\lfloor x+1\rfloor& x<-1 \\ 0&0\le x<1\\ -1&-1\le x<0 \end{cases}$

Also directly(sort of) computes the answer.

share|cite|improve this answer

$\lfloor x\rfloor=n\leftrightarrow \{n\}=\{y\in\mathbb{Z}:\forall z\in\mathbb{Z}~ z\le x \rightarrow z\le y\}$

This game is fun! Now let's prove 1+1=2.

share|cite|improve this answer

I suspect that this question can be better articulated as: how can we compute the floor of a given number using real number field operations, rather than by exploiting the printed notation, which separates the real and fractional part, making nearby integers instantly identifiable.

How about as Fourier series? If we subtract the function $y = x$ from $\lfloor x\rfloor$ then we get a periodic sawtooth wave. Hey look, that Wikipedia page even mentions this relationship.

So if you obtain the Fourier series (a sum of sinusoidal functions of various frequencies and amplitudes) for the sawtooth wave $\lfloor x\rfloor - x$ and add $x$, then you have an approximation for $\lfloor x\rfloor$ which is as good to whatever accuracy you care to apply in evaluating the series. Obtaining the Fourier series for $\lfloor x\rfloor - x$ is a basically a matter of scaling the function to fit: finding the parameters to substitute into the generic equation to produce the right amplitude, frequency and offset.

But another answer is that the printed notation which approximates a number is computable. When a computer evaluates floor(x), it's all math. The printed (or electronically stored) notation for a rational number which approximates a real number is a mathematical object.

share|cite|improve this answer

$$\lfloor x \rfloor = \text{supremum} \{n \in \mathbb{Z} : n \leq x\}$$

For a subset $S \subset X$, where we have an order $\leq$ on $X$, a supremum or least upper bound of $S$ is an element $M \in X$ such that $$x \leq M, \,\,\,\,\, \forall x \in S$$ and for any $m \in X$ such that $x \leq m$ for all $x \in S$, we have $M \leq m$.

share|cite|improve this answer
Can "max" then be put into mathematical notation as well? Or is this as mathematical as it can get? – Xenon May 12 '13 at 3:40
@Sim You can make it more and more "formal" as you want. But it is useless beyond a point. – user17762 May 12 '13 at 3:46
I first read this as "supermum" – Ell May 12 '13 at 10:13
@Sim $x = \sup(S) \iff \forall_{y\in U(S)}\left(x \leq y\right) \land x\in U(S)$, $U(S) = \left\{x \mid \forall_{y\in S} \left(y \leq x\right)\right\}$. – Matthias Benkard May 12 '13 at 14:58

There exists exactly one integer $n$ such that $n \le x < n+1$. We define $\lfloor x \rfloor$ to be this $n$.

Or, if you really like symbols: $\forall x \in \mathbb{R} \ \exists! n \in \mathbb{Z} \ n \le x < n+1 \quad \lfloor x \rfloor := n$.

share|cite|improve this answer

You have raised a most-interesting question which has a beautiful solution.

The floor-function is characterized by the following formula,

$\boxed{ \;\; \forall n \in \mathbb{Z},x \in \mathbb{R} :: n \leq \lfloor x \rfloor \equiv n \leq x \;\; }$

Indeed this states that ``$\lfloor x \rfloor$ is the greatest integer that is at-most $x$'':

  1. $\lfloor x \rfloor$ is an ingeter at-most $x$ ---ie $x \leq \lfloor x \rfloor$. We obtain this my taking $n = \lfloor x \rfloor$ in the above formula.

  2. It is also the largest such integer : $\forall n \in \mathbb{Z},x \in \mathbb{R} :: n \leq x \implies n \leq \lfloor x \rfloor$. We obtain this from the characterization by weakening the equivalence $\equiv$ into an implication $\implies$.

Some immediate results from the characterization, for $n \in \mathbb{Z}, x \in \mathbb{R}$, are

  1. $\lfloor x \rfloor < n \equiv x < n$, by negating the equivalence.

  2. $\lfloor x \rfloor \leq x$, by taking $n = \lfloor x \rfloor$. [Contracting]

  3. $\lfloor x \rfloor \leq \lfloor y \rfloor \Leftarrow x \leq y$, proven by the characterization and properties of $\leq$. [Order preserving]

  4. $\lfloor \lfloor x \rfloor \rfloor = \lfloor x \rfloor$, characterization again. [Idempotent]

Other nifty theorems can be easily proven from this characterization, such as

  1. $n = \lfloor x \rfloor \, \equiv \, ( n \leq x \text{ and } x<n+1)$

  2. $\lfloor x+n \rfloor = \lfloor x \rfloor + n$

  3. $\lfloor x \rfloor + \lfloor y \rfloor \leq \lfloor x+y \rfloor $

  4. $0\leq x \implies \lfloor \sqrt{\lfloor x \rfloor} \rfloor = \lfloor \sqrt{x} \rfloor$

Unlike the other answers presented earlier, this characterization shows its power in reasoning. For example, try proving one of the above theorems using one of the definitions presented by the others and then compare that with a proof using the characterization presented here.

These theorems and the characterization are explored in Feijen's ``The Joy of Formula Manipulation'',

Best regards,


share|cite|improve this answer

$\left \lfloor x \right \rfloor = a \in \mathbb{Z}, a \le x \ni a\ge b \;\forall \;b \in \mathbb{Z}, b\le x$

share|cite|improve this answer

Another expression is \begin{equation} \lfloor x \rfloor = \lim_{n \rightarrow \infty} (\sum_{k=-n}^n \mu(x-k)) - n - 1 \ , \end{equation} where $\mu$ is the step function. The function $\mu$ has the expression \begin{equation} \mu(x) = \lim_{n \rightarrow \infty} f(nx) \ , \end{equation} where $f(x) = e^{-x^2} + \frac{2}{\pi} \textrm{Si}(x)$. We have \begin{eqnarray} f(x) & = & 1 + \frac{2}{\pi}x + \sum_{k=1}^\infty \frac{(-1)^k}{\prod_{j=1}^k j} x^{2k} + \frac{2}{\pi} \frac{(\prod_{j=1}^{2k} j) (-1)^k}{(\prod_{j=1}^{2k+1} j)^2} x^{2k+1} . \end{eqnarray} The Taylor series converges for every $x \in \mathbb{R}$. Hence there is a representation for $\lfloor x \rfloor$ that applies multiplication, addition and limit.

share|cite|improve this answer
Im not convinced. For starter the term exp(-x^2) can be omitted i think. Because exp( - n x^2) Goes to 0 as n Goes to +oo ... – mick May 9 at 1:12

$$\large \left\lfloor x\right\rfloor = \sum_{n = -\infty}^{\infty}n\Theta\left(x - n\right) \Theta\left(n + 1 - x\right)\,, \qquad x \not\in {\mathbb Z} $$

$$\large \left\lfloor x\right\rfloor = \lim_{z \to x^{+}}\left\lfloor z\right\rfloor\,, \qquad x \in {\mathbb Z} $$

share|cite|improve this answer

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.