Limits and Continuity – Shouldn’t This Function Be Discontinuous Everywhere?

continuitylimits

I was thinking about single point continuity and came across this function. $$
f(x) = \left\{
\begin{array}{ll}
x & \quad x\in \mathbb{Q}\\
2-x & \quad x\notin \mathbb{Q}
\end{array}
\right.
$$ We know this function is continuous only at $x=1$ . But doesn't that contradict our whole idea of continuity? A function is continuous if we are able to draw the function without lifting our pen or pencil. But here both the pieces of the function exist at specific places, so we have to lift our pen. Shouldn't the function be discontinuous everywhere? Looks like a stupid doubt though.

Best Answer

The idea that "a function is continuous if (and only if) its graph can be drawn without lifting one's pen(cil)" is sometimes adequate for communicating with non-mathematicians, but is technically flawed for multiple reasons.

For convenience, let's call this "condition" pen continuity.

First, as other answers note, a function must be continuous on an interval to have any hope of being pen continuous. Unfortunately for "pen continuity", there are a couple of reasons a function might be continuous (to a mathematician, using the $\varepsilon$-$\delta$ definition), but not continuous on an interval:

  • A function can be continuous at a single point (such as the function in your post), or at each point of a complicated set that contains no interval of real numbers (such as Thomae's function, which is continuous at $x$ if and only if $x$ is irrational).

  • A function can be continuous at every point of its domain, but the domain is not an interval (and perhaps contains no interval). Think, for example, of Przemysław Scherwentke's example $f(x) = 1/x$ for $x \neq 0$, which is continuous throughout its domain (the set of non-zero real numbers), or of the zero function defined on an arbitrary set of real numbers (which can be nastier than the human mind can comprehend).

So, let's focus on (real-valued) functions that are continuous at every point of an interval. Depending on your definition of a pen, not every continuous function is pen continuous (!). If a "pen" is a mathematical point, and "draw" has its ordinary meaning ("the pen can be traced along the graph in finite time", say), then most continuous functions are not pen continuous, because their graphs have infinite length over arbitrary subintervals (or "are not locally rectifiable", in technical terms). (The Koch snowflake curve isn't a graph, but may be a familiar non-rectifiable example.)

To emphasize, a "typical" continuous function is nowhere-differentiable: Its graph looks something like an EKG or a seismograph tracing or the curves you draw after drinking 50 cups of espresso. "Zooming in" only reveals details at smaller and smaller scales, peaks and valleys whose total length (over an arbitrarily short subinterval of the domain) may well be infinite. Only functions of bounded variation have graphs of finite length, and that's a "thin" subset of all continuous functions.

[If instead you want to think of "real" pens, whose tip has positive radius, you arrive at mathematically interesting territory, including Hausdorff measure and geometric measure theory.]

The bottom line (literally!) is, a mathematician mustn't conflate "continuity" with "pen continuity".