Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I make a big fuss that my calculus students provide a "continuity argument" to evaluate limits such as $\lim_{x \rightarrow 0} 2x + 1$, by which I mean they should tell me that $2x+1$ is a polynomial, polynomials are continuous on $(-\infty, \infty)$, and therefore $\lim_{x \rightarrow 0} 2x + 1 = 2 \cdot 0 + 1 = 1$.

All the examples they encounter where it is not correct to simply evaluate at $a$ when $x \rightarrow a$ fall into one of two categories:

  • The function is not defined at $a$.
  • The function is piecewise and expressly constructed to have a discontinuity at $a$.

I'd like to find a function $f$ with the following properties:

  • $f(a)$ exists
  • $f(a)$ is not (obviously) piecewise defined
  • $f(x)$ is not continuous at $a$
  • $f$ is reasonably familiar to a Calculus I student - trigonometry would be admissible, but power series would not (though they might still make for interesting reading)

The best example I know is $f(x) = \frac{|x|}{x}$, but the natural definition of $|x|$ is essentially piecewise ($\sqrt{x^2}$ is cheating).

share|cite|improve this question
I think that their is a deeper question here: what is a piecewise defined function? – Baby Dragon Jan 25 '14 at 23:48
So you are trying to "hide" a removable discontinuity – MPW Jan 26 '14 at 0:08
I don't understand why you call $f(x)=\frac{|x|}x$ an example (for $a=0$ I presume). Certainly $f(0)$ does not exist in this case (unless you extend the definition of $f$ piecewise). – Marc van Leeuwen Jan 26 '14 at 4:24
Note that using a limit or some other “advanced” structure is necessary to fulfill your requirements, since all available functions are either piecewise-defined or continuous and all “simple” operations (adding, multiplying, function composition) preserve continuity with the exception of division which causes definition gaps where the divisor is zero and preserves continuity otherwise. – Wrzlprmft Jan 27 '14 at 12:55
I posted a similar question today, and now I've posted the first paragraph of my question as an answer to this question. – Michael Hardy Jan 30 '14 at 22:43
up vote 7 down vote accepted

A very easy way to construct a function that is piecewise without being "obviously piecewise" is functions defined in terms of limits:

$$f(x) = \lim_{a \to +\infty} \exp\left(-ax^2\right) = \begin{cases}1, & x = 0 \\ 0, & \text{otherwise}\end{cases}$$

This example has the advantage of being easily-comprehensible to beginning calculus students.

share|cite|improve this answer

How about $$ f(x) = \sup \bigl( \mathbb Z\cap (-\infty,x)\bigr) = \lceil x\rceil -1$$


$$ g(x) = \lim_{n\to\infty} \tan^{-1}(nx) = \begin{cases}\pi/2 & x>0 \\ 0 & x=0 \\ -\pi/2 & x< 0 \end{cases} $$


$$ h(x) = \limsup_{n\to\infty} \sin(nx\pi) = \begin{cases}0 & x \in \mathbb Z \\ 1 & x \notin \mathbb Q \\ \in(0,1] & \text{elsewhere} \end{cases}$$


$$ k(x) = \lim_{y\to+\infty} \frac1y \int_0^y \cos(xt) \, dt = \begin{cases} 1 & x=0 \\ 0 & x\ne 0 \end{cases}$$


$$ g(x) = \int_0^\infty \frac{x}{1+(xt)^2} \,dt = \begin{cases} \pi/2 & x > 0 \\ 0 & x=0 \\ -\pi/2 & x<0 \end{cases}$$

share|cite|improve this answer

You can define $f_n(x)=x^n$ on $[0,1]$, and $f(x)=\lim_{n\to\infty} f_n(x)$. Then the discontinuity of $f$ at $1$ is a little tricky, as all the $f_n$ are continuous.

share|cite|improve this answer

This problem relates to issues discussed by Weyl and embodied in the work of Brouwer on Intuistionist Mathematics. Here is a discussion:

Weyl stated "Above all, however, there can be no other functions at all on a continuum than continuous functions." After pointing out the absence of discontinuous functions on R, Weyl went on to say that: "When the old analysis allowed the formation of discontinuous functions, it thereby showed most clearly how far it is from grasping the essence of the continuum. What one calls nowadays a discontinuous function, consists in fact (and this also is basically a return to older intuitions) of a number of functions on separated continua."

Brouwer proved, in Intuitionist Mathematics, that a totally defined function on an interval is continuous.

share|cite|improve this answer

As I stare at a cube-shaped building whose side has length 100 meters, while walking westward parallel to its north wall at a location 100 meters north of the building, the distance to farthest point from me that I can see on the face of the building varies as my position changes. As I cross the line of the western wall, I can suddenly see the southwest corner of the buidling, so that distance as a function of my position has a jump discontinuity that arises naturally from geometry.

share|cite|improve this answer

There's always $[x]$, and $\chi_S(x)$ for any proper subset $S$ of $\mathbb{R}$.

