# One-sided limit in relation to a floor-function

I'm having problem understanding if the following statement is true or false (prove or provide a counter example):

if $\lim_{x\to x_0+} f(x) = L$, then $\lim_{x\to x_0+} \lfloor{f(x)}\rfloor = \lfloor{L}\rfloor$ or $\lim_{x\to x_0+} \lfloor{f(x)}\rfloor = \lfloor{L}\rfloor - 1$

By intuition it seems true. However I'm clueless on either proving it or on the other hand providing a counter example.

• It's not true but I am having trouble defining the counterexample. The issue is that even though we are approaching $x_0$ from the positive side, the limit $L$ might be approached by $f$ from both sides, and the floor will cause it to alternate between two integers. – Tony S.F. Jan 30 '18 at 13:03

## 2 Answers

It is not true. Consider the function,

$$f(x) = \begin{cases} 1+x & x\in\mathbb{Q},\\ 1-x, &x\not\in\mathbb{Q}\end{cases}$$

Then, $\lim\limits_{x\rightarrow0^+} f(x) = 1$ but $\lim\limits_{x\rightarrow 0^+}\lfloor f(x)\rfloor$ doesn't exist since $\lim\limits_{x\rightarrow 0^+, x\in\mathbb{Q}}\lfloor f(x)\rfloor=1$ but $\lim\limits_{x\rightarrow 0^+, x\not\in\mathbb{Q}}\lfloor f(x)\rfloor=0$

• What is the point of this comment? – Tony S.F. Jan 30 '18 at 13:13
• Your function is nowhere continuous except at $x=0$. The other two answers here are everywhere continuous except at $x=0$. – Parcly Taxel Jan 30 '18 at 13:21
• @ParclyTaxel It's still a valid counterexample and demonstrates the intuition I described in the comment on the question. It could reasonably be argued to be a more useful example because becoming comfortable with functions that are piecewise defined on the rationals and irrationals is an important part of studying real analysis and building one's intuition regarding functions of a real variable. Such functions are hardly ever continuous, yet still worth studying and mastering. – Tony S.F. Jan 30 '18 at 13:25
• However, I'm equally fine with pathological functions like that. – Parcly Taxel Jan 30 '18 at 13:28

Consider $$\lim_{x\to0+}x\sin\frac1x=0.$$ You have $$\left\lfloor x\sin\frac1x\right\rfloor=\begin {cases}0,&\ \frac1 { (2k+1)\pi}\leq x\leq\frac 1 {2k\pi}\\ \ \\-1,&\ \text {otherwise}\end {cases}$$ So the limit of the floor of the function doesn't exist.