# Useful examples of pathological functions

What are some particularly well-known functions that exhibit pathological behavior at or near at least one value and are particularly useful as examples?

For instance, if $f'(a) = b$, then $f(a)$ exists, $f$ is continuous at $a$, $f$ is differentiable at $a$, but $f'$ need not be continuous at $a$. A function for which this is true is $f(x) = x^2 \sin(1/x)$ at $x=0$.

-
Buy this book, it's only 10 bucks. – Larry Wang Jul 26 '10 at 21:46
Nice! I can't believe I didn't know such a book existed. – Isaac Jul 26 '10 at 21:58

Have also a look here:
http://mathoverflow.net/questions/22189/what-is-your-favorite-strange-function

-
 Also related: mathoverflow.net/questions/16829/… – Mechanical snail Nov 27 '12 at 19:09

The Weierstrass function is continuous everywhere and differentiable nowhere.
The Dirichlet function (the indicator function for the rationals) is continuous nowhere.
A modification of the Dirichlet function is continuous at all irrational values and discontinuous at rational values.
The Devil's Staircase is uniformly continuous but not absolutely. It increases from 0 to 1, but the derivative is 0 almost everywhere.

-
 I think you mean "discontinuous at all rational functions" – BlueRaja - Danny Pflughoeft Jul 27 '10 at 4:51 Should the modification of the Dirichlet function refer to rational/irrational numbers (not functions)? – Isaac Jul 27 '10 at 6:54 @BlueRaja: @Isaac: You're both right. I copy/pasted that description from somewhere and didn't double-check it. – Larry Wang Jul 27 '10 at 10:45 The devil's staircase has zero derivative almost everywhere, not at all but countably many points. Any continuous function with zero derivative at all but countably many points is constant. – George Lowther Aug 25 '10 at 20:50

Here's an example of a strictly increasing function on ℝ which is continuous exactly at the irrationals.

Pick your favorite absolutely convergent series ∑an in which all the terms are positive (mine is ∑1/2n) and your favorite enumeration of the rationals: ℚ={q1,q2,...}. For a real number x, define f(x) to be the sum of all the an for which qn ≤ x.

-

This function has the following properties:
1. On every closed interval $[a, b]$ take every real value.
2. Is continuous nowhere.

-

The Dirac delta "function." It's not a "function," strictly speaking, but rather a very simple example of a distribution that isn't a function.

-

The bump function $\psi\colon \mathbb{R} \to \mathbb{R}$ given by $\psi(x) = e^{-1/(1-x^2)}$ for $|x|\leq 1$ and $\psi(x) = 0$ for $|x| > 1$ is not exactly pathological per se, but it's very useful for (at least) two things:

1. It's an example of a function that is smooth (all derivatives exist) but not analytic (not equal to its Taylor series in a neighbourhood of every point) -- look at the points $x=\pm 1$.
2. You can use it to build partitions of unity on manifolds, which is important when you want to build a global object (like a Riemannian metric) out of local data (defined in each chart).
-
 +1, and to add a more practical use for this function: this, as well as its integral, is sometimes used in conjunction with the trapezoidal rule as a variable substitution for handling badly-behaved improper integrals. Its "singularity-flattening" property at the points 1 and -1 works well in tandem with the Euler-Maclaurin error of the trapezoidal rule. – J. M. Aug 8 '10 at 10:41 I find that the Fabius function is a better example of how weird smooth functions can be. The only problem with it is that it makes for a terrible demonstration for starting students since sums of independent random variables is convolution which (a) they probably haven't seen, (b) can seem awfully unmotivated or at least completely unrelated to Taylor series which is probably what you're working on at that point, and (c) you're doing infinitely many convolutions so you have to talk about a limit of a sequence of functions... – kahen Oct 25 '10 at 18:09

I like $f(x,y) = \frac{xy}{x^{2}+y{2}}$ for $(x,y) \ne (0,0)$ and $f(x,y)=0$ for $(x,y)=(0,0)$. Here $f$ has partial derivatives at (0,0) but it is not differentiable at $(0,0)$

