# Is it possible to define $\lceil x\rceil$ in terms of $\lfloor\ldots\rfloor$?

I have tried to define the ceiling function of $x$ in terms of its floor function; I thought this might be easy, but it isn't. I can easily do this with a piecewise equation, but I need to do without it.

# Attempts

I have tried three methods, one of which ($\mathbf{(3)}$) almost always works:

$$\left\lfloor x\right\rfloor+1\not= \left\lceil x\right\rceil,\tag 1$$ when $x=3$, because: $$\left\lfloor 3\right\rfloor+1=4,\text{and }4\not=\lceil3\rceil.$$ $$\left\lfloor x+1\right\rfloor\not= \left\lceil x\right\rceil,\tag2$$ when $x=3$. $$\left\lfloor x+\frac{x}{x+1}\right\rfloor\not= \left\lceil x\right\rceil,\tag3$$ when $\varepsilon$ is a number extremely close to $0$ and $x=(8+\varepsilon)$, i.e $x=8.099999999999987$. In that event: $$\left\lfloor 8.099999999999987+\frac{8.099999999999987}{9.099999999999987}\right\rfloor=\left\lfloor8.09999999999998+0.89010989010989\right\rfloor=\lfloor 8.99010989010987\rfloor=8,\text{and }8\not=\left\lceil8.099999999999987\right\rceil$$

# Question

Is it possible to define $\left\lceil\ldots\right\rceil$ in terms of $\left\lfloor \ldots\right\rfloor$?

• How about $-\lfloor -x \rfloor$? – Mark Dickinson Dec 28 '14 at 21:23
• No continuous function $f(x)$ can satisfy $\lceil x \rceil = \lfloor f(x) \rfloor$ for all $x$, because for integer $n$ we would have $f(n) < n+1$ but $\lim_{x \downarrow n} f(x) \geq n+1$. – user133281 Dec 28 '14 at 21:28

You can calculate ceiling as:

$$\lceil{x}\rceil=-\lfloor{-x}\rfloor$$

You can calculate floor itself as:

$$\lfloor{x}\rfloor=x-\frac12\left(\frac{\ln\left(e^{2\pi i\left(x-\frac12\right)}\right)}{\pi i}+1\right)$$

This is because $e^{2\pi i\left(x-\frac12\right)}$ has a period of $1$.

• @MarcvanLeeuwen Most of the enthusiasm arises from the fact that Barak posted the $$- \left\lceil -x \right\rfloor$$ response very quickly (which answers the question elegantly), not because of the second construction. Although it looks nice, Barak got about 6 upvotes before he edited that in. – Ahaan S. Rungta Dec 28 '14 at 22:34
• Your expression has three terms, separated (as terms are) by "$+$"; the third one is the fraction with $\pi$ in the denominator. It is undefined at all integer values, because $\tan(y)$ is not defined whenever $y$ is an odd multiple (positive or negative) of $\frac\pi2$. Using Python (or any programming language) is not a valid method to determine whether a mathematical function is defined at some value; one cannot even represent $\pi$ precisely in floating point. – Marc van Leeuwen Dec 29 '14 at 7:57
• @AhaanS.Rungta: Please see revised answer. – barak manos Dec 29 '14 at 8:21
• @ConorO'Brien: Please see revised answer (fixed due to a comment by Mark van Leeuwen). – barak manos Dec 29 '14 at 8:22
• OK, the formula is correct now, at least if you are using the principal branch of the logarithm. – Marc van Leeuwen Dec 29 '14 at 8:23

Well-known lemma: $$\left\lceil x \right\rceil = - \left\lfloor -x \right\rfloor$$*Proof.* Let $x = a + k$, where $a = \left\lfloor x \right\rfloor$. If $k=0$ the proof is trivial ,so let $0 < k < 1$. Then, the LHS is $a+1$ and \begin {align*} \text {RHS} &= - \left\lfloor - \left( a + k \right) \right\rfloor \\&= - \left\lfloor -a - k \right\rfloor \\&= - \left( -a - 1\right) \\&= a + 1. \end {align*}So we are done. $\Box$

$$\lceil x \rceil = -\lfloor-x\rfloor$$

• Have you read the other answers? ;) – Ahaan S. Rungta Dec 28 '14 at 21:48
• Apparently I didn't. – Michael Hardy Dec 28 '14 at 21:48
• @MichaelHardy +1 for honesty :) – user253055 Oct 21 '15 at 1:00

If $a$ is infinitesimal positive number, and you assume that $\lceil{a}\rceil=1$, then...

$$\lfloor{x+1-a}\rfloor=\lceil{x}\rceil$$

• This works in theory. My question was founded in practice. +1 anyhow. – Conor O'Brien Dec 14 '15 at 0:34
• @ConorO'Brien Yeah, I just was trying to give you a solution based on your idea, and not just what is commonly known – user285523 Dec 14 '15 at 0:36