Home » Blog » Find a function continuous at a single point of an interval

Find a function continuous at a single point of an interval

Find a function continuous at a single point of an interval, but discontinuous at all other points of the interval.


Consider the interval (-a,a) for any a \in \mathbb{R}, and define

    \[ f(x) =  \begin{cases}  x & \text{if } x \text{ is rational},\\  0 & \text{if } x \text{ is irrational}. \end{cases} \]

for all x \in (-a,a).

We claim f is continuous at 0, but discontinuous at every other point of the interval.

Proof. First, we show f is continuous at 0. To do this we must show that for all \varepsilon  > 0 there exists a \delta > 0 such that |f(x)| < \varepsilon whenever 0 < |x| < \delta. So, let \varepsilon > 0 be given. Then, choose \delta = \varepsilon. Then we have,

    \[ |x| < \delta \quad \implies \quad |x| < \varepsilon \quad \implies \quad |f(x)| < \varepsilon \]

since |f(x)| \leq |x| from the definition of f(x). Thus, f is continuous at 0.

Now, we must show f is discontinuous at every other point of the interval. Let p \neq 0 be any nonzero point of the interval.

We consider two cases:
Case #1: p is rational. Then f(p) = p. Since p \neq 0 by assumption, we consider \varepsilon = |p| > 0. Since the irrationals are dense in the reals (see Exercise #9 of Section I.3.12 here) we know that for any \delta > 0 there is some irrational number x such that |p-x| < \delta. But then, |f(p) - f(x)| = |p - 0| = |p| \not < \varepsilon. This means f is not continuous at p since we have found an \varepsilon > 0 such that there is no \delta > 0 we can choose such that |f(p) - f(x)| < \varepsilon whenever |p - x| < \delta.

Case #2: p is irrational. Since p is irrational we know f(p) = 0. Consider \varepsilon = |p| > 0. Since the rationals are dense in the reals (see Exercise #6 of Section I.3.12 here) we know that for any \delta > 0 there exists some rational number r such that |p| < |r| < |p| + \delta. But then, |f(p) - f(r)| = |0-r| = |r| \not < \varepsilon. This means f is not continuous at p. (Again, because we have shown that there exists an \varepsilon > 0 such that for every \delta > 0 there is some number r such that |f(p) - f(r)| \not < \varepsilon with |p-r| < \delta.) \qquad \blacksquare

(Note: There are much nicer ways to do this using sequences, but Apostol doesn’t develop those techniques, so we have to work straight from the epsilon-delta definitions.)

Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):