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.

  • 33
    $\begingroup$ No, it contradicts your intuition about being continuous, which has nothing at all to do with pens, pencils, drawing and etc. $\endgroup$
    – Timbuc
    Mar 3, 2015 at 11:57
  • 5
    $\begingroup$ When you dig into it, the notion of "able to draw without lifting our pen" is actually far harder to understand than the definition of "continuous". $\endgroup$ Mar 3, 2015 at 22:25
  • 1
    $\begingroup$ As a non-mathematician, what is the formal definition of continuity? An answer that explained what continuity is and how it applies in this example would be interesting to me (although, as a non-regular on this site, I acknowledge that it might not be the best answer for the community). $\endgroup$
    – Kevin
    Mar 4, 2015 at 9:39
  • 1
    $\begingroup$ @Kevin Define an $\varepsilon$-neighborhood around a point $c$ to be the interval $[c-\varepsilon,c+\varepsilon]$. A function $f$ is continuous at the point $c$ if, for every $\varepsilon$-neighborhood around $f(c)$ (no matter how small $\varepsilon$ is), there is a $\delta$-neighborhood around $c$ such that for every $x$ in the $\delta$-neighborhood, $f(x)$ is in the $\varepsilon$-neighborhood. $\endgroup$ Mar 9, 2015 at 1:08
  • $\begingroup$ @Kevin Look at this image. This choice of $\varepsilon$ and $\delta$ work: For every $x$ in the $\delta$-neighborhood (red), $f(x)$ is in the $\varepsilon$-neighborhood (blue). Now, let's play a game: You get to choose $\varepsilon$, and when you're done, I choose $\delta$. I win if it satisfies the condition I was talking about; you win if it doesn't. A function is continuous at a point if I always have a winning strategy. In this case, I can always win, and so the function is continuous at (cont'd) $\endgroup$ Mar 9, 2015 at 1:27

5 Answers 5


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".

  • $\begingroup$ @PrzemysławScherwentke: Thanks. :) $\endgroup$ Mar 3, 2015 at 21:45
  • $\begingroup$ Mental note to self: viz. closed graph theorem and bounded variation $\endgroup$ Mar 4, 2015 at 2:33
  • $\begingroup$ Hm… couldn't a pen draw an oscillating discontinuity? $\endgroup$
    – bjb568
    Mar 4, 2015 at 15:35
  • 1
    $\begingroup$ @bjb568 Perhaps, but not in finite time, if the length of the curve is infinite. (Consider, e.g., $f(x) = \sin(1/x)$.) $\endgroup$
    – wchargin
    Mar 4, 2015 at 15:39

More precisely, a function is continuous over an interval if we are able to draw the function without lifting our pen or pencil within that interval, in our intuition. This function is only continuous at one point.

  • $\begingroup$ This is a great answer! $\endgroup$ Mar 3, 2015 at 11:59
  • $\begingroup$ Thank you for your appreciation! :) $\endgroup$
    – Empiricist
    Mar 3, 2015 at 12:01
  • 5
    $\begingroup$ I don't understand what you mean: there exist continuous functions which are nowhere differentiable, and there is no sense in which you can draw such a function by hand. Can you clarify? $\endgroup$ Mar 3, 2015 at 13:43
  • 6
    $\begingroup$ he said "if", not "if and only if" ;-) $\endgroup$ Mar 4, 2015 at 3:32
  • 1
    $\begingroup$ @MichaelChirico: If we are going to buy that explanation, then you better get all those textbooks to stop using "if" for "iff" definitions. $\endgroup$
    – user21820
    Apr 16, 2015 at 9:24

A function is continous at a point $a$ if:

$$\lim_{x \to a}f(x)=f(a)$$

For your function, (except one point) no matter what point you choose there are irrational numbers alongside rational numbers so you can't find such a limit. The exception is a point that two conditions yield the same value, i.e., their intersection. Since, the intersection point ($2-x=x$) is $x=1$, both conditions tend to go to $1$ and above limit exists. Therefore it is only continuous at that point.


No, mathemathic hasn't failed. You has.

Drawing the graph of function without lifting pencil is only the initial intuition. Consider $f(x)=1/x$, which is continuous.

  • 2
    $\begingroup$ Except $x=0$ where we lift our pencil. $\endgroup$
    – user137035
    Mar 3, 2015 at 12:14
  • 1
    $\begingroup$ @i.ozturk Near $x=0$ we have already no pencil, because a line is infinitely long. ;-) $\endgroup$ Mar 3, 2015 at 13:40
  • 1
    $\begingroup$ I can agree with that. After all, near $x=0$ there is no spoon neither :) $\endgroup$
    – user137035
    Mar 3, 2015 at 13:52
  • $\begingroup$ @user137035 At $x=0$ the function is not defined, so you can't determine whether it is continuous there or not. Continuity is defined in a function's domain only. $\endgroup$
    – CiaPan
    Apr 7, 2016 at 12:49

user86418 gave some examples of where pen-continuity differs from continuity. Here are two more important distinctions. With a pen, you can only draw curves that have finite length and bounded derivative, otherwise you need infinite ink and either infinite time or infinite speed. But there are plenty of continuous curves that have infinite length.

Many fractals, which are beautiful (at least to some) continuous curves, have infinite length, such as the Koch snowflake, Sierpinski curve, Moore curve and Takagi_curve.

There are also 'simpler' examples. $\left( x \mapsto x \sin(\frac{π}{x^2}) \right)$ is continuous but has infinite length on any interval containing $0$, because the arc length between consecutive roots $\frac{1}{\sqrt{n}},\frac{1}{\sqrt{n+1}}$ is at least $\frac{2}{\sqrt{n+1}}$, and $\sum_{n=1}^\infty \frac{2}{\sqrt{n+1}} = \infty$. This example also has unbounded derivative, which means that you have to keep changing direction at higher and higher speed if you every want to finish drawing it!


You must log in to answer this question.