I'm looking for a function that is continuous on $\mathbb Z$ and discontinuous on $\mathbb R \setminus \mathbb Z$. I know the function floor of $x$, denoted $\lfloor x \rfloor$, that is continuous at all $c \in \mathbb R \setminus \mathbb Z$ and discontinuous at all $c \in \mathbb Z$. But I'm looking for the opposite one. Thank you.
3 Answers
I think the function $f$ such that :
- if $x\in \mathbb{R}-\mathbb{Q}, f(x) = 0$
- if $x\in \mathbb{Q}, f(x) = \sin \pi x$
will work.
- 2,371
The general idea for these is to partition $\mathbb R$ into two distinct but dense partitions. The traditional way is $\mathbb Q$ and $\mathbb R \setminus \mathbb Q$ but any other such ways. Then set $f(x)$ to be one thing for $x$ in one partition and $f(x)$ to be something else significantly far away for $x$ in the other partition.
For example if $f(x) = 1$ if $x\in \mathbb Q$ and $f(x)= 0$ if $x \not \in \mathbb Q$. Such a function is clearly continuous nowhere as in any interval $(x-\delta, x + \delta)$ there will be $x_0\in \mathbb Q$ and $x_1\in \mathbb R\setminus \mathbb Q$ so $|f(x)- f(x_1)|+ |f(x)-f(x_0)| \ge |f(x_0) - f(x_1)|=1$ so either $|f(x)-f(x_1)| \ge 12$ or $|f(x) - f(x_1)| \ge \frac 12$ so we can conclude $|f(x) -f(y)| < \epsilon < \frac 12$ for all $y; |x-y| < \delta$ can not be true.
To make this continuous at some points we need $\lim_{x\to a;x \in \mathbb Q} f(x) = \lim_{x\to a; x\not \in \mathbb Q} f(x)$ for the points where we want an $a$ to be a point of continuity.
So for instance $f(x) = x$ if $x\in \mathbb Q$ and $f(x) =0$ if $x \not \in \mathbb Q$ (or vice versa) is continuous at $x = 0$ and discontinuous every else.
To make it continuous at all integers but nowhere else we can do:
$f(x) = 0$ if $x$ is irrational. But $f(x)=0$ and $x \in \mathbb Z$ and $f(x)\ne 0$ for $x \in \mathbb Q\setminus \mathbb Z$ but $\lim_{x\to n; x\in \mathbb Q} f(x)= 0$ for all $n\in \mathbb Z$ that will be continuous at all integers.
Such an $f(x)_{x\in \mathbb Q}$ could be $f(x)= $ distance to nearest integer $= \min(x-\lfloor x\rfloor x, \lceil x\rceil - x)$.
So that will do it:
$f(x) = \begin{cases}0& x\not \in \mathbb Q\\\min(x-\lfloor x\rfloor x, \lceil x\rceil - x)&x\in \mathbb Q\end{cases}$.
It's continuous at $n\in\mathbb Z$ as $\lim_{x\to n} f(x) = \lim_{x\to n;x\in \mathbb Q} f(x)=\lim_{x\to n;x\not \in \mathbb Q} f(x)=f(n) = 0$.
But for any $a\not \in \mathbb Z$ we have $\lim_{x\to a;x\in \mathbb Q} \min(a-\lfloor a\rfloor a, \lceil a\rceil - a)\ne 0$ but $\lim_{x\to a;x\not\in \mathbb Q}f(x) = 0$.
=== Old function that turns out to be continuous on irrationals ====
$f(x)=\begin{cases} 0 & x\not \in \mathbb Q\\ 0& x\in \mathbb Z\\\frac 1b& x\in \mathbb Q\setminus \mathbb Z;x = \frac ab, a\in \mathbb Z; b\in \mathbb N; \gcd(a,b) = 1\end{cases}$
- 130,341
-
-
Actually, I think it is continuous on irrationals. But we can probably tweak it. Let $f(x) = \min ({x}, 1-{x}$..... Oh, wait. $f(x) = 0$ if $x$ is irrational and $f(x)$ equal the fractional part of $x$ or $1$ minus the fractional part, which ever is smallest. – fleablood Dec 27 '20 at 19:38
\begin{aligned} f(x)=\frac{1}{2}\left(l(x)+r(x)-|l(x)-r(x)| \right), \end{aligned}
where
\begin{aligned} l(x)=\begin{cases}\lceil x \rceil-x & \text{if }x\in\mathbb{Q}\\ 0 & \text{if }x\notin\mathbb{Q}\end{cases} \end{aligned}
and
\begin{aligned} r(x)=\begin{cases}x-\lfloor x \rfloor & \text{if }x\in\mathbb{Q}\\ 0 & \text{if }x\notin\mathbb{Q}\end{cases} \end{aligned}
- 4,788
-
1$$\lim_{x\to 0^{-}} x-\lfloor x \rfloor =1 $$ so I don't think this works. – FormulaWriter Dec 27 '20 at 17:46
-
-
1
But I'm looking for the opposite one. Thank you." That was a vandalization of the post. You made it unreadable.
– fleablood Dec 27 '20 at 18:05