# Determine where the function is continuous

I'm having trouble understanding how to do the solution to this problem. Could someone explain this problem and how I would show where they are continuous?

Determine where the following functions are continuous

\begin{align} f(x) & = \begin{cases} x, & x \text{ rational}\\ 0, & x \text{ irrational} \end{cases} \\[10pt] g(x) & = \begin{cases} x - \lfloor x \rfloor, & x \text{ rational}\\ 0, & x \text{ irrational} \end{cases} \end{align}

• first function is called dirichlet function, and it is nowhere continuous. – Bhaskar Vashishth Oct 2 '14 at 18:50
• @BhaskarVashishth: both assertions are false. The dirichlet function is 1 at rationals, not $x$. – Alex R. Oct 2 '14 at 18:51
• @BhaskarVashishth It seems as if it's continuous at $x=0$, though. (Note that $f(r)=r$, not $1$, where $r$ is a rational.) – Akiva Weinberger Oct 2 '14 at 18:51
• @AlexR. ya correct – Bhaskar Vashishth Oct 2 '14 at 18:57
• @BhaskarVashishth : The first function given here is not the Dirichlet function, and it is continuous at $0$. ${}\qquad{}$ – Michael Hardy Oct 2 '14 at 19:04

Let $a$ be irrational, so $f(a) = 0$.

Consider the $\epsilon,\delta$ definition of continuity. Practically speaking, if the function $f$ is continuous at $a$, then given any small $\epsilon$, there is some small neighborhood $(a-\delta,a+\delta)$ so that all the values of $|f(x)|$ are less than $\epsilon$ (since $|f(x) - f(a)| = |f(x)|$).

But any such neighborhood of $a$ contains infinitely many rational numbers (where the values of $f$ will range from $a-\delta$ to $a + \delta$). So, if you choose an $\epsilon < a$, then no matter what $\delta$ you choose, there's some rational $x \in (a-\delta,a+\delta)$ so that $f(x) > a$.

You can basically use the same kind of argument to examine the rational points; choose rational $b$, choose $\epsilon < b$, get the contradiction. Notice that there's one rational number which this argument won't work though (why?). That will be the sole point of continuity.

Once you understand the first example, the second is the same thing with a slight twist.

You need to verify the definition of continuity at each point $y$: for all $\epsilon>0$ there exists a $\delta>0$ such that |f(x)-f(y)|<\epsilon$\epsilon$ whenever $|x-y|<\delta$. Alternatively show that for all sequences $y_n\rightarrow y$, you have $f(y_n)\rightarrow f(y)$.

As a hint for $f(x)$, pick a nice value of $y$, say $y=0.5$. Is $f$ continuous at $0.5$? You have that $|f(x)-f(y)|=|f(x)-0.5|=0.5$ whenever $x$ is irrational. Notice that for any $\delta>0$, there is always an irrational in the interval $(0.5-\delta,0.5+\delta)$. So if $\epsilon=0.4$, for any delta you could always find an irrational $x$ satisfying $|x-0.5|<\delta$, giving $|f(x)-0.5|>\epsilon$, a contradiction. So $f$ is not continuous at $0.5$.

Something interesting happens for $x$ near $0$ though...

A function of one variable $f(x)$ continuous at point $x=p$ if for any given $\epsilon>0$ there exists a $\delta >0$ (where $\delta$ is permitted to depend on $\epsilon$) such that for all $x$ in the interval $(p-\delta, p+\delta)$, $|f(x) - f(p) < \epsilon$.

Let's try that for the first function you present. If $p$ is rational and non-zero, then any neighborhood of $p$ will have points with $x$ irrational and $f(x) = 0$, so choosing $\epsilon = p/2$ we see that the definition of continuity at $p$ cannot be met. And if $p$ is irrational any neighborhood of $p$ will contain points with $x$ rational and arbitrarily close to $p$ so that $f(x)$ will be arbitrarily close to $p$, yet $f(p) = 0$. Again choosing $\epsilon = p/2$ shows that $f(x)$ is not continuous at $x=p$.

But now look at $x=0$. Then for any $\epsilon < 0$, if we choose $\delta = \epsilon/2$, every point $x$ with $-\delta < x < \delta$ has $$|f(x) - f(0)| = |f(x)| \leq |x| \leq \delta = \epsilon/2$$ and this demonstrates that $f(x)$ is continuous at $x=0$ (and nowhere else).

Now look at $g(x)$. For $x$ not an integer, the same arguments that show $f(x)$ is non-continuous apply to $g(x)$. Now consider any integer $x = n$, including zero. At all rational points $n < x < n+\delta$, $0 < g(x) < \delta$. Yet for all rational points $n-\delta < x < n$, $1-\delta < g(x) < 1$. This makes it impossible to find a $\delta$ small enough to demonstrate continuity for any $\epsilon < 1$.

So $g(x)$ is discontinuous everywhere.