-
A less trivial exercise is to find a function with partial derivatives in every direction at a point but which is still not differentiable there. – Qiaochu Yuan Aug 7 '10 at 18:01

The constant function $0$ is an extremely pathological function: it has all kinds of properties that almost none of the functions $\mathbb R\to\mathbb R$ have: it is everywhere continuous, differentiable, analytic, polynomial, constant (not all of those are independent of course...), you name it. By contrast many of the answers given here involve properties that almost all functions have, or that almost all functions with the mentioned pathologies (e.g., being everywhere continuous for the Weierstrass function) have.

In fact being a definable function is a pathology that all answers share, but this is admittedly hard to avoid in an answer.

-
 +1 for the last comment. – Mechanical snail Nov 27 '12 at 19:09

$\displaystyle\frac{\sin(x)}{x}$ is useful; it has a singularity at $x=0$, but if you take the union of $\displaystyle y=\frac{\sin(x)}{x}$ with the point $(x=0,y=1)$ then you get $\text{sinc}(x/\pi)$. The $\text{sinc}$ function has a lot of applications in signal processing and diffraction.

-

The Cauchy distribution is another example. This distribution pops up frequently in statistical reasoning.

For example, the ratio of two independent standard normal random variables is a standard Cauchy variable. We calculate ratios all the time, but often forget to consider that their distribution does not follow a simple normal distribution.

This is interesting for several reasons:

1. The mean and variance for the Cauchy distribution are undefined (--> infinity). If one is trying to estimate these parameters for the ratio of two normal variables, the results may blow up to rather large values that are hard to interpret.

2. In such a situation, one would therefore prefer to use more robust estimators of the central tendency (such as the median) and scale (median absolute deviation). When designing and testing robust estimators (en.wikipedia.org/wiki/Robust_statistics), one way to test them is to try them out on a Cauchy distribution, and make sure that they don't blow up like the usual formulas for mean and variance.

-
 Also used to justify the finite variance requirement of CLT, and to motivate a more general form. – Larry Wang Jul 27 '10 at 23:30

When I was first learning calculus, the fact that $sin(1/x)$ is continuous on the set $(0,\infty)$ gave me a headache.

-
It will give you a much bigger headache when you study topology: en.wikipedia.org/wiki/Topologist's_sine_curve – Qiaochu Yuan Aug 7 '10 at 18:03

The function f(x) = x over the rationals and 2x over the irrationals is locally increasing in 0 but it is neither increasing nor decreasing.

-
 Increasing at x=0, but neither increasing nor decreasing for any interval? – Isaac Jul 29 '10 at 11:15

The Cauchy functionals, which satisfy the very simple equation f(a+b) = f(a)+f(b) for all real a,b. These are either a line through the origin (the "nice" ones) or really "ugly" functions that are discontinuous and unbounded in every interval. The latter are possible because the Axiom of Choice implies (actually is equivalent to) that infinite dimensional vector spaces have bases; i.e. the reals over the rationals have a Hamel basis. A great explanation of all this (including the nice/ugly terminology) is in Horst Herrlich's monograph The Axiom of Choice.

-

(1/x)^(1/x). Try graphing it if you dare (including over the negatives)

-
How to graph over the negatives? It's not real there for most x's. – KennyTM Jul 27 '10 at 13:31
@KennyTM: Exactly – Casebash Jul 27 '10 at 20:53
I think, depending on how you define exponentiation of negative bases with rational exponents, it might be possible to interpret it to have real values on a dense subset of the negative reals. – Isaac Jul 27 '10 at 21:26
GrafEq seems to be proud of how it handles a related function: peda.com/grafeq/gallery/rogue/xx_exponential.html – J. M. Aug 9 '10 at 10:08

Three examples suffice to show why some modes of convergence don't imply other modes of convergence: pointwise convergence, Lp norm convergence, convergence in measure, etc. See the counterexamples section here.

-