TITLE: Continuity at a point implies continuity on an interval?
QUESTION [6 upvotes]: If $f(x)$ is continuous at $a$, then is there a $\sigma$ such that $f(x)$ is also continuous on $(a-\sigma, a+\sigma)$?
This looks very intuitive, but I don't know how to prove it.

REPLY [8 votes]: This is not true. A standard example is
$$
f(x)=\begin{cases} x\text{ if }x\in\mathbb{Q}\\
0\text{ if }x\not\in\mathbb{Q}
\end{cases}
$$
The function $f(x)$ is continuous at $x=0$, but not continuous on any open interval.

REPLY [5 votes]: No, for example take 
$$f(x) = \begin{cases}
x &\text{ if } x\in\mathbb{Q} \\ -x &\text{ if } x\in\mathbb{R}-\mathbb{Q}
\end{cases}$$
then $f$ is continous in $x=0$, but not continous on $\left(-\varepsilon,\varepsilon\right)$ ($\forall\varepsilon\gt0$)
If you chose $f:\left[0,1\right]\rightarrow\mathbb{R}$ with
$$f(x) = \begin{cases}
1 &\text{ if } x=0 \\ 0 &\text{ if } x\in\mathbb{R}-\mathbb{Q} \\ q^{-1} & \text{ if } x=pq^{-1} \text{ with } p,q\in\mathbb{N} \text{ and } gcd(p,q)=1
\end{cases}$$
then $f$ becomes even continous in every irrational point, but you cannot find any intervall $\left(a,b\right)$ with $a\neq b$ where $f$ is continous.

REPLY [4 votes]: It’s false: the function
$$f(x)=\begin{cases}x,&\text{if }x\text{ is rational}\\-x,&\text{if }x\text{ is irrational}\end{cases}$$
is continuous only at $x=0$.

REPLY [2 votes]: It is a theorem that the discontinuity set of a real valued function is a $F_{\sigma}$ set, which means that it can be expressed as a countable union of closed sets. Conversely, the set of continuous points is $G_{\delta}$, which means it is a countable intersection of open sets. In general, a $G_{\delta}$ set need not contain an interval, so the answer to your question is no. What is true, however, is that it will always almost contain an interval, in a precise sense. 
See here.