The subset of discontinuous in all points is not open in the space of bounded functions

Let $X\subset \mathcal{B}(\mathbb{R},\mathbb{R})$ be the subset of bounded functions $f:\mathbb{R}\to\mathbb{R}$ such that are discontinuous in all points. Prove that $X$ is not open (with usual metric of supremum).

I think that I found an example of a function $f\in X$ such that for every $\epsilon>0$ there exist $g\in B(f,\epsilon)\cap X^c$.

Let $f$ defined by:

$$f(x)=\begin{cases} 1\ ; \text{if } x\in[-1,1]^c\cap\mathbb{Q}\\ x\ ; \text{if } x\in[-1,1]\cap\mathbb{Q}\setminus\{0\}\\ 1/2\ ; \text{if } x=0\\ -x\ ; \text{if } x\in[-1,1]\cap\mathbb{Q}^c\\ -1\ ; \text{if } x\in[-1,1]^c\cap\mathbb{Q}^c\\ \end{cases}$$

$f$ clearly be in $X$ and for each $\epsilon>0$ I can define $g$ by:

$$g(x)=\begin{cases} f(x)\ ; \text{if } x\in\{0\}\cup(-\epsilon,\epsilon)^c\\ 0\ ; \text{if } x\in(-\epsilon,\epsilon)\setminus\{0\}\\ \end{cases}$$

By a "draw" I think that $g\in B(f,1.1\epsilon)$ and $g$ is continuous in an interval then $g\in X^c$. Therefore $X$ is not open.

Am I right?

Do you know another way to prove this fact?

• Looks good to me, except I think you mean $g \in B(f, \epsilon)$, not $0.9\epsilon$. – Nate Eldredge May 26 '12 at 1:30
• @NateEldredge I think that you mean $g\in \overline{B(f,\epsilon)}$ not $g\in B(f,\epsilon)$. – Gaston Burrull May 26 '12 at 1:32
• Yes, you're right. – Nate Eldredge May 26 '12 at 1:33
• Oops I think that may be $1.1\epsilon$ indeed $0.9\epsilon$ – Gaston Burrull May 26 '12 at 1:37

Here’s a similar argument that I find a bit easier. Let $$f(x)=\begin{cases}\frac1{1+x^2},&\text{if }x\in\Bbb Q\\\\0,&\text{otherwise}\;.\end{cases}$$
For $a>0$ let $$f_a(x)=\begin{cases}f(x),&\text{if }|x|\le a\\\\0,&\text{otherwise}\;.\end{cases}$$
Clearly $f\in X$, each $f_a\in\mathcal{B}(\Bbb R,\Bbb R)\setminus X$ (since $f_a$ is continuous on $\Bbb R\setminus[-a,a]$), and
$$\|f-f_a\|=\frac1{1+a^2}$$ can be made arbitrarily small by taking $a$ large enough.
• Really good example! is less artificial that taking $f(x)=+x$, and $f(x)=-x$ and forcing boundness by more cases. I liked. – Gaston Burrull May 26 '12 at 3:12