share|cite|improve this answer
I would consider these to be at the same level of "piecewiseness" (and less familiar than) $|x|$. – Austin Mohr Jan 25 '14 at 23:45
If $[x]$ is the greatest integer function, I think that is in fact a pw defined function. Likewise of the characteristic function. – Baby Dragon Jan 25 '14 at 23:46
The limits of interest don't even exist here... – David Mitra Jan 25 '14 at 23:54
@DavidMitra: Indeed. My bad. – MPW Jan 26 '14 at 0:10
@BabyDragon: It can be written piecewise, but it needn't be. $[x]= \max\left( \mathbb{Z}\cap(-\infty,x]\right)$. – MPW Jan 26 '14 at 0:16

Note: I realize that this may not be the droid your looking for, but it is a droid.

I think that this depends on what one means by a piecewise defined function. I will take a stab at that question first. So let us start with a base set of functions (we may let the domain and codomain vary But insist that both be subsets of some big set, like $\mathbb{R}$) , which we will call $\mathcal{F}$. Then we will also have a set $\mathcal{O}$ which will be a set of operations (these operations [these operations may be partially defined] will typically be functions of the form $\mathcal{F}^n\to \mathcal{F}$, for varying $n$. We may then define $\widehat{\mathcal{F}}$ to be the smallest set of functions such that if $g:\mathcal{F}^n\to\mathcal{F}$ is in $\mathcal{O}$ and $$f_1,f_2,\cdots f_n\in\widehat{\mathcal{F}}$$ then $$g(f_1,f_2,\cdots f_n)\in\widehat{\mathcal{F}}.$$ We may then say that $\widehat{\mathcal{F}}$ is the set of functions (fully) defined by the pair $(\mathcal{F},\mathcal{O})$. Any function not in $\widehat{\mathcal{F}}$ may be defined in a piecewise manner (one piece for each point, provided we have all constant functions).

The question now is what are your sets, $(\mathcal{F},\mathcal{O})$. I would let the set $\mathcal{F}$ be the set

$$\{(x\mapsto any-constant),\mbox{ } (x\mapsto x),\mbox{ } (x\mapsto\sin x), \mbox{ }\\(x\mapsto e^x), \mbox{ }(x\mapsto \ln x)),\mbox{ }(x\mapsto \sin^{-1}x),\mbox{ }(x\mapsto \cos^{-1}x), \mbox{ other inverse trigs},\mbox{ }(x\mapsto\sqrt[n]{x}) \}$$ (one may add to this or take away at will).

Now the set $\mathcal{O}$ of operations is the following: $$\{(f,g\mapsto f+g), (f,g\mapsto fg),(f\mapsto\frac{1}{f}), (f,g\mapsto f\circ g) ,(f,g\mapsto f^g)\}$$ (the last rule could be tricky for negative values). Now given all of this the piece wise defined functions that you wanted to exclude such as $|x|$ cannot be excluded. Indeed, it may be the case that we can get all kinds of piecewise defined functions this way. If we add to our operations the ability to take certain point-wise limits we may obtain even more piece-wise defined functions.

share|cite|improve this answer
Note that one might think that $x\mapsto\sqrt[n]{x}$ is redundant since one may try to write this as $e^{\frac{\ln x}{n}}$. As written this is only Ok for positive $x$, where $x\mapsto\sqrt[3]{x}$ is Ok for all $x$. – Baby Dragon Jan 26 '14 at 0:56

What about a derivative? Something like $\left(x^2 \sin \frac 1 x\right)'$. You have to extend the function to say $f(0)=0$, as it is not defined there, but they'll have to extend the derivative, which cannot be computed with the formula at $x=0$.

I also remember a limit I was given in my last calculus exam:

$$ \lim_{m \to \infty} \lim_{n \to \infty} (\cos^2 (m! x))^n $$

(Zero for the rational numbers, 1 for the irrational ones)

share|cite|improve this answer

An interesting example of "natural discontinuity" that I know, is easy to absorb on any level and it comes from classical textbooks. It requires some basic imagination, however.

Textbooks usually start from defining the function, and then ask a student to prove some technical stuff about it. I prefer to start from the other way around.

Consider $(x,y,z)$-space. Take both $x$- and $y$- axes and exclude the origin. We want our function to go through them, so that whenever $x$ or $y$ equals $0$, $z$ equals $0$ as well.

Now, consider the diagonals $x+y=0$ and $x-y=0$ lifted above $(x,y)$-plane to $z=1$, and exclude the lifted origin $(0,0,1)$ from this construction. What happens if we want our continuous everywhere except for the origin function to go through these lines as well?

To help imagine that. A bisection by any vertical plane $y=c\neq0$ should be a continuous M-shaped function going through $(x,z)=(0,0)$ as well as $(x,z)=(\pm c,1)$. The closer is $c$ to $0$, the closer are the last two points to each other. Similarly, with bisection by any vertical $x$-plane.

When you move to origin from north, east, south or west along $x=0$ or $y=0$ you are always at the bottom of this "canyon" at sea-level height of $z=0$. However, when you are on one of the two diagonals moving, for example, from north-east, you are always on top of the range at height $z=1$.

Interestingly enough, such a function can be easily defined, for example, as follows: $$\frac{x^2y^2}{x^4+y^4},(x,y)\in\mathbb{R}-\{(0,0)\}$$

Now, without specifying the value at $(0,0)$ what should it be? Depending on what direction you are coming from, it can be any value within the whole interval. But in any case it will remain discontinuous.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.