# How do limits work with floor/ceiling?

I'm interested in the below equation:

$$\frac{n}{\operatorname{floor}(\frac{x}{n})}$$

Plotting with $$n = 1..100$$ shows the graph being slightly more aliased as $$n$$ increases and a discontinuity forms from $$0..n$$. The domain from what I can tell is $$(-\infty, 0) \cup [n, \infty)$$. I wanted to investigate the limits at each $$n$$ but not entirely certain how floor and ceiling factor into algebra.

Take for example $$n = 2$$,

$$f(x) = \frac{2}{\operatorname{floor}(\frac{x}{2})}$$

How could I find $$\lim_{x\to0} f(x)$$? Would the limit even exist considering the discontinuity between $$[0, 2)$$?

I know you can break down the function and help find the limit using the rules of limits:

$$\lim_{x\to b} \frac{p}{q} = \frac{\lim_{x\to b}p}{\lim_{x\to b}q}$$

So more precisely I'm looking for $$\frac{2}{\lim_{x\to0}\operatorname{floor}(\frac{x}{2})}$$.

For what it's worth, the plot looks like:

I can surmise $$\lim_{x\to0^-} f(x) = -2$$, am I right in assuming $$\lim_{x\to0^+} f(x)$$ doesn't exist?

• When dealing with a domain that is not the whole real line, you need to be careful with limits on the border of the domain. In this case, the limit is the same as $\lim_{x\to 0^{-}} f(x)$ because the small open neighborhoods of $0$ in the domain of $f$ are only negative. This means the limit will be $-n$ since $\lfloor x/n\rfloor=-1$ is constant for $x$ negative near $0.$ – Thomas Andrews Apr 8 at 16:36
• Your function not only has a discontinuity but fails to be defined at all for $x\in[0,n)$. – Henning Makholm Apr 8 at 16:36
• On the other hand it is clear that $f(x)=-n$ for every $x\in[-n,0)$, and since these numbers are the only ones in the domain that are close to $0$, the function very trivially goes to $-n$ for $x\to 0$. There's no algebra involved in this. – Henning Makholm Apr 8 at 16:38

It helps to carefully state definitions. A workable definition of a limit (of a real function) is something like the following:

Definition: Let $$f$$ be a function defined on some domain $$D\subseteq \mathbb{R}$$ and let $$a \in \mathbb{R}$$. Further suppose that there is some $$L\in\mathbb{R}$$ such that for every $$\varepsilon > 0$$ there exists some $$\delta > 0$$ such that if $$x \in D$$ and $$0 < |x-a|<\delta$$, then $$|f(x) - L| < \varepsilon.$$ $$L$$ is said to be the limit of $$f(x)$$ as $$x$$ approaches $$a$$, denoted $$\lim_{x\to a} f(x) = L.$$

I claim that $$\lim_{x\to 0} f(x) = \lim_{x\to 0} \frac{2}{\left\lfloor \frac{x}{2} \right\rfloor} = -2.$$ To prove this claim, I have to show that if $$\varepsilon$$ is any positive number, then I can find a value $$\delta$$ such that $$f(x)$$ is within $$\varepsilon$$ of $$-2$$ whenever $$x$$ is in the domain of $$f$$ and within $$\delta$$ of zero.

So, let $$\varepsilon > 0$$ be arbitrary and take $$\delta = 1$$. Observe that $$f$$ is only defined on the set $$D = \mathbb{R} \setminus [0,2).$$ If $$x \in D$$ and $$|x| < \delta = 1$$, then $$x \in (-1,0)$$, and so $$\lfloor x/2 \rfloor = -1$$. But then $$|f(x) - (-2)| = \left| \frac{2}{\left\lfloor \frac{x}{2} \right\rfloor} + 2 \right| = \left| \frac{2}{-1} + 2 \right| = 0.$$ Hence whenever $$|x-0| < \delta$$ and $$x\in D$$, we have $$|f(x)-(-2)| = 0 < \varepsilon$$. Therefore $$\lim_{x\to 0} \frac{2}{\left\lfloor \frac{x}{2} \right\rfloor} = -2,$$ as claimed.

The important point here is that the definition of a limit only cares about what is happening in the domain of the function. Points where the function is undefined are irrelevant. As long as we are working with a real-valued function of a real variable, the function of interest is simply not defined on the interval $$[0,2)$$, and so we don't have to worry about those points.

• My understanding in finding a limit was the limit for $x\to b$ only exists if the limit exists for both $x\to b^-$ and $x\to b^+$ and they are equal. If one doesn't exist, the limit doesn't exist; or, if they are not equivalent, the limit doesn't exist. I understand the leftside limit is $-2$ but the rightside limit is not defined. Doesn't then, the limit not exist? I'll disclaim I'm in Calculus I. – gator Apr 8 at 16:49
• As I said in the preamble, you have to carefully state your definitions. The definition of a limit which I gave is pretty standard. If you want to discuss left- and right-hand limits, you need to first carefully define what those mean. I would claim that $\lim_{x\to 0^+} f(x) = -2$ vacuously---indeed, I would claim that if $L$ is any real number, then $\lim_{x\to 0^+} f(x) = L$, since if I make $\delta$ small enough, I cannot find any values of $x$ such that $0 < x < \delta$. Thus all of the conditions are met. Again, state the definition very carefully, then see what happens. – Xander Henderson Apr 8 at 16:53
• You need to exclude the case where $x=a\in D$ or you'd have $\lim_{x\to a} f(x)$ would never be defined if $a$ was a point of discontinuity, even if it could be made continuous. You also want that for $\delta>0$ that there is at least one $x\in D\setminus\{a\}$ so that $|x-a|<\delta.$ Otherwise, all limit values would be vacuously true. – Thomas Andrews Apr 8 at 16:55
• @gator Using that definition, then you are at a loss here. You'd just have to leave it undefined. But in later math, that definition proves inadequate in many ways. – Thomas Andrews Apr 8 at 16:57
• @ThomasAndrews Regarding $|x-a| > 0$, I added that---omitting it was an oversight on my part. Regarding vacuous limits, I have no problem allowing the degenerate case in which the limit is anything by vacuity. But, again, everything comes down to definitions. If one wants to omit vacuous limits (which, in reality, one probably does), then the definition should be written slightly differently. – Xander Henderson Apr 8 at 19:21