I just started learning analysis and encountered my first task on continuity today, namely proving that $f: \mathbb{R}\to \mathbb{R}, \space f(x) = \inf\{|x-k\rvert \space \mid k\in \mathbb{Z} \}$ is continuous in every point. I attempted to prove this as follows:

Let $x_{0} \in \mathbb{R}$ be arbitrary. Let $x \in \mathbb{R}$. By the triangle inequality we have $\left|x_{0}-k\right| \leq\left|x_{0}-x\right|+|x-k|$ for all $k \in \mathbb{Z}$. Thus, one obtains $$ \inf \left\{\left|x_{0}-k\right| \mid k \in \mathbb{Z}\right\} \leq\left|x_{0}-x\right|+\inf \{|x-k| \mid k \in \mathbb{Z}\} $$ so by the definition of $f$ $$ f\left(x_{0}\right)-f(x) \leq\left|x_{0}-x\right| $$ so we obtain $f(x)-f\left(x_{0}\right) \leq$ $\left|x_{0}-x\right|$ (applying the same argumentation). We get $$ \left|f\left(x_{0}\right)-f(x)\right| \leq\left|x_{0}-x\right| $$ Now, let $\epsilon>0$ be arbitrary. To show that $f$ is continuous in $x_{0}$ we must find some $\delta>0$, s.t. for all $x \in \mathbb{R}$ with $\left|x-x_{0}\right|<\delta$ the inequality $\left|f\left(x_{0}\right)-f(x)\right|<\epsilon$ holds. From the above we can clearly see that $\delta=\epsilon$ is a sufficient choice is. Since $x_{0}$ was arbitrary, we are done.

Does this attempt seem valid? Also, what are other ways one could prove this (assuming that the above works). I assume that one often can just plug in the definition of the respective function and then rearrange the inequality, but this didn‘t quite work for me in this case.

  • $\begingroup$ But note $\inf\{|x_0-x|\}+ \inf\{|x-k|\}\le \inf\{|x_0-x|+|x-k|\}$ .(It's possible that the $x$ and $k$ that make$\inf\{|x_0-x|+|x-k|\}$the minimum might be a different $x$ then makes $|x_0-x|$ minimal and a different $x,k$ that makes $\inf\{|x-k|\}$ minimal.) What i fthere is an $x$where $|x_0-x| +\inf\{|x-k|\}< \inf\{|x_0-x| + |x-k|\}$ and why can′t we have $|x_0-x|+\inf\{|x-k|\} < \inf\{|x_0 -k|\} \le \inf\{|x_0-x| + |x-k|\}$? $\endgroup$
    – fleablood
    Commented Feb 16, 2021 at 0:38

1 Answer 1


Your estimate appears to be correct. If you draw a picture, this function is a "sawtooth" function. For $n\in \mathbb{Z}$, you have $f(n) = 0$ and $f(n + 1/2) = 1/2$. The rest of the graph can be obtained by "connecting the dots." The slopes of the connecting lines are $\pm 1$. So, you do have $|f(x) - f(y)| \le |x - y|$ for all $x, y\in \mathbb{R}$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .